TIME into LREAL
TIME_TO_LREAL converts a value of the data type TIME into a value of the data type LREAL. 10ms of the data type TIME correspond to 1.0 REAL unit, e.g. when TIME = 10ms, REAL = 1.0; when TIME = 1s, REAL = 100.0. The resolution amounts to 10ms.
Input data type
Output
Conversion 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
lrValue: LREAL:=0.0;
bStart: BOOL:=FALSE;
tValue: TIME:=T#0s;
END_VAR
When the variable bStart is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_CONTACT,,bStart,3,2,5,4,);
B(B_F,E_TIME_TO_LREAL!,,9,1,18,5,,?DEN?D?AENO?C);
B(B_VARIN,,tValue,7,3,9,5,);
B(B_VAROUT,,lrValue,18,3,20,5,);
L(1,0,1,6);
L(1,3,3,3);
L(5,3,9,3);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bStart) then
lrResult:=TIME_TO_LREAL(tValue);
end_if;