Multiply TIME by DOUBLE INTEGER
MUL_TIME_DINT multiplies the values of the input variables and writes the result to 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
time_value_1: TIME:=T#1s500ms;
multiplier: DINT:=5;
time_value_2: TIME:=T#0s;
END_VAR
In this example, the input variables time_value and multiplier have been declared. However, you can write a constant directly at the input contact of the function instead.
time_value_1 is multiplied by multiplier. The result is written in time_value_2.
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,,time_value_1,6,1,8,3,);
B(B_VARIN,,multiplier,6,2,8,4,);
B(B_VAROUT,,time_value_2,17,1,19,3,);
B(B_F,MUL_TIME_DINT!,Instance,8,0,17,4,,?D@'Time'?D@'DInt'?C);
L(1,0,1,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
time_value_2:=MUL_TIME_DINT(time_value_1, multiplier);