Opened 8 years ago

Closed 8 years ago

#4116 closed defect (fixed)

Start values of states are hardly changeable

Reported by: Rüdiger Franke Owned by: Lennart Ochel
Priority: high Milestone: 1.11.0
Component: Backend Version:
Keywords: Cc: Patrick Täuber

Description (last modified by Rüdiger Franke)

The attribute isValueChangeable is true for state variables, even though Modelica insists in initial values, like in the following example:

model IsValueChangeable
  parameter Real x_start = 0;
  Real x(start = x_start, fixed = true);
  Real y;
  Real z;
initial equation
  y = 0;
equation
  der(x) = 1;
  der(y) = 1;
  der(z) = 1;
end IsValueChangeable;

Doesn't this mean that start values of state variables are hardly ever changeable?

See also the level states in Modelica.Fluid.Examples.Tanks.ThreeTanks.

Change History (7)

comment:1 by Rüdiger Franke, 8 years ago

Description: modified (diff)

comment:2 by Rüdiger Franke, 8 years ago

Cc: Patrick Täuber added

Here is the result of a naive test, setting isValueChangeable to false for states:

https://test.openmodelica.org/hudson/job/OpenModelica_TEST_PULL_REQUEST/3346/

How can one detect if a state is iteration variable during initialization, i.e. really changeable?

comment:3 by Lennart Ochel, 8 years ago

Status: newaccepted

I opened OMCompiler#1186 for this.

comment:4 by Rüdiger Franke, 8 years ago

That's certainly better than before. IsValueChangeable.x is not changeable anymore, as well as the tank?.level states of the MSL ThreeTanks example!

Please have a look into IsValueChangeable_init.xml though:

  • x has isValueChangeable=false, useStart=true and no start value
  • y and z have isValueChangeable=true, useStart=false and no start value

How should this be interpreted?

comment:5 by Lennart Ochel, 8 years ago

There is always a start attribute according to the specification. So we should just ignore and probably remove the useStart attribute from the xml file.

If I remember correctly, I have added the useStart attribute for the old initialization a long time ago and it isn't used anymore. I will have a look.

comment:6 by Lennart Ochel, 8 years ago

I remembered correctly, and useStart isn't used at all. I will remove it with OMCompiler#1187.

comment:7 by Rüdiger Franke, 8 years ago

Resolution: fixed
Status: acceptedclosed

Looks good. OMEdit PR50 reverts the "hot fix" of the Variables Browser.

Note: See TracTickets for help on using tickets.