Overview
Enumerations allow you to associate numeric tag values with descriptive text strings, enhancing the data presentation of data in displays. Users define these sets (containing value-text pairs) in the Unified Namespace /Enumerations. Tags can then be Tags linked to an Enumeration Set , offering the flexibility to can display either the numeric value or its more meaningful descriptive text equivalent.Enumerations are sets of named
integer values used to represent discrete options or states. They can help improve code readability and reduce errors by assigning meaningful names to integer values. An example of an enumeration could be a set of named states for a pump, such as "Off", "On ", and "Fault", with corresponding integer values of 0, 1, and 2.To create and set up a new Enumeration, navigate to Unified Namespace → Enumerations. Then, click 'New' on the Grid toolbar to open the 'Create New Enumeration' pop-up window. Enter the name of the Enumeration and click 'Ok' to create a new one. Following this , add the properties of the Enumeration set. You can add On and Off options, set the default value to each one, for example, '1' for 'On' and '0' for 'Off', and customize any enumeration properties, such as ActiveColor and InactiveColor, and several other available properties.On this page:
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Tip |
---|
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.
| ||
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 "PlusInsert New" 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.
- .
Using Enumerations
After having the enumeration setup complete, you can use it to show strings associated with the value of a given tag.
To configure a Tag to use the specified Enumeration, navigate to UnifiedNamespace / Tags. Right-click on the column titles to open the 'Show Columns' combobox, then select the Enumeration column to make it visible. Next, click on the Enumeration cell in the desired tag line and choose the configured enumeration.
Once this is set up, use Tag.TagName.ValueAsString
in the display to show the string that corresponds to the configured value in the selected enumeration.
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. |
Enumerations Table
Name | Description |
ID | Identifies the unique identifier. |
VersionID | Shows the specific version number. |
Name | Names the Enumeration for identification and reference. |
Value | Sets the specific value associated with the Enumeration. |
Match | Defines the condition or criteria that match the enumeration value. |
Domain | Assigns the domain or category to which the Enumeration belongs. |
Visibility | Controls whether the Enumeration is visible in certain contexts. |
ActiveColor | Specifies the color to display when the Enumeration is active. |
InactiveColor | Specifies the color to display when the Enumeration is inactive. |
EditSecurity | Sets the security level required to edit the Enumeration. |
ReadSecurity | Sets the security level required to read the Enumeration. |
WriteSecurity | Sets the security level required to write to the Enumeration. |
Category | Classifies the Enumeration within a specific group or category. |
LockState | Indicates whether the Enumeration is locked and cannot be modified. |
LockOwner | Identifies the owner responsible for locking the Enumeration. |
DateCreated | Records the date and time when the Enumeration was created. |
DateModified | Records the date and time when the Enumeration was last modified. |
Description | Summarizes the purpose and details of the Enumeration. |
Display Text | Specifies the text to be displayed for the Enumeration in the interface. |
In this section:
Page Tree | ||||
---|---|---|---|---|
|