SUB_DT_DT block
Short summary
Name |
SUB_DT_DT |
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted |
Graphical interface |
|
Available since |
Version 1.109.0 (für logi.CAD 3) |
Functionality
The block subtracts the date value (with a time of day value) entered at input IN2 from the date value (with a time of day value) entered at input IN1 (= IN1 - IN2). The block returns the result of this subtraction in format TIME.
No check of invalid connections
For some blocks, invalid connections are not checked by logi.CAD 3. Therefore, enter code in your application to detect invalid connections (e.g. IF-statements in the ST-code).
See "IEC-blocks for the application" for information what the consequences of an invalid connection might be.
An invalid connection due to →overflows or →underflows might occur during a calculation using SUB_DT_DT . As your used →target system might influence the usage of →time literals in logi.CAD 3 (see "Properties and restrictions specific to the target system") , an overflow/underflow might occur for different return values when using different target systems.
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
IN1 |
DATE_AND_TIME |
1st value |
IN2 |
DATE_AND_TIME |
2nd value |
|
Return value: |
– |
TIME |
|
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
See:
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic .
Example for usage within ST-editor
The calculated values are evaluated by using the Assert block .
FUNCTION_BLOCK ExampleSubDtDt
VAR
result : TIME;
END_VAR
result := SUB_DT_DT(IN1 := DT#
2017
-
08
-
30
-
00
:
00
:
01
, IN2 := DT#
2017
-
08
-
29
-
23
:
59
:
59
);
Assert(result = TIME#2s);
END_FUNCTION_BLOCK
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.