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

Interactive Simulation

Interactive Simulation

Hi

I have created a simulation of an industrial process which varies according to the characteristics of the input. Is there any way I can pause the simulation and change some of the process parameters and then resume? Basically I want to create a training simulator that involves user input. So the workflow would be something like:

Start simulation with assumed parameters
Visualize results at say 25% of run time
Modify parameters
Visualize results at 50% of run time
Modify Parameters, etc

Any help or links would be gratefully appreciated.

Peter

Re: Interactive Simulation

It is possible to initialize a simulation based on previous simulation results. Would that be helpful?

Re: Interactive Simulation

Hi yes it could well be the way to go. Could you please let me have more information.

Thanks

Peter

Re: Interactive Simulation

There are two flags for the simulation executable: iif and iit (see here for more information https://www.openmodelica.org/doc/OpenMo … mflag-iif)
Additionally, you have to disable the ordinary initialization with –iim=none.

Code:


// run simulation from time=0 until time=0.25 and save results to xxx_res.mat
simulate(foo, stopTime=0.25, fileNamePrefix="xxx"); getErrorString();

// run simulation from time=0.25 until time=1.0 and use previous results as initial solution
simulate(foo, startTime=0.25, simflags="-iim=none -iif=xxx_res.mat -iit=0.25"); getErrorString();

Re: Interactive Simulation

OK. Many thanks I will explore this. I appreciate your prompt help.

Thanks

Peter

Re: Interactive Simulation

Basically I want to create a training simulator that involves user input.


^Goldenslot^

Re: Interactive Simulation

Basically I want to create a training simulator that involves user input.


^Goldenslot^

Re: Interactive Simulation

Hello phallyka

If you want to access and modify Modelica simulation "on the fly" you can use a sockets connection.
There is a sample out there. I can help you to search it if it is interesting for you.

Best regards
Koldo

Re: Interactive Simulation

Hi Koldo
That would be of great interest to me. I would like to see the example.

Many thanks

Peter

There are 0 guests and 0 other users also viewing this topic