Opened 13 years ago

Last modified 9 years ago

#1688 assigned defect

Reinit of non-state variables

Reported by: sjoelund.se Owned by: lochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: adrpo, sjoelund.se, jfrenkel

Description (last modified by lochel)

The following model is accepted by OpenModelica, but should not:

model M
  Real r = time;
equation
  when sample(0,0.1) then
    reinit(r, 2*time);
  end when;
end M;

The appropriate error should be:
Cannot use reinit() on r as it cannot be selected as a state variable

Change History (8)

comment:1 Changed 12 years ago by lochel

  • Cc Frenkel TUD added; Frenkel TUD removed
  • Component set to Backend
  • Description modified (diff)

comment:2 Changed 12 years ago by lochel

look also for #51. There is reinit used in a when initial() clause:

when initial() then
  reinit(x, u);
end when;

That makes no sense and is not valid. Perhaps, that should be caught in the Frontend?

comment:3 Changed 12 years ago by lochel

  • Cc adrpo added

comment:4 Changed 12 years ago by adrpo

  • Cc jfrenkel added; Frenkel TUD removed

We might catch the reinint in when initial in the front-end.
I'll see if i can add this rule to the already existing ones.

comment:5 Changed 12 years ago by lochel

Nice. You can recover the test case from #51. I have already removed it (r14242) from the testsuite/simulation, because it is no simulation test case.

comment:6 Changed 12 years ago by adrpo

I opened a new bug about the reinit in when with
condition initial: #1972 so we can talk about this
more.

comment:7 Changed 11 years ago by lochel

  • Owner changed from sjoelund.se to lochel
  • Status changed from new to assigned

comment:8 Changed 9 years ago by dietmarw

  • Milestone set to Future
Note: See TracTickets for help on using tickets.