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:

TypeSizeC# EquivalentsVB Equivalents
BOOL1-bitBOOL, bool, BooleanBOOL, boolean, Boolean, BOOLEAN
SINT8-bit SignedSINT, sbyte, SbyteSINT, sbyte, SByte, SBYTE
USINT8-bit UnsignedUSINT, byte, ByteUSINT, byte, Byte, BYTE
INT16-bit SignedINT, short, Int16INT, short, Short, INT16
UINT16-bit UnsignedUINT, ushort, UInt16UINT, ushort, UShort, UINT16
DINT32-bit SignedDINT, int, Int32DINT, integer, Integer, INT32
UDINT32-bit UnsignedUDINT, uint, UInt32UDINT, uinteger, UInteger, UINT32
LINT64-bit SignedLINT, long, Int64LINT, long, Long, INT64
ULINT64-bit UnsignedULINT, ulong, UInt64ULINT, ulong, ULong, UINT64
REAL32-bit FloatREAL, float, SingleREAL, single, Single, SINGLE
LREAL64-bit DoubleLREAL, double, DoubleLREAL, double, Double, DOUBLE
STRINGStringstring, String, STRINGSTRING, string, String, STRING
DATE/TIMETimeDATE, TIME, DATETIME, DateTimeDATE, 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.

SizeTarget TypeC# ExampleVB Example
8-bitUSINTUSINT R = byte.Parse(Input, NumberStyles.HexNumber);Dim R As USINT = Byte.Parse(Input, NumberStyles.HexNumber)
16-bitUINTUINT R = ushort.Parse(Input, NumberStyles.HexNumber);Dim R As UINT = UInt16.Parse(Input, NumberStyles.HexNumber)
32-bitUDINTUDINT R = uint.Parse(Input, NumberStyles.HexNumber);Dim R As UDINT = UInt32.Parse(Input, NumberStyles.HexNumber)
64-bitULINT        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.

SizeSCADA Type (Numeric)HEX Type (String)Description / Format CodeC# ExampleVB Example
8-bitUSINT or SINTSHEX“X2”: 2-digit HEX (E.g.: 250 → `”FA”$)SHEX R = Input.ToString(“X2”);Dim R As SHEX = Input.ToString(“X2”)
16-bitUINT or INTHEX“X4”: 4-digit HEX (E.g.: 10 → `”000A”$)HEX R = Input.ToString(“X4”);Dim R As HEX = Input.ToString(“X4”)
32-bitUDINT or DINTDHEX“X8”: 8-digit HEX (E.g.: 255 → `”000000FF”$)DHEX R = Input.ToString(“X8”);Dim R As DHEX = Input.ToString(“X8”)
64-bitULINT or LINTLHEX“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”).

Leave a Reply