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

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

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.

There are 0 guests and 0 other users also viewing this topic