Name | Description |
---|---|
PartialDynamicFourPortTransformer | Partial element transporting two fluid streams between four ports with storing mass or energy |
PartialDynamicTwoPortTransformer | Partial element transporting one fluid stream with storing mass or energy |
PartialFourPort | Partial component with two ports |
PartialStaticFourPortHeatMassTransfer | Partial element transporting two fluid streams between four ports without storing mass or energy |
PartialStaticFourPortInterface | Partial element transporting fluid between two ports without storing mass or energy |
PartialStaticTwoPortHeatMassTransfer | Partial element transporting fluid between two ports without storing mass or energy |
PartialStaticTwoPortInterface | Partial element transporting fluid between two ports without storing mass or energy |
This component transports two fluid streams between four ports. It provides the basic model for implementing a dynamic heat exchanger. It is used by HeatExchangers.BaseClasses.HexElement. The variable names follow the conventions used in Modelica_Fluid.HeatExchangers.BasicHX.
Extends from Buildings.Fluids.Interfaces.PartialStaticFourPortInterface (Partial element transporting fluid between two ports without storing mass or energy).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium_1 | Modelica.Media.Interfaces.Pa... | Medium 1 in the component | |
replaceable package Medium_2 | Modelica.Media.Interfaces.Pa... | Medium 2 in the component | |
MixingVolumeDryAir | vol_2 | redeclare Buildings.Fluids.M... | Volume for fluid 2 |
HeatCapacity | C | 2 | Heat capacity of metal (= cp*m) [J/K] |
Nominal condition | |||
MassFlowRate | m0_flow_1 | Nominal mass flow rate [kg/s] | |
MassFlowRate | m0_flow_2 | m0_flow_1 | Nominal mass flow rate [kg/s] |
Time | tau_1 | 60 | Time constant at nominal flow [s] |
Time | tau_2 | 60 | Time constant at nominal flow [s] |
Initialization | |||
MassFlowRate | m_flow_1.start | 0 | Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction) [kg/s] |
Pressure | dp_1.start | 0 | Pressure difference between port_a1 and port_b1 [Pa] |
MassFlowRate | m_flow_2.start | 0 | Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction) [kg/s] |
Pressure | dp_2.start | 0 | Pressure difference between port_a2 and port_b2 [Pa] |
Assumptions | |||
Boolean | allowFlowReversal_1 | system.allowFlowReversal | = true to allow flow reversal in medium 1, false restricts to design direction (port_a -> port_b) |
Boolean | allowFlowReversal_2 | system.allowFlowReversal | = true to allow flow reversal in medium 2, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_1_small | 1E-4*m0_flow_1 | Small mass flow rate for regularization of zero flow [kg/s] |
MassFlowRate | m_flow_2_small | 1E-4*m0_flow_2 | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a1_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b1_start | p_a1_start | Guess value for outlet pressure [Pa] |
AbsolutePressure | p_a2_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b2_start | p_a2_start | Guess value for outlet pressure [Pa] |
Type | Name | Description |
---|---|---|
FluidPort_a | port_a1 | Fluid connector a1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_b | port_b1 | Fluid connector b1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_a | port_a2 | Fluid connector a2 (positive design flow direction is from port_a2 to port_b2) |
FluidPort_b | port_b2 | Fluid connector b2 (positive design flow direction is from port_a2 to port_b2) |
partial model PartialDynamicFourPortTransformer "Partial element transporting two fluid streams between four ports with storing mass or energy" extends Buildings.Fluids.Interfaces.PartialStaticFourPortInterface; import Modelica.Constants; Buildings.Fluids.MixingVolumes.MixingVolume vol_1( redeclare package Medium = Medium_1, nPorts = 2, V=m0_flow_1*tau_1/rho0_1, medium(T(stateSelect=StateSelect.always)), final use_HeatTransfer=true, redeclare model HeatTransfer = Modelica_Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer) "Volume for fluid 1"; replaceable Buildings.Fluids.MixingVolumes.MixingVolumeDryAir vol_2( redeclare package Medium = Medium_2, nPorts = 2, V=m0_flow_2*tau_2/rho0_2, final use_HeatTransfer=true, redeclare model HeatTransfer = Modelica_Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer(surfaceAreas={1})) constrainedby Buildings.Fluids.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort "Volume for fluid 2"; parameter Modelica.SIunits.Time tau_1 = 60 "Time constant at nominal flow"; // parameter Modelica.SIunits.MassFlowRate m0_flow_1(min=0) "Mass flow rate" // annotation(Dialog(group = "Nominal condition")); parameter Modelica.SIunits.Time tau_2 = 60 "Time constant at nominal flow"; // parameter Modelica.SIunits.MassFlowRate m0_flow_2(min=0) "Mass flow rate" // annotation(Dialog(group = "Nominal condition")); Modelica.Thermal.HeatTransfer.Components.HeatCapacitor mas( C=C, T(stateSelect=StateSelect.always)) "Mass of metal"; Modelica.Thermal.HeatTransfer.Components.Convection con1 "Convection (and conduction) on fluid side 1"; parameter Modelica.SIunits.HeatCapacity C=2 "Heat capacity of metal (= cp*m)"; Modelica.Thermal.HeatTransfer.Components.Convection con2 "Convection (and conduction) on fluid side 2"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temSen( T(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0)) "Temperature sensor of metal"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFloSen_1 "Heat input into fluid 1"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFloSen_2 "Heat input into fluid 1"; Modelica.SIunits.HeatFlowRate Q_flow_1 "Heat flow rate into medium 1"; Modelica.SIunits.HeatFlowRate Q_flow_2 "Heat flow rate into medium 2"; protected parameter Medium_1.ThermodynamicState sta0_1=Medium_1.setState_pTX( T=Medium_1.T_default, p=Medium_1.p_default, X=Medium_1.X_default); parameter Modelica.SIunits.Density rho0_1=Medium_1.density(sta0_1) "Density, used to compute fluid volume"; parameter Medium_2.ThermodynamicState sta0_2=Medium_2.setState_pTX( T=Medium_2.T_default, p=Medium_2.p_default, X=Medium_2.X_default); parameter Modelica.SIunits.Density rho0_2=Medium_2.density(sta0_2) "Density, used to compute fluid volume"; equation assert(vol_1.use_HeatTransfer == true, "Wrong parameter for vol_1."); assert(vol_2.use_HeatTransfer == true, "Wrong parameter for vol_2."); Q_flow_1 = heaFloSen_1.Q_flow; Q_flow_2 = heaFloSen_2.Q_flow; connect(con1.solid, mas.port); connect(con2.solid, mas.port); connect(mas.port, temSen.port); connect(con1.fluid, heaFloSen_1.port_a); connect(con2.fluid, heaFloSen_2.port_a); connect(port_a1, vol_1.ports[1]); connect(vol_1.ports[2], port_b1); connect(port_a2, vol_2.ports[1]); connect(vol_2.ports[2], port_b2); connect(heaFloSen_1.port_b, vol_1.heatPort); connect(heaFloSen_2.port_b, vol_2.heatPort); end PartialDynamicFourPortTransformer;
This component transports one fluid stream. It provides the basic model for implementing a dynamic heater such as a boiler. It is used by FIX ME. The variable names follow the conventions used in Modelica_Fluid.HeatExchangers.BasicHX.
Extends from Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface (Partial element transporting fluid between two ports without storing mass or energy).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Nominal condition | |||
MassFlowRate | m0_flow | Nominal mass flow rate [kg/s] | |
Time | tau | 300 | Time constant at nominal flow [s] |
Initialization | |||
MassFlowRate | m_flow.start | 0 | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] |
Pressure | dp.start | 0 | Pressure difference between port_a and port_b [Pa] |
Assumptions | |||
Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Dynamics | |||
Dynamics | energyDynamics | system.energyDynamics | Formulation of energy balance |
Dynamics | massDynamics | energyDynamics | Formulation of mass balance |
Advanced | |||
MassFlowRate | m_flow_small | 1E-4*m0_flow | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b_start | p_a_start | Guess value for outlet pressure [Pa] |
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 |
---|---|---|
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
partial model PartialDynamicTwoPortTransformer "Partial element transporting one fluid stream with storing mass or energy" extends Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface; import Modelica.Constants; Buildings.Fluids.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, nPorts = 2, V=m0_flow*tau/rho0, final use_HeatTransfer=true, redeclare model HeatTransfer = Modelica_Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer, final energyDynamics=energyDynamics, final massDynamics=massDynamics, final p_start=p_start, final use_T_start=use_T_start, final T_start=T_start, final h_start=h_start, final X_start=X_start, final C_start=C_start) "Volume for fluid stream"; // medium(T(stateSelect=StateSelect.always)), parameter Modelica.SIunits.Time tau = 300 "Time constant at nominal flow"; // parameter Modelica.SIunits.MassFlowRate m0_flow(min=0) "Mass flow rate" // annotation(Dialog(group = "Nominal condition")); // Assumptions parameter Modelica_Fluid.Types.Dynamics energyDynamics=system.energyDynamics "Formulation of energy balance"; parameter Modelica_Fluid.Types.Dynamics massDynamics=energyDynamics "Formulation of mass balance"; final parameter Modelica_Fluid.Types.Dynamics substanceDynamics=massDynamics "Formulation of substance balance"; final parameter Modelica_Fluid.Types.Dynamics traceDynamics=massDynamics "Formulation of trace substance balance"; // Initialization parameter Medium.AbsolutePressure p_start = system.p_start "Start value of pressure"; parameter Boolean use_T_start = true "= true, use T_start, otherwise h_start"; parameter Medium.Temperature T_start= if use_T_start then system.T_start else Medium.temperature_phX(p_start,h_start,X_start) "Start value of temperature"; parameter Medium.SpecificEnthalpy h_start= if use_T_start then Medium.specificEnthalpy_pTX(p_start, T_start, X_start) else Medium.h_default "Start value of specific enthalpy"; parameter Medium.MassFraction X_start[Medium.nX] = Medium.X_default "Start value of mass fractions m_i/m"; parameter Medium.ExtraProperty C_start[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Start value of trace substances"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temSen( T(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0)) "Temperature sensor of metal"; protected parameter Medium.ThermodynamicState sta0=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default); parameter Modelica.SIunits.Density rho0=Medium.density(sta0) "Density, used to compute fluid volume"; equation assert(vol.use_HeatTransfer == true, "Wrong parameter for vol."); connect(temSen.port, vol.heatPort); connect(port_a, vol.ports[1]); connect(vol.ports[2], port_b); end PartialDynamicTwoPortTransformer;
This partial model defines an interface for components with two ports. The treatment of the design flow direction and of flow reversal are predefined based on the parameter allowFlowReversal.
An extending model providing direct access to internal storage of mass or energy through port_a or port_b (or port_a2 and port_b2) should redefine the protected parameters port_a1_exposesState and port_b1_exposesState appropriately. This will be visualized at the port icons, in order to improve the understanding of fluid model diagrams.
This partial model is identical to
Type | Name | Description |
---|---|---|
FluidPort_a | port_a1 | Fluid connector a1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_b | port_b1 | Fluid connector b1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_a | port_a2 | Fluid connector a2 (positive design flow direction is from port_a2 to port_b2) |
FluidPort_b | port_b2 | Fluid connector b2 (positive design flow direction is from port_a2 to port_b2) |
partial model PartialFourPort "Partial component with two ports" import Modelica.Constants; outer Modelica_Fluid.System system "System wide properties"; replaceable package Medium_1 = Modelica.Media.Interfaces.PartialMedium "Medium 1 in the component"; replaceable package Medium_2 = Modelica.Media.Interfaces.PartialMedium "Medium 2 in the component"; parameter Boolean allowFlowReversal_1 = system.allowFlowReversal "= true to allow flow reversal in medium 1, false restricts to design direction (port_a -> port_b)"; parameter Boolean allowFlowReversal_2 = system.allowFlowReversal "= true to allow flow reversal in medium 2, false restricts to design direction (port_a -> port_b)"; Modelica_Fluid.Interfaces.FluidPort_a port_a1( redeclare package Medium = Medium_1, m_flow(min=if allowFlowReversal_1 then -Constants.inf else 0)) "Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)"; Modelica_Fluid.Interfaces.FluidPort_b port_b1( redeclare package Medium = Medium_1, m_flow(max=if allowFlowReversal_1 then +Constants.inf else 0)) "Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)"; Modelica_Fluid.Interfaces.FluidPort_a port_a2( redeclare package Medium = Medium_2, m_flow(min=if allowFlowReversal_2 then -Constants.inf else 0)) "Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)"; Modelica_Fluid.Interfaces.FluidPort_b port_b2( redeclare package Medium = Medium_2, m_flow(max=if allowFlowReversal_2 then +Constants.inf else 0)) "Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)"; // Model structure, e.g. used for visualization protected parameter Boolean port_a1_exposesState = false "= true if port_a1 exposes the state of a fluid volume"; parameter Boolean port_b1_exposesState = false "= true if port_b1 exposes the state of a fluid volume"; parameter Boolean port_a2_exposesState = false "= true if port_a1 exposes the state of a fluid volume"; parameter Boolean port_b2_exposesState = false "= true if port_b1 exposes the state of a fluid volume"; end PartialFourPort;
This component transports two fluid streams between four ports, without storing mass or energy. It is similar to Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer, but it has four ports instead of two. See the documentation of the Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer for how to use this model.
Extends from Buildings.Fluids.Interfaces.PartialStaticFourPortInterface (Partial element transporting fluid between two ports without storing mass or energy).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium_1 | Modelica.Media.Interfaces.Pa... | Medium 1 in the component | |
replaceable package Medium_2 | Modelica.Media.Interfaces.Pa... | Medium 2 in the component | |
Nominal condition | |||
MassFlowRate | m0_flow_1 | Nominal mass flow rate [kg/s] | |
MassFlowRate | m0_flow_2 | m0_flow_1 | Nominal mass flow rate [kg/s] |
Initialization | |||
MassFlowRate | m_flow_1.start | 0 | Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction) [kg/s] |
Pressure | dp_1.start | 0 | Pressure difference between port_a1 and port_b1 [Pa] |
MassFlowRate | m_flow_2.start | 0 | Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction) [kg/s] |
Pressure | dp_2.start | 0 | Pressure difference between port_a2 and port_b2 [Pa] |
Assumptions | |||
Boolean | allowFlowReversal_1 | system.allowFlowReversal | = true to allow flow reversal in medium 1, false restricts to design direction (port_a -> port_b) |
Boolean | allowFlowReversal_2 | system.allowFlowReversal | = true to allow flow reversal in medium 2, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_1_small | 1E-4*m0_flow_1 | Small mass flow rate for regularization of zero flow [kg/s] |
MassFlowRate | m_flow_2_small | 1E-4*m0_flow_2 | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a1_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b1_start | p_a1_start | Guess value for outlet pressure [Pa] |
AbsolutePressure | p_a2_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b2_start | p_a2_start | Guess value for outlet pressure [Pa] |
Type | Name | Description |
---|---|---|
FluidPort_a | port_a1 | Fluid connector a1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_b | port_b1 | Fluid connector b1 (positive design flow direction is from port_a1 to port_b1) |
FluidPort_a | port_a2 | Fluid connector a2 (positive design flow direction is from port_a2 to port_b2) |
FluidPort_b | port_b2 | Fluid connector b2 (positive design flow direction is from port_a2 to port_b2) |
partial model PartialStaticFourPortHeatMassTransfer "Partial element transporting two fluid streams between four ports without storing mass or energy" extends Buildings.Fluids.Interfaces.PartialStaticFourPortInterface; import Modelica.Constants; Modelica.SIunits.HeatFlowRate Q_flow_1 "Heat transfered into the medium 1"; Medium_1.MassFlowRate mXi_flow_1[Medium_1.nXi] "Mass flow rates of independent substances added to the medium 1"; Modelica.SIunits.HeatFlowRate Q_flow_2 "Heat transfered into the medium 2"; Medium_2.MassFlowRate mXi_flow_2[Medium_2.nXi] "Mass flow rates of independent substances added to the medium 2"; Real TInStr_a1=inStream(port_a1.h_outflow)/4200+298.15-273.15; equation // Energy balance (no storage, no heat loss/gain) port_a1.m_flow*port_a1.h_outflow + port_b1.m_flow*inStream(port_b1.h_outflow) = -Q_flow_1; port_a1.m_flow*port_b1.h_outflow + port_b1.m_flow*inStream(port_a1.h_outflow) = Q_flow_1; port_a2.m_flow*port_a2.h_outflow + port_b2.m_flow*inStream(port_b2.h_outflow) = -Q_flow_2; port_a2.m_flow*port_b2.h_outflow + port_b2.m_flow*inStream(port_a2.h_outflow) = Q_flow_2; // Mass balance (no storage) port_a1.m_flow + port_b1.m_flow = -sum(mXi_flow_1); port_a2.m_flow + port_b2.m_flow = -sum(mXi_flow_2); port_a1.m_flow*port_a1.Xi_outflow + port_b1.m_flow*inStream(port_b1.Xi_outflow) = -mXi_flow_1; port_a1.m_flow*port_b1.Xi_outflow + port_b1.m_flow*inStream(port_a1.Xi_outflow) = mXi_flow_1; port_a2.m_flow*port_a2.Xi_outflow + port_b2.m_flow*inStream(port_b2.Xi_outflow) = -mXi_flow_2; port_a2.m_flow*port_b2.Xi_outflow + port_b2.m_flow*inStream(port_a2.Xi_outflow) = mXi_flow_2; // Transport of trace substances port_a1.C_outflow = inStream(port_b1.C_outflow); port_b1.C_outflow = inStream(port_a1.C_outflow); port_a2.C_outflow = inStream(port_b2.C_outflow); port_b2.C_outflow = inStream(port_a2.C_outflow); end PartialStaticFourPortHeatMassTransfer;
This component defines the interface for models that
transport two fluid streams between four ports.
It is similar to
,
but it has four ports instead of two.
The model is used by other models in this package that add heat transfer,
mass transfer and pressure drop equations.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium_1 | Modelica.Media.Interfaces.Pa... | Medium 1 in the component | |
replaceable package Medium_2 | Modelica.Media.Interfaces.Pa... | Medium 2 in the component | |
Nominal condition | |||
MassFlowRate | m0_flow_1 | Nominal mass flow rate [kg/s] | |
MassFlowRate | m0_flow_2 | m0_flow_1 | Nominal mass flow rate [kg/s] |
Assumptions | |||
Boolean | allowFlowReversal_1 | system.allowFlowReversal | = true to allow flow reversal in medium 1, false restricts to design direction (port_a -> port_b) |
Boolean | allowFlowReversal_2 | system.allowFlowReversal | = true to allow flow reversal in medium 2, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_1_small | 1E-4*m0_flow_1 | Small mass flow rate for regularization of zero flow [kg/s] |
MassFlowRate | m_flow_2_small | 1E-4*m0_flow_2 | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a1_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b1_start | p_a1_start | Guess value for outlet pressure [Pa] |
AbsolutePressure | p_a2_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b2_start | p_a2_start | Guess value for outlet pressure [Pa] |
partial model PartialStaticFourPortInterface "Partial element transporting fluid between two ports without storing mass or energy" import Modelica.Constants; extends Buildings.Fluids.Interfaces.PartialFourPort( port_a1( p(start=p_a1_start), m_flow(min = if allowFlowReversal_1 then -Constants.inf else 0)), port_b1( p(start=p_b1_start), m_flow(max = if allowFlowReversal_1 then +Constants.inf else 0)), port_a2( p(start=p_a2_start), m_flow(min = if allowFlowReversal_2 then -Constants.inf else 0)), port_b2( p(start=p_b2_start), m_flow(max = if allowFlowReversal_2 then +Constants.inf else 0))); parameter Medium_1.MassFlowRate m0_flow_1(min=0) "Nominal mass flow rate"; parameter Medium_2.MassFlowRate m0_flow_2(min=0) = m0_flow_1 "Nominal mass flow rate"; parameter Medium_1.MassFlowRate m_flow_1_small(min=0) = 1E-4*m0_flow_1 "Small mass flow rate for regularization of zero flow"; parameter Medium_2.MassFlowRate m_flow_2_small(min=0) = 1E-4*m0_flow_2 "Small mass flow rate for regularization of zero flow"; // Initialization parameter Medium_1.AbsolutePressure p_a1_start=system.p_start "Guess value for inlet pressure"; parameter Medium_1.AbsolutePressure p_b1_start=p_a1_start "Guess value for outlet pressure"; parameter Medium_2.AbsolutePressure p_a2_start=system.p_start "Guess value for inlet pressure"; parameter Medium_2.AbsolutePressure p_b2_start=p_a2_start "Guess value for outlet pressure"; // Diagnostics // parameter Boolean show_T = true // "= true, if temperatures at port_a and port_b are computed" annotation 7; parameter Boolean show_V_flow = true "= true, if volume flow rate at inflowing port is computed"; Modelica.SIunits.VolumeFlowRate V_flow_1= m_flow_1/Modelica_Fluid.Utilities.regStep(m_flow_1, Medium_1.density(state_a1_inflow), Medium_1.density(state_b1_inflow), m_flow_1_small) if show_V_flow "Volume flow rate at inflowing port (positive when flow from port_a1 to port_b1)"; Modelica.SIunits.VolumeFlowRate V_flow_2= m_flow_2/Modelica_Fluid.Utilities.regStep(m_flow_2, Medium_2.density(state_a2_inflow), Medium_2.density(state_b2_inflow), m_flow_2_small) if show_V_flow "Volume flow rate at inflowing port (positive when flow from port_a2 to port_b2)"; /* Medium_1.Temperature port_a1_T= Modelica_Fluid.Utilities.regStep(port_a1.m_flow, Medium_1.temperature(state_a1), Medium_1.temperature( Medium_1.setState_phX(port_a1.p, port_a1.h_outflow, port_a1.Xi_outflow)), m_flow_1_small) if show_T "Temperature close to port_a1, if show_T = true"; Medium_1.Temperature port_b1_T= Modelica_Fluid.Utilities.regStep(port_b1.m_flow, Medium_1.temperature(state_b1), Medium_1.temperature( Medium_1.setState_phX(port_b1.p, port_b1.h_outflow, port_b1.Xi_outflow)), m_flow_1_small) if show_T "Temperature close to port_b1, if show_T = true"; Medium_2.Temperature port_a2_T= Modelica_Fluid.Utilities.regStep(port_a2.m_flow, Medium_2.temperature(state_a2), Medium_2.temperature( Medium_2.setState_phX(port_a2.p, port_a2.h_outflow, port_a2.Xi_outflow)), m_flow_2_small) if show_T "Temperature close to port_a2, if show_T = true"; Medium_2.Temperature port_b2_T= Modelica_Fluid.Utilities.regStep(port_b2.m_flow, Medium_2.temperature(state_b2), Medium_2.temperature( Medium_2.setState_phX(port_b2.p, port_b2.h_outflow, port_b2.Xi_outflow)), m_flow_2_small) if show_T "Temperature close to port_b2, if show_T = true"; */ Medium_1.MassFlowRate m_flow_1(start=0) "Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction)"; Modelica.SIunits.Pressure dp_1(start=0, displayUnit="Pa") "Pressure difference between port_a1 and port_b1"; Medium_2.MassFlowRate m_flow_2(start=0) "Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction)"; Modelica.SIunits.Pressure dp_2(start=0, displayUnit="Pa") "Pressure difference between port_a2 and port_b2"; Medium_1.ThermodynamicState sta_a1= Medium_1.setState_phX(port_a1.p, actualStream(port_a1.h_outflow), actualStream(port_a1.Xi_outflow)) "Medium properties in port_a1"; Medium_1.ThermodynamicState sta_b1= Medium_1.setState_phX(port_b1.p, actualStream(port_b1.h_outflow), actualStream(port_b1.Xi_outflow)) "Medium properties in port_b1"; Medium_2.ThermodynamicState sta_a2= Medium_2.setState_phX(port_a2.p, actualStream(port_a2.h_outflow), actualStream(port_a2.Xi_outflow)) "Medium properties in port_a2"; Medium_2.ThermodynamicState sta_b2= Medium_2.setState_phX(port_b2.p, actualStream(port_b2.h_outflow), actualStream(port_b2.Xi_outflow)) "Medium properties in port_b2"; protected Medium_1.ThermodynamicState state_a1_inflow= Medium_1.setState_phX(port_a1.p, inStream(port_a1.h_outflow), inStream(port_a1.Xi_outflow)) "state for medium inflowing through port_a1"; Medium_1.ThermodynamicState state_b1_inflow= Medium_1.setState_phX(port_b1.p, inStream(port_b1.h_outflow), inStream(port_b1.Xi_outflow)) "state for medium inflowing through port_b1"; Medium_2.ThermodynamicState state_a2_inflow= Medium_2.setState_phX(port_a2.p, inStream(port_a2.h_outflow), inStream(port_a2.Xi_outflow)) "state for medium inflowing through port_a2"; Medium_2.ThermodynamicState state_b2_inflow= Medium_2.setState_phX(port_b2.p, inStream(port_b2.h_outflow), inStream(port_b2.Xi_outflow)) "state for medium inflowing through port_b2"; equation // Design direction of mass flow rate m_flow_1 = port_a1.m_flow; m_flow_2 = port_a2.m_flow; // Pressure difference between ports dp_1 = port_a1.p - port_b1.p; dp_2 = port_a2.p - port_b2.p; end PartialStaticFourPortInterface;
This component transports fluid between its two ports, without storing mass or energy. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but it does use a different implementation for handling reverse flow because in this component, mass flow rate can be added or removed from the medium.
When using this partial component, an equation for the momentum balance has to be added by specifying a relationship between the pressure drop dp and the mass flow rate m_flow and the energy and mass balances, such as
dp = 0; mWat_flow = u * m0_flow; Q_flow = Medium.enthalpyOfLiquid(TWat) * mWat_flow; for i in 1:Medium.nXi loop mXi_flow[i] = if ( i == Medium.Water) then mWat_flow else 0; end for;Extends from Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface (Partial element transporting fluid between two ports without storing mass or energy).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Nominal condition | |||
MassFlowRate | m0_flow | Nominal mass flow rate [kg/s] | |
Initialization | |||
MassFlowRate | m_flow.start | 0 | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] |
Pressure | dp.start | 0 | Pressure difference between port_a and port_b [Pa] |
Assumptions | |||
Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_small | 1E-4*m0_flow | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b_start | p_a_start | Guess value for outlet pressure [Pa] |
Type | Name | Description |
---|---|---|
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
partial model PartialStaticTwoPortHeatMassTransfer "Partial element transporting fluid between two ports without storing mass or energy" extends Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface; import Modelica.Constants; Modelica.SIunits.HeatFlowRate Q_flow "Heat transfered into the medium"; Medium.MassFlowRate mXi_flow[Medium.nXi] "Mass flow rates of independent substances added to the medium"; equation // Energy balance (no storage, no heat loss/gain) port_a.m_flow*port_a.h_outflow + port_b.m_flow*inStream(port_b.h_outflow) = -Q_flow; port_a.m_flow*port_b.h_outflow + port_b.m_flow*inStream(port_a.h_outflow) = Q_flow; // Mass balance (no storage) port_a.m_flow + port_b.m_flow = -sum(mXi_flow); port_a.m_flow*port_a.Xi_outflow + port_b.m_flow*inStream(port_b.Xi_outflow) = -mXi_flow; port_a.m_flow*port_b.Xi_outflow + port_b.m_flow*inStream(port_a.Xi_outflow) = mXi_flow; // Transport of trace substances port_a.C_outflow = inStream(port_b.C_outflow); port_b.C_outflow = inStream(port_a.C_outflow); end PartialStaticTwoPortHeatMassTransfer;
This component defines the interface for models that transports a fluid between two ports. It is similar to Modelica_Fluid.Interfaces.PartialTwoPortTransport, but it does not include the species balance
port_b.Xi_outflow = inStream(port_a.Xi_outflow);. Thus, it can be used as a base class for a heat and mass transfer component
The model is used by other models in this package that add heat transfer, mass transfer and pressure drop equations. See for example Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer.
Extends from Modelica_Fluid.Interfaces.PartialTwoPort (Partial component with two ports).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Nominal condition | |||
MassFlowRate | m0_flow | Nominal mass flow rate [kg/s] | |
Assumptions | |||
Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_small | 1E-4*m0_flow | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | true | = true, if volume flow rate at inflowing port is computed |
Initialization | |||
AbsolutePressure | p_a_start | system.p_start | Guess value for inlet pressure [Pa] |
AbsolutePressure | p_b_start | p_a_start | Guess value for outlet pressure [Pa] |
partial model PartialStaticTwoPortInterface "Partial element transporting fluid between two ports without storing mass or energy" import Modelica.Constants; extends Modelica_Fluid.Interfaces.PartialTwoPort( port_a( p(start=p_a_start), m_flow(min = if allowFlowReversal then -Constants.inf else 0)), port_b( p(start=p_b_start), m_flow(max = if allowFlowReversal then +Constants.inf else 0))); parameter Medium.MassFlowRate m0_flow(min=0) "Nominal mass flow rate"; parameter Medium.MassFlowRate m_flow_small(min=0) = 1E-4*m0_flow "Small mass flow rate for regularization of zero flow"; // Initialization parameter Medium.AbsolutePressure p_a_start=system.p_start "Guess value for inlet pressure"; parameter Medium.AbsolutePressure p_b_start=p_a_start "Guess value for outlet pressure"; // Diagnostics // parameter Boolean show_T = true // "= true, if temperatures at port_a and port_b are computed" annotation 4; parameter Boolean show_V_flow = true "= true, if volume flow rate at inflowing port is computed"; Modelica.SIunits.VolumeFlowRate V_flow= m_flow/Modelica_Fluid.Utilities.regStep(m_flow, Medium.density(state_a_inflow), Medium.density(state_b_inflow), m_flow_small) if show_V_flow "Volume flow rate at inflowing port (positive when flow from port_a to port_b)"; /* Medium.Temperature port_a_T= Modelica_Fluid.Utilities.regStep(port_a.m_flow, Medium.temperature(state_a), Medium.temperature(Medium.setState_phX(port_a.p, port_a.h_outflow, port_a.Xi_outflow)), m_flow_small) if show_T "Temperature close to port_a, if show_T = true"; Medium.Temperature port_b_T= Modelica_Fluid.Utilities.regStep(port_b.m_flow, Medium.temperature(state_b), Medium.temperature(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)), m_flow_small) if show_T "Temperature close to port_b, if show_T = true"; */ Medium.MassFlowRate m_flow(start=0) "Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction)"; Modelica.SIunits.Pressure dp(start=0, displayUnit="Pa") "Pressure difference between port_a and port_b"; Medium.ThermodynamicState sta_a= Medium.setState_phX(port_a.p, actualStream(port_a.h_outflow), actualStream(port_a.Xi_outflow)) "Medium properties in port_a"; Medium.ThermodynamicState sta_b= Medium.setState_phX(port_b.p, actualStream(port_b.h_outflow), actualStream(port_b.Xi_outflow)) "Medium properties in port_b"; protected Medium.ThermodynamicState state_a_inflow= Medium.setState_phX(port_a.p, inStream(port_a.h_outflow), inStream(port_a.Xi_outflow)) "state for medium inflowing through port_a"; Medium.ThermodynamicState state_b_inflow= Medium.setState_phX(port_b.p, inStream(port_b.h_outflow), inStream(port_b.Xi_outflow)) "state for medium inflowing through port_b"; equation // medium_a.state=sta_a; // medium_a.Xi = actualStream(port_a.Xi_outflow); // Design direction of mass flow rate m_flow = port_a.m_flow; // Pressure difference between ports dp = port_a.p - port_b.p; end PartialStaticTwoPortInterface;