Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

parameters and init.xml [solved]

parameters and init.xml [solved]

I am doing several simulations, where parameters are changed by updating the Model_init.xml.
Some values do not arrive.

model SubModel
  parameter Real C = 1;
  ...
end SubModel;

model MainModel
  parameter Real C = 2;
  SubModel submodel(C=C);
  ...
end MainModel;

When I reset parameter MainModel.C in init.xml to a value of 3 (or something else), then the value of submodel.C does not change - it remains 2.

The flat model says:
parameter Real C = 2;
parameter Real submodel.C = C;

The MainModel_init.xml is changed from:
(MainModel.)C -> <Real fixed="true" start="2" useNominal="false" useStart="true" />
submodel.C -> <Real fixed="true" start="2" useNominal="false" useStart="true" />

to:
(MainModel.)C -> <Real fixed="true" start="3" useNominal="false" useStart="true" />
submodel.C -> <Real fixed="true" start="2" useNominal="false" useStart="true" />

The MainModel_res.mat says:
C = 3
submodel.C = 2

---

Problem was solved by setting preOptModules without "evaluateReplaceProtectedFinalEvaluateParameters".

Edited by: svenjens - Mar-24-16 10:39:10
There are 0 guests and 0 other users also viewing this topic
You are here: