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

Appointing a New Set Value When/If Conditions Met

Appointing a New Set Value When/If Conditions Met

May be the solution is simple but couldn't find. Quick solution can be rewarding.

I try to build a new control unit. It is checking the measurement at a point in my hydraulic network and when its value becomes less than the criteria; I want this control unit increase the set value at another point in my hydraulic network. After this moment of the simulation, I want my hydraulic system operate with this new set value.

The problem is that: the conditional statements (i.e. if u1<=threshold then y:=u2+increase else y:=50-fictional example value-) in modelica have a continuous time varying influence of the output, in detail: the y value changes (y:=u2+increase) only while the if/when condition is being satisfied and at the following time steps when the condition becomes non-satisfied it reverts to else condition (y:=50). I want to add "// do nothing" for else condition but not working. But this is still due to the nature of the modelica that is being 'if/when condition met make the calculation or revert to else', if I understand correctly.

What I want is to give the increase in y value when the if/when conditions satisfied and have the new y value as constant permanently after that.

A quick response will be appreciated a lot.
Regards.

Re: Appointing a New Set Value When/If Conditions Met

SOLVED: I could find this Modelica.Blocks.MathInteger.TriggeredAdd by chance. When there is a trigger (the moment the condition satisfied -that is RisingEdge-) by the Boolean input to this block it resets the output to a new value to be stayed as consistent.

This is exactly what I needed. Now checking the textual codes to have the understanding of it (and of Modelica).

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