4

Goal

Modelica model of a pressure cooker:
I want to model how the liquid water is first heated up to the saturation point. Then water evaporates and mixes with the air. At start the liquid water has a volume of one liter and the air a volume of 100 liters.

Approach

  • The introduced heat goes only to the liquid water
  • Heat exchange between the liquid water and the moist air is only due to evaporation mass flow
  • The total volume is fixed (volume of vessel)
  • The thermal capacity of the walls is neglected and no heat losses to through the walls
  • Modelica.Media.Water.StandardWater for the liquid water
  • Modelica.Media.Air.MoistAir for the gas phase (air & vapor)
  • For now only text based model (no ports, no components...)

Code

model PressureCooker_Stackoverflow "Vater/Vapor/Air, Constant mass (no ports), constant total volume"

  extends Modelica.Icons.Example;
  import Modelica.Units.SI;

  parameter SI.HeatFlowRate Qflow = 1000;
  parameter SI.Volume Vtot = 0.100;
  parameter SI.Volume Vw_start = 0.001;
  parameter SI.AbsolutePressure p_start = 101325;
  parameter SI.Temperature T_start = 293.15;
  parameter SI.MassFraction Xw_start = 0.001;

  package Water = Modelica.Media.Water.StandardWater;
  Water.BaseProperties water(preferredMediumStates = true);
  SI.Mass Mw = Vw * water.d;
  SI.Energy Uw =  Mw * water.u;
  Water.SpecificEnthalpy hb = Water.bubbleEnthalpy(water.sat);
  Water.SpecificEnthalpy hd = Water.dewEnthalpy(water.sat);
  Water.SpecificEnthalpy dhEvap = hd - hb;
  SI.Volume Vw;
  SI.Power WflowW = -p * der(Vw);

  package Air = Modelica.Media.Air.MoistAir;
  Air.BaseProperties air(preferredMediumStates = true);
  SI.Mass Ma = Va * air.d;
  SI.Mass MXv = Ma * air.Xi[1];
  SI.Energy Ua = Ma * air.u;
  SI.Volume Va;
  SI.Power WflowA = -p * der(Va);

  SI.MassFlowRate MflowEvap;
  Water.EnthalpyFlowRate HflowEvap;
  Water.AbsolutePressure p;

  // Variables for plotting, not needed for modeling
  SI.Mass Mtot = Mw + Ma;
  Real x = max(0, min(1, (water.h - hb) / (hd - hb)));
  Real dxdt = if (x>0 and x<1) then der(x) else 0;

equation 
  Vtot = Va + Vw;
  water.p = p;
  air.p = p;

  if noEvent(water.h<=hb) then
    MflowEvap = 0;
    HflowEvap = 0;
  else
    MflowEvap = (Qflow + WflowW)/dhEvap;
    HflowEvap = MflowEvap * hd;
  end if;

  der(Mw)  = -MflowEvap;
  der(Uw)  = Qflow + WflowW - HflowEvap;
  der(Ma) = MflowEvap;
  der(MXv) = MflowEvap;
  der(Ua) =  WflowA + HflowEvap; //- QflowLoad;

initial equation 
  p = p_start;
  water.T = T_start;
  air.T = T_start;
  air.Xi[1] = Xw_start;
  Vw = Vw_start;

  annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)),
    experiment(
      StopTime=3000,
      __Dymola_NumberOfIntervals=10000,
      __Dymola_Algorithm="Dassl"));
end PressureCooker_Stackoverflow;

Problem

I tried a lot of different appoaches. This one seems to simulate, but as soon as the water starts to evaporate there is Chattering: enter image description here

Question

How should one model a pressure cooker in Modelica?
How would you model the evaporation rate?
Which solution is the best one, to avoid problems when crossing the saturation line?

T. Sergi
  • 203
  • 2
  • 9

0 Answers0