Opened 12 years ago

Closed 7 years ago

#1853 closed defect (fixed)

reinit does not handle arrays

Reported by: Adeel Asghar Owned by: Adeel Asghar
Priority: critical Milestone: 1.13.0
Component: Frontend Version: trunk
Keywords: Cc: Per Östlund, Martin Sjölund

Description (last modified by Martin Sjölund)

Passing an array to reinit (or change) raises the "wrong arguments error".

Change History (17)

comment:1 by Adeel Asghar, 12 years ago

Summary: reinit does not handle arraysreinit and change does not handle arrays

comment:2 by Adeel Asghar, 12 years ago

Description: modified (diff)

comment:3 by Martin Sjölund, 12 years ago

Cc: Per Östlund Martin Sjölund added
Owner: changed from perost, sjoelund.se to Adeel Asghar
Status: newassigned

comment:4 by Martin Sjölund, 12 years ago

I'm pretty sure you cannot vectorize change, because <> does not work on vectors.
reinit I guess should be allowed. What models uses this?

comment:5 by Martin Sjölund, 12 years ago

Description: modified (diff)
Summary: reinit and change does not handle arraysreinit does not handle arrays

in reply to:  4 comment:6 by Adeel Asghar, 12 years ago

Replying to sjoelund.se:

I'm pretty sure you cannot vectorize change, because <> does not work on vectors.
reinit I guess should be allowed. What models uses this?

reinit is used in,
Modelica.Mechanics.Translational.Components.MassWithStopAndFriction
Modelica.Blocks.Math.Mean

However, the above models are not using arrays with it.
Dymola allows arrays with change. Perhaps instead of using vectors in the code behind we can expand it something like this,

Code highlighting:

change(arr) => (change(arr[1]) or change(arr[2]) or change(arr[3]))

Upto whatever the length of the array!!!!

comment:7 by Martin Sjölund, 12 years ago

Milestone: 1.9.02.0.0

comment:8 by Martin Sjölund, 11 years ago

Milestone: 2.0.01.9.1
Version: trunk

comment:9 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:10 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:11 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:12 by Martin Sjölund, 9 years ago

Priority: blockercritical

comment:13 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:14 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:15 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:16 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:17 by Francesco Casella, 7 years ago

Milestone: 1.12.01.13.0
Resolution: fixed
Status: assignedclosed

The following model

model M
  Real x[2];
equation
  der(x[1]) = 1;
  der(x[2]) = 2;
  when (x[1]>0.2) then
    reinit(x, {0,0});
  end when;
end M;

works fine in v1.13.0-dev-155-g68350e9, both with old and new front-end

Note: See TracTickets for help on using tickets.