Name | Description |
---|---|
BaseClasses | Package with base classes for mixing volumes |
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 conatin water |
This model represents the same physics as Modelica_Fluid.Volumes.MixingVolume, but it allows to have more than two fluid ports. This is convenient for modeling the room volume in a building energy simulation since rooms often have more than two fluid connections, such as an HVAC inlet, outlet and a leakage flow to other rooms or the outside. If a fluid port is connected twice, the model will terminate the simulation with an error message.
The thermal port need not be connected, but can have any number of connections.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | V | Volume [m3] | |
Integer | nP | 2 | Number of ports |
Boolean | steadyState | false | Set to true for steady state model |
Initialization | |||
Temp | initType | Types.Init.NoInit | Initialization option |
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 Medium.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] |
Type | Name | Description |
---|---|---|
FluidPort_a | port[nP] | Fluid port |
HeatPort_a | thermalPort | Thermal port |
model MixingVolume "Mixing volume with inlet and outlet ports (flow reversal is allowed)" extends BaseClasses.PartialMixingVolume; equation // Mass and energy balance if steadyState then 0 = sum(port[i].m_flow for i in 1:nP); zeros(Medium.nXi) = sum(port[i].mXi_flow for i in 1:nP); 0 = sum(port[i].H_flow for i in 1:nP) + Qs_flow + Ws_flow; else der(m) = sum(port[i].m_flow for i in 1:nP); der(mXi) = sum(port[i].mXi_flow for i in 1:nP); der(U) = sum(port[i].H_flow for i in 1:nP) + Qs_flow + Ws_flow; end if; // /* der(m) */ 0 = sum(port[i].m_flow for i in 1:nP); // /* der(mXi) */ zeros(Medium.nXi) = sum(port[i].mXi_flow for i in 1:nP); // /* der(U) */ 0 = sum(port[i].H_flow for i in 1:nP) + Qs_flow + Ws_flow; end MixingVolume;
This model represents the same physics as Buildings.Fluids.MixingVolumes.MixingVolume, but in addition, it allows adding (or subtracting) water in liquid phase, which causes a change in enthalpy and species concentration. The water flow rate is assumed to be added or extracted at the temperature of the input port TWat, or if this port is not connected at the medium default temperature as returned by Medium.T_default.
Note that this model can only be used with medium models that include water as a substance. In particular, the medium model need to provide 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 instead the model Buildings.Fluids.MixingVolumes.MixingVolumeDryAir.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | V | Volume [m3] | |
Integer | nP | 2 | Number of ports |
Boolean | steadyState | false | Set to true for steady state model |
Initialization | |||
Temp | initType | Types.Init.NoInit | Initialization option |
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 Medium.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] |
Type | Name | Description |
---|---|---|
FluidPort_a | port[nP] | Fluid port |
HeatPort_a | thermalPort | Thermal port |
input RealInput | mWat_flow | Water flow rate added into the medium |
input RealInput | TWat | Temperature of liquid that is drained from or injected into volume |
output RealOutput | XWat | 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 XWat = 0; end MixingVolumeDryAir;
This model represents the same physics as Buildings.Fluids.MixingVolumes.MixingVolume, but in addition, it allows adding (or subtracting) water in liquid phase, which causes a change in enthalpy and species concentration. The water flow rate is assumed to be added or extracted at the temperature of the input port TWat, or if this port is not connected at the medium default temperature as returned by Medium.T_default.
Note that this model can only be used with medium models that include water as a substance. In particular, the medium model need to provide 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 instead the model Buildings.Fluids.MixingVolumes.MixingVolumeDryAir.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | V | Volume [m3] | |
Integer | nP | 2 | Number of ports |
Boolean | steadyState | false | Set to true for steady state model |
Initialization | |||
Temp | initType | Types.Init.NoInit | Initialization option |
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 Medium.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] |
Type | Name | Description |
---|---|---|
FluidPort_a | port[nP] | Fluid port |
HeatPort_a | thermalPort | Thermal port |
input RealInput | mWat_flow | Water flow rate added into the medium |
input RealInput | TWat | Temperature of liquid that is drained from or injected into volume |
output RealOutput | XWat | Species composition of medium |
model MixingVolumeMoistAir "Mixing volume with heat port for latent heat exchange, to be used with media that conatin 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; 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; for i in 1:Medium.nXi loop mXi_flow[i] = if ( i == Medium.Water) then mWat_flow else 0; end for; end if; // Medium species concentration XWat = medium.X[Medium.Water]; end MixingVolumeMoistAir;