PLC's - Ayuda Colegas con este codigo

   
Vista:
Imágen de perfil de favian

Ayuda Colegas con este codigo

Publicado por favian (1 intervención) el 04/09/2017 04:08:19
Que tal estimado
Solicito de su apreciable apoyo para entender este código.
Ya que soy nuevo en el tema de Texto Estructurado.
Gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
									//PORT OF: STORE_FEED_FACTOR STRUCTURED_TEXT SECTION//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
(* Accept a forced feed factor from the Quantum *)
IF CTL_ST.cmd_feed_factor_force AND NOT PROC_ST.echo_feed_factor_force THEN
	FEEDFACT := CTL_ST.config_data.feedfact_force_value;
END_IF;
 
(* Triggered when the pull is done and a new feed factor may have been calculated *)
IF store_new_feed_factor AND (current_feed_factor <> 0.0) THEN
	(* Sanity check on calculated feed factor *)
	IF (current_feed_factor > 0.0) AND (current_feed_factor < CTL_ST.config_data.feedfact_max_check) THEN
		IF (next_ff_value < 0) OR (next_ff_value > 4) THEN
 			next_ff_value := 0;
 		END_IF;
		ff_store_array[next_ff_value] := current_feed_factor;
		next_ff_value := next_ff_value + 1;
		IF next_ff_value >= 5 THEN
			next_ff_value := 0;
 			(* Sort the feed factors to find the median *)
 			FOR i := 1 TO 4 DO
 				stop := 4 - i;
 				FOR j := 1 TO stop DO
 					IF ff_store_array[j] > ff_store_array[j+1] THEN
 						temp_ff := ff_store_array[j+1];
 						ff_store_array[j+1] := ff_store_array[j];
 						ff_store_array[j] := temp_ff;
 					END_IF;
 				END_FOR;
 			END_FOR;
 			(* Change the feed factor to the new median.  Median is in location 2 after sorting. *)
 			FEEDFACT := ff_store_array[2];
 			FOR i := 0 TO 4 DO
 				ff_store_array[i] := 0.0;
 			END_FOR;
		END_IF;
	END_IF;
END_IF;
 
store_new_feed_factor := False;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder