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 to set simulation parameters.

How to set simulation parameters.

Hi,all.
Now I try to simulate Modelica models from shell script.
I have a question about simulation parameter settings.

In variable step simulation, generally we can set parameter called "number of iteration" in some simulation tools but in Open Modelica we can not set this parameter from GUI.
Also in fixed step size simulation, generally we can set parameter called "(fixed) step size" in some simulation tools but in Open Modelica we can not set this parameter.

These parameters("number of iteration" and "(fixed) step size") are needed to simulate in Open Modelica so I think these parameters are settled in some files but I can not find in which files these parameters are settled.

If you know how to change these parameters from shell script or in which files these parameters are settled, would you teach us?
(I have already checked web site about scripting(https://build.openmodelica.org/Document … ting.html) but I can not find.)

Re: How to set simulation parameters.

Code:

simulate(ModelName, startTime = 0, stopTime = 3, numberOfIntervals=1000);

If a fixed-step solver is used, the number of intervals will be used. For variable-step solvers, it is a recommendation for output points.

Re: How to set simulation parameters.

Thank you for your reply.
Do you mean that "output points" can be used as "(maximum) number of iteration" for variable-step solvers?

Re: How to set simulation parameters.

No, those solvers always choose when and how they iterate. It is merely the points you ask to get an output point in the result file (it will usually be interpolated or extrapolated).

Re: How to set simulation parameters.

Thanks.
Do you mean that solvers always choose when and how they iterate automatically so users can not set when and how they iterate ?

Re: How to set simulation parameters.

Pretty much, yes

Re: How to set simulation parameters.

sjoelund.se wrote:

No, those solvers always choose when and how they iterate. It is merely the points you ask to get an output point in the result file (it will usually be interpolated or extrapolated).

It seems strange to me that the user has to specify the number of output points.

I just tried to simulate a very simple model (sine wave voltage source in series with a resistor) with a variable time step solver (dassl), an appropriate tolerance (1e-6) and specified in the number of intervals 2 output points as  and the result file actually shows two output points. The results are clearly not as one would expect (due to data reduction?), so the only option the user has is to choose the number of intervals in a conservative manner.
In case the number of intervals is chosen very high, the time step is affected according to the log. To me, it seems that the user specifies in this case the maximum time step, so in case of a high number of intervals a fixed time step is more or less created, taking away the benefits of a variable time step solver.

Is the output file really reduced in case of a low value in number of intervals?
Would it be possible to let the solver decide the number of output points as well?

Re: How to set simulation parameters.

hideishi wrote:

Thanks.
Do you mean that solvers always choose when and how they iterate automatically so users can not set when and how they iterate ?

This is true for solvers with a (more or less advanced) step size control as our Default one DASSL. There are also solver with a fix step size available (e.g. radau1, radau3, radau5, lobatto2, lobatto4 or lobatto6).

Re: How to set simulation parameters.

lochel wrote:

hideishi wrote:

Thanks.
Do you mean that solvers always choose when and how they iterate automatically so users can not set when and how they iterate ?

This is true for solvers with a (more or less advanced) step size control as our Default one DASSL. There are also solver with a fix step size available (e.g. radau1, radau3, radau5, lobatto2, lobatto4 or lobatto6).

In case of the DASSL solver, would it be possible to let DASSL decide the output points in the output file as well (since I assume this is now set by the user with number of intervals)?

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