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

Querying current step size

Querying current step size

Hi guys,

Is there a way to query the step size details from Modelica Solver during the simulation?
I am using some external DLLs for implementing some functionalities in Modelica and that requires the current step size of the simulation.

There are other queries required as well, for ex. unit details and step mode (converged, predictor or corrector step), but finding the current step size is the most important for now.

Thanks in advance.

Regards,
Pranay Kumar

Re: Querying current step size

There is no step size in a variable-step solver. Modelica intentionally does not allow you to query this information because you don't even know if the simulation will rely on the concept of time (e.g. using QSS).

If you must know step sizes, export as FMI for Model Exchange and implement the solver yourself.

If you don't want to be portable, write an external C-function and #include the necessary headers from the OpenModelica simulation runtime and start querying the internal state for information. You'll need to implement this differently for each numerical solver you want to access the internals for since most of this information is not used by OpenModelica. You won't know the "current" step size until it's done though; you can probably access the previous step at best since external functions must always give the same output regardless of input (except during discrete events, but at discrete events there is no step size since time does not progress).

Edited by: sjoelund.se - May-27-20 07:17:41
There are 0 guests and 0 other users also viewing this topic