This package contains models for completely mixed volumes.
Optionally, heat can be added to the volume by setting the
parameter use_HeatTransfer
to true
.
For most situations, the model Buildings.Fluid.MixingVolumes.MixingVolume should be used. The other models are only of interest if water should be added to or subtracted from the fluid volume, such as needed in a dynamic model of a coil with water vapor condensation.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Name | Description |
---|---|
MixingVolume | Mixing volume with inlet and outlet ports (flow reversal is allowed) |
MixingVolumeDryAir | Mixing volume with heat port for latent heat exchange, to be used with dry air |
MixingVolumeMoistAir | Mixing volume with heat port for latent heat exchange, to be used with media that contain water |
Examples | Collection of models that illustrate model use and test models |
BaseClasses | Package with base classes for Buildings.Fluid.MixingVolumes |
heatPort
.
Extends from Buildings.Fluid.Interfaces.PartialLumpedVolume (Lumped volume with mass and energy balance), Buildings.BaseClasses.BaseIcon (Base icon).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | fluidVolume | V | Volume [m3] |
Volume | V | Volume [m3] | |
Assumptions | |||
Dynamics | |||
Dynamics | energyDynamics | system.energyDynamics | Formulation of energy balance |
Dynamics | massDynamics | system.massDynamics | Formulation of mass balance |
Dynamics | substanceDynamics | massDynamics | Formulation of substance balance |
Dynamics | traceDynamics | massDynamics | Formulation of trace substance balance |
Heat transfer | |||
Boolean | use_HeatTransfer | false | = true to use the HeatTransfer model |
Initialization | |||
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Boolean | use_T_start | true | = true, use T_start, otherwise h_start |
Temperature | T_start | if use_T_start then system.T... | Start value of temperature [K] |
SpecificEnthalpy | h_start | if use_T_start then Medium.s... | Start value of specific enthalpy [J/kg] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
ExtraProperty | C_start[Medium.nC] | fill(0, Medium.nC) | Start value of trace substances |
ExtraProperty | C_nominal[Medium.nC] | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
Type | Name | Description |
---|---|---|
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
HeatPort_a | heatPort |
model MixingVolume "Mixing volume with inlet and outlet ports (flow reversal is allowed)" extends Buildings.Fluid.Interfaces.PartialLumpedVolume( m(start=V*rho_nominal, fixed=false), final fluidVolume = V, mC(nominal=V*rho_nominal*C_nominal)); extends Buildings.BaseClasses.BaseIcon; import Modelica.Constants.pi; // Port definitions parameter Integer nPorts=0 "Number of ports";Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts]( redeclare each package Medium = Medium) "Fluid inlets and outlets"; // parameter Modelica.SIunits.MassFlowRate m_flow_small(min=0)=system.m_flow_small // "Regularization range at zero mass flow rate" // annotation(Dialog(tab="Advanced", group="Port properties", enable=stiffCharacteristicForEmptyPort)); 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 constrainedby Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.PartialVesselHeatTransfer "Wall heat transfer";HeatTransfer heatTransfer( redeclare final package Medium = Medium, surfaceAreas={4*pi*(3/4*V/pi)^(2/3)}, final n=1, final states = {medium.state}, final use_k = use_HeatTransfer); Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort if use_HeatTransfer; parameter Modelica.SIunits.Volume V "Volume"; protected parameter Modelica.SIunits.Density rho_nominal=Medium.density( Medium.setState_pTX( T=T_start, p=p_start, X=X_start[1:Medium.nXi])) "Density, used to compute fluid mass"; equation // 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; // actual definition of port variables for i in 1:nPorts loop // fluid flow through ports // regular operation: fluidLevel is above ports[i] // Note: >= covers default values of zero as well ports[i].p = medium.p; ports[i].h_outflow = medium.h; ports[i].Xi_outflow = medium.Xi; ports[i].C_outflow = C; 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; mb_flow = sum(ports.m_flow); mbXi_flow = sum_ports_mXi_flow; mbC_flow = sum_ports_mC_flow; Hb_flow = sum(ports_H_flow); Qb_flow = heatTransfer.Q_flows[1];connect(heatPort, heatTransfer.heatPorts[1]); end MixingVolume;
This model has the same ports as
Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir.
However, there is no mass exchange with the medium other than through the port
ports
.
For media that do provide water as a species, use the model
Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir to add
or subtract moisture using a signal that is connected to the port
mWat_flow
and TWat
.
Extends from BaseClasses.PartialMixingVolumeWaterPort (Partial mixing volume that allows adding or subtracting water vapor).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | V | Volume [m3] | |
Assumptions | |||
Dynamics | |||
Dynamics | energyDynamics | system.energyDynamics | Formulation of energy balance |
Dynamics | massDynamics | system.massDynamics | Formulation of mass balance |
Dynamics | substanceDynamics | massDynamics | Formulation of substance balance |
Dynamics | traceDynamics | massDynamics | Formulation of trace substance balance |
Heat transfer | |||
Boolean | use_HeatTransfer | false | = true to use the HeatTransfer model |
replaceable model HeatTransfer | Modelica.Fluid.Vessels.BaseC... | Wall heat transfer | |
Initialization | |||
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Boolean | use_T_start | true | = true, use T_start, otherwise h_start |
Temperature | T_start | if use_T_start then system.T... | Start value of temperature [K] |
SpecificEnthalpy | h_start | if use_T_start then Medium.s... | Start value of specific enthalpy [J/kg] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
ExtraProperty | C_start[Medium.nC] | fill(0, Medium.nC) | Start value of trace substances |
ExtraProperty | C_nominal[Medium.nC] | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
Type | Name | Description |
---|---|---|
FluidPorts_b | ports[nPorts] | Fluid outlets |
HeatPort_a | heatPort | |
input RealInput | mWat_flow | Water flow rate added into the medium [kg/s] |
input RealInput | TWat | Temperature of liquid that is drained from or injected into volume [K] |
output RealOutput | X_w | Species composition of medium |
model MixingVolumeDryAir "Mixing volume with heat port for latent heat exchange, to be used with dry air" extends BaseClasses.PartialMixingVolumeWaterPort; equation if cardinality(mWat_flow) == 0 then mWat_flow = 0; end if; if cardinality(TWat) == 0 then TWat = Medium.T_default; end if; HWat_flow = 0; mXi_flow = zeros(Medium.nXi); // Assign output port X_w = 0;end MixingVolumeDryAir;
This model represents the same physics as
Buildings.Fluid.MixingVolumes.MixingVolume, but in addition, it allows
adding or subtracting water in liquid phase.
The mass flow rate of the added or subtracted water is
specified at the port mWat_flow
.
The water flow rate is assumed to be added or subtracted at the
temperature of the input port TWat
, or
if this port is not connected, at the medium default temperature as
defined by Medium.T_default
.
Adding water causes a change in
enthalpy and species concentration in the volume.
Note that this model can only be used with medium models that include water
as a substance. In particular, the medium model needs to implement the function
enthalpyOfLiquid(T)
and the integer variable Water
that
contains the index to the water substance. For medium that do not provide this
functionality, use
Buildings.Fluid.MixingVolumes.MixingVolumeDryAir.
Extends from BaseClasses.PartialMixingVolumeWaterPort (Partial mixing volume that allows adding or subtracting water vapor).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | V | Volume [m3] | |
Assumptions | |||
Dynamics | |||
Dynamics | energyDynamics | system.energyDynamics | Formulation of energy balance |
Dynamics | massDynamics | system.massDynamics | Formulation of mass balance |
Dynamics | substanceDynamics | massDynamics | Formulation of substance balance |
Dynamics | traceDynamics | massDynamics | Formulation of trace substance balance |
Heat transfer | |||
Boolean | use_HeatTransfer | false | = true to use the HeatTransfer model |
replaceable model HeatTransfer | Modelica.Fluid.Vessels.BaseC... | Wall heat transfer | |
Initialization | |||
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Boolean | use_T_start | true | = true, use T_start, otherwise h_start |
Temperature | T_start | if use_T_start then system.T... | Start value of temperature [K] |
SpecificEnthalpy | h_start | if use_T_start then Medium.s... | Start value of specific enthalpy [J/kg] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
ExtraProperty | C_start[Medium.nC] | fill(0, Medium.nC) | Start value of trace substances |
ExtraProperty | C_nominal[Medium.nC] | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
Type | Name | Description |
---|---|---|
FluidPorts_b | ports[nPorts] | Fluid outlets |
HeatPort_a | heatPort | |
input RealInput | mWat_flow | Water flow rate added into the medium [kg/s] |
input RealInput | TWat | Temperature of liquid that is drained from or injected into volume [K] |
output RealOutput | X_w | Species composition of medium |
model MixingVolumeMoistAir "Mixing volume with heat port for latent heat exchange, to be used with media that contain water" extends BaseClasses.PartialMixingVolumeWaterPort; // redeclare Medium with a more restricting base class. This improves the error // message if a user selects a medium that does not contain the function // enthalpyOfLiquid(.) replaceable package Medium = Modelica.Media.Interfaces.PartialCondensingGases; protected parameter Integer i_w(min=1, fixed=false) "Index for water substance"; parameter Real s[Medium.nXi](fixed=false) "Vector with zero everywhere except where species is"; initial algorithm i_w:= -1; if cardinality(mWat_flow) > 0 then for i in 1:Medium.nXi loop if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i], string2="Water", caseSensitive=false) then i_w := i; s[i] :=1; else s[i] :=0; end if; end for; assert(i_w > 0, "Substance 'water' is not present in medium '" + Medium.mediumName + "'.\n" + "Check medium model."); end if; equation if cardinality(mWat_flow) == 0 then mWat_flow = 0; HWat_flow = 0; mXi_flow = zeros(Medium.nXi); else if cardinality(TWat) == 0 then HWat_flow = mWat_flow * Medium.enthalpyOfLiquid(Medium.T_default); else HWat_flow = mWat_flow * Medium.enthalpyOfLiquid(TWat); end if; // We obtain the substance concentration with a vector multiplication // because Dymola 7.4 cannot find the derivative in the model // Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl // if we set mXi_flow[i] = if ( i == i_w) then mWat_flow else 0; mXi_flow = mWat_flow * s; end if; // Medium species concentration X_w = s*medium.Xi;end MixingVolumeMoistAir;
Type | Name | Default | Description |
---|---|---|---|
Ambient | |||
CoefficientOfHeatTransfer | k | 0 | Heat transfer coefficient to ambient [W/(m2.K)] |
Temperature | T_ambient | system.T_ambient | Ambient temperature [K] |
Internal Interface | |||
replaceable package Medium | PartialMedium | Medium in the component | |
Integer | n | 1 | Number of heat transfer segments |
Boolean | use_k | false | = true to use k value for thermal isolation |
Type | Name | Description |
---|---|---|
HeatPorts_a | heatPorts[n] | Heat port to component boundary |
replaceable model HeatTransfer = Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer constrainedby Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.PartialVesselHeatTransfer "Wall heat transfer";