Opened 10 years ago

Closed 10 years ago

#3049 closed defect (fixed)

FMI export of attributes of variables

Reported by: Rüdiger Franke Owned by: Willi Braun
Priority: high Milestone: 1.9.2
Component: FMI Version: trunk
Keywords: Cc:

Description

OpenModelica r23881 does not include the attributes of model variables into modelDescription.xml, or it does it wrong. This is bad for numeric solvers that rely on appropriate nominal and start values for things like pressure in Pa.

Here is an example:

model Attributes
  output Modelica.SIunits.AbsolutePressure p1 = 1e5;
  output Modelica.Media.Water.WaterIF97_base.AbsolutePressure p2 = 2e5;
  output Modelica.SIunits.AbsolutePressure p3(nominal = 1e7) = 1e5;
  annotation(uses(Modelica(version="3.2.1")));
end Attributes;

translateModelFMU(Attributes, version="2.0") mentions no nominal values in the XML file.

p2 gets a start value of 1e5 -- this is the start value of Modelica.Media.Interfaces.Types.AbsolutePressure, which is modified to 50e5 in Modelica.Media.Water.WaterIF97_base.

Shouldn't the XML file provide three nominal values and the modified start value for p2?

Change History (4)

comment:1 by Willi Braun, 10 years ago

Owner: changed from Adeel Asghar to Willi Braun
Status: newaccepted

comment:2 by Willi Braun, 10 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r23895.

comment:3 by Rüdiger Franke, 10 years ago

Resolution: fixed
Status: closedreopened

Good to have the some reasonable attributes now! modelDescription.xml says now:

<ModelVariables>
  <ScalarVariable name="p1" initial="calculated" causality="output" variability="continuous" valueReference="0">
    <Real nominal="100000.0" min="0.0"/></ScalarVariable>
  <ScalarVariable name="p2" initial="approx" causality="output" variability="continuous" valueReference="1">
    <Real nominal="100000.0" min="0.0" max="100000000.0" start="100000.0"/></ScalarVariable>
  <ScalarVariable name="p3" initial="calculated" causality="output" variability="continuous" valueReference="2">
    <Real nominal="10000000.0" min="0.0"/></ScalarVariable>
</ModelVariables>

The attributes of p2 appear wrong. See:

partial package WaterIF97_base 
  "Water: Steam properties as defined by IAPWS/IF97 standard"

  extends Interfaces.PartialTwoPhaseMedium(
    mediumName="WaterIF97",
    substanceNames={"water"},
    singleState=false,
    SpecificEnthalpy(start=1.0e5, nominal=5.0e5),
    Density(start=150, nominal=500),
    AbsolutePressure(
      start=50e5,
      nominal=10e5,
      min=611.657,
      max=100e6),
...

comment:4 by Willi Braun, 10 years ago

Resolution: fixed
Status: reopenedclosed

Yes, I noticed that, too, and created a new ticket therefore #3051, since it's also a different issue.

Note: See TracTickets for help on using tickets.