Opened 13 years ago

Closed 10 years ago

Last modified 7 years ago

#1529 closed defect (fixed)

It should be possible to use non-fixed parameters as array indices

Reported by: sjoelund.se Owned by: lochel
Priority: high Milestone: 1.9.4
Component: Run-time Version:
Keywords: Cc: sjoelund.se, perost

Description

model M
  parameter Integer p(fixed=false,min=1,max=1);
  Real r[1];
initial equation
  p = 1;
equation
  r[p] = 2.0;
end M;
[a.mo:7:3-7:13:writable] Error: Illegal subscript [p] for dimensions 1 in component <NO COMPONENT>

Also, have fun with:

model M
  parameter Integer p(fixed=false,min=1,max=1,start=1);
  Real r[1];
initial equation
  p = 15;
equation
  r[p] = 2.0;
end M;

Change History (5)

comment:1 Changed 13 years ago by perost

Non-fixed parameter subscripts are now no longer evaluated in r9075. It's still not possible to compile the model though, since it does not pass the backend.

comment:2 Changed 11 years ago by sjoelund.se

  • Component set to Run-time
  • Milestone set to Future
  • Owner changed from sjoelund.se to lochel
  • Status changed from new to assigned

These examples now fail initialization. The first one because p.start is used as an initial guess despite being outside the min/max interval. The second because it should :)

comment:3 Changed 10 years ago by lochel

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

Both models work as expected.

comment:4 Changed 9 years ago by dietmarw

  • Milestone changed from Future to pre1.9.4

It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.

comment:5 Changed 7 years ago by sjoelund.se

  • Milestone changed from pre1.9.4 to 1.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.