Dymola Initialization failed

58 Views Asked by At

I'm trying to use the importInitialResult command to set initial values from old results. After doing this, I press the simulate button and receive the following error:

The boundary mass fractions in medium "AirNOW" in model "FixedBoundary"
do not sum up to 1. Instead, sum(X_boundary) = 1:
   X_boundary[1] = 0.005 "H2O"
   X_boundary[2] = 0.23 "O2"
   X_boundary[3] = 0.765 "N2"

it does not make sensse since 0.005 + 0.23 + 0.765 equal 1. I cound not figure out why i get this eror and how to make it correct.

1

There are 1 best solutions below

2
Hans Olsson On

It is difficult to fully answer this without the full model, but the error message and using importInitialResult suggests one explanation:

  • The sum seems to be 1 and the error message indicates that as well.
  • The simplest explanation is thus that the sum is almost but not quite 1

It should be possible to avoid this by any of the following:

  • Store the result (that you import with importInitialResult`) in double precision, Simulation>Setup>Output>Format>Double precision
  • Use a less strict check for 1 in AirNOW-model
  • Use some of the reduced-states-variants where you don't specify the last element of X_boundary but instead compute it as 1-sum(X_boundary[1:..])

Added:

Without the example model I tried importInitialResult for Modelica.Fluid.Examples.TraceSubstances.RoomCO2:

  • Without double precision it failed with the same error message as in the question
  • With double precision, but not storing protected variables it sometimes failed with index out of bounds for traceVolume.CVec[traceVolume.ind] - that is somewhat specific for this example; but in general protected variables can be a problem.
  • Storing double precision and protected variables it worked

Note that those changes must be done before the first simulation, so that importInitialResult reads from such a result file. The GUI for importInitialResult will show warnings if the result file doesn't contain all variables in double precision.