Name | Description |
---|---|
PartialTwoPortTransformer | Partial element transporting fluid between two ports without storing mass or energy |
This component transports fluid between its two ports, without storing mass or energy. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but does not include the energy, mass and substance balance. Reversal and zero mass flow rate is taken care of, for details see definition of built-in operator semiLinear().
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
port_a.H_flow + port_b.H_flow = 0; port_a.m_flow + port_b.m_flow = 0; port_a.mXi_flow + port_b.mXi_flow = zeros(Medium.nXi);
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Advanced | |||
Temp | flowDirection | Modelica_Fluid.Types.FlowDir... | Unidirectional (port_a -> port_b) or bidirectional flow component |
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 PartialTwoPortTransformer "Partial element transporting fluid between two ports without storing mass or energy" extends Buildings.Fluids.Interfaces.PartialSingleFluidParameters; import Modelica.Constants; Modelica_Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium, m_flow(start=0, min=if allowFlowReversal then -Constants.inf else 0)) "Fluid connector a (positive design flow direction is from port_a to port_b)"; Modelica_Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium, m_flow(start=0, max=if allowFlowReversal then +Constants.inf else 0)) "Fluid connector b (positive design flow direction is from port_a to port_b)"; Medium.BaseProperties medium_a "Medium properties in port_a"; Medium.BaseProperties medium_b "Medium properties in port_b"; Medium.MassFlowRate m_flow(start=0) "Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction)"; Modelica.SIunits.VolumeFlowRate V_flow_a = port_a.m_flow/medium_a.d "Volume flow rate near port_a"; Modelica.SIunits.Pressure dp(start=0) "Pressure difference between port_a and port_b"; equation // Properties in the ports port_a.p = medium_a.p; port_a.h = medium_a.h; port_a.Xi = medium_a.Xi; port_b.p = medium_b.p; port_b.h = medium_b.h; port_b.Xi = medium_b.Xi; /* Handle reverse and zero flow */ port_a.H_flow = semiLinear(port_a.m_flow, port_a.h, port_b.h); port_a.mXi_flow = semiLinear(port_a.m_flow, port_a.Xi, port_b.Xi); /* Energy, mass and substance mass balance */ // to be added by child classes port_a.H_flow + port_b.H_flow = 0; // to be added by child classes port_a.m_flow + port_b.m_flow = 0; // to be added by child classes port_a.mXi_flow + port_b.mXi_flow = zeros(Medium.nXi); // Design direction of mass flow rate m_flow = port_a.m_flow; // Pressure difference between ports dp = port_a.p - port_b.p; end PartialTwoPortTransformer;