Name | Description |
---|---|
FixedResistanceDpM | Fixed flow resistance with dp and m_flow as parameter |
LosslessPipe | Pipe with no flow friction and no heat transfer |
SplitterFixedResistanceDpM | Flow splitter with fixed resistance at each port |
Examples | Collection of models that illustrate model use and test models |
This is a model of a resistance with a fixed flow coefficient k = m_flow/sqrt(dP).
Near the origin, the square root relation is regularized to ensure that the derivative is bounded.
Extends from Buildings.Fluid.BaseClasses.PartialResistance (Partial model for a hydraulic resistance).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Boolean | use_dh | false | Set to true to specify hydraulic diameter |
Length | dh | 1 | Hydraulic diameter [m] |
Real | ReC | 4000 | Reynolds number where transition to turbulent starts |
Real | deltaM | 0.3 | Fraction of nominal mass flow rate where transition to turbulent occurs |
Nominal condition | |||
MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
Pressure | dp_nominal | Pressure drop at nominal mass flow rate [Pa] | |
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*m_flow_nominal | Small mass flow rate for regularization of zero flow [kg/s] |
Boolean | from_dp | false | = 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 |
Diagnostics | |||
Boolean | show_V_flow | false | = true, if volume flow rate at inflowing port is computed |
Boolean | show_T | false | = true, if actual temperature at port is computed (may lead to events) |
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) |
model FixedResistanceDpM "Fixed flow resistance with dp and m_flow as parameter" extends Buildings.Fluid.BaseClasses.PartialResistance; parameter Boolean use_dh = false "Set to true to specify hydraulic diameter"; parameter Modelica.SIunits.Length dh=1 "Hydraulic diameter"; parameter Real ReC=4000 "Reynolds number where transition to turbulent starts"; parameter Real deltaM(min=0.01) = 0.3 "Fraction of nominal mass flow rate where transition to turbulent occurs"; initial equation if ( m_flow_turbulent > m_flow_nominal) then Modelica.Utilities.Streams.print("Warning: In FixedResistanceDpM, m_flow_nominal is smaller than m_flow_turbulent." + "\n" + " m_flow_nominal = " + realString(m_flow_nominal) + "\n" + " dh = " + realString(dh) + "\n" + " To fix, set dh < " + realString( 4*m_flow_nominal/eta_nominal/Modelica.Constants.pi/ReC) + "\n" + " Suggested value: dh = " + realString(1/10*4*m_flow_nominal/eta_nominal/Modelica.Constants.pi/ReC)); end if; equation // if computeFlowResistance = false, then equations of this model are disabled. if computeFlowResistance then m_flow_turbulent = if use_dh then eta_nominal*dh/4*Modelica.Constants.pi*ReC else deltaM * m_flow_nominal; if linearized then k = m_flow_nominal / dp_nominal / conv2; else k = m_flow_nominal / sqrt(dp_nominal); end if; else m_flow_turbulent = 0; k = 0; end if;end FixedResistanceDpM;
Model of a pipe with no flow resistance and no heat loss. This model can be used to replace a replaceable pipe model in flow legs in which no friction should be modeled, such as in the outlet port of a three way valve.
Extends from Buildings.Fluid.Interfaces.PartialStaticTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy), Buildings.BaseClasses.BaseIcon (Base icon).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Nominal condition | |||
MassFlowRate | m_flow_nominal | 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*m_flow_nominal | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics | |||
Boolean | show_V_flow | false | = true, if volume flow rate at inflowing port is computed |
Boolean | show_T | false | = true, if actual temperature at port is computed (may lead to events) |
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) |
model LosslessPipe "Pipe with no flow friction and no heat transfer" extends Buildings.Fluid.Interfaces.PartialStaticTwoPortInterface( show_T=false, show_V_flow=false); extends Buildings.BaseClasses.BaseIcon; final parameter Boolean from_dp=true "Used to satisfy replaceable models"; equation dp=0; // Isenthalpic state transformation (no storage and no loss of energy) port_a.h_outflow = inStream(port_b.h_outflow); port_b.h_outflow = inStream(port_a.h_outflow); // Mass balance (no storage) port_a.m_flow + port_b.m_flow = 0; // Transport of substances port_a.Xi_outflow = inStream(port_b.Xi_outflow); port_b.Xi_outflow = inStream(port_a.Xi_outflow); port_a.C_outflow = inStream(port_b.C_outflow); port_b.C_outflow = inStream(port_a.C_outflow);end LosslessPipe;
Model of a flow splitter (or mixer) with a fixed resistance in each flow leg.
Extends from Buildings.Fluid.BaseClasses.PartialThreeWayResistance (Flow splitter with partial resistance model at each port).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Fluid medium model | |
Boolean | use_dh | false | Set to true to specify hydraulic diameter |
Real | deltaM | 0.3 | Fraction of nominal mass flow rate where transition to turbulent occurs |
Length | dh[3] | {1,1,1} | Hydraulic diameter [m] |
Real | ReC[3] | {4000,4000,4000} | Reynolds number where transition to turbulent starts |
Nominal condition | |||
MassFlowRate | m_flow_nominal[3] | Mass flow rate [kg/s] | |
Pressure | dp_nominal[3] | Pressure [Pa] | |
Advanced | |||
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 |
Assumptions | |||
Dynamics | |||
Boolean | dynamicBalance | true | Set to true to use a dynamic balance, which often leads to smaller systems of equations |
Time | tau | 10 | Time constant at nominal flow for dynamic energy and momentum balance [s] |
MassFlowRate | mDyn_flow_nominal | sum(m_flow_nominal[:]/3) | Nominal mass flow rate for dynamic momentum and energy balance [kg/s] |
Dynamics | energyDynamics | system.energyDynamics | Formulation of energy balance |
Dynamics | massDynamics | system.massDynamics | Formulation of mass balance |
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 Medium.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_1 | |
FluidPort_b | port_2 | |
FluidPort_a | port_3 |
model SplitterFixedResistanceDpM "Flow splitter with fixed resistance at each port" extends Buildings.Fluid.BaseClasses.PartialThreeWayResistance( mDyn_flow_nominal = sum(m_flow_nominal[:]/3), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res1( redeclare package Medium=Medium, from_dp=from_dp, m_flow_nominal=m_flow_nominal[1], dp_nominal=dp_nominal[1], ReC=ReC[1], dh=dh[1], linearized=linearized, deltaM=deltaM), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res2( redeclare package Medium=Medium, from_dp=from_dp, m_flow_nominal=m_flow_nominal[2], dp_nominal=dp_nominal[2], ReC=ReC[2], dh=dh[2], linearized=linearized, deltaM=deltaM), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res3( redeclare package Medium=Medium, from_dp=from_dp, m_flow_nominal=m_flow_nominal[3], dp_nominal=dp_nominal[3], ReC=ReC[3], dh=dh[3], linearized=linearized, deltaM=deltaM)); parameter Boolean use_dh = false "Set to true to specify hydraulic diameter"; parameter Modelica.SIunits.MassFlowRate[3] m_flow_nominal(each min=0) "Mass flow rate"; parameter Modelica.SIunits.Pressure[3] dp_nominal(each min=0) "Pressure"; parameter Real deltaM(min=0) = 0.3 "Fraction of nominal mass flow rate where transition to turbulent occurs"; parameter Modelica.SIunits.Length[3] dh={1, 1, 1} "Hydraulic diameter"; parameter Real[3] ReC={4000, 4000, 4000} "Reynolds number where transition to turbulent starts"; parameter Boolean linearized = false "= true, use linear relation between m_flow and dp for any flow rate";end SplitterFixedResistanceDpM;