Opened 10 years ago

Closed 10 years ago

#3155 closed defect (fixed)

Wrong illegal subscript

Reported by: Rüdiger Franke Owned by: Per Östlund
Priority: high Milestone: 1.9.2
Component: Frontend Version: trunk
Keywords: Cc:

Description

6 models of the PowerSystems library fail for the reason reported here. See:

https://test.openmodelica.org/libraries/PowerSystems/BuildModelRecursive.html

The model

model Modulator
  parameter Integer m = 3;
  Modelica.Blocks.Interfaces.BooleanOutput[2 * m] gates;
  final parameter Integer[m] pgt = 1:2:2 * m - 1 "positive gates";
  final parameter Integer[m] ngt = 2:2:2 * m "negative gates";
initial algorithm
  for k in 1:3 loop
    gates[{pgt[k], ngt[k]}] := {true, false};
  end for;
equation
  for k in 1:3 loop
    when time > 0.5 then
      gates[{pgt[k], ngt[k]}] = pre(gates[{ngt[k], pgt[k]}]);
    end when;
  end for;
end Modulator;

generates the error:

[1] 08:38:24 Translation Error
Error occurred while flattening model Modulator

[2] 08:38:24 Translation Error
[/home/user/work/Modulator.mo: 8:5-8:45]: Variable gates[{pgt[k], ngt[k]}] not found in scope Modulator.$for loop scope$.

[3] 08:38:24 Translation Error
[/home/user/work/Modulator.mo: 8:5-8:45]: Illegal subscript {pgt[k], ngt[k]} for dimensions 6 in component gates[{pgt[k], ngt[k]}].

Change History (2)

comment:1 by Per Östlund, 10 years ago

Owner: changed from somebody to Per Östlund
Status: newaccepted

comment:2 by Per Östlund, 10 years ago

Resolution: fixed
Status: acceptedclosed

Should be fixed in r24568.

Note: See TracTickets for help on using tickets.