UNS Enumerations (Reference) ssociate numeric tag values with descriptive text strings, enabling meaningful data presentation by displaying text instead of numbers in HMI displays.
Enumerations provide:
- Value-to-text mapping
- Descriptive state display
- Color associations
- Multilingual support
- Reusable definitions
- Consistent terminology
Enumerations transform raw numeric values into human-readable states like "Running/Stopped" or "Open/Closed".
In this page:
Creating Enumerations
- Navigate to Unified Namespace → Enumerations
- Click Insert New button on toolbar
- Enter enumeration name
- Define value mappings:
- Value: Numeric value
- Display Text: Associated text
- ActiveColor: Optional color
- InactiveColor: Optional color
Configuration Properties
Property | Description | Required |
---|---|---|
Name | Enumeration set identifier | Yes |
Value | Numeric value to map | Yes |
Display Text | Text to show for value | Yes |
Match | Matching criteria/condition | No |
ActiveColor | Color when value matches | No |
InactiveColor | Color when value doesn't match | No |
Category | Classification group | No |
Description | Documentation text | No |
Using Enumerations
Assign to Tag
- Go to Unified Namespace → Tags
- Show Enumeration column (right-click headers)
- Select enumeration for tag
- Tag now displays text instead of number
Access in Runtime
csharp
// Get numeric value
int value = @Tag.Motor1.Value; // Returns: 1
// Get enumeration text
string text = @Tag.Motor1.ValueAsString; // Returns: "Running"
// Display value (automatic)
string display = @Tag.Motor1.DisplayValue; // Returns: "Running"
Common Enumeration Sets
Basic States
OnOff
Value | Text | Use Case |
---|---|---|
0 | Off | Equipment stopped |
1 | On | Equipment running |
OpenClosed
Value | Text | Use Case |
---|---|---|
0 | Open | Valve/breaker open |
1 | Closed | Valve/breaker closed |
ManualAuto
Value | Text | Use Case |
---|---|---|
0 | Manual | Local control |
1 | Auto | Automatic control |
Electrical System Examples
Circuit States
EnumOpenedClosed
- 0 → "Opened" (Circuit open)
- 1 → "Closed" (Circuit closed)
Control Modes
EnumLocalRemote
- 0 → "Local" (Local control)
- 1 → "Remote" (Remote control)
Power States
EnumPower
- 0 → "Unpowered" (No power)
- 1 → "Powered" (Power present)
Connection Types
EnumTypeConnector
- 0 → "Delta" (Delta connection)
- 1 → "Wye" (Wye connection)
- 2 → "WyeGrounded" (Grounded wye)
Multi-State Enumerations
Transfer Switch
EnumNormIntermTransf
Value | Text | Description |
---|---|---|
0 | Normal | Standard operation |
1 | Intermediary | Transition state |
2 | Transferred | Alternate position |
Priority Levels
EnumTicketColor
Value | Text | Color | Priority |
---|---|---|---|
0 | Red | #FF0000 | High |
1 | Green | #00FF00 | Low |
Color Configuration
Associate colors with enumeration values:
Enumeration: AlarmLevel
Value: 0, Text: "Normal", ActiveColor: Green
Value: 1, Text: "Warning", ActiveColor: Yellow
Value: 2, Text: "Critical", ActiveColor: Red
Display automatically uses colors when configured.
Best Practices
- Use standard names - Consistent naming convention
- Start with 0 - Follow programming standards
- Document values - Clear descriptions
- Plan for expansion - Leave gaps for future values
- Group related sets - Use categories
- Consider localization - Plan for multiple languages
- Test all values - Verify mappings work
Display Integration
TextBox Display
xml
<TextBox Text="{Tag.Motor1.ValueAsString}" />
ComboBox Selection
xml
<ComboBox SelectedValue="{Tag.Motor1.Value}">
<ComboBoxItem Value="0">Manual</ComboBoxItem>
<ComboBoxItem Value="1">Auto</ComboBoxItem>
</ComboBox>
Color Indication
xml
<Rectangle Fill="{Tag.Status.ActiveColor}" />
Troubleshooting
Text not displaying:
- Verify enumeration assigned to tag
- Check value exists in enumeration
- Use ValueAsString property
- Confirm display binding
Wrong text shown:
- Review value mappings
- Check for duplicate values
- Verify enumeration selection
- Test with known values
Colors not working:
- Configure ActiveColor/InactiveColor
- Use color properties in display
- Check color format (#RRGGBB)
- Test color visibility
Advanced Usage
Dynamic Enumeration Selection
csharp
// Change enumeration at runtime
if (@Tag.SystemType == 1)
@Tag.Status.Enumeration = "EnumMotorStates";
else
@Tag.Status.Enumeration = "EnumValveStates";
Custom Value Formatting
csharp
// Override enumeration display
string GetStatusText(int value)
{
return value switch
{
0 => "System Off",
1 => "System Running",
2 => "System in Fault",
_ => "Unknown"
};
}
In this section...