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:
Enumerations transform raw numeric values into human-readable states like "Running/Stopped" or "Open/Closed".
| 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 |
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"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 |
EnumOpenedClosed
EnumLocalRemote
EnumPower
EnumTypeConnector
EnumNormIntermTransf
| Value | Text | Description |
|---|---|---|
| 0 | Normal | Standard operation |
| 1 | Intermediary | Transition state |
| 2 | Transferred | Alternate position |
EnumTicketColor
| Value | Text | Color | Priority |
|---|---|---|---|
| 0 | Red | #FF0000 | High |
| 1 | Green | #00FF00 | Low |
Associate colors with enumeration values:
Enumeration: AlarmLevel
Value: 0, Text: "Normal", ActiveColor: Green
Value: 1, Text: "Warning", ActiveColor: Yellow
Value: 2, Text: "Critical", ActiveColor: RedDisplay automatically uses colors when configured.
xml
<TextBox Text="{Tag.Motor1.ValueAsString}" />xml
<ComboBox SelectedValue="{Tag.Motor1.Value}">
<ComboBoxItem Value="0">Manual</ComboBoxItem>
<ComboBoxItem Value="1">Auto</ComboBoxItem>
</ComboBox>xml
<Rectangle Fill="{Tag.Status.ActiveColor}" />Text not displaying:
Wrong text shown:
Colors not working:
csharp
// Change enumeration at runtime
if (@Tag.SystemType == 1)
@Tag.Status.Enumeration = "EnumMotorStates";
else
@Tag.Status.Enumeration = "EnumValveStates";csharp
// Override enumeration display
string GetStatusText(int value)
{
return value switch
{
0 => "System Off",
1 => "System Running",
2 => "System in Fault",
_ => "Unknown"
};
}