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

How can I execute 2 models one by one in one simulation?

How can I execute 2 models one by one in one simulation?

Hi everybody,

I was trying to execute 2 models one by one in a simulation via state chart. The pseudo-code follows. In model test, there are two blocks, stateA and stateB. At the beginning of the simulation, stateA is activated. 10 seconds later, stateA is deactivated  while stateB is activated. Could anybody give me some advises? Thanks a lot!


model test
inner Integer v(start = 1);
block StateA
outer output Integer v;
equation
v = previous(v) + 2;
end StateA;
StateA stateA;

block StateB
outer output Integer v;
equation
v = previous(v) - 1;
end StateB;
StateB stateB;

equation
initialState(stateA);
transition(stateA, stateB, t >= t0, immediate=false);

end test;

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