Buildings.Fluid.MixingVolumes.BaseClasses

Package with base classes for mixing volumes

Package Content

NameDescription
Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort PartialMixingVolumeWaterPort Partial mixing volume that allows adding or subtracting water vapor


Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort

Partial mixing volume that allows adding or subtracting water vapor

Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort

Information


Model for an ideally mixed fluid volume with nP ports and the ability 
to store mass and energy. The volume is fixed. 

This model represents the same physics as Modelica.Fluid.Vessels.Volume but in addition, it allows to connect signals for the water exchanged with the volume. The model is partial in order to allow a submodel that can be used with media that contain water as a substance, and a submodel that can be used with dry air. Having separate models is required because calls to the medium property function enthalpyOfLiquid results in a linker error if a medium such as Modelica.Media.Air.SimpleAir is used that does not implement this function.


Extends from Modelica.Fluid.Interfaces.PartialLumpedVolume (Lumped volume with mass and energy balance).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumefluidVolumeVVolume [m3]
VolumeV Volume [m3]
Assumptions
Dynamics
DynamicsenergyDynamicssystem.energyDynamicsFormulation of energy balance
DynamicsmassDynamicssystem.massDynamicsFormulation of mass balance
Heat transfer
Booleanuse_HeatTransferfalse= true to use the HeatTransfer model
Initialization
AbsolutePressurep_startsystem.p_startStart value of pressure [Pa]
Booleanuse_T_starttrue= true, use T_start, otherwise h_start
TemperatureT_startif use_T_start then system.T...Start value of temperature [K]
SpecificEnthalpyh_startif use_T_start then Medium.s...Start value of specific enthalpy [J/kg]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts]Fluid outlets
HeatPort_aheatPort 
input RealInputmWat_flowWater flow rate added into the medium [kg/s]
input RealInputTWatTemperature of liquid that is drained from or injected into volume [K]
output RealOutputXWatSpecies composition of medium

Modelica definition

partial model PartialMixingVolumeWaterPort 
  "Partial mixing volume that allows adding or subtracting water vapor"
  extends Modelica.Fluid.Interfaces.PartialLumpedVolume(fluidVolume = V, m(start=V*rho_nominal, fixed=false));

// declarations similar than in PartialLumpedVolumePorts from Modelica.Fluid
  // Port definitions
  parameter Integer nPorts(min=1)=1 "Number of ports";
  Modelica.Fluid.Interfaces.FluidPorts_b ports[nPorts](
      redeclare each package Medium = Medium) "Fluid outlets";
  Medium.AbsolutePressure ports_p_static 
    "static pressure at the ports, inside the volume";

  Medium.EnthalpyFlowRate ports_H_flow[nPorts];
  Medium.MassFlowRate ports_mXi_flow[nPorts,Medium.nXi];
  Medium.MassFlowRate[Medium.nXi] sum_ports_mXi_flow 
    "Substance mass flows through ports";
  Medium.ExtraPropertyFlowRate ports_mC_flow[nPorts,Medium.nC];
  Medium.ExtraPropertyFlowRate[Medium.nC] sum_ports_mC_flow 
    "Trace substance mass flows through ports";

  // Heat transfer through boundary
  parameter Boolean use_HeatTransfer = false 
    "= true to use the HeatTransfer model";
  replaceable model HeatTransfer = 
      Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer (
       surfaceAreas={4*Modelica.Constants.pi*(3/4*V/Modelica.Constants.pi)^(2/3)}) 
    constrainedby 
    Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.PartialVesselHeatTransfer 
    "Wall heat transfer";
  HeatTransfer heatTransfer(
    redeclare final package Medium = Medium,
    final n=1,
    final states = {medium.state},
    final use_k = use_HeatTransfer);
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort if use_HeatTransfer;

 // additional declarations
  Modelica.Blocks.Interfaces.RealInput mWat_flow(final quantity="MassFlowRate",
                                                 final unit = "kg/s") 
    "Water flow rate added into the medium";
  Modelica.Blocks.Interfaces.RealInput TWat(final quantity="ThermodynamicTemperature",
                                            final unit = "K", displayUnit = "degC", min=260) 
    "Temperature of liquid that is drained from or injected into volume";
  Modelica.Blocks.Interfaces.RealOutput XWat "Species composition of medium";
  Medium.MassFlowRate mXi_flow[Medium.nXi] 
    "Mass flow rates of independent substances added to the medium";
  Modelica.SIunits.HeatFlowRate HWat_flow 
    "Enthalpy flow rate of extracted water";
   parameter Modelica.SIunits.Volume V "Volume";
protected 
   parameter Medium.ThermodynamicState sta0 = Medium.setState_pTX(T=T_start,
         p=p_start, X=X_start[1:Medium.nXi]);
   parameter Modelica.SIunits.Density rho_nominal=Medium.density(sta0) 
    "Density, used to compute fluid mass";
equation 
   assert(not (energyDynamics<>Modelica.Fluid.Types.Dynamics.SteadyState and 
        massDynamics==Modelica.Fluid.Types.Dynamics.SteadyState) or Medium.singleState,
          "Bad combination of dynamics options and Medium not conserving mass if fluidVolume is fixed.");

  ports_p_static = medium.p;

  connect(heatPort, heatTransfer.heatPorts[1]);
  Wb_flow = 0;

  mb_flow = sum(ports.m_flow) + mWat_flow 
    "eqn. differs from Modelica.Fluid implementation";
  mbXi_flow = sum_ports_mXi_flow + mXi_flow 
    "eqn. differs from Modelica.Fluid implementation";
  mbC_flow  = sum_ports_mC_flow;
  Hb_flow = sum(ports_H_flow) + HWat_flow 
    "eqn. differs from Modelica.Fluid implementation";
  Qb_flow = heatTransfer.Q_flows[1];

  // Only one connection allowed to a port to avoid unwanted ideal mixing
  for i in 1:nPorts loop
    assert(cardinality(ports[i]) <= 1,"
each ports[i] of volume can at most be connected to one component.
If two or more connections are present, ideal mixing takes
place with these connections, which is usually not the intention
of the modeller. Increase nPorts to add an additional port.
");
  end for;

  // Boundary conditions
  for i in 1:nPorts loop
    ports[i].p = ports_p_static;
  end for;
  ports.h_outflow = fill(medium.h,   nPorts);
  ports.Xi_outflow = fill(medium.Xi, nPorts);
  ports.C_outflow  = fill(C,         nPorts);

  for i in 1:nPorts loop
    ports_H_flow[i] = ports[i].m_flow * actualStream(ports[i].h_outflow) 
      "Enthalpy flow";
    ports_mXi_flow[i,:] = ports[i].m_flow * actualStream(ports[i].Xi_outflow) 
      "Component mass flow";
    ports_mC_flow[i,:]  = ports[i].m_flow * actualStream(ports[i].C_outflow) 
      "Trace substance mass flow";
  end for;
  for i in 1:Medium.nXi loop
    sum_ports_mXi_flow[i] = sum(ports_mXi_flow[:,i]);
  end for;
  for i in 1:Medium.nC loop
    sum_ports_mC_flow[i]  = sum(ports_mC_flow[:,i]);
  end for;

end PartialMixingVolumeWaterPort;

Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort.HeatTransfer Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort.HeatTransfer

Wall heat transfer

Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort.HeatTransfer

Parameters

TypeNameDefaultDescription
AreasurfaceAreas[n]{4*Modelica.Constants.pi*(3/...Heat transfer areas [m2]
Ambient
CoefficientOfHeatTransferk0Heat transfer coefficient to ambient [W/(m2.K)]
TemperatureT_ambientsystem.T_ambientAmbient temperature [K]
Internal Interface
replaceable package MediumPartialMediumMedium in the component
Integern1Number of heat transfer segments
Booleanuse_kfalse= true to use k value for thermal isolation

Connectors

TypeNameDescription
HeatPorts_aheatPorts[n]Heat port to component boundary

Modelica definition

replaceable model HeatTransfer = 
    Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer (
     surfaceAreas={4*Modelica.Constants.pi*(3/4*V/Modelica.Constants.pi)^(2/3)}) 
  constrainedby 
  Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.PartialVesselHeatTransfer 
  "Wall heat transfer";

HTML-documentation generated by Dymola Tue Sep 29 08:08:56 2009.