I have modelled a dynamic Rankine cycle on Dymola 2022 using the ThermoSysPro library. Since I want to be able to start the simulations from any given state, I made sure to output all the states' values. Then using parameters, I set the initial value of each state. For instance, for a pressure:
parameter Modelica.Units.SI.Pressure P0 = 10e5 "Initial pressure";
Modelica.Units.SI.Pressure P(start=P0, fixed=true) "Pressure";
or
parameter Modelica.Units.SI.Pressure P0 = 10e5 "Initial pressure";
Modelica.Units.SI.Pressure P "Pressure";
initial equation
P = P0;
(By the way, is there a difference between these two definitions?)
Doing this for all my states, I can retrieve the states' values at the end of a simulation and modify my initialisation parameters accordingly. Starting a new simulation from this new point works like a charm.
Next step is to export this model as FMU in order to interact with a control & monitoring model. So the export is performed with cosimulation FMI 2.0 using Dymola solvers (DASSL in particular). Then I load the FMU in Dymola, apply the same commands as the non-FMU model, with the default initial parameters. The simulation has no issue starting and gives identical results.
Then, that's where it gets tricky, I am unable to start the simulation from any other state, unless the parameters are close from the default ones. When I set initial parameters to a completely different operating point, the initialisation algorithm starts with nil values for pressures or enthalpies in vapour properties functions, which causes the initialisation to miserably fail.
So far, I have tried to prevent the vapour properties functions from using nil values, using minimum values, I also provided much more start values (guess values), but that is both time consuming and inelegant.
I would expect the initialisation process to behave the same way it does for the non-FMU model. If necessary, I could try to code a minimal non-working example, but without guarantee.