
Section 6 Program Code Issues
Overflow handling
3BSE042835-600
107
Overflow handling
The object must have a predictable behavior when calculating output parameter
values. Situations like divide by zero and sqrt() of negative numbers shall be
prevented or handled in the code.
Example:
Create a function Y := (1/T)*G, where T and G are parameters to a function block.
Solution:
When T is too small, the calculation generates an overflow in the arithmetical
processing unit. To avoid this, the parameter T must be checked. As T is assumed to
be a time, only positive and not too small values are allowed.
Code:
IF T < Ts THEN
Y := G / Ts;
ELSE
Y := G / T;
END_IF;
Where Ts is the selected sample time for the running task.
The requirement is that the library object shall not give an overflow output value if
none of the input parameters have an overflow value.
SIL Mark Restrictions
Objects need to be restricted marked if any of the below is true:
•
The object calls the functions that are not fully executed in the SM81x safety
module.
•
The output data from an unsafe source is not secured with a safety layer.
This is only relevant for 800xA internal libraries.
To obtain the main functionality of the object in the SIL environment, the whole
object must be SIL Restricted.
If the object is set to SIL1-2 or SIL3, but the parameters are Non-SIL, then it is
possible to obtain partial functionality in the SIL environment.
Summary of Contents for AC 800M
Page 2: ......
Page 3: ...AC 800M Library Object Style Guide System Version 6 0...
Page 12: ...Related Documentation About This User Manual 12 3BSE042835 600...
Page 18: ...Naming Convention Section 1 Libraries 18 3BSE042835 600...
Page 108: ...SIL Mark Restrictions Section 6 Program Code Issues 108 3BSE042835 600...
Page 116: ...Standard Library Parameters Appendix A Names and Abbreviations 116 3BSE042835 600...
Page 119: ......