Dear S7 Experts,
After several attempts I have come to conclusion that I should seek your help...The below is the stl source code.
FC311 calls FC1008 and DB900 is the data block which is passed into FC1008..
I am not able to intrepret the code and the data movement/manuplation in the DB900...and also I am not getting the concept why the programmer is using SLD3 for multiplication by 8.
Advance thanks.
FUNCTION FC 311 : VOID
TITLE =Pusher
VERSION : 0.1
VAR_TEMP
sp_push_time_int : REAL ;
table : ARRAY [0 .. 19 ] OF REAL ;
END_VAR
BEGIN
NETWORK
TITLE =Pusher-Speed_ convert time to valve position (lookUpTable)
A M 0.1;
= L 84.0;
BLD 103;
CALL FC 1008 (
Table := DB 900,
Input := MD 1652,
low := 7.500000e+001,
high := 2.100000e+002,
invert := L 84.0,
output := MD 1644);
NOP 0;
END_FUNCTION
DATA_BLOCK DB 900
TITLE =
VERSION : 0.1
STRUCT
POS_0 : REAL := 7.500000e+001;
POS_05 : REAL := 7.600000e+001;
POS_10 : REAL := 7.700000e+001;
POS_15 : REAL := 7.800000e+001;
POS_20 : REAL := 7.900000e+001;
POS_25 : REAL := 8.100000e+001;
POS_30 : REAL := 8.500000e+001;
POS_35 : REAL := 9.000000e+001;
POS_40 : REAL := 9.900000e+001;
POS_45 : REAL := 1.290000e+002;
POS_50 : REAL := 1.500000e+002;
POS_55 : REAL := 1.800000e+002;
POS_60 : REAL := 2.100000e+002;
POS_65 : REAL := 2.100000e+002;
POS_70 : REAL := 2.100000e+002;
POS_75 : REAL := 2.100000e+002;
POS_80 : REAL := 2.100000e+002;
POS_85 : REAL := 2.100000e+002;
POS_90 : REAL := 2.000000e+003;
POS_95 : REAL := 2.100000e+003;
POS_100 : REAL := 2.100000e+002;
END_STRUCT ;
BEGIN
POS_0 := 7.500000e+001;
POS_05 := 7.600000e+001;
POS_10 := 7.700000e+001;
POS_15 := 7.800000e+001;
POS_20 := 7.900000e+001;
POS_25 := 8.100000e+001;
POS_30 := 8.500000e+001;
POS_35 := 9.000000e+001;
POS_40 := 9.900000e+001;
POS_45 := 1.290000e+002;
POS_50 := 1.500000e+002;
POS_55 := 1.800000e+002;
POS_60 := 2.100000e+002;
POS_65 := 2.100000e+002;
POS_70 := 2.100000e+002;
POS_75 := 2.100000e+002;
POS_80 := 2.100000e+002;
POS_85 := 2.100000e+002;
POS_90 := 2.100000e+002;
POS_95 := 2.100000e+002;
POS_100 := 2.100000e+002;
END_DATA_BLOCK
FUNCTION FC 1008 : VOID
TITLE =
VERSION : 0.1
VAR_INPUT
Table : BLOCK_DB ;
Input : REAL ;
low : REAL ;
high : REAL ;
invert : BOOL ;
END_VAR
VAR_OUTPUT
output : REAL ;
END_VAR
VAR_TEMP
index : INT ;
pointer_min : DINT ;
pointer_max : DINT ;
min : REAL ;
max : REAL ;
input_int : REAL ;
dummy : REAL ;
END_VAR
BEGIN
NETWORK
TITLE =limit imput value
A M 0.1;
= L 26.0;
A L 26.0;
JNB _001;
L #Input;
T #input_int;
_001: NOP 0;
A L 26.0;
A( ;
L #Input;
L #high;
>R ;
) ;
JNB _002;
L #high;
T #input_int;
_002: NOP 0;
A L 26.0;
A( ;
L #Input;
L #low;
<R ;
) ;
JNB _003;
L #low;
T #input_int;
_003: NOP 0;
NETWORK
TITLE =
OPN #Table;
NETWORK
TITLE =
//5*(index-((max-input)/(max-min)))
L 1; //start index
T #index;
loop: L #index; //create pointer
L 4;
*I ;
SLD 3;
T #pointer_max;
L #index; //create pointer+1
L 1;
-I ;
L 4;
*I ;
SLD 3;
T #pointer_min;
//compare
L #input_int;
L DBD [#pointer_max];
<=R ;
JCN inc;
//calc
L DBD [#pointer_max];
L DBD [#pointer_min];
-R ;
L 1.000000e-009; // no div by 0
+R ;
T #dummy;
L DBD [#pointer_max];
L #input_int;
-R ;
L #dummy;
/R ;
L #index;
ITD ;
DTR ;
TAK ;
-R ;
L 5.000000e+000;
*R ;
T #output;
JU end;
inc: L #index;
L 1;
+I ;
T #index;
JU loop;
end: NOP 0;
NETWORK
TITLE =invert output
A #invert;
JCN end1;
L 1.000000e+002;
L #output;
-R ;
T #output;
end1: NOP 0;
END_FUNCTION
After several attempts I have come to conclusion that I should seek your help...The below is the stl source code.
FC311 calls FC1008 and DB900 is the data block which is passed into FC1008..
I am not able to intrepret the code and the data movement/manuplation in the DB900...and also I am not getting the concept why the programmer is using SLD3 for multiplication by 8.
Advance thanks.
FUNCTION FC 311 : VOID
TITLE =Pusher
VERSION : 0.1
VAR_TEMP
sp_push_time_int : REAL ;
table : ARRAY [0 .. 19 ] OF REAL ;
END_VAR
BEGIN
NETWORK
TITLE =Pusher-Speed_ convert time to valve position (lookUpTable)
A M 0.1;
= L 84.0;
BLD 103;
CALL FC 1008 (
Table := DB 900,
Input := MD 1652,
low := 7.500000e+001,
high := 2.100000e+002,
invert := L 84.0,
output := MD 1644);
NOP 0;
END_FUNCTION
DATA_BLOCK DB 900
TITLE =
VERSION : 0.1
STRUCT
POS_0 : REAL := 7.500000e+001;
POS_05 : REAL := 7.600000e+001;
POS_10 : REAL := 7.700000e+001;
POS_15 : REAL := 7.800000e+001;
POS_20 : REAL := 7.900000e+001;
POS_25 : REAL := 8.100000e+001;
POS_30 : REAL := 8.500000e+001;
POS_35 : REAL := 9.000000e+001;
POS_40 : REAL := 9.900000e+001;
POS_45 : REAL := 1.290000e+002;
POS_50 : REAL := 1.500000e+002;
POS_55 : REAL := 1.800000e+002;
POS_60 : REAL := 2.100000e+002;
POS_65 : REAL := 2.100000e+002;
POS_70 : REAL := 2.100000e+002;
POS_75 : REAL := 2.100000e+002;
POS_80 : REAL := 2.100000e+002;
POS_85 : REAL := 2.100000e+002;
POS_90 : REAL := 2.000000e+003;
POS_95 : REAL := 2.100000e+003;
POS_100 : REAL := 2.100000e+002;
END_STRUCT ;
BEGIN
POS_0 := 7.500000e+001;
POS_05 := 7.600000e+001;
POS_10 := 7.700000e+001;
POS_15 := 7.800000e+001;
POS_20 := 7.900000e+001;
POS_25 := 8.100000e+001;
POS_30 := 8.500000e+001;
POS_35 := 9.000000e+001;
POS_40 := 9.900000e+001;
POS_45 := 1.290000e+002;
POS_50 := 1.500000e+002;
POS_55 := 1.800000e+002;
POS_60 := 2.100000e+002;
POS_65 := 2.100000e+002;
POS_70 := 2.100000e+002;
POS_75 := 2.100000e+002;
POS_80 := 2.100000e+002;
POS_85 := 2.100000e+002;
POS_90 := 2.100000e+002;
POS_95 := 2.100000e+002;
POS_100 := 2.100000e+002;
END_DATA_BLOCK
FUNCTION FC 1008 : VOID
TITLE =
VERSION : 0.1
VAR_INPUT
Table : BLOCK_DB ;
Input : REAL ;
low : REAL ;
high : REAL ;
invert : BOOL ;
END_VAR
VAR_OUTPUT
output : REAL ;
END_VAR
VAR_TEMP
index : INT ;
pointer_min : DINT ;
pointer_max : DINT ;
min : REAL ;
max : REAL ;
input_int : REAL ;
dummy : REAL ;
END_VAR
BEGIN
NETWORK
TITLE =limit imput value
A M 0.1;
= L 26.0;
A L 26.0;
JNB _001;
L #Input;
T #input_int;
_001: NOP 0;
A L 26.0;
A( ;
L #Input;
L #high;
>R ;
) ;
JNB _002;
L #high;
T #input_int;
_002: NOP 0;
A L 26.0;
A( ;
L #Input;
L #low;
<R ;
) ;
JNB _003;
L #low;
T #input_int;
_003: NOP 0;
NETWORK
TITLE =
OPN #Table;
NETWORK
TITLE =
//5*(index-((max-input)/(max-min)))
L 1; //start index
T #index;
loop: L #index; //create pointer
L 4;
*I ;
SLD 3;
T #pointer_max;
L #index; //create pointer+1
L 1;
-I ;
L 4;
*I ;
SLD 3;
T #pointer_min;
//compare
L #input_int;
L DBD [#pointer_max];
<=R ;
JCN inc;
//calc
L DBD [#pointer_max];
L DBD [#pointer_min];
-R ;
L 1.000000e-009; // no div by 0
+R ;
T #dummy;
L DBD [#pointer_max];
L #input_int;
-R ;
L #dummy;
/R ;
L #index;
ITD ;
DTR ;
TAK ;
-R ;
L 5.000000e+000;
*R ;
T #output;
JU end;
inc: L #index;
L 1;
+I ;
T #index;
JU loop;
end: NOP 0;
NETWORK
TITLE =invert output
A #invert;
JCN end1;
L 1.000000e+002;
L #output;
-R ;
T #output;
end1: NOP 0;
END_FUNCTION