Opened 4 years ago

Last modified 3 years ago

#6039 new enhancement

Allow to change parameters before resimulating when -iif is used to import start values

Reported by: Francesco Casella Owned by: Andreas Heuermann
Priority: blocker Milestone: 1.19.0
Component: Run-time Version:
Keywords: Cc: Adeel Asghar, Karim Adbdelhak, Andrea Bartolini, massimo ceraolo, daniel.bouskela@…, tobias.krenz@…, Lennart Ochel

Description

The -iif flag allows to import start values for parameters and variables from the results of previous simulations. These can be used to ensure the convergence of the initialization equations, or possibly be used directly to start the simulation, if -iim=none is also set.

These flags can be set in OMEdit from the Simulation Setup window, Simulation Flags, Equation System Initialization File/Time.

As far as I understand, when the simulation executable is run, it first reads in the start values from the _init.xml file, and then it overwrites whatever values are found in the -iif file before starting the simulation. @AnHeuermann, please correct me if I'm wrong here.

Unfortunately, this means that it is not possible to import all the start values and parameters of a previous simulation, change some parameter values in the Variables Browser, and then restart a simulation that will produce results different from the imported simulation, because the the changed parameter values will end up in the _init.xml file and will be overriden by the imported values. As a matter of fact, this makes the whole -iif/-iim thing not very useful in practice, if used from OMEdit, because it only allow to re-run an existing simulation, possibly only changing the solver or the solver parameters.

We need to find a way to make this possible, in an easy and intuitive way.

The most natural idea that comes to my mind is to have another runtime option, say -iis, which selects what start values should actually be imported from the file when the -iif option is activated. Possible values:

  • -iis=all (default) import everything, as it happens today
  • -iis=nostates import everything, except start values of state variables
  • -iis=noparams import everything, except start values of fixed = true parameters
  • -iis=nostatesnoparams combines the two previous options

Adding this option to the Simulation Setup | Translation Flag window will solve this issue, enabling a wide range of interesting use cases, without the need of further work in OMEdit. In particular, it will make possible to change parameters and/or initial state values before resimulating.

The -iis=noparams option should only affect fixed = true parameters, which are the ones that can be changed from the Variables Browser before resimulating. fixed = false parameters are determined by initial equations, so I think it makes more sense to keep the imported start values for them, to avoid convergence problems.

The only shortcoming I see of this solution is that the -iis flag will apply broadly to the entire set of parameters/initial states. This means, it won't be possible, e.g., to import all the parameter and initial states from the file except some, that may be changed before resimulating.

It would be nice if we could actually do that, but I'm afraid this can't be done easily with the current OMEdit workflow, which is based on the GUI updating the _init.xml file, which is always read before -iif is applied. Any suggestion about how to overcome this limitation in a simple way would be welcome, I have no idea how to do that.

Change History (5)

comment:1 by Karim Adbdelhak, 4 years ago

Is this the same as -overrideFile? And if not, what is the difference?

I am not quite sure if this is easy to realize as is... parameters should be easy, but i don't know about the states. I don't know if that information actually is easy accessible.

Also: What about discrete values?

in reply to:  1 comment:2 by Francesco Casella, 4 years ago

Cc: Lennart Ochel added

Replying to Karim.Abdelhak:

Is this the same as -overrideFile? And if not, what is the difference?

I was not aware of that flag, they're simply too many :)

I looked up the documentation, from what I understand -override overrides files read from the .xml file. I'm not sure if -iff then overrides the whole thing afterwards or not. Maybe I could experiment a bit with the test case in #5824, or you could do that.

I am not quite sure if this is easy to realize as is... parameters should be easy

I think parameters are the most important feature, otherwise you can't really change the simulation outcome. Since OMEdit allows you to also change initial state values, I thought it would be nice to support that as well for consistency, but it's not that important.

Also: What about discrete values?

I guess they should be handled the same way as continuous ones. If they are states (i.e., pre() is applied to them) and we allow changing initial values of continuous states, it would be nice to also allow changing the initial values of discrete states. I'm not sure if OMEdit supports that, I'm not much into discrete modelling. Maybe Lennart can comment on that.

comment:3 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Rescheduled to 1.18.0

comment:4 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

comment:5 by Francesco Casella, 3 years ago

Milestone: 1.19.0

1.18.0 blocker tickets moved to 1.19.0

Note: See TracTickets for help on using tickets.