Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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).

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).

There are 0 guests and 0 other users also viewing this topic
You are here: