ADD_TIME

Add TIME

ADD_TIME adds the times of the two input variables and writes the sum in the output variable.

Parameters

Input

Time1 (DATE_AND_TIME)

1st input: addend

Time2 (TIME)

2nd input: addend

Output

VAR_OUT (DATE_AND_TIME)

sum

Example

POU header

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.

In this example the input variables time_value_1 and time_value_2 have been declared. Instead, you may enter constants directly at the input contacts of a function.

	VAR
		time_value_1: TIME:=T#0s;
		time_value_2: TIME:=T#0s;
		time_value_3: TIME:=T#0s;
	END_VAR

POU body

time_value_1 and time_value_2 are added. The result is written into time_value_3.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,ADD_TIME!,Instance,8,0,14,4,,?DTime1?DTime2?C);
B(B_VARIN,,time_value_1,6,1,8,3,);
B(B_VARIN,,time_value_2,6,2,8,4,);
B(B_VAROUT,,time_value_3,14,1,16,3,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

time_value_3:=ADD_TIME(time_value_1, time_value_2);

IL body

Modified on: 2019-01-26Feedback on this pagePanasonic hotline