为什么我不能将输出变量作为参数传递给 IEC61131-3 结构化文本 (TwinCAT3) 中的功能块构造函数?

问题描述

我有一个功能块 A,它有一个变量 output(在 FUNCTION_BLOCK A 方法中定义)和这个 FB_init 方法:

METHOD FB_init : BOOL
    VAR_INPUT
        bInitRetains : BOOL; // if TRUE,the retain variables are initialized (warm start / cold start)
        bInCopyCode : BOOL;  // if TRUE,the instance afterwards gets moved into the copy code (online change)
    END_VAR
    
    VAR_OUTPUT
        output : REAL := 0;
    END_VAR

THIS^.output := output;

当我调用这个构造函数时:

a : A(output => outputLocal);
  • 我收到语法错误:Identifier 'output' not defined。但我确实定义了 构造函数方法中的这个参数。
  • 当我尝试编译项目时,出现另一个错误:No matching FB_init method found for instantiation of A
  • 有谁知道问题出在哪里?以及我如何将变量传递为 功能块的输出参数?
  • 我想基本上将 localoutput 链接到 FB 构造函数中的变量 output(FB A)。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)