Buildings.Fluid.MixingVolumes.Examples

Collection of models that illustrate model use and test models

Information


This package contains examples for the use of models
that can be found in 
Buildings.Fluid.MixingVolumes.

Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
MixingVolume  
MixingVolumeDryAir  
MixingVolumeInitialization  
MixingVolumeMoistAir  


Buildings.Fluid.MixingVolumes.Examples.MixingVolume

Buildings.Fluid.MixingVolumes.Examples.MixingVolume

Modelica definition

model MixingVolume
  import Buildings;

// package Medium = Buildings.Media.IdealGases.SimpleAir;
 package Medium = Buildings.Media.PerfectGases.MoistAir;
 //  package Medium = Modelica.Media.Air.MoistAir;
    Modelica.Blocks.Sources.Ramp P(
    duration=0.5,
    startTime=0.5,
    height=-10,
    offset=101330);
  Buildings.Fluid.Sources.Boundary_pT sou(             redeclare package Medium
      = Medium, T=293.15,
    use_p_in=true,
    nPorts=3);
  Buildings.Fluid.Sources.Boundary_pT sin(             redeclare package Medium
      = Medium,
    nPorts=3,
    use_p_in=false,
    p=101325,
    T=283.15);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res1(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
  MixingVolumes.MixingVolume vol1(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res2(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res11(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res12(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
  Modelica.Fluid.Vessels.ClosedVolume vol(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2,
    use_portsData=false,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial);
  Buildings.Utilities.Diagnostics.AssertEquality assertEquality;
  Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat(redeclare package Medium
      = Medium) "Enthalpy flow rate";
  Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat1(redeclare package Medium
      = Medium) "Enthalpy flow rate";
  Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol2(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res21(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res22(
    redeclare each package Medium = Medium,
    from_dp=true,
    m_flow_nominal=2,
    dp_nominal=2.5);
  Buildings.Utilities.Diagnostics.AssertEquality assertEquality1;
  Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat2(redeclare package Medium
      = Medium) "Enthalpy flow rate";
    Modelica.Blocks.Sources.Constant zero(k=0);
    Modelica.Blocks.Sources.Constant TLiq(k=283.15);
  inner Modelica.Fluid.System system;
equation 
  connect(P.y, sou.p_in);
  connect(res2.port_a, entFloRat.port_b);
  connect(entFloRat2.H_flow, assertEquality1.u2);
  connect(zero.y, vol2.mWat_flow);
  connect(TLiq.y, vol2.TWat);
  connect(sou.ports[1], res1.port_a);
  connect(sou.ports[2], res11.port_a);
  connect(sou.ports[3], res21.port_a);
  connect(sin.ports[1], res2.port_b);
  connect(sin.ports[2], res12.port_b);
  connect(res22.port_b, sin.ports[3]);
  connect(res1.port_b, vol.ports[1]);
  connect(vol.ports[2], entFloRat.port_a);
  connect(res11.port_b, vol1.ports[1]);
  connect(vol1.ports[2], entFloRat1.port_a);
  connect(res21.port_b, vol2.ports[1]);
  connect(vol2.ports[2], entFloRat2.port_a);
  connect(entFloRat2.port_b, res22.port_a);
  connect(entFloRat1.port_b, res12.port_a);
  connect(entFloRat.H_flow, assertEquality.u1);
  connect(entFloRat.H_flow, assertEquality1.u1);
  connect(entFloRat1.H_flow, assertEquality.u2);
end MixingVolume;

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeDryAir

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeDryAir

Modelica definition

model MixingVolumeDryAir
  import Buildings;

 package Medium = Modelica.Media.Air.SimpleAir(T_min=Modelica.SIunits.Conversions.from_degC(-50)) 
    "Medium in the component";

    Modelica.Blocks.Sources.Ramp P(
    height=-10,
    offset=101330,
    duration=300,
    startTime=150);
  Buildings.Fluid.Sources.Boundary_pT sou(             redeclare package Medium
      = Medium,
    nPorts=2,
    use_p_in=true,
    p=Medium.p_default,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sin(             redeclare package Medium
      = Medium,
    use_p_in=false,
    p=101325,
    T=283.15,
    nPorts=2);
  MixingVolumes.MixingVolume vol1(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res11(
    redeclare each package Medium = Medium,
    dp_nominal=5,
    from_dp=true,
    m_flow_nominal=2);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res12(
    redeclare each package Medium = Medium,
    dp_nominal=5,
    from_dp=true,
    m_flow_nominal=2);
  Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat1(redeclare package Medium
      = Medium) "Enthalpy flow rate";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res21(
    redeclare each package Medium = Medium,
    dp_nominal=5,
    from_dp=true,
    m_flow_nominal=2);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res22(
    redeclare each package Medium = Medium,
    dp_nominal=5,
    from_dp=true,
    m_flow_nominal=2);
  Buildings.Utilities.Diagnostics.AssertEquality assertEquality1(startTime=0);
  Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat2(redeclare package Medium
      = Medium) "Enthalpy flow rate";
    Modelica.Blocks.Sources.Constant zero(k=0);
    Modelica.Blocks.Sources.Constant TLiq(k=283.15);
  inner Modelica.Fluid.System system;
  Buildings.Fluid.MixingVolumes.MixingVolumeDryAir vol2(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2);
equation 
  connect(res12.port_a, entFloRat1.port_b);
  connect(res22.port_a, entFloRat2.port_b);
  connect(entFloRat2.H_flow, assertEquality1.u2);
  connect(res11.port_b, vol1.ports[1]);
  connect(entFloRat1.port_a, vol1.ports[2]);
  connect(res21.port_b, vol2.ports[1]);
  connect(vol2.ports[2], entFloRat2.port_a);
  connect(zero.y, vol2.mWat_flow);
  connect(TLiq.y, vol2.TWat);
  connect(entFloRat1.H_flow, assertEquality1.u1);
  connect(sou.ports[1], res11.port_a);
  connect(sou.ports[2], res21.port_a);
  connect(res12.port_b, sin.ports[1]);
  connect(res22.port_b, sin.ports[2]);
  connect(P.y, sou.p_in);
end MixingVolumeDryAir;

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeInitialization

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeInitialization

Modelica definition

model MixingVolumeInitialization

 package Medium = Modelica.Media.Air.SimpleAir;
 //package Medium = Buildings.Media.PerfectGases.MoistAir;
 //package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir;

  Buildings.Fluid.Sources.Boundary_pT sou1(redeclare package Medium =
        Medium,
    p=101330,
    nPorts=1,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sin1(redeclare package Medium =
        Medium,
    p=101320,
    nPorts=1,
    T=293.15);
  Modelica.Fluid.Pipes.StaticPipe pipe1(
    redeclare package Medium = Medium,
    length=1,
    diameter=0.25);
  Modelica.Fluid.Pipes.StaticPipe pipe2(
    redeclare package Medium = Medium,
    length=1,
    diameter=0.25);
  MixingVolumes.MixingVolume vol1(
    redeclare package Medium = Medium,
    V=0.1,
    nPorts=2);
  inner Modelica.Fluid.System system;
equation 
  connect(sou1.ports[1], pipe1.port_a);
  connect(pipe1.port_b, vol1.ports[1]);
  connect(vol1.ports[2], pipe2.port_a);
  connect(pipe2.port_b, sin1.ports[1]);
end MixingVolumeInitialization;

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir

Modelica definition

model MixingVolumeMoistAir
  import Buildings;

// package Medium = Buildings.Media.PerfectGases.MoistAir;
   package Medium = Buildings.Media.GasesPTDecoupled.MoistAir;
  // package Medium = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;

  Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol1(
    redeclare package Medium = Medium,
    V=1,
    nPorts=2,
    use_HeatTransfer=true) "Volume";
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TSen 
    "Temperature sensor";
  Modelica.Blocks.Sources.Constant XSet(k=0.005) 
    "Set point for water mass fraction";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo;
  Modelica.Blocks.Sources.Constant TSet(k=273.15 + 20) 
    "Set point for temperature";
  Buildings.Utilities.Psychrometrics.pW_X humRat(           use_p_in=false) 
    "Conversion from humidity ratio to partial water vapor pressure";
  Buildings.Utilities.Psychrometrics.Tdp_pW dewPoi "Dew point temperature";
  Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor;
  Modelica.Blocks.Continuous.Integrator QSen "Sensible heat transfer";
  Modelica.Blocks.Continuous.Integrator QWat "Enthalpy of extracted water";
  Modelica.Blocks.Sources.RealExpression HWat_flow(y=vol1.HWat_flow) 
    "MoistAir heat flow rate";
  Buildings.Fluid.Sources.MassFlowSource_T sou(
    redeclare package Medium = Medium,
    nPorts=1,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sin(        redeclare package Medium =
        Medium,
    nPorts=1,
    T=293.15);
  Buildings.Controls.Continuous.LimPID PI(
    Ni=0.1,
    yMax=1000,
    k=1,
    Ti=1,
    Td=1,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    wd=0);
  Buildings.Controls.Continuous.LimPID PI1(
    Ni=0.1,
    Ti=1,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=10,
    yMax=1,
    yMin=-1,
    Td=1);
  Buildings.Fluid.Sensors.MassFlowRate mIn_flow(redeclare package Medium =
        Medium);
  Buildings.Fluid.Sensors.MassFlowRate mOut_flow(redeclare package Medium =
        Medium);
  Modelica.Blocks.Math.Add dM_flow(k2=-1);
  Modelica.Blocks.Math.Gain gai(k=200);
  Modelica.Blocks.Math.Gain gai1(k=0.1);
  inner Modelica.Fluid.System system;
equation 
  connect(preHeaFlo.port, heatFlowSensor.port_a);
  connect(heatFlowSensor.Q_flow, QSen.u);
  connect(HWat_flow.y,QWat. u);
  connect(TSet.y, PI.u_s);
  connect(TSen.T, PI.u_m);
  connect(XSet.y, PI1.u_s);
  connect(mOut_flow.m_flow, dM_flow.u1);
  connect(mIn_flow.m_flow, dM_flow.u2);
  connect(gai.y, preHeaFlo.Q_flow);
  connect(PI1.y, gai1.u);
  connect(gai1.y, vol1.mWat_flow);
  connect(dewPoi.T, vol1.TWat);
  connect(vol1.X_w, PI1.u_m);
  connect(vol1.X_w, humRat.X_w);
  connect(sou.ports[1], mIn_flow.port_a);
  connect(mOut_flow.port_b, sin.ports[1]);
  connect(heatFlowSensor.port_b, vol1.heatPort);
  connect(TSen.port, vol1.heatPort);
  connect(mIn_flow.port_b, vol1.ports[1]);
  connect(mOut_flow.port_a, vol1.ports[2]);
  connect(PI.y, gai.u);
  connect(humRat.p_w, dewPoi.p_w);
end MixingVolumeMoistAir;

HTML-documentation generated by Dymola Thu Jun 24 16:54:52 2010.