Opened 13 years ago

Last modified 9 years ago

#1688 assigned defect

Reinit of non-state variables

Reported by: Martin Sjölund Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: Adrian Pop, Martin Sjölund, Jens Frenkel

Description (last modified by Lennart Ochel)

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 by Lennart Ochel, 12 years ago

Cc: Frenkel TUD added; Jens Frenkel removed
Component: Backend
Description: modified (diff)

comment:2 by Lennart Ochel, 12 years ago

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 by Lennart Ochel, 12 years ago

Cc: Adrian Pop added

comment:4 by Adrian Pop, 12 years ago

Cc: Jens Frenkel 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 by Lennart Ochel, 12 years ago

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 by Adrian Pop, 12 years ago

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

comment:7 by Lennart Ochel, 12 years ago

Owner: changed from Martin Sjölund to Lennart Ochel
Status: newassigned

comment:8 by Dietmar Winkler, 9 years ago

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