Opened 5 years ago

Closed 5 years ago

#5657 closed defect (invalid)

when not allowed inside for in algorithm although specification does not prohibit this

Reported by: anonymous Owned by: Per Östlund
Priority: high Milestone: Future
Component: New Instantiation Version:
Keywords: Cc:

Description

Model foo below does not compile


model foo

parameter Real[:] inter_arrival_time={1,2};
discrete Real qlen[2](each start=0);
Boolean iLoad_taken[2]={sin(time)>0,sin(2*time)>0};


algorithm

for i in 1:2 loop

when sample(0,inter_arrival_time[i]) then

qlen[i] := qlen[i]+1;

end when;
when change(iLoad_taken[i]) then

qlen[i] := qlen[i]-1;

end when;

end for;


end foo;

Change History (1)

comment:1 by Per Östlund, 5 years ago

Resolution: invalid
Status: newclosed

Section 11.2.7.1 in the specification states:

When-statements may not occur inside while, if, and for-clauses in algorithms.

Note: See TracTickets for help on using tickets.