- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How to solve when and Matrix probleme?
How to solve when and Matrix probleme?
How to solve when and Matrix probleme?
Hello,
why OpenModelica dasn't accepte the use of matrix in when statement?
this is a exemple?
model test
Integer i;
Real R[3,8]=fill(0,3,8);
equation
if time>0.5 then
i=2;
else
i=4;
end if;
when change(i) then
reinit(R,{{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}});
end when;
end test;
any one have a solution for that?
thinks
Re: How to solve when and Matrix probleme?
That's not as issue with reinit of a matrix in when; it's an issue with change() not working properly (only works on discrete Real in OpenModelica runtime it seems).
- sjoelund.se
- 1700 Posts
Re: How to solve when and Matrix probleme?
model test
Integer i;
Real R[3,8]=fill(0,3,8);
equation
if time>0.5 then
i=2;
else
i=4;
end if;
when time>0.5 then
reinit(R,{{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}});
end when;
end test;
this also dasn't work.
Re: How to solve when and Matrix probleme?
That code does work in (at least in the trunk version of OpenModelica).
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How to solve when and Matrix probleme?