You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to save and restore the history associated with the delay function so that the simulation of a model can be properly restored from a snapshot?
It would be really interesting to have this capability in pharmacometric and biosystems models, where the delay is widely used to calculate half-life, area under the curve, and other standard indices that support prescription optimization and genomic and personalized precision medicine.
Its implementation on openModelica will add a new issue where OM overcomes other object oriented Modeling and Simulation development environments like EcosimPro :)
I think this is not (only) a tool issue, but also involves at least two issues that are worth discussing here.
Issue 1: initial values for the delay() operator
The spatialDistribution() operator allows to specify the initial content of buffer that stores the internal state of the operator, so a tool could re-use this feature to initialize it with the result of a previous simulation.
Unfortunately, the delay() operator specification has no such provision, as it explicitly states:
Evaluates to 𝑒𝑥𝑝𝑟(time - 𝑑𝑒𝑙𝑎𝑦𝑇𝑖𝑚𝑒) for 𝚝𝚒𝚖𝚎>𝚝𝚒𝚖𝚎.𝚜𝚝𝚊𝚛𝚝+𝑑𝑒𝑙𝑎𝑦𝑇𝑖𝑚𝑒 and 𝑒𝑥𝑝𝑟(time.start) for 𝚝𝚒𝚖𝚎≤𝚝𝚒𝚖𝚎.𝚜𝚝𝚊𝚛𝚝+𝑑𝑒𝑙𝑎𝑦𝑇𝑖𝑚𝑒.
Should we add some additional optional argument to allow intializing the delay buffer memory as well? Of course we should retain the current behaviour when they are not specified. For example, we could add:
I think it would be best to use a relative time axis which is relative to the start time value, to make the operator behaviour more portable in case one want to start from a different point in time while retaining the same content of the delay buffer.
This would also come with the nice side effect that one could initialize models involving delay() in non-trivial initial conditions, e.g. a periodic steady-state.
Issue 2: how to write down these results in a result file
We should probably agree on a standardized way to represent these data in CSV files, so that they can be re-imported to continue a simulation.
The text was updated successfully, but these errors were encountered:
I agree with @casella on the importance of making the operator portable to allow starting from a different point in time, as this could be a valuable feature when restoring a "snapshot".
I have no knowledge of the implementation of the delay() operator, although I feel that to avoid the hassle of changing the delayTime (if it is a parameter, page 24 in MLS3.6), the use of the optional third argument, delayMax, including the annotation (Evaluate = true) could be required to manage the init values of delay().
For resuming simulations there are a number of issues:
In practice we need to modify models, in order to ignore initial equations and some start-values (in some cases that can be done by modifiers but start-values may be final or in protected components, and there is no standardized way to disable initial equations). In practice we have found that this is a major obstacle. Tools such as Dymola can, of course, continue a simulation - but that is tool-specific and doesn't allow resuming it in a more general setting.
Then there are these extra states - but compared to the above they are less problematic:
Synchronous models would need special care for setting ticks in state etc.
And then delay/spatialDistribution
...
If we just focus on tool-specific ways of resuming a simulation the blocker in the language is the lack of external object save/restore. And if we add that one could imagine that delay reuses on such a definition, i.e., each delay call is treated as an external object with a specified save/restore function.
In this discussion post for OpenModelica, @mpradovelasco asks:
I think this is not (only) a tool issue, but also involves at least two issues that are worth discussing here.
Issue 1: initial values for the delay() operator
The spatialDistribution() operator allows to specify the initial content of buffer that stores the internal state of the operator, so a tool could re-use this feature to initialize it with the result of a previous simulation.
Unfortunately, the delay() operator specification has no such provision, as it explicitly states:
Should we add some additional optional argument to allow intializing the delay buffer memory as well? Of course we should retain the current behaviour when they are not specified. For example, we could add:
I think it would be best to use a relative time axis which is relative to the start time value, to make the operator behaviour more portable in case one want to start from a different point in time while retaining the same content of the delay buffer.
This would also come with the nice side effect that one could initialize models involving
delay()
in non-trivial initial conditions, e.g. a periodic steady-state.Issue 2: how to write down these results in a result file
We should probably agree on a standardized way to represent these data in CSV files, so that they can be re-imported to continue a simulation.
The text was updated successfully, but these errors were encountered: