答案 0 :(得分:6)
您设置的每个修饰符都会显示在参数窗口中。您不仅可以设置参数的修饰符,还可以设置或多或少的非最终修饰符:还可以为所有变量和组件实例设置修饰符,无论它们在参数窗口中是否可见。 Dymola将在“自定义参数”部分中显示此类修饰符。
有几种方法可以设置此类修饰符:
在旧版Dymola中,这些修饰符仅显示在常规参数组中,这会引起混淆。因此,他们将其移至“自定义参数”部分。
让我们使用下面的简单代码来演示这三种不同的方法。
package Demo
model StepSine
Modelica.Blocks.Sources.Step step annotation (Placement(transformation(extent={{-20,20},{20,60}})));
Modelica.Blocks.Interfaces.RealOutput y annotation (Placement(transformation(extent={{100,-10},{120,10}})));
Modelica.Blocks.Math.Add add annotation (Placement(transformation(extent={{60,-10},{80,10}})));
Modelica.Blocks.Sources.Sine sine annotation (Placement(transformation(extent={{-20,-60},{20,-20}})));
equation
connect(add.y, y) annotation (Line(points={{81,0},{110,0}}, color={0,0,127}));
connect(step.y, add.u1) annotation (Line(points={{22,40},{40,40},{40,6},{58,6}}, color={0,0,127}));
connect(sine.y, add.u2) annotation (Line(points={{22,-40},{40,-40},{40,-6},{58,-6}}, color={0,0,127}));
end StepSine;
model Example
StepSine stepSine annotation (Placement(transformation(extent={{-8,-10},{12,10}})));
end Example;
end Demo;
在这里,我们创建了类StepSine
,该类仅向正弦信号增加了一个台阶。不会传播组件的任何参数,但是使用上述方法,我们仍然可以在Example
中进行设置。
使用文本层
StepSine stepSine(add.k1=-1)
stepSine
的参数窗口。您有了第一个自定义参数。使用“添加修饰符”
stepSine
中打开Example
的参数窗口step.height=1
,然后单击“确定” 使用“显示组件”
stepSine
sine
的参数窗口,然后输入例如幅度为3 stepSine
的参数窗口。您获得了第三个自定义参数。