Applies To:
  • CitectSCADA

Summary:
I have a numeric tag on a Citect page. The tag is of type REAL. A number with a large number of digits is entered, for example 123456789. After the number is entered, it seems to be displayed incorrectly (in the example as 123456792). Why is this so? 

Solution:
Citect uses the IEEE 32 bit floating point number format. The number 123456789 cannot be stored as an IEEE 32 bit floating point number exactly. The closest number which can be stored is 123456792 because precision is lost during conversion to an IEEE 32 bit floating point number. IEEE 32 bit floating point numbers have a range of 3.4 * 10-38 to 3.4 * 10+38 and allow 7 digit precision.

Rather than displaying a 15 digit real number, it is probably better to use exponential notation for your display format and not use more than 7 digits in the mantissa eg #s###### . In the above example, the number 1.234567e + 008 would be entered and displayed on the screen.

For further reference, the following is a list of the Data Types that may be supported by your I/O device and their ranges/precision.

BCD Binary- Coded Decimal 2 bytes 0 to 9,999
BYTE Byte 1 byte 0 to 255
DIGITAL Digital 1 bit or 1 byte 0 or 1
INT Integer 2 bytes -32,768 to 32,767
UINT Unsigned Integer 2 bytes 0 to 65,535
LONG Long Integer 4 bytes -2,147,483,648 to 2,147,483,647
LONGBCD Long Binary- Coded Decimal 4 bytes 0 to 99,999,999
REAL Floating Point 4 bytes -3.4E38 to 3.4E38 (max of 7 digits of precision)
Local REAL* Floating Point 8 bytes 1.79D-308 to 1.79D+308 (max of 15 digits of precision)

* Local REAL Cicode variables and internal variables (used to store intermediate values during a calculation Q3826) are 64-bit. Other REAL variables (MODULE, GLOBAL, and variable tags) are 32-bit. This may cause issues comparing values (Q3244) unless they are rounded to 7 digits with the Round() function. OLE Date/Time values will be accurate to the second with 64-bit REALs, but will only be accurate to the nearest 2min 49 sec with 32-bit REAL variables (Q4362).
 

 

Keywords:
 

Attachments