This package contains base classes that are used to construct the models in Buildings.Fluid.MixingVolumes.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Name | Description |
---|---|
PartialMixingVolumeWaterPort | Partial mixing volume that allows adding or subtracting water vapor |
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 Buildings.Fluid.Interfaces.PartialLumpedVolume (Lumped volume with mass and energy balance).
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 |
---|---|---|
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 |
partial model PartialMixingVolumeWaterPort "Partial mixing volume that allows adding or subtracting water vapor" extends Buildings.Fluid.Interfaces.PartialLumpedVolume(fluidVolume = V, m(start=V*rho_nominal, fixed=false), mC(nominal=V*rho_nominal*C_nominal)); // declarations similar than in PartialLumpedVolumePorts from Modelica.Fluid // Port definitions parameter Integer nPorts=0 "Number of ports";Modelica.Fluid.Interfaces.FluidPorts_b ports[nPorts]( redeclare each package Medium = Medium) "Fluid outlets"; 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 declarationsModelica.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="Temperature", final unit = "K", displayUnit = "degC", min=260) "Temperature of liquid that is drained from or injected into volume"; Modelica.Blocks.Interfaces.RealOutput X_w "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 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 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.");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 = medium.p; 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;
Type | Name | Default | Description |
---|---|---|---|
Area | surfaceAreas[n] | {4*Modelica.Constants.pi*(3/... | Heat transfer areas [m2] |
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 ( surfaceAreas={4*Modelica.Constants.pi*(3/4*V/Modelica.Constants.pi)^(2/3)}) constrainedby Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.PartialVesselHeatTransfer "Wall heat transfer";