Opened 8 years ago

Closed 7 years ago

#4160 closed defect (fixed)

Systems with variable array indexing produce wrong results with -daeModel

Reported by: Francesco Casella Owned by: Willi Braun
Priority: high Milestone: 1.13.0
Component: Run-time Version:
Keywords: Cc:

Description

Consider the following benchmark model, which is representative of a feature needed for large power transmission models

model TestVariableIncidence
  parameter Integer N = 4;
  Real x[N](start = cat(1, {1}, zeros(N-1)), each fixed = true);
  Integer idx[N](start = 1:N, each fixed = true);
equation 
  for i in 1:N loop
    der(x[i]) = 1-x[idx[i]];
  end for;
  when sample(0.5,1) then
    idx[1] = pre(idx[N]);
    for i in 2:N loop
      idx[i] = pre(idx[i-1]); 
    end for;
  end when;
  annotation(experiment(StopTime = 4, StartTime = 0, Tolerance = 1e-06, Interval = 0.02));
end TestVariableIncidence;

When simulating with the standard causalization approach, OMC produces the expected results, which coincide with the output of other Modelica tools. If -daeMode is used, all events after the first at time = 0.5 are missed, and the results are completely wrong.

The attached test script allows to reproduce the problem.

Attachments (1)

test.mos (790 bytes ) - added by Francesco Casella 8 years ago.

Download all attachments as: .zip

Change History (4)

by Francesco Casella, 8 years ago

Attachment: test.mos added

comment:1 by Francesco Casella, 7 years ago

Milestone: 1.12.01.13.0

Milestone moved to 1.13.0 due to 1.12.0 already being released.

comment:2 by Willi Braun, 7 years ago

Status: newaccepted

comment:3 by Willi Braun, 7 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in PR2259.

Note: See TracTickets for help on using tickets.