Section 6 Program Code Issues
Conditional Range Check
3BSE042835-600
105
Conditional Range Check
Table 16. Parameter interface for an example type with conditional range check and last good value
Name
Data
type
Attributes
Direction
Initial
value
Description
MyPar
dint
Retain
In
1
Config (<=0 = Event1,
1 = Event2,
2 = Event3,
Else Last good value + ParErr)
EnablePar
Error
bool
Retain
In
false
EDIT Enable par error
calculation for Non-SIL
applications.
ParError
bool
Retain
Out
Indicates parameter range
error.
If a conditional range check is applied, the execution time can be reduced in
Non-SIL applications.
In the example code, the parameter
EnableParError
is copied during the first scan
to a local variable
EnParError
for Non-SIL application, otherwise the local
variable will be true. If the range check finds an out-of-range value, the last good
value will be used.
if Init then
Init := false;
(* Force range checks if SIL application *)
EnParError := EnableParError or GetApplicationSIL() <> 0;
MyParInt:= MyLimit; (* Last good value *)
ParErrorInt := false;
end_if;
if EnParError then
(* Perform parameter range check each scan *)
(* before assignment *)
ParErrorInt := false;
Содержание AC 800M
Страница 1: ...Power and productivity for a better worldTM AC 800M Library Object Style Guide System Version 6 0...
Страница 2: ......
Страница 3: ...AC 800M Library Object Style Guide System Version 6 0...
Страница 12: ...Related Documentation About This User Manual 12 3BSE042835 600...
Страница 18: ...Naming Convention Section 1 Libraries 18 3BSE042835 600...
Страница 108: ...SIL Mark Restrictions Section 6 Program Code Issues 108 3BSE042835 600...
Страница 116: ...Standard Library Parameters Appendix A Names and Abbreviations 116 3BSE042835 600...
Страница 119: ......