Enumerated types allow you to associate a set of names with a unique set of values. For example:
TYPE PumpState : ( Stopped, Running, Invalid, Failed ); END_TYPE
Within your code you can declare variables of type PumpState, assign enumerated values, and use in tests. For example:
Var P1, P2 : PumpState := Stopped; End_Var If P1 = Stopped AND P2 = Stopped Then .... End_If
There may be situations where you want to declare the same value in different enumerated types. In this example the enumerated value Failed is used in both PumpState, and ValveState:
TYPE PumpState : ( Stopped, Running, Invalid, Failed ); ValveState : ( Open, Closed, Failed ); END_TYPE
When you wish to use enumerated value Failed, you should qualify the value with the enumerated type prefix to remove any ambiguity. For example:
Var P1, P2 : PumpState := PumpState#Stopped; End_Var If P1 = PumpState#Failed AND P2 = PumpState#Failed Then .... End_If
IEC 61131-3 Second Edition: Table 12.1.
IEC 61131-3 Third Edition: Table 11.1.
To learn about other derived data types, for example STRUCT, or ARRAY.
To learn about other common language elements.
For the meaning of terms used in Fernhill SCADA.