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

Once-only execution

Once-only execution

Hi all,

i want have Modelica execute an algorithm exactly once, independently on the choosen simulation duration. Can anyone say how this would be done properly?

--Paul

Re: Once-only execution

Guard it with external C code. Give it a unique identifier so you can guard multiple sections.

Code:

if once(13) then

...
end if;

Re: Once-only execution

Hi sjoelund.se,

thanks for your answer. I fear i don't see your point. Without further means, the algorithm is executed over and over again, until the end of the simulation duration, but i want it to be executed exactly once.

--Paul

Re: Once-only execution

The part inside you have guarded with an expression in an external function that you made sure would only return true once.
The algorithm section will be called every time-step, but the part inside only once.

Re: Once-only execution

Thanks

--Paul

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