Name | Description |
---|---|
PartialMixingVolumeWaterPort | Partial mixing volume that allows adding or subtracting water vapor |
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).
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 |
Heat transfer | |||
Boolean | use_HeatTransfer | false | = true to use the HeatTransfer model |
Initialization | |||
AbsolutePressure | p_start | system.p_start | 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 |
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 | XWat | Species composition of medium |
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;
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";