Opened 14 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: Martin Sjölund Owned by: Lennart Ochel
Priority: high Milestone: 1.9.4
Component: Run-time Version:
Keywords: Cc: Martin Sjölund, Per Östlund

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 by Per Östlund, 14 years ago

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 by Martin Sjölund, 11 years ago

Component: Run-time
Milestone: Future
Owner: changed from Martin Sjölund to Lennart Ochel
Status: newassigned

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 by Lennart Ochel, 10 years ago

Resolution: fixed
Status: assignedclosed

Both models work as expected.

comment:4 by Dietmar Winkler, 9 years ago

Milestone: Futurepre1.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 by Martin Sjölund, 7 years ago

Milestone: pre1.9.41.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.