Syntax Modelica评论

Syntax Modelica评论,syntax,comments,whitespace,grammar,modelica,Syntax,Comments,Whitespace,Grammar,Modelica,Modelica规范是否禁止以下示例代码中给出的注释类型? 我使用的工具将注释移动到下一个分号后面 within ; model HeatingResistor_Comment "Heating resistor" extends Modelica.Icons.Example; Modelica.Electrical.Analog.Basic.HeatingResistor heatingResistor( R_ref=100, alpha=1e-3, // tak

Modelica规范是否禁止以下示例代码中给出的注释类型? 我使用的工具将注释移动到下一个分号后面

within ;
model HeatingResistor_Comment "Heating resistor"
  extends Modelica.Icons.Example;

  Modelica.Electrical.Analog.Basic.HeatingResistor heatingResistor(
    R_ref=100,
    alpha=1e-3,   // taken from Meyer 2016 paper
    T_ref=293.15, // this is 20C
    i(start=0));
  Modelica.Electrical.Analog.Basic.Ground G;
  Modelica.Electrical.Analog.Sources.SineVoltage SineVoltage1(
    V=220,
    freqHz=1);
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor(G=50);
  Modelica.Thermal.HeatTransfer.Celsius.FixedTemperature fixedTemperature(T=20);

equation
  connect(SineVoltage1.n, G.p);
  connect(heatingResistor.heatPort, thermalConductor.port_a);
  connect(SineVoltage1.p, heatingResistor.p);
  connect(G.p, heatingResistor.n);
  connect(thermalConductor.port_b, fixedTemperature.port);

end HeatingResistor_Comment; 
此示例的副本也在此处(带有语法突出显示):

如果您使用的是OpenModelica,那么很遗憾,注释会被移动。
我们正计划解决这个问题,但这需要一些时间。

我想,相应的问题是:您没有明确地说出来,但我认为您的回答是:Modelica规范允许这些注释,移动它们是一个错误。所以我会把你的答案作为我问题的答案。是的。这些注释是Modelica规范允许的,OpenModelica会将它们转移到一个bug中。解析后,我们将分离AST,这就是注释(以及任何其他格式)移动的原因。