Skip to main content

运算符:__POSITION

运算符是 IEC 61131-1 标准的扩展。

在运行时,运算符产生变量在声明部分或 POU 的实现部分中的位置。必须为运算符分配类型的变量 STRING 在声明部分或实现部分。

. 的结果 __POSITION
  • 声明部分: 'Line <line number> (Decl)'

  • 实现部分: 'Line <line number>, Column <Column number> (Impl)'

157. 例子
PROGRAM PROG1
VAR
        strPOS : STRING := __POSITION();  //Returns the line number of this declaration
        strlocalPOS : STRING;
END_VAR

        strlocalPOS := __POSITION();      //Returns row and column number of this assignment