SUB_***_PL7 : Subtract a period
Original instructions
Description of the function
The SUB_***_PL7 function removes a period from a date or from a time expressed in the DT format or TOD format of PL7.
The additional parameters EN and ENO can be configured.
Available functions
The available functions are as follows:
Representation in FBD
Representation applied to a time of day:
Representation in LD
Representation applied to a time of day:
Representation in IL
Representation applied to a time of day:
LD Source_Value
SUB_TOD_PL7 Time_to_Sub
ST Result_Value
Representation in ST
Representation applied to a time of day:
Result_Value := SUB_TOD_PL7(Source_Value, Time_to_Add);
Description of parameters
The following table describes the input parameters:
Parameter
Type
Comment
Source_Value
ARRAY [0..3] OF INT
Date or time.
Time_to_Sub
ARRAY [0..3] OF INT
Period to be subtracted from Source_Value
Note : this time is expressed in the TIME format of PL7 (with an accuracy of the order of one tenth of a second). As the DT and TOD types of PL7 (converted under Control Expert into DINT or tables of 4 INT) are expressed to the nearest second, Time_to_Sub is rounded to the nearest second.
The following table describes the output parameters:
Parameter
Type
Comment
Result_Value
ARRAY [0..3] OF INT
Result_Value is of the same type as Source_Value.
NOTE: management of leap years must be provided for in the application.
Execution errors
If Source_Value is in the DINT format (TOD of PL7), there is a change of day if Result_Value is outside of the range of authorized values. In this case the system bit %S18 is set at 1 and the value of Result_Value is only significant with a modulo 24:00:00.
If Source_Value is in the ARRAY [0..3] OF INT format (DT of PL7), if Result_Value is outside the authorized range of values, the system bit %S18 is set at 1 and the value of Result_Value is also at the minimum limit.
If one of the input parameters cannot be interpreted and is inconsistent with the function format then the system bit %S18 is set at 1 and Result_Value applies: