WOLFRAM SYSTEMMODELER

Initialization

Initialization

Wolfram Language

In[1]:=
SystemModel["Modelica.Media.UsersGuide.MediumUsage.Initialization"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

When a medium model is used in a balance volume, differential equations for the independent medium variables are present and therefore initial conditions have to be provided. The following possibilities exist:

Steady state initialization

Modelica has currently no language element to define steady state initialization. In the Modelica simulation environment Dymola, the option

   Advanced.DefaultSteadyStateInitialization = true

can be set before translation. Then, missing initial conditions are provided by automatically setting appropriate state derivatives to zero.

Explicit start values or initial equations

Explicit start values can be defined with the "start" and "fixed" attributes. The number of independent variables nx need to be known which can be deduced from the medium constants (nx = nXi + if singleState then 1 else 2). Then, start values or initial equations can be defined for nx variables (= p, T, d, u, h, Xi) from Medium.BaseProperties, e.g., in the form:

     replaceable package Medium = Medium.Interfaces.PartialMedium;
     Medium.BaseProperties medium1 (p(start=1e5, fixed=not Medium.singleState),
                                    T(start=300, fixed=true));
     Medium.BaseProperties medium2;
  initial equation
     if not Medium.singleState then
        medium2.p = 1e5;
     end if;
     medium2.T = 300;
  equation
  

If initial conditions are not provided for the independent medium variables, non-linear systems of equations may occur to compute the initial values of the independent medium variables from the provided initial conditions.

Guess values

If non-linear systems of equations occur during initialization, e.g., in case of steady state initialization, guess values for the iteration variables of the non-linear system of equations have to be provided via the "start" attribute (and fixed=false). Unfortunately, it is usually not known in advance which variables are selected as iteration variables of a non-linear system of equations. One of the following possibilities exist:

  • Do not supply start values and hope that the medium specific types have meaningful start values, such as in "Medium.AbsolutePressure"
  • Supply start values on all variables of the BaseProperties model, i.e., on p, T, d, u, h, Xi.
  • Determine the iteration variables of the non-linear systems of equations and provide start values for these variables. In the Modelica simulation environment Dymola, the iteration variables can be determined by setting the command Advanced.OutputModelicaCode = true and by inspection of the file "dsmodel.mof" that is generated when this option is set (search for "nonlinear").