Iec 61131-3 Second edition 2003-01 Programmable controllers – Part 3: Programming languages
Table 22 - Type conversion function features
Download 1.35 Mb. Pdf ko'rish
|
ourdev 569653
- Bu sahifa navigatsiya:
- 2.5.1.5.2 Numerical functions
Table 22 - Type conversion function features
a A statement of conformance to feature 1 of this table shall include a list of the specific type conversions supported, and a statement of the effects of performing each conversion. b Conversion from type REAL or LREAL to SINT, INT, DINT or LINT shall round according to the convention of IEC 60559, according to which, if the two nearest integers are equally near, the result shall be the nearest even integer, e.g.: REAL_TO_INT(1.6) is equivalent to 2 REAL_TO_INT(-1.6) is equivalent to -2 REAL_TO_INT(1.5) is equivalent to 2 REAL_TO_INT(-1.5) is equivalent to -2 REAL_TO_INT(1.4) is equivalent to 1 REAL_TO_INT(-1.4) is equivalent to -1 REAL_TO_INT(2.5) is equivalent to 2 REAL_TO_INT(-2.5) is equivalent to –2 c The function TRUNC shall be used for truncation toward zero of a REAL or LREAL, yielding one of the integer types, for instance, TRUNC(1.6) is equivalent to 1 TRUNC(-1.6) is equivalent to -1 TRUNC(1.4) is equivalent to 1 TRUNC(-1.4) is equivalent to -1 d The conversion functions *_BCD_TO_** and **_TO_BCD_* shall perform conversions between variables of type BYTE, WORD, DWORD, and LWORD and variables of type USINT, UINT, UDINT and ULINT (represented by "*" and "**" respectively), when the corresponding bit-string variables contain data encoded in BCD format. For example, the value of USINT_TO_BCD_BYTE(25) would be 2#0010_0101, and the value of WORD_BCD_TO_UINT (2#0011_0110_1001) would be 369. e When an input or output of a type conversion function is of type STRING or WSTRING, the character string data shall conform to the external representation of the corresponding data, as specified in 2.2, in the character set defined in 2.1.1. 2.5.1.5.2 Numerical functions The standard graphical representation, function names, input and output variable types, and function descriptions of functions of a single numeric variable shall be as defined in table 23. These functions shall be overloaded on the defined generic types, and can be typed as defined in 2.5.1.4. For these functions, the types of the input and output shall be the same. The standard graphical representation, function names and symbols, and descriptions of arithmetic functions of two or more variables shall be as shown in table 24. These functions shall be overloaded on all numeric types, and can be typed as defined in 2.5.1.4. The accuracy of numerical functions shall be expressed in terms of one or more implementation- Download 1.35 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling