Opened 11 years ago

Closed 11 years ago

#2597 closed discussion (fixed)

*_init.xml and bounded nominal values

Reported by: Lennart Ochel Owned by: Lennart Ochel
Priority: high Milestone: 1.9.1
Component: Run-time Version: trunk
Keywords: Cc: Willi Braun

Description

The *_init.xml file contains if a nominal value is used and if so also the nominal value itself for all variables. In the case of dependent nominal values (i.e., parameter bounded) the xml-file contains always "useNominal=false, nominal=1.0".
This got fixed for the simulation in r19183, so that useNominal gets overwritten during runtime if needed. However, the xml-file still contains "useNominal=false, nominal=1.0". This is very confusing and should be fixed.

Change History (12)

comment:1 by Vitalij Ruge, 11 years ago

Owner: changed from Vitalij Ruge to somebody
Status: newassigned

comment:2 by Lennart Ochel, 11 years ago

Owner: changed from somebody to Vitalij Ruge

Come on - you can fix it.

Any comments on how to fix it? The straightforward solution would be a new attribute boundedNominalValue={false|true} in the xml-file, right? I don't like it very much, but still better than now. Any better ideas?

comment:3 by Lennart Ochel, 11 years ago

same for start, min and max.

comment:4 by Vitalij Ruge, 11 years ago

Owner: changed from Vitalij Ruge to somebody
Type: defectdiscussion

This statement
useNominal=false, nominal=1.0
is correct. We don't use 1.0 as nominal.

comment:5 by Lennart Ochel, 11 years ago

No, it is not correct. Please, check the following example from the test suite:

// testsuite/simulation/modelica/initialization/bug_2207.mos
  model bug_2207
    parameter Real a=100;
    constant Real b=100;
    Real x(start=2*a, nominal=3*a, min=-4*a, max=5*a);
    Real y(start=2*b, nominal=3*b, min=-4*b, max=5*b);
  equation
    der(x) = 0;
    der(y) = 0;
  end bug_2207;

The file 'initializationTests.bug_2207_init.xml' contains following information:

  <ScalarVariable
  name = "x"
  valueReference = "1001"
  variability = "continuous" isDiscrete = "false"
  causality = "internal" isValueChangeable = "true"
  alias = "noAlias"
  classIndex = "1" classType = "rSta"
  fileName = "&lt;interactive&gt;" startLine = "7" startColumn = "5" endLine = "7" endColumn = "54" fileWritable = "true">
  <Real useStart="false" start="0.0" fixed="false" useNominal="false" nominal="1.0" />
  </ScalarVariable>

useNominal="false" nominal="1.0" is obviously confusing. There is useNominal=false to make clear that nominal="1.0" is not given in the model. But it is not possible to determine if either there is no nominal value given and 1.0 is used as default value or a parameter bounded nominal value is defined as in this example.

Version 0, edited 11 years ago by Lennart Ochel (next)

comment:6 by Lennart Ochel, 11 years ago

I propose to introduce new Boolean entities "dependentNominal", "dependentStart", "dependentMin", and "dependentMax". The actually entities "nominal", "start", "min", and "max" should then contains the actual expression. Hence, the example from above would become the following:

<Real useStart="false" dependentStart="false" start="0.0" fixed="false" 
      useNominal="false" dependentNominal="true" nominal="3*a" dependentMin="true" 
      min="4*a" dependentMax="true" max="5*a" />

BTW: I am not sure if we need the useStart attribute at all.

comment:7 by Lennart Ochel, 11 years ago

I changed the handling for nominal values in r19239. Now, the XML file Looks like:

[...]
<ScalarVariable
  name = "y"
  valueReference = "1000"
  variability = "continuous" isDiscrete = "false"
  causality = "internal" isValueChangeable = "true"
  alias = "noAlias"
  classIndex = "0" classType = "rSta"
  fileName = "&lt;interactive&gt;" startLine = "8" startColumn = "5" endLine = "8" endColumn = "54" fileWritable = "true">
  <Real useStart="true" start="200.0" fixed="false" useNominal="true" nominal="300.0" min="-400.0" max="500.0" />
</ScalarVariable>
<ScalarVariable
  name = "x"
  valueReference = "1001"
  variability = "continuous" isDiscrete = "false"
  causality = "internal" isValueChangeable = "true"
  alias = "noAlias"
  classIndex = "1" classType = "rSta"
  fileName = "&lt;interactive&gt;" startLine = "7" startColumn = "5" endLine = "7" endColumn = "54" fileWritable = "true">
  <Real useStart="false" start="0.0" fixed="false" useNominal="true" />
</ScalarVariable>
[...]

comment:8 by Lennart Ochel, 11 years ago

Resolution: fixed
Status: assignedclosed

in reply to:  6 comment:9 by Martin Sjölund, 11 years ago

Replying to lochel:

BTW: I am not sure if we need the useStart attribute at all.

Doesn't OMEdit use this?

comment:10 by Lennart Ochel, 11 years ago

Resolution: fixed
Status: closedreopened

OMEdit is not using that attribute. I used it for an old initialization approach. Probably it is obsolete and the useStart attribute can be removed. Moreover, it is not compliant to the specification.

comment:11 by Lennart Ochel, 11 years ago

Owner: changed from somebody to Lennart Ochel
Status: reopenedaccepted

comment:12 by Lennart Ochel, 11 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in r19255 (see also #2601).

Note: See TracTickets for help on using tickets.