Following issues have been observed that is related to the Modelica specification:

**Inconvenient to calculate parameters**

Currently it is inconvenient to use a model or block based structure to calculate parameters as illustrated below. It would be more user friendly if a model or block could be used in a similar way as a function to calculate parameters.

parameter SpecificEnthalpy h_start (fixed=false) annotation(Evaluate=true);
SpecificEnthalpy h(start=h_start);
Medium.MultiPhaseProperties
flash_init(Z=Z_start,p=p_start,T=T_start,
presentPhases=presentPhases,
presentPhasesStatus=presentPhasesStatus,
init(p=p_start, x=fill(Z_start, Medium.nP)),
inputs=MultiPhaseMixture.Interfaces.Inputs.pTX)
initial equation
h_start=flash.h;

#### Solver callback interface

The external interface ExternalMixtureMedia has been designed with a structure that supports caching. The idea is to cache result from a calculation and use it as start values in a next coming calculation to decrease the number of internal iterations and increase robustness. A problem with this approach is that it is not possible to distinguish a function call during normal continuous simulation from one where the steady-state solver desperately tries to find a solution.

During continous simulation a good strategy would be to use values from the last accepted step. For the steady-state case it might be an idea to let the non-linear solver update the starting values of the iteration variables hidden in these algorithms, when the solver makes good progress.

A solution would be to have the possibility to register a solver callback interface, which could be used to update iteration start values in a controlled way.

##### A suggestion

• onSolverAcceptedStep() - called by solver/simulation environment when an accepted step has occurred. Place to implement updates of iteration start variables.

• onSolverSteadyStateProgress() - called by solver/simulation environment when progress in steady-state solver. Place to update iteration start values variables.

Advantages with introducing callback methods are that the iteration start values can be updated in a controlled way and thereby avoiding the risk of an update during a bad steady-state iteration step.

Generated at 2024-06-18T18:16:02Z
by OpenModelicaOpenModelica 1.22.4 using GenerateDoc.mos