Modelica.Fluid
library.
Name | Description |
---|---|
basicFlowFunction_dp | Basic class for flow models |
basicFlowFunction_m_flow | Basic class for flow models |
Examples | Collection of models that illustrate model use and test models |
Function that computes the pressure drop of flow elements as
m_flow = sign(dp) * k * sqrt(|dp|),with regularization near the origin. The variable
m_flow_turbulent
determines the location of the regularization.
Type | Name | Default | Description |
---|---|---|---|
Pressure | dp | Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa] | |
Real | k | Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2) | |
MassFlowRate | m_flow_turbulent | Mass flow rate [kg/s] | |
Boolean | linearized | false | = true, use linear relation between m_flow and dp for any flow rate |
Type | Name | Description |
---|---|---|
MassFlowRate | m_flow | Mass flow rate in design flow direction [kg/s] |
function basicFlowFunction_dp "Basic class for flow models" input Modelica.SIunits.Pressure dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.SIunits.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate"; input Boolean linearized = false "= true, use linear relation between m_flow and dp for any flow rate"; output Modelica.SIunits.MassFlowRate m_flow "Mass flow rate in design flow direction"; protected Modelica.SIunits.Pressure dp_turbulent(displayUnit="Pa") "Turbulent flow if |dp| >= dp_small, not a parameter because k can be a function of time"; protected Real kSqu(unit="kg.m") "Flow coefficient, kSqu=k^2=m_flow^2/|dp|"; constant Real conv(unit="m.s2/kg") = 1 "Factor, needed to satisfy unit check"; constant Real conv2 = sqrt(conv) "Factor, needed to satisfy unit check"; algorithm // if dp==0, we avoid a computation if (dp == 0 or k==0) then m_flow := 0; else kSqu:=k*k; dp_turbulent :=m_flow_turbulent^2/kSqu; if linearized then m_flow :=k*dp*conv2; else m_flow :=Modelica.Fluid.Utilities.regRoot2(x=dp, x_small=dp_turbulent, k1=kSqu, k2=kSqu); end if; end if;end basicFlowFunction_dp;
Function that computes the pressure drop of flow elements as
dp = 1/k^2 * sign(m_flow) m_flow^2with regularization near the origin. The variable
m_flow_turbulent
determines the location of the regularization.
Type | Name | Default | Description |
---|---|---|---|
MassFlowRate | m_flow | Mass flow rate in design flow direction [kg/s] | |
Real | k | Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2) | |
MassFlowRate | m_flow_turbulent | Mass flow rate [kg/s] | |
Boolean | linearized | false | = true, use linear relation between m_flow and dp for any flow rate |
Type | Name | Description |
---|---|---|
Pressure | dp | Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa] |
function basicFlowFunction_m_flow "Basic class for flow models" input Modelica.SIunits.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.SIunits.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate"; input Boolean linearized = false "= true, use linear relation between m_flow and dp for any flow rate"; output Modelica.SIunits.Pressure dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Real kSquInv(unit="1/(kg.m)") "Flow coefficient"; constant Real conv(unit="m.s2/kg") = 1 "Factor, needed to satisfy unit check"; constant Real conv2 = sqrt(conv) "Factor, needed to satisfy unit check"; algorithm // if m_flow == 0, we avoid a computation if (m_flow == 0) then dp := 0; else if linearized then dp := m_flow/k/conv2; else kSquInv:=1/k^2; dp :=Modelica.Fluid.Utilities.regSquare2(x=m_flow, x_small=m_flow_turbulent, k1=kSquInv, k2=kSquInv); end if; end if;end basicFlowFunction_m_flow;