OpenModelica


Forgot password? | Forgot username? | Register

when-end when

when-end when

Hi There,
I do assign boolean  value to variable with when command.
such as below sample.

Code:


  when condition1  then
    x = true;
  end when;

and then i want to re-assign new value with new condition.

Code:


  when condition2  then
    x = false;
  end when;

But OM give me this error.  " Error: Model is structurally singular, error found sorting equations "

How can re-assign  x  value after when condition.

Thanks

Oki

Administrator has disabled public posting. Please login or register in order to proceed.

Re: when-end when

You need to use elsewhen. Otherwise, if condition1 and condition2 become true at the same time, you have two different assignments to x.

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic