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

Changing boolean during simulation

Changing boolean during simulation

Hi,

I'm working on a model that utilizes a valve from Modelon. Using a controller it is open about 30-40%, and theres comes a point I need it be fully open and not be controlled anymore.
The valve has a boolean parameter fixedOpening, followed by a real paramter opening_fixed.

What I tried to do is implement a when statement
when (time>100) then
valve.fixedOpening:= true;
valve.opening_fixed=1;
end when;

as a result, I have 2 more equations than unknowns and also get the error:
Illegal left hand side in the when equation
when (time>100) then
true=false;
end when;

Is it possible to change a boolean during simulation? Or is there a different way to approach this?

Thanks for the help!

Re: Changing boolean during simulation

You can change Boolean variables during simulation, but not Boolean parameters.

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