Name | Description |
---|---|
PartialResistance | Partial model for a hydraulic resistance |
PartialThreeWayResistance | Flow splitter with partial resistance model at each port |
Partial model for a flow resistance, possible with variable flow coefficient.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
MassFlowRate | m_small_flow | Mass flow rate where transition to laminar occurs [kg/s] | |
Initialization | |||
MassFlowRate | m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] | |
Pressure | dp | Pressure difference between port_a and port_b [Pa] | |
Advanced | |||
Temp | flowDirection | Modelica_Fluid.Types.FlowDir... | Unidirectional (port_a -> port_b) or bidirectional flow component |
Boolean | from_dp | true | = true, use m_flow = f(dp) else dp = f(m_flow) |
Boolean | linearized | false | = true, use linear relation between m_flow and dp for any flow rate |
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 PartialResistance "Partial model for a hydraulic resistance" extends Modelica_Fluid.Interfaces.PartialTwoPortTransport( medium_a(T(start = Medium.T_default), h(start=Medium.h_default), p(start=Medium.p_default)), medium_b(T(start = Medium.T_default), h(start=Medium.h_default), p(start=Medium.p_default))); extends Buildings.BaseClasses.BaseIcon; parameter Boolean from_dp = true "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Modelica.SIunits.MassFlowRate m_small_flow "Mass flow rate where transition to laminar occurs"; parameter Boolean linearized = false "= true, use linear relation between m_flow and dp for any flow rate"; protected Real k(unit="(kg*m)^(1/2)", start=1) "Flow coefficient, k=m_flow/sqrt(dp)"; Real kInv(unit="1/kg/m", start=1) "Flow coefficient for inverse flow computation, kInv=dp/m_flow^2"; Modelica.SIunits.AbsolutePressure dp_small "Turbulent flow if |dp| >= dp_small, not a parameter because k can be a function of time"; parameter Medium.ThermodynamicState sta0(T=Medium.T_default, p=Medium.p_default); parameter Modelica.SIunits.DynamicViscosity eta0=Medium.dynamicViscosity(sta0) "Dynamic viscosity, used to compute laminar/turbulent transition"; parameter Modelica.SIunits.SpecificEnthalpy h0=Medium.h_default "Initial value for solver for specific enthalpy"; //specificEnthalpy(sta0) initial equation // this equation can be deleted, it here for debugging during library transition assert(abs(eta0-Medium.dynamicViscosity(medium_a)) < 0.1*eta0, "Wrong parameter for eta.\n" + " medium_a.T = " + realString(medium_a.T) + "\n" + " medium_a.p = " + realString(medium_a.p) + "\n" + " Medium.dynamicViscosity(medium_a) = " + realString(Medium.dynamicViscosity(medium_a)) + "\n" + " eta0 = " + realString(eta0) + "\n" + " Medium.dynamicViscosity(medium_a)/ eta0 = " + realString(Medium.dynamicViscosity(medium_a)/eta0)); equation 1=k*k*kInv; dp_small = kInv * m_small_flow^2; if linearized then m_flow = k * dp; else if from_dp then m_flow = Buildings.Fluids.Utilities.massFlowRate_dp( dp=dp, dp_small=dp_small, k=k); else dp = Buildings.Fluids.Utilities.pressureLoss_m_flow( m_flow=m_flow,m_small_flow=m_small_flow,k=kInv); end if; end if; /////////////////////////////////////////////////////////////////////////////////// // Extra species flow. This may be removed when upgrading to the new Modelica.Fluid. port_a.mC_flow = semiLinear(port_a.m_flow, port_a.C, port_b.C); port_a.mC_flow + port_b.mC_flow = zeros(Medium.nC); /////////////////////////////////////////////////////////////////////////////////// end PartialResistance;
Partial model for flow resistances with three ports such as a flow mixer/splitter or a three way valve.
Type | Name | Default | Description |
---|---|---|---|
PartialTwoPortTransport | res1 | redeclare Modelica_Fluid.Int... | Partial model, to be replaced with a fluid component |
PartialTwoPortTransport | res2 | redeclare Modelica_Fluid.Int... | Partial model, to be replaced with a fluid component |
PartialTwoPortTransport | res3 | redeclare Modelica_Fluid.Int... | Partial model, to be replaced with a fluid component |
Advanced | |||
Boolean | from_dp | true | = true, use m_flow = f(dp) else dp = f(m_flow) |
Temp | flowDirection | Modelica_Fluid.Types.FlowDir... | Unidirectional (port_1 -> port_2) or bidirectional flow component |
Type | Name | Description |
---|---|---|
FluidPort_b | port_1 | |
FluidPort_b | port_2 | |
FluidPort_b | port_3 |
partial model PartialThreeWayResistance "Flow splitter with partial resistance model at each port" extends Buildings.BaseClasses.BaseIcon; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Fluid medium model"; Modelica_Fluid.Interfaces.FluidPort_b port_1( redeclare package Medium = Medium, m_flow(start=0,min=if allowFlowReversal then -Modelica.Constants.inf else 0)); Modelica_Fluid.Interfaces.FluidPort_b port_2( redeclare package Medium = Medium, m_flow(start=0,max=if allowFlowReversal then +Modelica.Constants.inf else 0)); // For port_3, allowFlowReversal must not be specified because the flow // direction is different for a mixer and splitter Modelica_Fluid.Interfaces.FluidPort_b port_3(redeclare package Medium = Medium); parameter Boolean from_dp = true "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Modelica_Fluid.Types.FlowDirection.Temp flowDirection= Modelica_Fluid.Types.FlowDirection.Bidirectional "Unidirectional (port_1 -> port_2) or bidirectional flow component"; replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res1(redeclare package Medium = Medium) "Partial model, to be replaced with a fluid component"; replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res2(redeclare package Medium = Medium) "Partial model, to be replaced with a fluid component"; replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res3(redeclare package Medium = Medium) "Partial model, to be replaced with a fluid component"; protected parameter Boolean allowFlowReversal= flowDirection == Modelica_Fluid.Types.FlowDirection.Bidirectional "= false, if flow only from port_a to port_b, otherwise reversing flow allowed"; protected Modelica_Fluid.Interfaces.FluidPort_b port_m(redeclare package Medium = Medium) "Mixing port"; equation connect(port_1, res1.port_a); connect(res2.port_a, port_2); connect(res3.port_a, port_3); connect(res1.port_b, port_m); connect(res2.port_b, port_m); connect(res3.port_b, port_m); end PartialThreeWayResistance;