Skip to content

Failed

tests / 06 testsuite-clang 3/3 / openmodelica_interactive-API.Obfuscation2.mos (from (result.xml))

Failing for the past 2 builds (Since #1 )
Took 3 sec.

Stacktrace

Output mismatch (see stdout for details)

Standard Output

 + Obfuscation2                                                                      ... equation mismatch [time: 3]

==== Log /tmp/omc-rtest-omtmpuser/openmodelica/interactive-API/Obfuscation2.mos_temp8096/log-Obfuscation2.mos
true
true
""
"function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX \"Return temperature as a function of pressure p, specific enthalpy h and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) \"Mass fractions of composition\";
  output Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
algorithm
  T := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.solve(h, 190.0, 647.0, p, X[1:1], Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), 1e-13);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear
  input Real x \"Independent variable of function\";
  input Real p = 0.0 \"Disregarded variables (here always used for pressure)\";
  input Real[:] X = {} \"Disregarded variables (her always used for composition)\";
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear_Data f_nonlinear_data \"Additional data for the function\";
  output Real y \"= f_nonlinear(x)\";
algorithm
  y := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX(p, x, X);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear_Data \"Automatically generated record constructor for Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear_Data\"
  input String name;
  input Real MM;
  input Real Hf;
  input Real H0;
  input Real Tlimit;
  input Real[7] alow;
  input Real[2] blow;
  input Real[7] ahigh;
  input Real[2] bhigh;
  input Real R;
  output f_nonlinear_Data res;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear_Data;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.solve
  input Real y_zero \"Determine x_zero, such that f_nonlinear(x_zero) = y_zero\";
  input Real x_min \"Minimum value of x\";
  input Real x_max \"Maximum value of x\";
  input Real pressure = 0.0 \"Disregarded variables (here always used for pressure)\";
  input Real[:] X = {} \"Disregarded variables (here always used for composition)\";
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear_Data f_nonlinear_data \"Additional data for function f_nonlinear\";
  input Real x_tol = 1e-13 \"Relative tolerance of the result\";
  output Real x_zero \"f_nonlinear(x_zero) = y_zero\";
  protected constant Real eps = 1e-15 \"Machine epsilon\";
  protected constant Real x_eps = 1e-10 \"Slight modification of x_min, x_max, since x_min, x_max are usually exactly at the borders T_min/h_min and then small numeric noise may make the interval invalid\";
  protected Real c \"Intermediate point a <= c <= b\";
  protected Real d;
  protected Real e \"b - a\";
  protected Real m;
  protected Real s;
  protected Real p;
  protected Real q;
  protected Real r;
  protected Real tol;
  protected Real fa \"= f_nonlinear(a) - y_zero\";
  protected Real fb \"= f_nonlinear(b) - y_zero\";
  protected Real fc;
  protected Boolean found = false;
  protected Real x_min2 = x_min - x_eps;
  protected Real x_max2 = x_max + x_eps;
  protected Real a = x_min2 \"Current best minimum interval value\";
  protected Real b = x_max2 \"Current best maximum interval value\";
algorithm
  fa := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear(x_min2, pressure, X, f_nonlinear_data) - y_zero;
  fb := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear(x_max2, pressure, X, f_nonlinear_data) - y_zero;
  fc := fb;
  if fa > 0.0 and fb > 0.0 or fa < 0.0 and fb < 0.0 then
    Modelica.Utilities.Streams.error(\"The arguments x_min and x_max to OneNonLinearEquation.solve(..)
    do not bracket the root of the single non-linear equation:
      x_min  = \" + String(x_min2, 6, 0, true) + \"
    \" + \"  x_max  = \" + String(x_max2, 6, 0, true) + \"
    \" + \"  y_zero = \" + String(y_zero, 6, 0, true) + \"
    \" + \"  fa = f(x_min) - y_zero = \" + String(fa, 6, 0, true) + \"
    \" + \"  fb = f(x_max) - y_zero = \" + String(fb, 6, 0, true) + \"
    \" + \"fa and fb must have opposite sign which is not the case\");
  end if;
  c := a;
  fc := fa;
  e := b - a;
  d := e;
  while not found loop
    if abs(fc) < abs(fb) then
      a := b;
      b := c;
      c := a;
      fa := fb;
      fb := fc;
      fc := fa;
    end if;
    tol := 2.0 * eps * abs(b) + x_tol;
    m := (c - b) / 2.0;
    if abs(m) <= tol or fb == 0.0 then
      found := true;
      x_zero := b;
    else
      if abs(e) < tol or abs(fa) <= abs(fb) then
        e := m;
        d := e;
      else
        s := fb / fa;
        if a == c then
          p := 2.0 * m * s;
          q := 1.0 - s;
        else
          q := fa / fc;
          r := fb / fc;
          p := s * (2.0 * m * q * (q - r) - (b - a) * (r - 1.0));
          q := (q - 1.0) * (r - 1.0) * (s - 1.0);
        end if;
        if p > 0.0 then
          q := -q;
        else
          p := -p;
        end if;
        s := e;
        e := d;
        if 2.0 * p < 3.0 * m * q - abs(tol * q) and p < abs(0.5 * s * q) then
          d := p / q;
        else
          e := m;
          d := e;
        end if;
      end if;
      a := b;
      fa := fb;
      b := b + (if abs(d) > tol then d else if m > 0.0 then tol else -tol);
      fb := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.f_nonlinear(b, pressure, X, f_nonlinear_data) - y_zero;
      if fb > 0.0 and fc > 0.0 or fb < 0.0 and fc < 0.0 then
        c := a;
        fc := fa;
        e := b - a;
        d := e;
      end if;
    end if;
  end while;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX.Internal.solve;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState \"Automatically generated record constructor for Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState\"
  input Real p;
  input Real T;
  input Real[2] X;
  output ThermodynamicState res;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax
  input Real x1 \"First argument of smooth max operator\";
  input Real x2 \"Second argument of smooth max operator\";
  input Real dx \"Approximate difference between x1 and x2, below which regularization starts\";
  output Real y \"Result of smooth max operator\";
algorithm
  y := max(x1, x2) + log(exp(4.0 / dx * (x1 - max(x1, x2))) + exp(4.0 / dx * (x2 - max(x1, x2)))) / (4.0 / dx);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax_der
  input Real x1 \"First argument of smooth max operator\";
  input Real x2 \"Second argument of smooth max operator\";
  input Real dx \"Approximate difference between x1 and x2, below which regularization starts\";
  input Real dx1;
  input Real dx2;
  input Real ddx;
  output Real dy \"Derivative of smooth max operator\";
algorithm
  dy := (if x1 > x2 then dx1 else dx2) + 0.25 * (((4.0 * (dx1 - (if x1 > x2 then dx1 else dx2)) / dx - 4.0 * (x1 - max(x1, x2)) * ddx / dx ^ 2.0) * exp(4.0 * (x1 - max(x1, x2)) / dx) + (4.0 * (dx2 - (if x1 > x2 then dx1 else dx2)) / dx - 4.0 * (x2 - max(x1, x2)) * ddx / dx ^ 2.0) * exp(4.0 * (x2 - max(x1, x2)) / dx)) * dx / (exp(4.0 * (x1 - max(x1, x2)) / dx) + exp(4.0 * (x2 - max(x1, x2)) / dx)) + log(exp(4.0 * (x1 - max(x1, x2)) / dx) + exp(4.0 * (x2 - max(x1, x2)) / dx)) * ddx);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction \"Spline interpolation of two functions\"
  input Real pos \"Returned value for x-deltax >= 0\";
  input Real neg \"Returned value for x+deltax <= 0\";
  input Real x \"Function argument\";
  input Real deltax = 1.0 \"Region around x with spline interpolation\";
  output Real out;
  protected Real scaledX;
  protected Real scaledX1;
  protected Real y;
algorithm
  scaledX1 := x / deltax;
  scaledX := scaledX1 * 1.5707963267948966;
  if scaledX1 <= -0.999999999 then
    y := 0.0;
  elseif scaledX1 >= 0.999999999 then
    y := 1.0;
  else
    y := (tanh(tan(scaledX)) + 1.0) / 2.0;
  end if;
  out := pos * y + (1.0 - y) * neg;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction_der \"Derivative of spliceFunction\"
  input Real pos;
  input Real neg;
  input Real x;
  input Real deltax = 1.0;
  input Real dpos;
  input Real dneg;
  input Real dx;
  input Real ddeltax = 0.0;
  output Real out;
  protected Real scaledX;
  protected Real scaledX1;
  protected Real dscaledX1;
  protected Real y;
algorithm
  scaledX1 := x / deltax;
  scaledX := scaledX1 * 1.5707963267948966;
  dscaledX1 := (dx - scaledX1 * ddeltax) / deltax;
  if scaledX1 <= -0.99999999999 then
    y := 0.0;
  elseif scaledX1 >= 0.9999999999 then
    y := 1.0;
  else
    y := (tanh(tan(scaledX)) + 1.0) / 2.0;
  end if;
  out := dpos * y + (1.0 - y) * dneg;
  if abs(scaledX1) < 1.0 then
    out := out + (pos - neg) * dscaledX1 * 1.5707963267948966 / 2.0 / (cosh(tan(scaledX)) * cos(scaledX)) ^ 2.0;
  end if;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater \"Computes specific enthalpy of water (solid/liquid) near atmospheric pressure from temperature T\"
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\") \"Specific enthalpy of water\";
algorithm
  h := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction(4200.0 * (T - 273.15), 2050.0 * (T - 273.15) - 333000.0, T - 273.16, 0.1);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater_der \"Derivative function of enthalpyOfWater\"
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real dT(unit = \"K/s\") \"Time derivative of temperature\";
  output Real dh(unit = \"J/(kg.s)\") \"Time derivative of specific enthalpy\";
algorithm
  dh := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction_der(4200.0 * (T - 273.15), 2050.0 * (T - 273.15) - 333000.0, T - 273.16, 0.1, 4200.0 * dT, 2050.0 * dT, dT, 0.0);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX \"Return specific enthalpy of moist air as a function of pressure p, temperature T and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\") \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"1\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1))) \"Mass fractions of moist air\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\") \"Specific enthalpy at p, T, X\";
  protected Real p_steam_sat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) \"partial saturation pressure of steam\";
  protected Real X_sat(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Absolute humidity per unit mass of moist air\";
  protected Real X_liquid(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of liquid water\";
  protected Real X_steam(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of steam water\";
  protected Real X_air(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of air\";
algorithm
  p_steam_sat := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure(T);
  X_sat := min(p_steam_sat * 0.6219647130774989 / max(1e-13, p - p_steam_sat) * (1.0 - X[1]), 1.0);
  X_liquid := max(X[1] - X_sat, 0.0);
  X_steam := X[1] - X_liquid;
  X_air := 1.0 - X[1];
  h := Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 2.547494319e6) * X_steam + Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"Air\", 0.0289651159, -4333.833858403446, 298609.6803431054, 1000.0, {10099.5016, -196.827561, 5.00915511, -0.00576101373, 1.06685993e-5, -7.94029797e-9, 2.18523191e-12}, {-176.796731, -3.921504225}, {241521.443, -1257.8746, 5.14455867, -2.13854179e-4, 7.06522784e-8, -1.07148349e-11, 6.57780015e-16}, {6462.26319, -8.147411905}, 287.0512249529787), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 25104.684) * X_air + Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater(T) * X_liquid;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX_der \"Derivative function of h_pTX\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\") \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"1\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1))) \"Mass fractions of moist air\";
  input Real dp(unit = \"Pa/s\") \"Pressure derivative\";
  input Real dT(unit = \"K/s\") \"Temperature derivative\";
  input Real[:] dX(unit = \"1/s\") \"Composition derivative\";
  output Real h_der(unit = \"J/(kg.s)\") \"Time derivative of specific enthalpy\";
  protected Real p_steam_sat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) \"partial saturation pressure of steam\";
  protected Real X_sat(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Absolute humidity per unit mass of moist air\";
  protected Real X_liquid(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of liquid water\";
  protected Real X_steam(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of steam water\";
  protected Real X_air(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of air\";
  protected Real x_sat(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Absolute humidity per unit mass of dry air at saturation\";
  protected Real dX_steam(unit = \"1/s\") \"Time derivative of steam mass fraction\";
  protected Real dX_air(unit = \"1/s\") \"Time derivative of dry air mass fraction\";
  protected Real dX_liq(unit = \"1/s\") \"Time derivative of liquid/solid water mass fraction\";
  protected Real dps(unit = \"Pa/s\") \"Time derivative of saturation pressure\";
  protected Real dx_sat(unit = \"1/s\") \"Time derivative of absolute humidity per unit mass of dry air\";
algorithm
  p_steam_sat := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure(T);
  x_sat := p_steam_sat * 0.6219647130774989 / max(1e-13, p - p_steam_sat);
  X_sat := min(x_sat * (1.0 - X[1]), 1.0);
  X_liquid := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax(X[1] - X_sat, 0.0, 1e-5);
  X_steam := X[1] - X_liquid;
  X_air := 1.0 - X[1];
  dX_air := -dX[1];
  dps := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure_der(T, dT);
  dx_sat := 0.6219647130774989 * (dps * (p - p_steam_sat) - p_steam_sat * (dp - dps)) / (p - p_steam_sat) / (p - p_steam_sat);
  dX_liq := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.smoothMax_der(X[1] - X_sat, 0.0, 1e-5, (1.0 + x_sat) * dX[1] - (1.0 - X[1]) * dx_sat, 0.0, 0.0);
  dX_steam := dX[1] - dX_liq;
  h_der := X_steam * Modelica.Media.IdealGases.Common.Functions.h_Tlow_der(Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 2.547494319e6, dT) + dX_steam * Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 2.547494319e6) + X_air * Modelica.Media.IdealGases.Common.Functions.h_Tlow_der(Modelica.Media.IdealGases.Common.DataRecord(\"Air\", 0.0289651159, -4333.833858403446, 298609.6803431054, 1000.0, {10099.5016, -196.827561, 5.00915511, -0.00576101373, 1.06685993e-5, -7.94029797e-9, 2.18523191e-12}, {-176.796731, -3.921504225}, {241521.443, -1257.8746, 5.14455867, -2.13854179e-4, 7.06522784e-8, -1.07148349e-11, 6.57780015e-16}, {6462.26319, -8.147411905}, 287.0512249529787), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 25104.684, dT) + dX_air * Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"Air\", 0.0289651159, -4333.833858403446, 298609.6803431054, 1000.0, {10099.5016, -196.827561, 5.00915511, -0.00576101373, 1.06685993e-5, -7.94029797e-9, 2.18523191e-12}, {-176.796731, -3.921504225}, {241521.443, -1257.8746, 5.14455867, -2.13854179e-4, 7.06522784e-8, -1.07148349e-11, 6.57780015e-16}, {6462.26319, -8.147411905}, 287.0512249529787), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 25104.684) + X_liquid * Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater_der(T, dT) + dX_liq * Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.enthalpyOfWater(T);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure \"Return saturation pressure of water as a function of temperature T between 190 and 647.096 K\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Saturation temperature\";
  output Real psat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Saturation pressure\";
algorithm
  psat := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction(Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid(Tsat), Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce(Tsat), Tsat - 273.16, 1.0);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid \"Return saturation pressure of water as a function of temperature T in the range of 273.16 to 647.096 K\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Saturation temperature\";
  output Real psat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) \"Saturation pressure\";
  protected Real Tcritical(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = 647.096 \"Critical temperature\";
  protected Real pcritical(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) = 2.2064e7 \"Critical pressure\";
  protected Real[:] a = {-7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502} \"Coefficients a[:]\";
  protected Real[:] n = {1.0, 1.5, 3.0, 3.5, 4.0, 7.5} \"Coefficients n[:]\";
  protected Real r1 = 1.0 - Tsat / Tcritical \"Common subexpression\";
algorithm
  psat := exp((a[1] * r1 ^ n[1] + a[2] * r1 ^ n[2] + a[3] * r1 ^ n[3] + a[4] * r1 ^ n[4] + a[5] * r1 ^ n[5] + a[6] * r1 ^ n[6]) * Tcritical / Tsat) * pcritical;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid_der \"Derivative function for 'saturationPressureLiquid'\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Saturation temperature\";
  input Real dTsat(unit = \"K/s\") \"Saturation temperature derivative\";
  output Real psat_der(unit = \"Pa/s\") \"Saturation pressure derivative\";
  protected Real Tcritical(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = 647.096 \"Critical temperature\";
  protected Real pcritical(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) = 2.2064e7 \"Critical pressure\";
  protected Real[:] a = {-7.85951783, 1.84408259, -11.7866497, 22.6807411, -15.9618719, 1.80122502} \"Coefficients a[:]\";
  protected Real[:] n = {1.0, 1.5, 3.0, 3.5, 4.0, 7.5} \"Coefficients n[:]\";
  protected Real r1 = 1.0 - Tsat / Tcritical \"Common subexpression 1\";
  protected Real r1_der = -1.0 / Tcritical * dTsat \"Derivative of common subexpression 1\";
  protected Real r2 = a[1] * r1 ^ n[1] + a[2] * r1 ^ n[2] + a[3] * r1 ^ n[3] + a[4] * r1 ^ n[4] + a[5] * r1 ^ n[5] + a[6] * r1 ^ n[6] \"Common subexpression 2\";
algorithm
  psat_der := exp(r2 * Tcritical / Tsat) * pcritical * ((a[1] * r1 ^ (n[1] - 1.0) * n[1] * r1_der + a[2] * r1 ^ (n[2] - 1.0) * n[2] * r1_der + a[3] * r1 ^ (n[3] - 1.0) * n[3] * r1_der + a[4] * r1 ^ (n[4] - 1.0) * n[4] * r1_der + a[5] * r1 ^ (n[5] - 1.0) * n[5] * r1_der + a[6] * r1 ^ (n[6] - 1.0) * n[6] * r1_der) * Tcritical / Tsat - r2 * Tcritical * dTsat / Tsat ^ 2.0);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure_der \"Derivative function for 'saturationPressure'\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Saturation temperature\";
  input Real dTsat(unit = \"K/s\") \"Time derivative of saturation temperature\";
  output Real psat_der(unit = \"Pa/s\") \"Saturation pressure\";
algorithm
  psat_der := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.Utilities.spliceFunction_der(Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid(Tsat), Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce(Tsat), Tsat - 273.16, 1.0, Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressureLiquid_der(Tsat, dTsat), Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce_der(Tsat, dTsat), dTsat, 0.0);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.saturationPressure_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_pTX \"Return thermodynamic state as function of pressure p, temperature T and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) = {0.01, 0.99} \"Mass fractions\";
  output Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState state \"Thermodynamic state\";
algorithm
  state := if size(X, 1) == 2 then Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState(p, T, X) else Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState(p, T, cat(1, X, {1.0 - sum(X)}));
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_pTX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_phX \"Return thermodynamic state as function of pressure p, specific enthalpy h and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) = {0.01, 0.99} \"Mass fractions\";
  output Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState state \"Thermodynamic state\";
algorithm
  state := if size(X, 1) == 2 then Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState(p, Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX(p, h, X), X) else Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState(p, Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.T_phX(p, h, X), cat(1, X, {1.0 - sum(X)}));
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_phX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.specificEnthalpy \"Return specific enthalpy of moist air as a function of the thermodynamic state record\"
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState state \"Thermodynamic state record\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
algorithm
  h := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.h_pTX(state.p, state.T, state.X);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.specificEnthalpy;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.specificEnthalpy_pTX \"Return specific enthalpy from p, T, and X or Xi\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) = {0.01, 0.99} \"Mass fractions\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
algorithm
  h := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.specificEnthalpy(Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_pTX(p, T, X));
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.specificEnthalpy_pTX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce \"Return sublimation pressure of water as a function of temperature T between 190 and 273.16 K\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Sublimation temperature\";
  output Real psat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) \"Sublimation pressure\";
  protected Real Ttriple(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = 273.16 \"Triple point temperature\";
  protected Real ptriple(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) = 611.657 \"Triple point pressure\";
  protected Real[:] a = {-13.928169, 34.7078238} \"Coefficients a[:]\";
  protected Real[:] n = {-1.5, -1.25} \"Coefficients n[:]\";
  protected Real r1 = Tsat / Ttriple \"Common subexpression\";
algorithm
  psat := exp(a[1] - a[1] * r1 ^ n[1] + a[2] - a[2] * r1 ^ n[2]) * ptriple;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce_der \"Derivative function for 'sublimationPressureIce'\"
  input Real Tsat(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Sublimation temperature\";
  input Real dTsat(unit = \"K/s\") \"Sublimation temperature derivative\";
  output Real psat_der(unit = \"Pa/s\") \"Sublimation pressure derivative\";
  protected Real Ttriple(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = 273.16 \"Triple point temperature\";
  protected Real ptriple(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) = 611.657 \"Triple point pressure\";
  protected Real[:] a = {-13.928169, 34.7078238} \"Coefficients a[:]\";
  protected Real[:] n = {-1.5, -1.25} \"Coefficients n[:]\";
  protected Real r1 = Tsat / Ttriple \"Common subexpression 1\";
  protected Real r1_der = dTsat / Ttriple \"Derivative of common subexpression 1\";
algorithm
  psat_der := exp(a[1] - a[1] * r1 ^ n[1] + a[2] - a[2] * r1 ^ n[2]) * ptriple * (-(a[1] * r1 ^ (n[1] - 1.0) * n[1] * r1_der + a[2] * r1 ^ (n[2] - 1.0) * n[2] * r1_der));
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.sublimationPressureIce_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.temperature \"Return temperature of ideal gas as a function of the thermodynamic state record\"
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.ThermodynamicState state \"Thermodynamic state record\";
  output Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
algorithm
  T := state.T;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.temperature;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.temperature_phX \"Return temperature from p, h, and X or Xi\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) = {0.01, 0.99} \"Mass fractions\";
  output Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
algorithm
  T := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.temperature(Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.setState_phX(p, h, X));
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary1.Medium.temperature_phX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX \"Return temperature as a function of pressure p, specific enthalpy h and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, max = 1e8, start = 1e5, nominal = 1e5) \"Pressure\";
  input Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\", min = -1e10, max = 1e10, nominal = 1e6) \"Specific enthalpy\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"kg/kg\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1)), nominal = fill(0.1, size(X, 1))) \"Mass fractions of composition\";
  output Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 190.0, max = 647.0, start = 288.15, nominal = 300.0) \"Temperature\";
algorithm
  T := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.solve(h, 190.0, 647.0, p, X[1:1], Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), 1e-13);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear
  input Real x \"Independent variable of function\";
  input Real p = 0.0 \"Disregarded variables (here always used for pressure)\";
  input Real[:] X = {} \"Disregarded variables (her always used for composition)\";
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear_Data f_nonlinear_data \"Additional data for the function\";
  output Real y \"= f_nonlinear(x)\";
algorithm
  y := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.h_pTX(p, x, X);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear_Data \"Automatically generated record constructor for Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear_Data\"
  input String name;
  input Real MM;
  input Real Hf;
  input Real H0;
  input Real Tlimit;
  input Real[7] alow;
  input Real[2] blow;
  input Real[7] ahigh;
  input Real[2] bhigh;
  input Real R;
  output f_nonlinear_Data res;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear_Data;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.solve
  input Real y_zero \"Determine x_zero, such that f_nonlinear(x_zero) = y_zero\";
  input Real x_min \"Minimum value of x\";
  input Real x_max \"Maximum value of x\";
  input Real pressure = 0.0 \"Disregarded variables (here always used for pressure)\";
  input Real[:] X = {} \"Disregarded variables (here always used for composition)\";
  input Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear_Data f_nonlinear_data \"Additional data for function f_nonlinear\";
  input Real x_tol = 1e-13 \"Relative tolerance of the result\";
  output Real x_zero \"f_nonlinear(x_zero) = y_zero\";
  protected constant Real eps = 1e-15 \"Machine epsilon\";
  protected constant Real x_eps = 1e-10 \"Slight modification of x_min, x_max, since x_min, x_max are usually exactly at the borders T_min/h_min and then small numeric noise may make the interval invalid\";
  protected Real c \"Intermediate point a <= c <= b\";
  protected Real d;
  protected Real e \"b - a\";
  protected Real m;
  protected Real s;
  protected Real p;
  protected Real q;
  protected Real r;
  protected Real tol;
  protected Real fa \"= f_nonlinear(a) - y_zero\";
  protected Real fb \"= f_nonlinear(b) - y_zero\";
  protected Real fc;
  protected Boolean found = false;
  protected Real x_min2 = x_min - x_eps;
  protected Real x_max2 = x_max + x_eps;
  protected Real a = x_min2 \"Current best minimum interval value\";
  protected Real b = x_max2 \"Current best maximum interval value\";
algorithm
  fa := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear(x_min2, pressure, X, f_nonlinear_data) - y_zero;
  fb := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear(x_max2, pressure, X, f_nonlinear_data) - y_zero;
  fc := fb;
  if fa > 0.0 and fb > 0.0 or fa < 0.0 and fb < 0.0 then
    Modelica.Utilities.Streams.error(\"The arguments x_min and x_max to OneNonLinearEquation.solve(..)
    do not bracket the root of the single non-linear equation:
      x_min  = \" + String(x_min2, 6, 0, true) + \"
    \" + \"  x_max  = \" + String(x_max2, 6, 0, true) + \"
    \" + \"  y_zero = \" + String(y_zero, 6, 0, true) + \"
    \" + \"  fa = f(x_min) - y_zero = \" + String(fa, 6, 0, true) + \"
    \" + \"  fb = f(x_max) - y_zero = \" + String(fb, 6, 0, true) + \"
    \" + \"fa and fb must have opposite sign which is not the case\");
  end if;
  c := a;
  fc := fa;
  e := b - a;
  d := e;
  while not found loop
    if abs(fc) < abs(fb) then
      a := b;
      b := c;
      c := a;
      fa := fb;
      fb := fc;
      fc := fa;
    end if;
    tol := 2.0 * eps * abs(b) + x_tol;
    m := (c - b) / 2.0;
    if abs(m) <= tol or fb == 0.0 then
      found := true;
      x_zero := b;
    else
      if abs(e) < tol or abs(fa) <= abs(fb) then
        e := m;
        d := e;
      else
        s := fb / fa;
        if a == c then
          p := 2.0 * m * s;
          q := 1.0 - s;
        else
          q := fa / fc;
          r := fb / fc;
          p := s * (2.0 * m * q * (q - r) - (b - a) * (r - 1.0));
          q := (q - 1.0) * (r - 1.0) * (s - 1.0);
        end if;
        if p > 0.0 then
          q := -q;
        else
          p := -p;
        end if;
        s := e;
        e := d;
        if 2.0 * p < 3.0 * m * q - abs(tol * q) and p < abs(0.5 * s * q) then
          d := p / q;
        else
          e := m;
          d := e;
        end if;
      end if;
      a := b;
      fa := fb;
      b := b + (if abs(d) > tol then d else if m > 0.0 then tol else -tol);
      fb := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.f_nonlinear(b, pressure, X, f_nonlinear_data) - y_zero;
      if fb > 0.0 and fc > 0.0 or fb < 0.0 and fc < 0.0 then
        c := a;
        fc := fa;
        e := b - a;
        d := e;
      end if;
    end if;
  end while;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.T_phX.Internal.solve;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.ThermodynamicState \"Automatically generated record constructor for Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.ThermodynamicState\"
  input Real p;
  input Real T;
  input Real[2] X;
  output ThermodynamicState res;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.ThermodynamicState;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.smoothMax
  input Real x1 \"First argument of smooth max operator\";
  input Real x2 \"Second argument of smooth max operator\";
  input Real dx \"Approximate difference between x1 and x2, below which regularization starts\";
  output Real y \"Result of smooth max operator\";
algorithm
  y := max(x1, x2) + log(exp(4.0 / dx * (x1 - max(x1, x2))) + exp(4.0 / dx * (x2 - max(x1, x2)))) / (4.0 / dx);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.smoothMax;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.smoothMax_der
  input Real x1 \"First argument of smooth max operator\";
  input Real x2 \"Second argument of smooth max operator\";
  input Real dx \"Approximate difference between x1 and x2, below which regularization starts\";
  input Real dx1;
  input Real dx2;
  input Real ddx;
  output Real dy \"Derivative of smooth max operator\";
algorithm
  dy := (if x1 > x2 then dx1 else dx2) + 0.25 * (((4.0 * (dx1 - (if x1 > x2 then dx1 else dx2)) / dx - 4.0 * (x1 - max(x1, x2)) * ddx / dx ^ 2.0) * exp(4.0 * (x1 - max(x1, x2)) / dx) + (4.0 * (dx2 - (if x1 > x2 then dx1 else dx2)) / dx - 4.0 * (x2 - max(x1, x2)) * ddx / dx ^ 2.0) * exp(4.0 * (x2 - max(x1, x2)) / dx)) * dx / (exp(4.0 * (x1 - max(x1, x2)) / dx) + exp(4.0 * (x2 - max(x1, x2)) / dx)) + log(exp(4.0 * (x1 - max(x1, x2)) / dx) + exp(4.0 * (x2 - max(x1, x2)) / dx)) * ddx);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.smoothMax_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction \"Spline interpolation of two functions\"
  input Real pos \"Returned value for x-deltax >= 0\";
  input Real neg \"Returned value for x+deltax <= 0\";
  input Real x \"Function argument\";
  input Real deltax = 1.0 \"Region around x with spline interpolation\";
  output Real out;
  protected Real scaledX;
  protected Real scaledX1;
  protected Real y;
algorithm
  scaledX1 := x / deltax;
  scaledX := scaledX1 * 1.5707963267948966;
  if scaledX1 <= -0.999999999 then
    y := 0.0;
  elseif scaledX1 >= 0.999999999 then
    y := 1.0;
  else
    y := (tanh(tan(scaledX)) + 1.0) / 2.0;
  end if;
  out := pos * y + (1.0 - y) * neg;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction_der \"Derivative of spliceFunction\"
  input Real pos;
  input Real neg;
  input Real x;
  input Real deltax = 1.0;
  input Real dpos;
  input Real dneg;
  input Real dx;
  input Real ddeltax = 0.0;
  output Real out;
  protected Real scaledX;
  protected Real scaledX1;
  protected Real dscaledX1;
  protected Real y;
algorithm
  scaledX1 := x / deltax;
  scaledX := scaledX1 * 1.5707963267948966;
  dscaledX1 := (dx - scaledX1 * ddeltax) / deltax;
  if scaledX1 <= -0.99999999999 then
    y := 0.0;
  elseif scaledX1 >= 0.9999999999 then
    y := 1.0;
  else
    y := (tanh(tan(scaledX)) + 1.0) / 2.0;
  end if;
  out := dpos * y + (1.0 - y) * dneg;
  if abs(scaledX1) < 1.0 then
    out := out + (pos - neg) * dscaledX1 * 1.5707963267948966 / 2.0 / (cosh(tan(scaledX)) * cos(scaledX)) ^ 2.0;
  end if;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.enthalpyOfWater \"Computes specific enthalpy of water (solid/liquid) near atmospheric pressure from temperature T\"
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\") \"Specific enthalpy of water\";
algorithm
  h := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction(4200.0 * (T - 273.15), 2050.0 * (T - 273.15) - 333000.0, T - 273.16, 0.1);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.enthalpyOfWater;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.enthalpyOfWater_der \"Derivative function of enthalpyOfWater\"
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real dT(unit = \"K/s\") \"Time derivative of temperature\";
  output Real dh(unit = \"J/(kg.s)\") \"Time derivative of specific enthalpy\";
algorithm
  dh := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.Utilities.spliceFunction_der(4200.0 * (T - 273.15), 2050.0 * (T - 273.15) - 333000.0, T - 273.16, 0.1, 4200.0 * dT, 2050.0 * dT, dT, 0.0);
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.enthalpyOfWater_der;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.h_pTX \"Return specific enthalpy of moist air as a function of pressure p, temperature T and composition X\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\") \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"1\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1))) \"Mass fractions of moist air\";
  output Real h(quantity = \"SpecificEnergy\", unit = \"J/kg\") \"Specific enthalpy at p, T, X\";
  protected Real p_steam_sat(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\", min = 0.0, nominal = 1e5) \"partial saturation pressure of steam\";
  protected Real X_sat(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Absolute humidity per unit mass of moist air\";
  protected Real X_liquid(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of liquid water\";
  protected Real X_steam(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of steam water\";
  protected Real X_air(quantity = \"MassFraction\", unit = \"1\", min = 0.0, max = 1.0) \"Mass fraction of air\";
algorithm
  p_steam_sat := Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.saturationPressure(T);
  X_sat := min(p_steam_sat * 0.6219647130774989 / max(1e-13, p - p_steam_sat) * (1.0 - X[1]), 1.0);
  X_liquid := max(X[1] - X_sat, 0.0);
  X_steam := X[1] - X_liquid;
  X_air := 1.0 - X[1];
  h := Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"H2O\", 0.01801528, -1.342338281725291e7, 549760.6476280135, 1000.0, {-39479.6083, 575.573102, 0.931782653, 0.00722271286, -7.34255737e-6, 4.95504349e-9, -1.336933246e-12}, {-33039.7431, 17.24205775}, {1.034972096e6, -2412.698562, 4.64611078, 0.002291998307, -6.836830479999999e-7, 9.426468930000001e-11, -4.82238053e-15}, {-13842.86509, -7.97814851}, 461.5233290850878), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 2.547494319e6) * X_steam + Modelica.Media.IdealGases.Common.Functions.h_Tlow(Modelica.Media.IdealGases.Common.DataRecord(\"Air\", 0.0289651159, -4333.833858403446, 298609.6803431054, 1000.0, {10099.5016, -196.827561, 5.00915511, -0.00576101373, 1.06685993e-5, -7.94029797e-9, 2.18523191e-12}, {-176.796731, -3.921504225}, {241521.443, -1257.8746, 5.14455867, -2.13854179e-4, 7.06522784e-8, -1.07148349e-11, 6.57780015e-16}, {6462.26319, -8.147411905}, 287.0512249529787), T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.UserDefined, 25104.684) * X_air + Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.enthalpyOfWater(T) * X_liquid;
end Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.h_pTX;

function Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.h_pTX_der \"Derivative function of h_pTX\"
  input Real p(quantity = \"Pressure\", unit = \"Pa\", displayUnit = \"bar\") \"Pressure\";
  input Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature\";
  input Real[:] X(quantity = fill(\"MassFraction\", size(X, 1)), unit = fill(\"1\", size(X, 1)), min = fill(0.0, size(X, 1)), max = fill(1.0, size(X, 1))) \"Mass fractions of moist air\";
  input Real dp(unit
...[truncated 786544 chars]...
_outflow[1]) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe4.port_a.m_flow, 1e-7)), pipe3.mediums[5].Xi[1]);
  pipe3.port_a.m_flow = pipe3.m_flows[1];
  pipe3.port_b.m_flow = -pipe3.m_flows[6];
  pipe3.port_a.h_outflow = pipe3.mediums[1].h;
  pipe3.port_b.h_outflow = pipe3.mediums[5].h;
  pipe3.port_a.Xi_outflow[1] = pipe3.mediums[1].Xi[1];
  pipe3.port_b.Xi_outflow[1] = pipe3.mediums[5].Xi[1];
  pipe3.state_a = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.Medium.setState_phX(pipe3.port_a.p, ($OMC$PositiveMax(-pipe2.port_a.m_flow, 1e-7) * pipe2.port_a.h_outflow + $OMC$PositiveMax(-pipe1.port_b.m_flow, 1e-7) * pipe1.port_b.h_outflow) / ($OMC$PositiveMax(-pipe2.port_a.m_flow, 1e-7) + $OMC$PositiveMax(-pipe1.port_b.m_flow, 1e-7)), {($OMC$PositiveMax(-pipe2.port_a.m_flow, 1e-7) * pipe2.port_a.Xi_outflow[1] + $OMC$PositiveMax(-pipe1.port_b.m_flow, 1e-7) * pipe1.port_b.Xi_outflow[1]) / ($OMC$PositiveMax(-pipe2.port_a.m_flow, 1e-7) + $OMC$PositiveMax(-pipe1.port_b.m_flow, 1e-7))});
  pipe3.state_b = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.Medium.setState_phX(pipe3.port_b.p, ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.h_outflow + $OMC$PositiveMax(-pipe4.port_a.m_flow, 1e-7) * pipe4.port_a.h_outflow) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe4.port_a.m_flow, 1e-7)), {($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.Xi_outflow[1] + $OMC$PositiveMax(-pipe4.port_a.m_flow, 1e-7) * pipe4.port_a.Xi_outflow[1]) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe4.port_a.m_flow, 1e-7))});
  pipe3.statesFM[1] = pipe3.state_a;
  pipe3.statesFM[2] = pipe3.mediums[1].state;
  pipe3.statesFM[3] = pipe3.mediums[2].state;
  pipe3.statesFM[4] = pipe3.mediums[3].state;
  pipe3.statesFM[5] = pipe3.mediums[4].state;
  pipe3.statesFM[6] = pipe3.mediums[5].state;
  pipe3.statesFM[7] = pipe3.state_b;
  pipe3.m_flows[1] = pipe3.flowModel.m_flows[1];
  pipe3.m_flows[2] = pipe3.flowModel.m_flows[2];
  pipe3.m_flows[3] = pipe3.flowModel.m_flows[3];
  pipe3.m_flows[4] = pipe3.flowModel.m_flows[4];
  pipe3.m_flows[5] = pipe3.flowModel.m_flows[5];
  pipe3.m_flows[6] = pipe3.flowModel.m_flows[6];
  pipe3.n88[1] = pipe3.m_flows[1] / Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.Medium.density(pipe3.state_a) / pipe3.crossAreas[1] / pipe3.nParallel;
  pipe3.n88[2] = pipe3.vs[1];
  pipe3.n88[3] = pipe3.vs[2];
  pipe3.n88[4] = pipe3.vs[3];
  pipe3.n88[5] = pipe3.vs[4];
  pipe3.n88[6] = pipe3.vs[5];
  pipe3.n88[7] = pipe3.m_flows[6] / Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.Medium.density(pipe3.state_b) / pipe3.crossAreas[5] / pipe3.nParallel;
  pipe3.ms[1] = pipe3.fluidVolumes[1] * pipe3.mediums[1].d;
  pipe3.mXis[1,1] = pipe3.ms[1] * pipe3.mediums[1].Xi[1];
  pipe3.Us[1] = pipe3.ms[1] * pipe3.mediums[1].u;
  pipe3.ms[2] = pipe3.fluidVolumes[2] * pipe3.mediums[2].d;
  pipe3.mXis[2,1] = pipe3.ms[2] * pipe3.mediums[2].Xi[1];
  pipe3.Us[2] = pipe3.ms[2] * pipe3.mediums[2].u;
  pipe3.ms[3] = pipe3.fluidVolumes[3] * pipe3.mediums[3].d;
  pipe3.mXis[3,1] = pipe3.ms[3] * pipe3.mediums[3].Xi[1];
  pipe3.Us[3] = pipe3.ms[3] * pipe3.mediums[3].u;
  pipe3.ms[4] = pipe3.fluidVolumes[4] * pipe3.mediums[4].d;
  pipe3.mXis[4,1] = pipe3.ms[4] * pipe3.mediums[4].Xi[1];
  pipe3.Us[4] = pipe3.ms[4] * pipe3.mediums[4].u;
  pipe3.ms[5] = pipe3.fluidVolumes[5] * pipe3.mediums[5].d;
  pipe3.mXis[5,1] = pipe3.ms[5] * pipe3.mediums[5].Xi[1];
  pipe3.Us[5] = pipe3.ms[5] * pipe3.mediums[5].u;
  der(pipe3.Us[1]) = pipe3.Hb_flows[1] + pipe3.Wb_flows[1] + pipe3.Qb_flows[1];
  der(pipe3.Us[2]) = pipe3.Hb_flows[2] + pipe3.Wb_flows[2] + pipe3.Qb_flows[2];
  der(pipe3.Us[3]) = pipe3.Hb_flows[3] + pipe3.Wb_flows[3] + pipe3.Qb_flows[3];
  der(pipe3.Us[4]) = pipe3.Hb_flows[4] + pipe3.Wb_flows[4] + pipe3.Qb_flows[4];
  der(pipe3.Us[5]) = pipe3.Hb_flows[5] + pipe3.Wb_flows[5] + pipe3.Qb_flows[5];
  der(pipe3.ms[1]) = pipe3.mb_flows[1];
  der(pipe3.ms[2]) = pipe3.mb_flows[2];
  der(pipe3.ms[3]) = pipe3.mb_flows[3];
  der(pipe3.ms[4]) = pipe3.mb_flows[4];
  der(pipe3.ms[5]) = pipe3.mb_flows[5];
  der(pipe3.mXis[1,1]) = pipe3.mbXi_flows[1,1];
  der(pipe3.mXis[2,1]) = pipe3.mbXi_flows[2,1];
  der(pipe3.mXis[3,1]) = pipe3.mbXi_flows[3,1];
  der(pipe3.mXis[4,1]) = pipe3.mbXi_flows[4,1];
  der(pipe3.mXis[5,1]) = pipe3.mbXi_flows[5,1];
  pipe4.fluidVolumes = array(pipe4.crossAreas[i] * 10.0 for i in 1:5) * pipe4.nParallel;
  assert(pipe4.mediums[1].T >= 190.0 and pipe4.mediums[1].T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(pipe4.mediums[1].T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  pipe4.mediums[1].MM = 1.0 / (pipe4.mediums[1].Xi[1] / 0.01801528 + (1.0 - pipe4.mediums[1].Xi[1]) / 0.0289651159);
  pipe4.mediums[1].n99 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.saturationPressure(pipe4.mediums[1].T), 0.999 * pipe4.mediums[1].p);
  pipe4.mediums[1].n97 = min(pipe4.mediums[1].n99 * 0.6219647130774989 / max(1e-13, pipe4.mediums[1].p - pipe4.mediums[1].n99) * (1.0 - pipe4.mediums[1].Xi[1]), 1.0);
  pipe4.mediums[1].n94 = max(pipe4.mediums[1].Xi[1] - pipe4.mediums[1].n97, 0.0);
  pipe4.mediums[1].n95 = pipe4.mediums[1].Xi[1] - pipe4.mediums[1].n94;
  pipe4.mediums[1].n96 = 1.0 - pipe4.mediums[1].Xi[1];
  pipe4.mediums[1].h = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.specificEnthalpy_pTX(pipe4.mediums[1].p, pipe4.mediums[1].T, pipe4.mediums[1].Xi);
  pipe4.mediums[1].R = 287.0512249529787 * pipe4.mediums[1].n96 / (1.0 - pipe4.mediums[1].n94) + 461.5233290850878 * pipe4.mediums[1].n95 / (1.0 - pipe4.mediums[1].n94);
  pipe4.mediums[1].u = pipe4.mediums[1].h - pipe4.mediums[1].R * pipe4.mediums[1].T;
  pipe4.mediums[1].d = pipe4.mediums[1].p / (pipe4.mediums[1].R * pipe4.mediums[1].T);
  pipe4.mediums[1].state.p = pipe4.mediums[1].p;
  pipe4.mediums[1].state.T = pipe4.mediums[1].T;
  pipe4.mediums[1].state.X[1] = pipe4.mediums[1].X[1];
  pipe4.mediums[1].state.X[2] = pipe4.mediums[1].X[2];
  pipe4.mediums[1].n98 = 0.6219647130774989 * pipe4.mediums[1].n99 / max(1e-13, pipe4.mediums[1].p - pipe4.mediums[1].n99);
  pipe4.mediums[1].x_water = pipe4.mediums[1].Xi[1] / max(pipe4.mediums[1].n96, 1e-13);
  pipe4.mediums[1].phi = pipe4.mediums[1].p / pipe4.mediums[1].n99 * pipe4.mediums[1].Xi[1] / (pipe4.mediums[1].Xi[1] + 0.6219647130774989 * pipe4.mediums[1].n96);
  pipe4.mediums[1].Xi[1] = pipe4.mediums[1].X[1];
  pipe4.mediums[1].X[2] = 1.0 - pipe4.mediums[1].Xi[1];
  assert(pipe4.mediums[1].X[1] >= -1e-5 and pipe4.mediums[1].X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(pipe4.mediums[1].X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[1].X[2] >= -1e-5 and pipe4.mediums[1].X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(pipe4.mediums[1].X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[1].p >= 0.0, \"Pressure (= \" + String(pipe4.mediums[1].p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(pipe4.mediums[1].T, 6, 0, true) + \" K)\");
  assert(pipe4.mediums[2].T >= 190.0 and pipe4.mediums[2].T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(pipe4.mediums[2].T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  pipe4.mediums[2].MM = 1.0 / (pipe4.mediums[2].Xi[1] / 0.01801528 + (1.0 - pipe4.mediums[2].Xi[1]) / 0.0289651159);
  pipe4.mediums[2].n99 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.saturationPressure(pipe4.mediums[2].T), 0.999 * pipe4.mediums[2].p);
  pipe4.mediums[2].n97 = min(pipe4.mediums[2].n99 * 0.6219647130774989 / max(1e-13, pipe4.mediums[2].p - pipe4.mediums[2].n99) * (1.0 - pipe4.mediums[2].Xi[1]), 1.0);
  pipe4.mediums[2].n94 = max(pipe4.mediums[2].Xi[1] - pipe4.mediums[2].n97, 0.0);
  pipe4.mediums[2].n95 = pipe4.mediums[2].Xi[1] - pipe4.mediums[2].n94;
  pipe4.mediums[2].n96 = 1.0 - pipe4.mediums[2].Xi[1];
  pipe4.mediums[2].h = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.specificEnthalpy_pTX(pipe4.mediums[2].p, pipe4.mediums[2].T, pipe4.mediums[2].Xi);
  pipe4.mediums[2].R = 287.0512249529787 * pipe4.mediums[2].n96 / (1.0 - pipe4.mediums[2].n94) + 461.5233290850878 * pipe4.mediums[2].n95 / (1.0 - pipe4.mediums[2].n94);
  pipe4.mediums[2].u = pipe4.mediums[2].h - pipe4.mediums[2].R * pipe4.mediums[2].T;
  pipe4.mediums[2].d = pipe4.mediums[2].p / (pipe4.mediums[2].R * pipe4.mediums[2].T);
  pipe4.mediums[2].state.p = pipe4.mediums[2].p;
  pipe4.mediums[2].state.T = pipe4.mediums[2].T;
  pipe4.mediums[2].state.X[1] = pipe4.mediums[2].X[1];
  pipe4.mediums[2].state.X[2] = pipe4.mediums[2].X[2];
  pipe4.mediums[2].n98 = 0.6219647130774989 * pipe4.mediums[2].n99 / max(1e-13, pipe4.mediums[2].p - pipe4.mediums[2].n99);
  pipe4.mediums[2].x_water = pipe4.mediums[2].Xi[1] / max(pipe4.mediums[2].n96, 1e-13);
  pipe4.mediums[2].phi = pipe4.mediums[2].p / pipe4.mediums[2].n99 * pipe4.mediums[2].Xi[1] / (pipe4.mediums[2].Xi[1] + 0.6219647130774989 * pipe4.mediums[2].n96);
  pipe4.mediums[2].Xi[1] = pipe4.mediums[2].X[1];
  pipe4.mediums[2].X[2] = 1.0 - pipe4.mediums[2].Xi[1];
  assert(pipe4.mediums[2].X[1] >= -1e-5 and pipe4.mediums[2].X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(pipe4.mediums[2].X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[2].X[2] >= -1e-5 and pipe4.mediums[2].X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(pipe4.mediums[2].X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[2].p >= 0.0, \"Pressure (= \" + String(pipe4.mediums[2].p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(pipe4.mediums[2].T, 6, 0, true) + \" K)\");
  assert(pipe4.mediums[3].T >= 190.0 and pipe4.mediums[3].T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(pipe4.mediums[3].T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  pipe4.mediums[3].MM = 1.0 / (pipe4.mediums[3].Xi[1] / 0.01801528 + (1.0 - pipe4.mediums[3].Xi[1]) / 0.0289651159);
  pipe4.mediums[3].n99 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.saturationPressure(pipe4.mediums[3].T), 0.999 * pipe4.mediums[3].p);
  pipe4.mediums[3].n97 = min(pipe4.mediums[3].n99 * 0.6219647130774989 / max(1e-13, pipe4.mediums[3].p - pipe4.mediums[3].n99) * (1.0 - pipe4.mediums[3].Xi[1]), 1.0);
  pipe4.mediums[3].n94 = max(pipe4.mediums[3].Xi[1] - pipe4.mediums[3].n97, 0.0);
  pipe4.mediums[3].n95 = pipe4.mediums[3].Xi[1] - pipe4.mediums[3].n94;
  pipe4.mediums[3].n96 = 1.0 - pipe4.mediums[3].Xi[1];
  pipe4.mediums[3].h = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.specificEnthalpy_pTX(pipe4.mediums[3].p, pipe4.mediums[3].T, pipe4.mediums[3].Xi);
  pipe4.mediums[3].R = 287.0512249529787 * pipe4.mediums[3].n96 / (1.0 - pipe4.mediums[3].n94) + 461.5233290850878 * pipe4.mediums[3].n95 / (1.0 - pipe4.mediums[3].n94);
  pipe4.mediums[3].u = pipe4.mediums[3].h - pipe4.mediums[3].R * pipe4.mediums[3].T;
  pipe4.mediums[3].d = pipe4.mediums[3].p / (pipe4.mediums[3].R * pipe4.mediums[3].T);
  pipe4.mediums[3].state.p = pipe4.mediums[3].p;
  pipe4.mediums[3].state.T = pipe4.mediums[3].T;
  pipe4.mediums[3].state.X[1] = pipe4.mediums[3].X[1];
  pipe4.mediums[3].state.X[2] = pipe4.mediums[3].X[2];
  pipe4.mediums[3].n98 = 0.6219647130774989 * pipe4.mediums[3].n99 / max(1e-13, pipe4.mediums[3].p - pipe4.mediums[3].n99);
  pipe4.mediums[3].x_water = pipe4.mediums[3].Xi[1] / max(pipe4.mediums[3].n96, 1e-13);
  pipe4.mediums[3].phi = pipe4.mediums[3].p / pipe4.mediums[3].n99 * pipe4.mediums[3].Xi[1] / (pipe4.mediums[3].Xi[1] + 0.6219647130774989 * pipe4.mediums[3].n96);
  pipe4.mediums[3].Xi[1] = pipe4.mediums[3].X[1];
  pipe4.mediums[3].X[2] = 1.0 - pipe4.mediums[3].Xi[1];
  assert(pipe4.mediums[3].X[1] >= -1e-5 and pipe4.mediums[3].X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(pipe4.mediums[3].X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[3].X[2] >= -1e-5 and pipe4.mediums[3].X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(pipe4.mediums[3].X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[3].p >= 0.0, \"Pressure (= \" + String(pipe4.mediums[3].p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(pipe4.mediums[3].T, 6, 0, true) + \" K)\");
  assert(pipe4.mediums[4].T >= 190.0 and pipe4.mediums[4].T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(pipe4.mediums[4].T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  pipe4.mediums[4].MM = 1.0 / (pipe4.mediums[4].Xi[1] / 0.01801528 + (1.0 - pipe4.mediums[4].Xi[1]) / 0.0289651159);
  pipe4.mediums[4].n99 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.saturationPressure(pipe4.mediums[4].T), 0.999 * pipe4.mediums[4].p);
  pipe4.mediums[4].n97 = min(pipe4.mediums[4].n99 * 0.6219647130774989 / max(1e-13, pipe4.mediums[4].p - pipe4.mediums[4].n99) * (1.0 - pipe4.mediums[4].Xi[1]), 1.0);
  pipe4.mediums[4].n94 = max(pipe4.mediums[4].Xi[1] - pipe4.mediums[4].n97, 0.0);
  pipe4.mediums[4].n95 = pipe4.mediums[4].Xi[1] - pipe4.mediums[4].n94;
  pipe4.mediums[4].n96 = 1.0 - pipe4.mediums[4].Xi[1];
  pipe4.mediums[4].h = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.specificEnthalpy_pTX(pipe4.mediums[4].p, pipe4.mediums[4].T, pipe4.mediums[4].Xi);
  pipe4.mediums[4].R = 287.0512249529787 * pipe4.mediums[4].n96 / (1.0 - pipe4.mediums[4].n94) + 461.5233290850878 * pipe4.mediums[4].n95 / (1.0 - pipe4.mediums[4].n94);
  pipe4.mediums[4].u = pipe4.mediums[4].h - pipe4.mediums[4].R * pipe4.mediums[4].T;
  pipe4.mediums[4].d = pipe4.mediums[4].p / (pipe4.mediums[4].R * pipe4.mediums[4].T);
  pipe4.mediums[4].state.p = pipe4.mediums[4].p;
  pipe4.mediums[4].state.T = pipe4.mediums[4].T;
  pipe4.mediums[4].state.X[1] = pipe4.mediums[4].X[1];
  pipe4.mediums[4].state.X[2] = pipe4.mediums[4].X[2];
  pipe4.mediums[4].n98 = 0.6219647130774989 * pipe4.mediums[4].n99 / max(1e-13, pipe4.mediums[4].p - pipe4.mediums[4].n99);
  pipe4.mediums[4].x_water = pipe4.mediums[4].Xi[1] / max(pipe4.mediums[4].n96, 1e-13);
  pipe4.mediums[4].phi = pipe4.mediums[4].p / pipe4.mediums[4].n99 * pipe4.mediums[4].Xi[1] / (pipe4.mediums[4].Xi[1] + 0.6219647130774989 * pipe4.mediums[4].n96);
  pipe4.mediums[4].Xi[1] = pipe4.mediums[4].X[1];
  pipe4.mediums[4].X[2] = 1.0 - pipe4.mediums[4].Xi[1];
  assert(pipe4.mediums[4].X[1] >= -1e-5 and pipe4.mediums[4].X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(pipe4.mediums[4].X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[4].X[2] >= -1e-5 and pipe4.mediums[4].X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(pipe4.mediums[4].X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[4].p >= 0.0, \"Pressure (= \" + String(pipe4.mediums[4].p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(pipe4.mediums[4].T, 6, 0, true) + \" K)\");
  assert(pipe4.mediums[5].T >= 190.0 and pipe4.mediums[5].T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(pipe4.mediums[5].T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  pipe4.mediums[5].MM = 1.0 / (pipe4.mediums[5].Xi[1] / 0.01801528 + (1.0 - pipe4.mediums[5].Xi[1]) / 0.0289651159);
  pipe4.mediums[5].n99 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.saturationPressure(pipe4.mediums[5].T), 0.999 * pipe4.mediums[5].p);
  pipe4.mediums[5].n97 = min(pipe4.mediums[5].n99 * 0.6219647130774989 / max(1e-13, pipe4.mediums[5].p - pipe4.mediums[5].n99) * (1.0 - pipe4.mediums[5].Xi[1]), 1.0);
  pipe4.mediums[5].n94 = max(pipe4.mediums[5].Xi[1] - pipe4.mediums[5].n97, 0.0);
  pipe4.mediums[5].n95 = pipe4.mediums[5].Xi[1] - pipe4.mediums[5].n94;
  pipe4.mediums[5].n96 = 1.0 - pipe4.mediums[5].Xi[1];
  pipe4.mediums[5].h = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.specificEnthalpy_pTX(pipe4.mediums[5].p, pipe4.mediums[5].T, pipe4.mediums[5].Xi);
  pipe4.mediums[5].R = 287.0512249529787 * pipe4.mediums[5].n96 / (1.0 - pipe4.mediums[5].n94) + 461.5233290850878 * pipe4.mediums[5].n95 / (1.0 - pipe4.mediums[5].n94);
  pipe4.mediums[5].u = pipe4.mediums[5].h - pipe4.mediums[5].R * pipe4.mediums[5].T;
  pipe4.mediums[5].d = pipe4.mediums[5].p / (pipe4.mediums[5].R * pipe4.mediums[5].T);
  pipe4.mediums[5].state.p = pipe4.mediums[5].p;
  pipe4.mediums[5].state.T = pipe4.mediums[5].T;
  pipe4.mediums[5].state.X[1] = pipe4.mediums[5].X[1];
  pipe4.mediums[5].state.X[2] = pipe4.mediums[5].X[2];
  pipe4.mediums[5].n98 = 0.6219647130774989 * pipe4.mediums[5].n99 / max(1e-13, pipe4.mediums[5].p - pipe4.mediums[5].n99);
  pipe4.mediums[5].x_water = pipe4.mediums[5].Xi[1] / max(pipe4.mediums[5].n96, 1e-13);
  pipe4.mediums[5].phi = pipe4.mediums[5].p / pipe4.mediums[5].n99 * pipe4.mediums[5].Xi[1] / (pipe4.mediums[5].Xi[1] + 0.6219647130774989 * pipe4.mediums[5].n96);
  pipe4.mediums[5].Xi[1] = pipe4.mediums[5].X[1];
  pipe4.mediums[5].X[2] = 1.0 - pipe4.mediums[5].Xi[1];
  assert(pipe4.mediums[5].X[1] >= -1e-5 and pipe4.mediums[5].X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(pipe4.mediums[5].X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[5].X[2] >= -1e-5 and pipe4.mediums[5].X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(pipe4.mediums[5].X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(pipe4.mediums[5].p >= 0.0, \"Pressure (= \" + String(pipe4.mediums[5].p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(pipe4.mediums[5].T, 6, 0, true) + \" K)\");
  pipe4.flowModel.states[1].X = pipe4.statesFM[1].X;
  pipe4.flowModel.states[2].X = pipe4.statesFM[2].X;
  pipe4.flowModel.states[3].X = pipe4.statesFM[3].X;
  pipe4.flowModel.states[4].X = pipe4.statesFM[4].X;
  pipe4.flowModel.states[5].X = pipe4.statesFM[5].X;
  pipe4.flowModel.states[6].X = pipe4.statesFM[6].X;
  pipe4.flowModel.states[7].X = pipe4.statesFM[7].X;
  pipe4.flowModel.vs = pipe4.n113;
  pipe4.flowModel.crossAreas = pipe4.n112;
  pipe4.flowModel.dimensions = pipe4.n114;
  pipe4.flowModel.roughnesses = pipe4.n115;
  pipe4.flowModel.dheights = pipe4.n111;
  pipe4.flowModel.pathLengths = pipe4.n110;
  pipe4.flowModel.rhos = array(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.density(pipe4.flowModel.states[$i1]) for $i1 in 1:7);
  pipe4.flowModel.mus = array(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.dynamicViscosity(pipe4.flowModel.states[$i1]) for $i1 in 1:7);
  pipe4.flowModel.pathLengths_internal = pipe4.flowModel.pathLengths;
  pipe4.flowModel.Res_turbulent_internal = {pipe4.flowModel.Re_turbulent, pipe4.flowModel.Re_turbulent, pipe4.flowModel.Re_turbulent, pipe4.flowModel.Re_turbulent, pipe4.flowModel.Re_turbulent, pipe4.flowModel.Re_turbulent};
  pipe4.flowModel.n108 = {0.5 * (pipe4.flowModel.dimensions[1] + pipe4.flowModel.dimensions[2]), 0.5 * (pipe4.flowModel.dimensions[2] + pipe4.flowModel.dimensions[3]), 0.5 * (pipe4.flowModel.dimensions[3] + pipe4.flowModel.dimensions[4]), 0.5 * (pipe4.flowModel.dimensions[4] + pipe4.flowModel.dimensions[5]), 0.5 * (pipe4.flowModel.dimensions[5] + pipe4.flowModel.dimensions[6]), 0.5 * (pipe4.flowModel.dimensions[6] + pipe4.flowModel.dimensions[7])};
  pipe4.flowModel.m_flows = array(homotopy((array(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.WallFriction.massFlowRate_dp_staticHead(pipe4.flowModel.dps_fg[$i1], pipe4.flowModel.rhos[(1:6)[$i1]], pipe4.flowModel.rhos[(2:7)[$i1]], pipe4.flowModel.mus[(1:6)[$i1]], pipe4.flowModel.mus[(2:7)[$i1]], pipe4.flowModel.pathLengths_internal[$i1], pipe4.flowModel.n108[$i1], {pipe4.flowModel.g * pipe4.flowModel.dheights[1], pipe4.flowModel.g * pipe4.flowModel.dheights[2], pipe4.flowModel.g * pipe4.flowModel.dheights[3], pipe4.flowModel.g * pipe4.flowModel.dheights[4], pipe4.flowModel.g * pipe4.flowModel.dheights[5], pipe4.flowModel.g * pipe4.flowModel.dheights[6]}[$i1], {(pipe4.flowModel.crossAreas[1] + pipe4.flowModel.crossAreas[2]) / 2.0, (pipe4.flowModel.crossAreas[2] + pipe4.flowModel.crossAreas[3]) / 2.0, (pipe4.flowModel.crossAreas[3] + pipe4.flowModel.crossAreas[4]) / 2.0, (pipe4.flowModel.crossAreas[4] + pipe4.flowModel.crossAreas[5]) / 2.0, (pipe4.flowModel.crossAreas[5] + pipe4.flowModel.crossAreas[6]) / 2.0, (pipe4.flowModel.crossAreas[6] + pipe4.flowModel.crossAreas[7]) / 2.0}[$i1], {(pipe4.flowModel.roughnesses[1] + pipe4.flowModel.roughnesses[2]) / 2.0, (pipe4.flowModel.roughnesses[2] + pipe4.flowModel.roughnesses[3]) / 2.0, (pipe4.flowModel.roughnesses[3] + pipe4.flowModel.roughnesses[4]) / 2.0, (pipe4.flowModel.roughnesses[4] + pipe4.flowModel.roughnesses[5]) / 2.0, (pipe4.flowModel.roughnesses[5] + pipe4.flowModel.roughnesses[6]) / 2.0, (pipe4.flowModel.roughnesses[6] + pipe4.flowModel.roughnesses[7]) / 2.0}[$i1], pipe4.flowModel.n105 / 6.0, pipe4.flowModel.Res_turbulent_internal[$i1]) for $i1 in 1:6) * pipe4.flowModel.nParallel)[$i1], {pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[1] - pipe4.flowModel.g * pipe4.flowModel.dheights[1] * pipe4.flowModel.n102), pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[2] - pipe4.flowModel.g * pipe4.flowModel.dheights[2] * pipe4.flowModel.n102), pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[3] - pipe4.flowModel.g * pipe4.flowModel.dheights[3] * pipe4.flowModel.n102), pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[4] - pipe4.flowModel.g * pipe4.flowModel.dheights[4] * pipe4.flowModel.n102), pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[5] - pipe4.flowModel.g * pipe4.flowModel.dheights[5] * pipe4.flowModel.n102), pipe4.flowModel.m_flow_nominal / pipe4.flowModel.dp_nominal * (pipe4.flowModel.dps_fg[6] - pipe4.flowModel.g * pipe4.flowModel.dheights[6] * pipe4.flowModel.n102)}[$i1]) for $i1 in 1:6);
  pipe4.flowModel.rhos_act[1] = noEvent(if pipe4.flowModel.m_flows[1] > 0.0 then pipe4.flowModel.rhos[1] else pipe4.flowModel.rhos[2]);
  pipe4.flowModel.mus_act[1] = noEvent(if pipe4.flowModel.m_flows[1] > 0.0 then pipe4.flowModel.mus[1] else pipe4.flowModel.mus[2]);
  pipe4.flowModel.rhos_act[2] = noEvent(if pipe4.flowModel.m_flows[2] > 0.0 then pipe4.flowModel.rhos[2] else pipe4.flowModel.rhos[3]);
  pipe4.flowModel.mus_act[2] = noEvent(if pipe4.flowModel.m_flows[2] > 0.0 then pipe4.flowModel.mus[2] else pipe4.flowModel.mus[3]);
  pipe4.flowModel.rhos_act[3] = noEvent(if pipe4.flowModel.m_flows[3] > 0.0 then pipe4.flowModel.rhos[3] else pipe4.flowModel.rhos[4]);
  pipe4.flowModel.mus_act[3] = noEvent(if pipe4.flowModel.m_flows[3] > 0.0 then pipe4.flowModel.mus[3] else pipe4.flowModel.mus[4]);
  pipe4.flowModel.rhos_act[4] = noEvent(if pipe4.flowModel.m_flows[4] > 0.0 then pipe4.flowModel.rhos[4] else pipe4.flowModel.rhos[5]);
  pipe4.flowModel.mus_act[4] = noEvent(if pipe4.flowModel.m_flows[4] > 0.0 then pipe4.flowModel.mus[4] else pipe4.flowModel.mus[5]);
  pipe4.flowModel.rhos_act[5] = noEvent(if pipe4.flowModel.m_flows[5] > 0.0 then pipe4.flowModel.rhos[5] else pipe4.flowModel.rhos[6]);
  pipe4.flowModel.mus_act[5] = noEvent(if pipe4.flowModel.m_flows[5] > 0.0 then pipe4.flowModel.mus[5] else pipe4.flowModel.mus[6]);
  pipe4.flowModel.rhos_act[6] = noEvent(if pipe4.flowModel.m_flows[6] > 0.0 then pipe4.flowModel.rhos[6] else pipe4.flowModel.rhos[7]);
  pipe4.flowModel.mus_act[6] = noEvent(if pipe4.flowModel.m_flows[6] > 0.0 then pipe4.flowModel.mus[6] else pipe4.flowModel.mus[7]);
  pipe4.flowModel.Ib_flows = array(pipe4.flowModel.rhos[i] * pipe4.flowModel.vs[i] * pipe4.flowModel.vs[i] * pipe4.flowModel.crossAreas[i] - pipe4.flowModel.rhos[i + 1] * pipe4.flowModel.vs[i + 1] * pipe4.flowModel.vs[i + 1] * pipe4.flowModel.crossAreas[i + 1] for i in 1:6) * pipe4.flowModel.nParallel;
  pipe4.flowModel.Fs_p = array(0.5 * (pipe4.flowModel.crossAreas[i] + pipe4.flowModel.crossAreas[i + 1]) * (Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.pressure(pipe4.flowModel.states[i + 1]) - Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.pressure(pipe4.flowModel.states[i])) for i in 1:6) * pipe4.flowModel.nParallel;
  pipe4.flowModel.dps_fg = array(pipe4.flowModel.Fs_fg[i] / pipe4.flowModel.nParallel * 2.0 / (pipe4.flowModel.crossAreas[i] + pipe4.flowModel.crossAreas[i + 1]) for i in 1:6);
  pipe4.flowModel.Is = array(pipe4.flowModel.m_flows[i] * pipe4.flowModel.pathLengths[i] for i in 1:6);
  der(pipe4.flowModel.Is[1]) = pipe4.flowModel.Ib_flows[1] - pipe4.flowModel.Fs_p[1] - pipe4.flowModel.Fs_fg[1];
  der(pipe4.flowModel.Is[2]) = pipe4.flowModel.Ib_flows[2] - pipe4.flowModel.Fs_p[2] - pipe4.flowModel.Fs_fg[2];
  der(pipe4.flowModel.Is[3]) = pipe4.flowModel.Ib_flows[3] - pipe4.flowModel.Fs_p[3] - pipe4.flowModel.Fs_fg[3];
  der(pipe4.flowModel.Is[4]) = pipe4.flowModel.Ib_flows[4] - pipe4.flowModel.Fs_p[4] - pipe4.flowModel.Fs_fg[4];
  der(pipe4.flowModel.Is[5]) = pipe4.flowModel.Ib_flows[5] - pipe4.flowModel.Fs_p[5] - pipe4.flowModel.Fs_fg[5];
  der(pipe4.flowModel.Is[6]) = pipe4.flowModel.Ib_flows[6] - pipe4.flowModel.Fs_p[6] - pipe4.flowModel.Fs_fg[6];
  pipe4.vs = array(0.5 * (pipe4.m_flows[i] + pipe4.m_flows[i + 1]) / pipe4.mediums[i].d / pipe4.crossAreas[i] for i in 1:5) / pipe4.nParallel;
  pipe4.heatTransfer.states[1].X = pipe4.mediums[1].state.X;
  pipe4.heatTransfer.states[2].X = pipe4.mediums[2].state.X;
  pipe4.heatTransfer.states[3].X = pipe4.mediums[3].state.X;
  pipe4.heatTransfer.states[4].X = pipe4.mediums[4].state.X;
  pipe4.heatTransfer.states[5].X = pipe4.mediums[5].state.X;
  pipe4.heatTransfer.surfaceAreas = {pipe4.perimeter * 10.0, pipe4.perimeter * 10.0, pipe4.perimeter * 10.0, pipe4.perimeter * 10.0, pipe4.perimeter * 10.0};
  pipe4.heatTransfer.Ts = array(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.heatTransfer.Medium.temperature(pipe4.heatTransfer.states[$i1]) for $i1 in 1:5);
  pipe4.heatTransfer.vs = pipe4.vs;
  pipe4.heatTransfer.lengths = {10.0, 10.0, 10.0, 10.0, 10.0};
  pipe4.heatTransfer.dimensions = pipe4.dimensions;
  pipe4.heatTransfer.roughnesses = pipe4.roughnesses;
  pipe4.heatTransfer.Ts[1] = pipe4.heatTransfer.heatPorts[1].T;
  pipe4.heatTransfer.Ts[2] = pipe4.heatTransfer.heatPorts[2].T;
  pipe4.heatTransfer.Ts[3] = pipe4.heatTransfer.heatPorts[3].T;
  pipe4.heatTransfer.Ts[4] = pipe4.heatTransfer.heatPorts[4].T;
  pipe4.heatTransfer.Ts[5] = pipe4.heatTransfer.heatPorts[5].T;
  pipe4.heatTransfer.Q_flows[1] = pipe4.heatTransfer.heatPorts[1].Q_flow;
  pipe4.heatTransfer.Q_flows[2] = pipe4.heatTransfer.heatPorts[2].Q_flow;
  pipe4.heatTransfer.Q_flows[3] = pipe4.heatTransfer.heatPorts[3].Q_flow;
  pipe4.heatTransfer.Q_flows[4] = pipe4.heatTransfer.heatPorts[4].Q_flow;
  pipe4.heatTransfer.Q_flows[5] = pipe4.heatTransfer.heatPorts[5].Q_flow;
  pipe4.Qb_flows[1] = pipe4.heatTransfer.Q_flows[1];
  pipe4.Qb_flows[2] = pipe4.heatTransfer.Q_flows[2];
  pipe4.Qb_flows[3] = pipe4.heatTransfer.Q_flows[3];
  pipe4.Qb_flows[4] = pipe4.heatTransfer.Q_flows[4];
  pipe4.Qb_flows[5] = pipe4.heatTransfer.Q_flows[5];
  pipe4.Wb_flows[2:4] = array(pipe4.vs[i] * pipe4.crossAreas[i] * ((pipe4.mediums[i + 1].p - pipe4.mediums[i - 1].p) / 2.0 + (pipe4.flowModel.dps_fg[i] + pipe4.flowModel.dps_fg[i + 1]) / 2.0 - system.g * 10.0 * pipe4.mediums[i].d) for i in 2:4) * pipe4.nParallel;
  pipe4.Wb_flows[1] = pipe4.vs[1] * pipe4.crossAreas[1] * ((pipe4.mediums[2].p - pipe4.port_a.p) / 1.5 + pipe4.flowModel.dps_fg[1] + pipe4.flowModel.dps_fg[2] / 2.0 - system.g * 10.0 * pipe4.mediums[1].d) * pipe4.nParallel;
  pipe4.Wb_flows[5] = pipe4.vs[5] * pipe4.crossAreas[5] * ((pipe4.port_b.p - pipe4.mediums[4].p) / 1.5 + pipe4.flowModel.dps_fg[5] / 2.0 + pipe4.flowModel.dps_fg[6] - system.g * 10.0 * pipe4.mediums[5].d) * pipe4.nParallel;
  pipe4.n110[1] = 5.0;
  pipe4.n110[2] = 10.0;
  pipe4.n110[3] = 10.0;
  pipe4.n110[4] = 10.0;
  pipe4.n110[5] = 10.0;
  pipe4.n110[6] = 5.0;
  pipe4.n111[1] = 5.0;
  pipe4.n111[2] = 10.0;
  pipe4.n111[3] = 10.0;
  pipe4.n111[4] = 10.0;
  pipe4.n111[5] = 10.0;
  pipe4.n111[6] = 5.0;
  pipe4.n112[1] = pipe4.crossAreas[1];
  pipe4.n112[2] = pipe4.crossAreas[1];
  pipe4.n112[3] = pipe4.crossAreas[2];
  pipe4.n112[4] = pipe4.crossAreas[3];
  pipe4.n112[5] = pipe4.crossAreas[4];
  pipe4.n112[6] = pipe4.crossAreas[5];
  pipe4.n112[7] = pipe4.crossAreas[5];
  pipe4.n114[1] = pipe4.dimensions[1];
  pipe4.n114[2] = pipe4.dimensions[1];
  pipe4.n114[3] = pipe4.dimensions[2];
  pipe4.n114[4] = pipe4.dimensions[3];
  pipe4.n114[5] = pipe4.dimensions[4];
  pipe4.n114[6] = pipe4.dimensions[5];
  pipe4.n114[7] = pipe4.dimensions[5];
  pipe4.n115[1] = pipe4.roughnesses[1];
  pipe4.n115[2] = pipe4.roughnesses[1];
  pipe4.n115[3] = pipe4.roughnesses[2];
  pipe4.n115[4] = pipe4.roughnesses[3];
  pipe4.n115[5] = pipe4.roughnesses[4];
  pipe4.n115[6] = pipe4.roughnesses[5];
  pipe4.n115[7] = pipe4.roughnesses[5];
  pipe4.mb_flows[1] = pipe4.m_flows[1] - pipe4.m_flows[2];
  pipe4.mbXi_flows[1,1] = pipe4.mXi_flows[1,1] - pipe4.mXi_flows[2,1];
  pipe4.Hb_flows[1] = pipe4.H_flows[1] - pipe4.H_flows[2];
  pipe4.mb_flows[2] = pipe4.m_flows[2] - pipe4.m_flows[3];
  pipe4.mbXi_flows[2,1] = pipe4.mXi_flows[2,1] - pipe4.mXi_flows[3,1];
  pipe4.Hb_flows[2] = pipe4.H_flows[2] - pipe4.H_flows[3];
  pipe4.mb_flows[3] = pipe4.m_flows[3] - pipe4.m_flows[4];
  pipe4.mbXi_flows[3,1] = pipe4.mXi_flows[3,1] - pipe4.mXi_flows[4,1];
  pipe4.Hb_flows[3] = pipe4.H_flows[3] - pipe4.H_flows[4];
  pipe4.mb_flows[4] = pipe4.m_flows[4] - pipe4.m_flows[5];
  pipe4.mbXi_flows[4,1] = pipe4.mXi_flows[4,1] - pipe4.mXi_flows[5,1];
  pipe4.Hb_flows[4] = pipe4.H_flows[4] - pipe4.H_flows[5];
  pipe4.mb_flows[5] = pipe4.m_flows[5] - pipe4.m_flows[6];
  pipe4.mbXi_flows[5,1] = pipe4.mXi_flows[5,1] - pipe4.mXi_flows[6,1];
  pipe4.Hb_flows[5] = pipe4.H_flows[5] - pipe4.H_flows[6];
  pipe4.H_flows[2] = semiLinear(pipe4.m_flows[2], pipe4.mediums[1].h, pipe4.mediums[2].h);
  pipe4.mXi_flows[2,1] = semiLinear(pipe4.m_flows[2], pipe4.mediums[1].Xi[1], pipe4.mediums[2].Xi[1]);
  pipe4.H_flows[3] = semiLinear(pipe4.m_flows[3], pipe4.mediums[2].h, pipe4.mediums[3].h);
  pipe4.mXi_flows[3,1] = semiLinear(pipe4.m_flows[3], pipe4.mediums[2].Xi[1], pipe4.mediums[3].Xi[1]);
  pipe4.H_flows[4] = semiLinear(pipe4.m_flows[4], pipe4.mediums[3].h, pipe4.mediums[4].h);
  pipe4.mXi_flows[4,1] = semiLinear(pipe4.m_flows[4], pipe4.mediums[3].Xi[1], pipe4.mediums[4].Xi[1]);
  pipe4.H_flows[5] = semiLinear(pipe4.m_flows[5], pipe4.mediums[4].h, pipe4.mediums[5].h);
  pipe4.mXi_flows[5,1] = semiLinear(pipe4.m_flows[5], pipe4.mediums[4].Xi[1], pipe4.mediums[5].Xi[1]);
  pipe4.H_flows[1] = semiLinear(pipe4.port_a.m_flow, ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.h_outflow + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7) * pipe3.port_b.h_outflow) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7)), pipe4.mediums[1].h);
  pipe4.H_flows[6] = -semiLinear(pipe4.port_b.m_flow, boundary4.ports[1].h_outflow, pipe4.mediums[5].h);
  pipe4.mXi_flows[1,1] = semiLinear(pipe4.port_a.m_flow, ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.Xi_outflow[1] + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7) * pipe3.port_b.Xi_outflow[1]) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7)), pipe4.mediums[1].Xi[1]);
  pipe4.mXi_flows[6,1] = -semiLinear(pipe4.port_b.m_flow, boundary4.ports[1].Xi_outflow[1], pipe4.mediums[5].Xi[1]);
  pipe4.port_a.m_flow = pipe4.m_flows[1];
  pipe4.port_b.m_flow = -pipe4.m_flows[6];
  pipe4.port_a.h_outflow = pipe4.mediums[1].h;
  pipe4.port_b.h_outflow = pipe4.mediums[5].h;
  pipe4.port_a.Xi_outflow[1] = pipe4.mediums[1].Xi[1];
  pipe4.port_b.Xi_outflow[1] = pipe4.mediums[5].Xi[1];
  pipe4.state_a = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.setState_phX(pipe4.port_a.p, ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.h_outflow + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7) * pipe3.port_b.h_outflow) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7)), {($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) * pipe2.port_b.Xi_outflow[1] + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7) * pipe3.port_b.Xi_outflow[1]) / ($OMC$PositiveMax(-pipe2.port_b.m_flow, 1e-7) + $OMC$PositiveMax(-pipe3.port_b.m_flow, 1e-7))});
  pipe4.state_b = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.setState_phX(pipe4.port_b.p, boundary4.ports[1].h_outflow, {boundary4.ports[1].Xi_outflow[1]});
  pipe4.statesFM[1] = pipe4.state_a;
  pipe4.statesFM[2] = pipe4.mediums[1].state;
  pipe4.statesFM[3] = pipe4.mediums[2].state;
  pipe4.statesFM[4] = pipe4.mediums[3].state;
  pipe4.statesFM[5] = pipe4.mediums[4].state;
  pipe4.statesFM[6] = pipe4.mediums[5].state;
  pipe4.statesFM[7] = pipe4.state_b;
  pipe4.m_flows[1] = pipe4.flowModel.m_flows[1];
  pipe4.m_flows[2] = pipe4.flowModel.m_flows[2];
  pipe4.m_flows[3] = pipe4.flowModel.m_flows[3];
  pipe4.m_flows[4] = pipe4.flowModel.m_flows[4];
  pipe4.m_flows[5] = pipe4.flowModel.m_flows[5];
  pipe4.m_flows[6] = pipe4.flowModel.m_flows[6];
  pipe4.n113[1] = pipe4.m_flows[1] / Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.density(pipe4.state_a) / pipe4.crossAreas[1] / pipe4.nParallel;
  pipe4.n113[2] = pipe4.vs[1];
  pipe4.n113[3] = pipe4.vs[2];
  pipe4.n113[4] = pipe4.vs[3];
  pipe4.n113[5] = pipe4.vs[4];
  pipe4.n113[6] = pipe4.vs[5];
  pipe4.n113[7] = pipe4.m_flows[6] / Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.Medium.density(pipe4.state_b) / pipe4.crossAreas[5] / pipe4.nParallel;
  pipe4.ms[1] = pipe4.fluidVolumes[1] * pipe4.mediums[1].d;
  pipe4.mXis[1,1] = pipe4.ms[1] * pipe4.mediums[1].Xi[1];
  pipe4.Us[1] = pipe4.ms[1] * pipe4.mediums[1].u;
  pipe4.ms[2] = pipe4.fluidVolumes[2] * pipe4.mediums[2].d;
  pipe4.mXis[2,1] = pipe4.ms[2] * pipe4.mediums[2].Xi[1];
  pipe4.Us[2] = pipe4.ms[2] * pipe4.mediums[2].u;
  pipe4.ms[3] = pipe4.fluidVolumes[3] * pipe4.mediums[3].d;
  pipe4.mXis[3,1] = pipe4.ms[3] * pipe4.mediums[3].Xi[1];
  pipe4.Us[3] = pipe4.ms[3] * pipe4.mediums[3].u;
  pipe4.ms[4] = pipe4.fluidVolumes[4] * pipe4.mediums[4].d;
  pipe4.mXis[4,1] = pipe4.ms[4] * pipe4.mediums[4].Xi[1];
  pipe4.Us[4] = pipe4.ms[4] * pipe4.mediums[4].u;
  pipe4.ms[5] = pipe4.fluidVolumes[5] * pipe4.mediums[5].d;
  pipe4.mXis[5,1] = pipe4.ms[5] * pipe4.mediums[5].Xi[1];
  pipe4.Us[5] = pipe4.ms[5] * pipe4.mediums[5].u;
  der(pipe4.Us[1]) = pipe4.Hb_flows[1] + pipe4.Wb_flows[1] + pipe4.Qb_flows[1];
  der(pipe4.Us[2]) = pipe4.Hb_flows[2] + pipe4.Wb_flows[2] + pipe4.Qb_flows[2];
  der(pipe4.Us[3]) = pipe4.Hb_flows[3] + pipe4.Wb_flows[3] + pipe4.Qb_flows[3];
  der(pipe4.Us[4]) = pipe4.Hb_flows[4] + pipe4.Wb_flows[4] + pipe4.Qb_flows[4];
  der(pipe4.Us[5]) = pipe4.Hb_flows[5] + pipe4.Wb_flows[5] + pipe4.Qb_flows[5];
  der(pipe4.ms[1]) = pipe4.mb_flows[1];
  der(pipe4.ms[2]) = pipe4.mb_flows[2];
  der(pipe4.ms[3]) = pipe4.mb_flows[3];
  der(pipe4.ms[4]) = pipe4.mb_flows[4];
  der(pipe4.ms[5]) = pipe4.mb_flows[5];
  der(pipe4.mXis[1,1]) = pipe4.mbXi_flows[1,1];
  der(pipe4.mXis[2,1]) = pipe4.mbXi_flows[2,1];
  der(pipe4.mXis[3,1]) = pipe4.mbXi_flows[3,1];
  der(pipe4.mXis[4,1]) = pipe4.mbXi_flows[4,1];
  der(pipe4.mXis[5,1]) = pipe4.mbXi_flows[5,1];
  assert(boundary4.medium.T >= 190.0 and boundary4.medium.T <= 647.0, \"
  Temperature T is not in the allowed range
  190.0 K <= (T =\" + String(boundary4.medium.T, 6, 0, true) + \" K) <= 647.0 K
  required from medium model \\\"\" + \"Moist air\" + \"\\\".\");
  boundary4.medium.MM = 1.0 / (boundary4.medium.Xi[1] / 0.01801528 + (1.0 - boundary4.medium.Xi[1]) / 0.0289651159);
  boundary4.medium.n121 = min(Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.saturationPressure(boundary4.medium.T), 0.999 * boundary4.medium.p);
  boundary4.medium.n119 = min(boundary4.medium.n121 * 0.6219647130774989 / max(1e-13, boundary4.medium.p - boundary4.medium.n121) * (1.0 - boundary4.medium.Xi[1]), 1.0);
  boundary4.medium.n116 = max(boundary4.medium.Xi[1] - boundary4.medium.n119, 0.0);
  boundary4.medium.n117 = boundary4.medium.Xi[1] - boundary4.medium.n116;
  boundary4.medium.n118 = 1.0 - boundary4.medium.Xi[1];
  boundary4.medium.h = Modelica.Fluid.Examples.BranchingDynamicPipes.boundary4.Medium.specificEnthalpy_pTX(boundary4.medium.p, boundary4.medium.T, boundary4.medium.Xi);
  boundary4.medium.R = 287.0512249529787 * boundary4.medium.n118 / (1.0 - boundary4.medium.n116) + 461.5233290850878 * boundary4.medium.n117 / (1.0 - boundary4.medium.n116);
  boundary4.medium.u = boundary4.medium.h - boundary4.medium.R * boundary4.medium.T;
  boundary4.medium.d = boundary4.medium.p / (boundary4.medium.R * boundary4.medium.T);
  boundary4.medium.state.p = boundary4.medium.p;
  boundary4.medium.state.T = boundary4.medium.T;
  boundary4.medium.state.X[1] = boundary4.medium.X[1];
  boundary4.medium.state.X[2] = boundary4.medium.X[2];
  boundary4.medium.n120 = 0.6219647130774989 * boundary4.medium.n121 / max(1e-13, boundary4.medium.p - boundary4.medium.n121);
  boundary4.medium.x_water = boundary4.medium.Xi[1] / max(boundary4.medium.n118, 1e-13);
  boundary4.medium.phi = boundary4.medium.p / boundary4.medium.n121 * boundary4.medium.Xi[1] / (boundary4.medium.Xi[1] + 0.6219647130774989 * boundary4.medium.n118);
  boundary4.medium.Xi[1] = boundary4.medium.X[1];
  boundary4.medium.X[2] = 1.0 - boundary4.medium.Xi[1];
  assert(boundary4.medium.X[1] >= -1e-5 and boundary4.medium.X[1] <= 1.00001, \"Mass fraction X[\" + String(1, 0, true) + \"] = \" + String(boundary4.medium.X[1], 6, 0, true) + \"of substance \" + \"water\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(boundary4.medium.X[2] >= -1e-5 and boundary4.medium.X[2] <= 1.00001, \"Mass fraction X[\" + String(2, 0, true) + \"] = \" + String(boundary4.medium.X[2], 6, 0, true) + \"of substance \" + \"air\" + \"
  of medium \" + \"Moist air\" + \" is not in the range 0..1\");
  assert(boundary4.medium.p >= 0.0, \"Pressure (= \" + String(boundary4.medium.p, 6, 0, true) + \" Pa) of medium \\\"\" + \"Moist air\" + \"\\\" is negative
  (Temperature = \" + String(boundary4.medium.T, 6, 0, true) + \" K)\");
  Modelica.Fluid.Utilities.checkBoundary(\"Moist air\", {\"water\", \"air\"}, false, true, boundary4.n125, \"Boundary_pT\");
  boundary4.n124 = boundary4.T;
  boundary4.n125[1] = boundary4.X[1];
  boundary4.n125[2] = boundary4.X[2];
  boundary4.medium.p = boundary4.n123;
  boundary4.medium.T = boundary4.n124;
  boundary4.medium.Xi[1] = boundary4.n125[1];
  boundary4.ports[1].p = boundary4.medium.p;
  boundary4.ports[1].h_outflow = boundary4.medium.h;
  boundary4.ports[1].Xi_outflow[1] = boundary4.medium.Xi[1];
  ramp1.y = ramp1.offset + (if time < ramp1.startTime then 0.0 else if time < ramp1.startTime + ramp1.duration then (time - ramp1.startTime) * ramp1.height / ramp1.duration else ramp1.height);
  heat2[1].port.Q_flow = -heat2[1].Q_flow * (1.0 + heat2[1].alpha * (heat2[1].port.T - heat2[1].T_ref));
  heat2[2].port.Q_flow = -heat2[2].Q_flow * (1.0 + heat2[2].alpha * (heat2[2].port.T - heat2[2].T_ref));
  heat2[3].port.Q_flow = -heat2[3].Q_flow * (1.0 + heat2[3].alpha * (heat2[3].port.T - heat2[3].T_ref));
  heat2[4].port.Q_flow = -heat2[4].Q_flow * (1.0 + heat2[4].alpha * (heat2[4].port.T - heat2[4].T_ref));
  heat2[5].port.Q_flow = -heat2[5].Q_flow * (1.0 + heat2[5].alpha * (heat2[5].port.T - heat2[5].T_ref));
end Modelica.Fluid.Examples.BranchingDynamicPipes;
"
""

Equation mismatch: diff says:
--- /tmp/omc-rtest-omtmpuser/openmodelica/interactive-API/Obfuscation2.mos_temp8096/equations-expected2024-06-15 01:31:59.992203516 +0000
+++ /tmp/omc-rtest-omtmpuser/openmodelica/interactive-API/Obfuscation2.mos_temp8096/equations-got2024-06-15 01:32:02.896183486 +0000
@@ -4472,11 +4472,11 @@
 final parameter Real pipe1.flowModel.Re_turbulent(quantity = \"ReynoldsNumber\", unit = \"1\") = 4000.0 \"Start of turbulent regime, depending on type of flow device\";
 final parameter Boolean pipe1.flowModel.show_Res = false \"= true, if Reynolds numbers are included for plotting\";
 protected final parameter Boolean pipe1.flowModel.n21 = false \"= true, if rho_nominal is used, otherwise computed from medium\";
 protected parameter Real pipe1.flowModel.n22(quantity = \"Density\", unit = \"kg/m3\", displayUnit = \"g/cm3\", min = 0.0) = 1.1968386935810924 \"Nominal density (e.g., rho_liquidWater = 995, rho_air = 1.2)\";
 protected final parameter Boolean pipe1.flowModel.n23 = false \"= true, if mu_nominal is used, otherwise computed from medium\";
-protected parameter Real pipe1.flowModel.n24(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = 1.823286547365138e-5 \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
+protected parameter Real pipe1.flowModel.n24(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe1.flowModel.Medium.dynamicViscosity(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe1.flowModel.Medium.ThermodynamicState(101325.0, 293.15, {0.01, 0.99})) \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
 Real pipe1.flowModel.pathLengths_internal[1](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe1.flowModel.pathLengths_internal[2](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe1.flowModel.pathLengths_internal[3](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe1.flowModel.pathLengths_internal[4](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe1.flowModel.pathLengths_internal[5](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
@@ -5021,11 +5021,11 @@
 final parameter Real pipe2.flowModel.Re_turbulent(quantity = \"ReynoldsNumber\", unit = \"1\") = 4000.0 \"Start of turbulent regime, depending on type of flow device\";
 final parameter Boolean pipe2.flowModel.show_Res = false \"= true, if Reynolds numbers are included for plotting\";
 protected final parameter Boolean pipe2.flowModel.n46 = false \"= true, if rho_nominal is used, otherwise computed from medium\";
 protected parameter Real pipe2.flowModel.n47(quantity = \"Density\", unit = \"kg/m3\", displayUnit = \"g/cm3\", min = 0.0) = 1.1968386935810924 \"Nominal density (e.g., rho_liquidWater = 995, rho_air = 1.2)\";
 protected final parameter Boolean pipe2.flowModel.n48 = false \"= true, if mu_nominal is used, otherwise computed from medium\";
-protected parameter Real pipe2.flowModel.n49(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = 1.823286547365138e-5 \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
+protected parameter Real pipe2.flowModel.n49(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe2.flowModel.Medium.dynamicViscosity(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe2.flowModel.Medium.ThermodynamicState(101325.0, 293.15, {0.01, 0.99})) \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
 Real pipe2.flowModel.pathLengths_internal[1](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe2.flowModel.pathLengths_internal[2](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe2.flowModel.pathLengths_internal[3](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe2.flowModel.pathLengths_internal[4](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe2.flowModel.Res_turbulent_internal[1](quantity = \"ReynoldsNumber\", unit = \"1\") \"Re_turbulent used internally; to be defined by extending class\";
@@ -5672,11 +5672,11 @@
 final parameter Real pipe3.flowModel.Re_turbulent(quantity = \"ReynoldsNumber\", unit = \"1\") = 4000.0 \"Start of turbulent regime, depending on type of flow device\";
 final parameter Boolean pipe3.flowModel.show_Res = false \"= true, if Reynolds numbers are included for plotting\";
 protected final parameter Boolean pipe3.flowModel.n76 = false \"= true, if rho_nominal is used, otherwise computed from medium\";
 protected parameter Real pipe3.flowModel.n77(quantity = \"Density\", unit = \"kg/m3\", displayUnit = \"g/cm3\", min = 0.0) = 1.1968386935810924 \"Nominal density (e.g., rho_liquidWater = 995, rho_air = 1.2)\";
 protected final parameter Boolean pipe3.flowModel.n78 = false \"= true, if mu_nominal is used, otherwise computed from medium\";
-protected parameter Real pipe3.flowModel.n79(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = 1.823286547365138e-5 \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
+protected parameter Real pipe3.flowModel.n79(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.flowModel.Medium.dynamicViscosity(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe3.flowModel.Medium.ThermodynamicState(101325.0, 293.15, {0.01, 0.99})) \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
 Real pipe3.flowModel.pathLengths_internal[1](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe3.flowModel.pathLengths_internal[2](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe3.flowModel.pathLengths_internal[3](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe3.flowModel.pathLengths_internal[4](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe3.flowModel.pathLengths_internal[5](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
@@ -6269,11 +6269,11 @@
 final parameter Real pipe4.flowModel.Re_turbulent(quantity = \"ReynoldsNumber\", unit = \"1\") = 4000.0 \"Start of turbulent regime, depending on type of flow device\";
 final parameter Boolean pipe4.flowModel.show_Res = false \"= true, if Reynolds numbers are included for plotting\";
 protected final parameter Boolean pipe4.flowModel.n101 = false \"= true, if rho_nominal is used, otherwise computed from medium\";
 protected parameter Real pipe4.flowModel.n102(quantity = \"Density\", unit = \"kg/m3\", displayUnit = \"g/cm3\", min = 0.0) = 1.1968386935810924 \"Nominal density (e.g., rho_liquidWater = 995, rho_air = 1.2)\";
 protected final parameter Boolean pipe4.flowModel.n103 = false \"= true, if mu_nominal is used, otherwise computed from medium\";
-protected parameter Real pipe4.flowModel.n104(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = 1.823286547365138e-5 \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
+protected parameter Real pipe4.flowModel.n104(quantity = \"DynamicViscosity\", unit = \"Pa.s\", min = 0.0) = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.dynamicViscosity(Modelica.Fluid.Examples.BranchingDynamicPipes.pipe4.flowModel.Medium.ThermodynamicState(101325.0, 293.15, {0.01, 0.99})) \"Nominal dynamic viscosity (e.g., mu_liquidWater = 1e-3, mu_air = 1.8e-5)\";
 Real pipe4.flowModel.pathLengths_internal[1](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe4.flowModel.pathLengths_internal[2](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe4.flowModel.pathLengths_internal[3](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe4.flowModel.pathLengths_internal[4](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";
 Real pipe4.flowModel.pathLengths_internal[5](quantity = \"Length\", unit = \"m\") \"pathLengths used internally; to be defined by extending class\";

Equation mismatch: omc-diff says:
Line 4477: Text differs:
expected: ) = 
got:      ) = Modelica.Fluid.Examples.BranchingDynamicPipes.pipe

== 1 out of 1 tests failed [openmodelica/interactive-API/Obfuscation2.mos_temp8096, time: 3]