Enumerations allow to associate numeric tag values with descriptive text strings, enhancing the presentation of data in displays. Users define these sets (containing value-text pairs) in the Unified Namespace /Enumerations. Tags can then be linked to an Enumeration Set, offering the flexibility to display either the numeric value or its more meaningful text equivalent.
On this page:
Overview
Enumerations are a unique type of UDT (User Defined Types). They enumerate a collection of values, messages, and colors. These can be used as parameters for Tags or directly in script expressions.
Understanding Enumerations
Enumerations are frequently employed as parameters for other tags or variables. This practice enhances code readability and maintains a finite list of states or options that a variable can take. Utilizing an enumeration as a parameter restricts the value options for that variable, facilitating a clearer understanding of its purpose and minimizing the likelihood of errors.
For instance, consider a building control system with lights that can exist in one of several states: off, on, or emergency. Rather than using integers or strings to represent these states, one could employ an enumeration, such as LightStatus
. This approach makes the code easier to read and write while also making it more robust by preventing invalid states from being assigned to the variable.
Defining Enumerations
- Navigate to Unified Namespace → Enumerations.
- On the toolbar of DataGrid, click on the "Plus" button to create a new enumeration.
- Insert a descriptive name for your new enumeration in the name field.
- Finally, define the enumeration values along with their respective display texts.
Enumerations Examples on Electrical Systems
Name | Values | Display Text | Description |
---|---|---|---|
EnumPower | 0 | Unpowered | Unpowered: The system or device is not receiving power. |
1 | Powered | Powered: The system or device is receiving power. | |
EnumCmd | 0 | Enable | Enable: Enables the system. |
1 | Disable | Disable: Disables the system. | |
EnumOpenedClosed | 0 | Opened | Opened: Circuit is open. |
1 | Closed | Closed: Circuit is closed. | |
EnumOpenClose | 0 | Open | Open: Command to open the circuit. |
1 | Close | Close: Command to close the circuit. | |
EnumManualAuto | 0 | Manual | Manual: System is in manual mode. |
1 | Auto | Auto: System is in automatic mode. | |
EnumActivateDeactivate | 0 | Activate | Activate: Activate the system or feature. |
1 | Deactivate | Deactivate: Deactivate the system or feature. | |
EnumOnepoleThreepole | 0 | One-pole | One-pole: Single-phase connection. |
1 | Three-pole | Three-pole: Three-phase connection. | |
EnumNormIntermTransf | 0 | Normal | Normal: Operating in standard conditions. |
1 | Intermediary | Intermediary: Operating in an intermediary state. | |
2 | Transferred | Transferred: The component has been transferred to a different state. | |
EnumLocalRemote | 0 | Local | Local: Controlled locally. |
1 | Remote | Remote: Controlled remotely. | |
EnumIntermOpenClosedInconsist | 0 | Open | Open: Circuit is open and inconsistent. |
1 | Closed | Closed: Circuit is closed but inconsistent. | |
EnumUnblockedBlocked | 0 | Unblocked | Unblocked: System is unblocked. |
1 | Blocked | Blocked: System is blocked. | |
EnumUpDown | 0 | Up | Up: Direction is up. |
1 | Down | Down: Direction is down. | |
EnumParallelIndividual | 0 | Parallel | Parallel: Running in parallel. |
1 | Individual | Individual: Running individually. | |
EnumStopStart | 0 | Stop | Stop: Stop the system. |
1 | Start | Start: Start the system. | |
EnumOnOff | 0 | Off | Off: System is turned off. |
1 | On | On: System is turned on. | |
EnumNormalActed | 0 | Normal | Normal: System is operating normally. |
1 | Acted | Acted: System has acted on a command or event. | |
EnumBlockedUnblocked | 0 | Blocked | Blocked: System is blocked. |
1 | Unblocked | Unblocked: System is unblocked. | |
EnumRemoteLocal | 0 | Remote | Remote: Controlled remotely. |
1 | Local | Local: Controlled locally. | |
EnumActivatedDeactivated | 0 | Activated | Activated: System or feature is activated. |
1 | Deactivated | Deactivated: System or feature is deactivated. | |
EnumTicketColor | 0 | Red | Red: High priority. |
1 | Green | Green: Low priority. | |
EnumVisible | 0 | Visible | Visible: Can be seen. |
1 | Invisible | Invisible: Cannot be seen. | |
EnumTypeConnector | 0 | Delta | Delta: A three-phase connection in a closed loop. |
1 | Wye | Wye: Each phase connected to a central neutral point. | |
2 | WyeGrounded | WyeGrounded: Wye connection with grounded neutral. | |
EnumReclosing | 0 | Single | Single: Single reclosing operation. |
1 | Auto | Auto: Automatic reclosing operation. | |
EnumTurnedOnTurnedOff | 0 | Turned On | Turned On: Device is turned on. |
1 | Turned Off | Turned Off: Device is turned off. |
In this section: