Displays Units Conversion (Reference) enables automatic conversion between measurement systems, allowing multiple client displays to show values in their preferred units (Metric/Imperial) while connected to the same server.
Units Conversion provides:
- Metric to Imperial conversion
- Imperial to Metric conversion
- Custom conversion tables
- Client-specific display units
- Runtime unit switching
- Extensible conversion definitions
Each client station can display values in its preferred measurement system without affecting other connected clients or server values
Overview
The Units Conversion interface helps convert different metrics, units, and measurement systems. This functionality already includes conversion tables for both Metric to Imperial and Imperial to Metric, but you can extend and modify them according to your requirements.
This feature allows two or more Client Displays connected to the same server to see the values and units on their own computers according to the metric currently selected for that operator station.
On this page:
Table of Contents maxLevel
2 minLevel 2 indent 10px exclude Steps style none
To configure a tag for unit conversion:
- Set the tag’s Units property. You can do this through the Unified Namespace / Tags table. You can also change it via CodeBehind or Scripts, by assigning a value to
Tag.<TagName>.Units
. - To apply unit conversions to your solution, assign the name of the desired conversion table to the
Client.Units
property. - All tags with units affected by the conversion table will have their values changed. To display the tag’s unit after conversion, use
Tag.<TagName>.DisplayUnits
.
Configuration Steps
- Set Tag Units
- Navigate to Unified Namespace → Tags
- Configure Units property for each tag
- Or set via script:
@Tag.Temperature.Units = "°C"
- Apply Conversion Table
- Assign conversion table to client
- Set
@Client.Units = "MetricToImperial"
- Values automatically convert
- Display Converted Units
- Use
@Tag.Temperature.DisplayUnits
- Shows converted unit string
- Updates with conversion changes
- Use
Conversion Table Properties
Property | Description | Example |
---|---|---|
BaseUnit | Original unit before conversion | °C |
NewUnit | Unit after conversion | °F |
Div | Division factor for conversion | 1.8 |
Add | Addition factor for conversion | 32 |
BaseName | Base unit display name | Celsius |
NewName | New unit display name | Fahrenheit |
MeasurementType | Category of measurement | Temperature |
Conversion Formula
NewValue = (BaseValue / Div) + Add
Standard Conversions
Temperature
Base | New | Div | Add |
---|---|---|---|
°C | °F | 0.556 | 32 |
°F | °C | 1.8 | -32 |
Length
Base | New | Div | Add |
---|---|---|---|
m | ft | 0.3048 | 0 |
ft | m | 3.281 | 0 |
km | mi | 1.609 | 0 |
mi | km | 0.621 | 0 |
Pressure
Base | New | Div | Add |
---|---|---|---|
bar | psi | 0.0689 | 0 |
psi | bar | 14.504 | 0 |
kPa | psi | 6.895 | 0 |
Runtime Usage
Client-Side Configuration
csharp
// Set conversion table for client
@Client.Units = "MetricToImperial";
// Check current conversion
string currentTable = @Client.Units;
// Remove conversion
@Client.Units = "";
Tag Properties
csharp
// Original unit
string baseUnit = @Tag.Pressure.Units; // "bar"
// Converted unit (after conversion applied)
string displayUnit = @Tag.Pressure.DisplayUnits; // "psi"
// Original value
double baseValue = @Tag.Pressure.BaseValue; // 10 bar
// Converted value
double displayValue = @Tag.Pressure.Value; // 145.04 psi
Creating Custom Tables
- Navigate to Displays → Units Conversion
- Create new conversion set
- Define conversions:
- BaseUnit and NewUnit
- Div and Add factors
- MeasurementType category
Example: Custom Speed Conversion
BaseUnit: m/s
NewUnit: km/h
Div: 0.278
Add: 0
MeasurementType: Speed
Multi-Client Scenarios
Different Units Per Client
csharp
// Client 1 - US Operator
@Client.Units = "ImperialUnits";
// Sees: 72°F, 14.7 psi, 100 ft
// Client 2 - EU Operator
@Client.Units = "MetricUnits";
// Sees: 22.2°C, 1.01 bar, 30.5 m
// Server stores single value set
// Each client sees converted display
Best Practices
- Define Units Early - Set during tag creation
- Group by Type - Organize conversions by measurement
- Test Conversions - Verify accuracy
- Document Custom - Explain custom conversions
- Consider Precision - Account for rounding
- Default Tables - Provide standard sets
- User Preferences - Store per operator
Measurement Types
Organize conversions by category:
- Temperature - °C, °F, K
- Pressure - bar, psi, kPa, MPa
- Flow - m³/h, gpm, l/s
- Length - m, ft, km, mi
- Mass - kg, lb, ton
- Volume - l, gal, m³
- Speed - m/s, km/h, mph
- Energy - kWh, BTU, J
Troubleshooting
Values not converting:
- Check Units property set on tag
- Verify conversion table assigned
- Confirm table contains unit mapping
- Review Div/Add factors
Wrong conversion:
- Check formula factors
- Verify unit strings match exactly
- Test with known values
- Review calculation order
Client differences:
- Confirm each client's Units setting
- Check local vs server values
- Verify table assignments
- Test client isolation
Examples
Temperature Gauge
xml
<TextBlock Text="{Tag.Temperature.Value}" />
<TextBlock Text="{Tag.Temperature.DisplayUnits}" />
<!-- Shows: "72" and "°F" for Imperial client -->
Dynamic Switching
csharp
public void ToggleUnits()
{
if (@Client.Units == "MetricToImperial")
@Client.Units = "";
else
@Client.Units = "MetricToImperial";
}
In this section...
Page Tree | ||||
---|---|---|---|---|
|
Units Conversion Table Columns
Property
Description
ID
Identifies each unit conversion entry uniquely.
VersionID
Tracks the version of the unit conversion entry.
BaseUnit
Represents the original unit of measurement before conversion.
NewUnit
Represents the unit of measurement after conversion.
Div
Indicates the division factor used in the conversion process.
Add
Indicates the addition factor used in the conversion process.
BaseName
Names the base unit.
NewName
Names the new unit after conversion.
DateCreated
Records the creation date and time of the unit conversion entry.
DateModified
Records the last modification date and time of the unit conversion entry.
MeasurementType
Specifies the type of measurement for the units involved, such as length or weight.
In this section:
Page Tree | ||||
---|---|---|---|---|
|