Opened 8 years ago

Closed 8 years ago

#4271 closed defect (fixed)

Loss of modification equations during transformation

Reported by: Bernhard Thiele Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: Rüdiger Franke, Lennart Ochel, lena.buffoni@…

Description

Following state machine model has two states for which the input xfoox is provided by modification equations.

loadString("
model test
  StateX state1(xfoox=1.0);
  StateX state2(xfoox=0.1);
equation
  initialState(state1);
  transition(state1, state2, true, immediate=false);
  transition(state2, state1, true, immediate=false);
end test;

model StateX
  input Real xfoox;
  Real y;
equation
  y = xfoox * sample(1, Clock(1,10));
end StateX;
"); getErrorString();
simulate(test); getErrorString();

The problem is that after simulation both input variables state1.xfoox and state2.xfoox remain on their "initial value" 0. If one provides an explicit start value, e.g., xfoox(start=0.1), that value is used instead. First analysis by Lennart and me suggests that the modification equations are "lost" either at the back-end transformation or the code generation.

Change History (3)

comment:1 by Lennart Ochel, 8 years ago

Status: newaccepted

comment:2 by Lennart Ochel, 8 years ago

Fixed with OMCompiler#1485.
Test case added with OpenModelica-testsuite#562.

Well, these changes are pretty radical. I think we should also handle clocked partitions in the future. Therefore, we probably just need to add some restrictions on what is allowed to remove in case of clocked partitions.

comment:3 by Bernhard Thiele, 8 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.