#6050 closed defect (fixed)
reinit with introduceOutputAliases broken
| Reported by: | Andreas Heuermann | Owned by: | Andreas Heuermann |
|---|---|---|---|
| Priority: | high | Milestone: | 1.16.0 |
| Component: | Backend | Version: | v1.16.0-dev |
| Keywords: | introduceOutputAliases reinit fmi fmi-cross-check | Cc: |
Description
When enabeling preOptModule introduceOutputAliases (default for FMI 2.0) reinit will not reinitialize the correct variable for top level outputs leading to wrong event behavior.
loadString("
model simpleEvent
Real h(start=1, fixed=true);
Real v(start=-2, fixed=true);
Real x;
equation
der(h) = v;
der(v) = 0;
when h <= 0 then
reinit(v,-pre(v));
x = 0.5*v;
end when;
end simpleEvent;"); getErrorString();
loadString("
model simpleEventOutput
Real h(start=1, fixed=true);
output Real v(start=-2, fixed=true);
Real x;
equation
der(h) = v;
der(v) = 0;
when h <= 0 then
reinit(v,-pre(v));
x = 0.5*v;
end when;
end simpleEventOutput;"); getErrorString();
setCommandLineOptions("--preOptModules+=introduceOutputAliases"); getErrorString();
mkdir("simpleEvent"); getErrorString();
cd("simpleEvent"); getErrorString();
simulate(simpleEvent); getErrorString();
cd(".."); getErrorString();
mkdir("simpleEventOutput"); getErrorString();
cd("simpleEventOutput"); getErrorString();
simulate(simpleEventOutput); getErrorString();
When v is a top level output it should get replaced with outputAlias_v everywhere but is not inside the when equation containing reinit.
Working for:
/*
equation index: 14
type: WHEN
when {$whenCondition1} then
x = 0.5 * $outputAlias_v;
end when;
*/
Not working for:
/*
equation index: 15
type: WHEN
when {$whenCondition1} then
reinit(v, -pre(v));
end when;
*/
Change History (5)
comment:1 by , 5 years ago
| Milestone: | Future → 1.17.0 |
|---|---|
| Priority: | high → blocker |
comment:2 by , 5 years ago
| Milestone: | 1.17.0 → Future |
|---|---|
| Priority: | blocker → high |
The problem is that equation 15 is not inside the equation array updated by function BackendDAEUtil.introduceOutputAliases
Adding simple equations aka removed equations solves this.
Simple Equations (1, 0) ======================================== 1/1 (0): when h <= 0.0 then reinit(v,-pre(v)); end when; [dynamic |0|0|0|0|]
See PR 6665.
comment:3 by , 5 years ago
| Milestone: | Future → 1.16.0 |
|---|
Sorry, changed your changes back without noticing.
Note:
See TracTickets
for help on using tickets.

@AnHeuermann, I marked this as a blocker for 1.17.0; I understand it's not urgent, but it needs to be done in the not too distant future.