Change annotation(Evaluate=true/false ) for parameters in models from Modelica Standard Library

ぃ、小莉子 提交于 2019-12-18 07:08:46

问题


I am using some components from the Modelica Standard Library (MSL) in my simulations. These components each have some parameters. For example, Modelica.Fluid.Sources.MassFlowSource_T has a parameter m_flow. Usually, parameters can be changed between simulation runs without re-compilation. This is not the case for m_flow, because it has an annotation(Evaluate=true), so it is used for symbolic processing.
Is it possible to change the annotations of parameters at instantiation? I tried the following, but it didn't work.

Modelica.Fluid.Sources.MassFlowSource_T source2(
    redeclare package Medium = Medium2,
    nPorts=1,
    m_flow=22.17 annotation(Evaluate=false));

Of course there are workarounds, like making a copy first and changing the annotation there or using use_m_flow_in=true and a constant source block.


回答1:


As far as I know this is not possible with current Modelica Specification. Some tools might support it if you extend MassFlowSource_T:

model MassFlowSource_T_2
  extends Modelica.Fluid.Sources.MassFlowSource_T;
  // declare m_flow here again with annotation(Evaluate=false);
end MassFlowSource_T_2;

use MassFlowSource_T_2 when you declare source2.

There is some work in progress to extend the way annotations are specified/handled but it will be a while until it makes it into the Modelica Specification: https://trac.modelica.org/Modelica/ticket/1293 (not open to the public yet).



来源:https://stackoverflow.com/questions/21957303/change-annotationevaluate-true-false-for-parameters-in-models-from-modelica-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!