Opened 8 years ago

Closed 7 years ago

#4160 closed defect (fixed)

Systems with variable array indexing produce wrong results with -daeModel

Reported by: casella Owned by: wbraun
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 casella 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by casella

comment:1 Changed 7 years ago by casella

  • Milestone changed from 1.12.0 to 1.13.0

Milestone moved to 1.13.0 due to 1.12.0 already being released.

comment:2 Changed 7 years ago by wbraun

  • Status changed from new to accepted

comment:3 Changed 7 years ago by wbraun

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in PR2259.

Note: See TracTickets for help on using tickets.