Search code examples
syntaxcommentswhitespacegrammarmodelica

Modelica comments


Does the Modelica specification forbid the type of comments as given in the following example code? The tool I am using moves the comment behind the next semicolon.

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; 

A copy of this example is also here (with syntax highlight):
https://gist.github.com/thorade/c1a0447f2f5c05aefb9e


Solution

  • If you're using OpenModelica then the comments will be moved around unfortunately. We are planning to fix that but it will take some time.