我的电路中有几个块“FixedCurrent”。我希望能够通过 FMU 更改这些块的电流值。我可以使用“参数”更改一个值,如下面的代码所示:
type Current = Real(unit = "A", min = 0);
parameter Current CurrentTest1(start = 50) "Test current";
PowerSystems.Generic.FixedCurrent fixedCurrent3(
I = CurrentTest1,
redeclare package PhaseSystem = PhaseSystem),
annotation(...);
PowerSystems.Generic.FixedCurrent fixedCurrent1(
I = 55,
redeclare package PhaseSystem = PhaseSystem),
annotation(...);
但我不能为他们分配输入。例如,如果我使用输入命令 (1) 或 RealInput 块 (2) 为块 fixedCurrent3 设置电流值:
// 1)
input Real TZtest(start=50);
PowerSystems.Generic.FixedCurrent fixedCurrent3(
I = TZtest,
redeclare package PhaseSystem = PhaseSystem),
annotation(...);
// 2)
Modelica.Blocks.Interfaces.RealInput TZTest2 annotation(...);
PowerSystems.Generic.FixedCurrent fixedCurrent3(
I = TZtest,
redeclare package PhaseSystem = PhaseSystem),
annotation(...);
我收到相应的错误:
1) Translation Error
Component fixedCurrent3.I of variability PARAM has binding TZtest of higher variability VAR.
2)Translation Error
Component fixedCurrent3.I of variability PARAM has binding TZTest2 of higher variability VAR.
因此,我无法通过 FMU 输入设置参数值。我将不胜感激得到这个问题的任何解决方案。