Multiply TIME by REAL
MUL_TIME_REAL multiplies the value of the first input variable of the data type TIME by the value of the second input variable of the data type REAL. The REAL value is rounded off to the nearest whole number. The result is written into the output variable.
Input
1st input: multiplicand
2nd input: multiplicator
Output
result
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
mul_result: TIME:=T#0s;
END_VAR
The constant T#1h30m is multiplied by the value 3.5. The result is written in mul_result. By clicking on the (Monitoring) icon while in the online mode, you can see the resultT#5h15m0s0.00ms immediately.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 4 ;
NETWORK_BODY
B(B_VARIN,,T#1h30m,5,1,7,3,);
B(B_VARIN,,3.5,5,2,7,4,);
B(B_VAROUT,,mul_result,16,1,18,3,);
B(B_F,MUL_TIME_REAL!,Instance,7,0,16,4,,?D@'Time'?D@'Real'?C);
L(1,0,1,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
mul_result:=MUL_TIME_REAL(T#1h30m, 3.5);
LD |
T#1h30m |
MUL_TIME_REAL |
3.5 |
ST |
mul_result |