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" clause problem in SimulationX

"When" clause problem in SimulationX

    I do the modelica programme in the simulationX environment. Recently, I found in the some cases, the statement “when” could not response the many event. Here is one of my examples.

when v5>0 then reinit(xx5,0.03);elsewhen v5<0 then reinit(xx5,0.06);end when;


   During the simulation process, the variety xx5 changing events from negative to positive or from positive to negative couldn’t trigger the command of “reinit”.
   In the programme piece, there is a clause “x=x1+x5”. If I designate “x1=0”, the clause “when v5>0 then reinit…” works well. If the variety x1 is integrated in a complicated equation, the clause “when v5>0 then reinit…”does not work well completely. I could not understand the above problem. Is the problem a bug of the software. Does anybody could help me to solve the problem.

The piece of the my codes is as following
equation
    x=ctr1.x-ctr2.x;
    v=ctr1.v-ctr2.v;
    x=x1+x5;

    vv5=der(xx5);v5=der(x5);vv5=0;   
    when v5<0 then reinit(xx5,0.03);elsewhen v5>0 then reinit(xx5,0.06);end when;

    vv1=der(xx1);v1=der(x1);vv1=0;
    when v1<=0 then reinit(xx1,10);elsewhen v1>=0 then reinit(xx1,20);end when;
............

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