Tag Types
Tag Types (Data Types)
Wise SCADA has integrated PLC-compatible data types into C# and VB languages. This allows you to use types from SCADA/PLC terminology instead of standard C# or VB types within your scripts.
Data Type Definitions
The table below shows the different syntax options available for the same data type:
| Type | Size | C# Equivalents | VB Equivalents |
| BOOL | 1-bit | BOOL, bool, Boolean | BOOL, boolean, Boolean, BOOLEAN |
| SINT | 8-bit Signed | SINT, sbyte, Sbyte | SINT, sbyte, SByte, SBYTE |
| USINT | 8-bit Unsigned | USINT, byte, Byte | USINT, byte, Byte, BYTE |
| INT | 16-bit Signed | INT, short, Int16 | INT, short, Short, INT16 |
| UINT | 16-bit Unsigned | UINT, ushort, UInt16 | UINT, ushort, UShort, UINT16 |
| DINT | 32-bit Signed | DINT, int, Int32 | DINT, integer, Integer, INT32 |
| UDINT | 32-bit Unsigned | UDINT, uint, UInt32 | UDINT, uinteger, UInteger, UINT32 |
| LINT | 64-bit Signed | LINT, long, Int64 | LINT, long, Long, INT64 |
| ULINT | 64-bit Unsigned | ULINT, ulong, UInt64 | ULINT, ulong, ULong, UINT64 |
| REAL | 32-bit Float | REAL, float, Single | REAL, single, Single, SINGLE |
| LREAL | 64-bit Double | LREAL, double, Double | LREAL, double, Double, DOUBLE |
| STRING | String | string, String, STRING | STRING, string, String, STRING |
| DATE/TIME | Time | DATE, TIME, DATETIME, DateTime | DATE, TIME, DATETIME, DateTime, datetime |
HEX Value Management (Conversion)
HEX types in SCADA (SHEX, HEX, DHEX, LHEX) are stored as String types within scripts (e.g., SHEX HexTag = “FA”;). This prevents direct mathematical operations on them. To perform calculations, these values must be converted to numeric types.
1. Converting HEX Value to Numeric Value
The HEX (String) value must be converted to the appropriate bit-sized numeric type.
| Size | Target Type | C# Example | VB Example |
| 8-bit | USINT | USINT R = byte.Parse(Input, NumberStyles.HexNumber); | Dim R As USINT = Byte.Parse(Input, NumberStyles.HexNumber) |
| 16-bit | UINT | UINT R = ushort.Parse(Input, NumberStyles.HexNumber); | Dim R As UINT = UInt16.Parse(Input, NumberStyles.HexNumber) |
| 32-bit | UDINT | UDINT R = uint.Parse(Input, NumberStyles.HexNumber); | Dim R As UDINT = UInt32.Parse(Input, NumberStyles.HexNumber) |
| 64-bit | ULINT | ULINT R = ulong.Parse(Input, NumberStyles.HexNumber); | Dim R As ULINT = UInt64.Parse(Input, NumberStyles.HexNumber) |
In these examples, the value of the Input variable must be a HEX string like “FA”, “F00A”, etc.
2. Converting Numeric Value to HEX Value
Used to convert a numeric value back into a readable HEX String format.
| Size | SCADA Type (Numeric) | HEX Type (String) | Description / Format Code | C# Example | VB Example |
| 8-bit | USINT or SINT | SHEX | “X2”: 2-digit HEX (E.g.: 250 → `”FA”$) | SHEX R = Input.ToString(“X2”); | Dim R As SHEX = Input.ToString(“X2”) |
| 16-bit | UINT or INT | HEX | “X4”: 4-digit HEX (E.g.: 10 → `”000A”$) | HEX R = Input.ToString(“X4”); | Dim R As HEX = Input.ToString(“X4”) |
| 32-bit | UDINT or DINT | DHEX | “X8”: 8-digit HEX (E.g.: 255 → `”000000FF”$) | DHEX R = Input.ToString(“X8”); | Dim R As DHEX = Input.ToString(“X8”) |
| 64-bit | ULINT or LINT | LHEX | “X16”: 16-digit HEX (E.g.: 1 → `”0000000000000001″$) | LHEX R = Input.ToString(“X16”); | Dim R As LHEX = Input.ToString(“X16”) |
In the table above, the Input variable is a USINT with a numeric value of 250. The “X2” format guarantees an 8-bit (2-digit) HEX output. The format code (“X4”, “X8”, “X16”) must be adjusted according to the bit size.
Note: The number in the format code (2, 4, 8, 16) specifies the minimum number of characters the output will have. Using an uppercase ‘X’ ensures HEX digits are uppercase (e.g., “FA”), while using a lowercase ‘x’ produces lowercase digits (e.g., “fa”).
