Water Valve

Control the flow of Water

 Description The Water Valve component models a generic valve which is to control the flow for the lumped thermal fluid simulation of Water. In this component, the mass flow rate is calculated based on valve opening mainly.

Equations

The calculation is changed based on parameter values of Type of flow, Calculation Type, and Dynamics of mass in the Water Settings component.

 Type of flow = Linear and Dynamics of mass = Static Calculation Type = true    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{A\cdot \mathrm{α__linear}}\cdot \mathrm{mflow}$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{opening__act}\cdot \mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$ Calculation Type = false    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{A\cdot \mathrm{opening__act}\cdot \mathrm{α__linear}}\cdot \mathrm{mflow}$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$
 Type of flow = Linear and Dynamics of mass = Dynamic Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{opening__act}\cdot A\cdot \mathrm{α__linear}\cdot \mathrm{dp}$ Mass flow rate is calculated with: $\mathrm{port_a.mflow}=\mathrm{mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$
 Type of flow = Square root and Dynamics of mass = Static Calculation Type = true    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{{\left(A\cdot \mathrm{α__sqrt}\right)}^{2}}\cdot {\mathrm{mflow}}^{2}\cdot \mathrm{sign}\left(\mathrm{mflow}\right)$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{opening__act}\cdot \mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$ Calculation Type = false    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{{\left(A\cdot \mathrm{opening__act}\cdot \mathrm{α__sqrt}\right)}^{2}}\cdot {\mathrm{mflow}}^{2}\cdot \mathrm{sign}\left(\mathrm{mflow}\right)$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$
 Type of flow = Square root and Dynamics of mass = Dynamic In theory, Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{opening__act}\cdot A\cdot \mathrm{α__sqrt}\cdot \sqrt{\mathrm{dp}}$ In the Heat Transfer Library, the following equation is used to resolve difficulties of the numerical calculation: $\mathrm{mflow}=\mathrm{opening__act}\cdot A\cdot \mathrm{α__sqrt}\cdot \mathrm{HeatTransfer.Functions.regRoot}\left(\mathrm{dp},\mathrm{sharpness}\right)$ Mass flow rate is calculated with: $\mathrm{port_a.mflow}=\mathrm{mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$ (*) $\mathrm{HeatTransfer.Functions.regRoot}$ is the same function as $\mathrm{Modelica.Fluid.Utilities.regRoot}$. To check the details of the package and view the original documentation, which includes author and copyright information, click here.
 Type of flow = Darcy-Weisbach and Dynamics of mass = Static Calculation Type = true    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{2}\cdot \mathrm{λ}\cdot \frac{L}{\mathrm{D__h}\cdot {A}^{2}\cdot {\begin{array}{cc}\mathrm{inStream}\left(\mathrm{port_a.rho}\right)& \mathrm{dp}\ge 0\\ \mathrm{inStream}\left(\mathrm{port_b.rho}\right)& \mathrm{others}\end{array}}\cdot {\mathrm{mflow}}^{2}\cdot \mathrm{sign}\left(\mathrm{mflow}\right)$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{opening__act}\cdot \mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$ Calculation Type = false    Pressure difference is calculated with: $\mathrm{dp}=\frac{1}{2}\cdot \mathrm{λ}\cdot \frac{L}{\mathrm{D__h}\cdot {\left(A\cdot \mathrm{opening__act}\right)}^{2}\cdot {\begin{array}{cc}\mathrm{inStream}\left(\mathrm{port_a.rho}\right)& \mathrm{dp}\ge 0\\ \mathrm{inStream}\left(\mathrm{port_b.rho}\right)& \mathrm{others}\end{array}}\cdot {\mathrm{mflow}}^{2}\cdot \mathrm{sign}\left(\mathrm{mflow}\right)$    Mass flow rate is calculated with: $\mathrm{mflow}=\mathrm{port_a.mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$
 Type of flow = Darcy-Weisbach and Dynamics of mass = Dynamic Mass flow rate is calculated with in theory: $\mathrm{mflow}=\sqrt{\frac{2\cdot \mathrm{D__h}\cdot {\left(\mathrm{opening__act}\cdot A\right)}^{2}}{\mathrm{λ}\cdot L}}\cdot \sqrt{{\begin{array}{cc}\mathrm{inStream}\left(\mathrm{port_a.rho}\right)& \mathrm{dp}\ge 0\\ \mathrm{inStream}\left(\mathrm{port_b.rho}\right)& \mathrm{others}\end{array}\cdot \mathrm{dp}}$ In the Heat Transfer Library, the following equation is used to resolve difficulties of the numerical calculation: $\mathrm{mflow}=\sqrt{\frac{2\cdot \mathrm{D__h}\cdot {\left(\mathrm{opening__act}\cdot A\right)}^{2}}{\mathrm{\lambda }\cdot L}}\cdot \mathrm{HeatTransfer.Functions.regRoot2}\left(\mathrm{dp},\mathrm{dp_small},\mathrm{inStream}\left(\mathrm{port_a.rho}\right),\mathrm{inStream}\left(\mathrm{port_b.rho}\right),\mathrm{true},\mathrm{sharpness}\right)$ Mass flow rate is calculated with: $\mathrm{port_a.mflow}=\mathrm{mflow}$ $\mathrm{port_b.mflow}=-\mathrm{mflow}$ (*) $\mathrm{HeatTransfer.Functions.regRoot2}$ is the same function as $\mathrm{Modelica.Fluid.Utilities.regRoot2}$. To check the details of the package and view the original documentation, which includes author and copyright information, click here.

If Dynamic of mass = Static, valve opening is calculated with:

$\mathrm{opening__act}=\mathrm{min}\left(1.0,\mathrm{max}\left(\mathrm{opening},1.0\cdot {10}^{-10}\right)\right)$

On the other hand, if Dynamic of mass = Dynamic, it is calculated with:

$\frac{ⅆ\mathrm{opening__act}}{ⅆt}=\frac{\left(\mathrm{min}\left(1.0,\mathrm{max}\left(\mathrm{opening},1.0\cdot {10}^{-10}\right)\right)-\mathrm{opening__act}\right)}{\mathrm{T__const}}$

Common definitions are the following:

$\mathrm{dp}=\mathrm{port_a.p}-\mathrm{port_b.p}$

$v=\frac{\mathrm{mflow}}{{\begin{array}{cc}\mathrm{inStream}\left(\mathrm{port_a.rho}\right)& \mathrm{dp}\ge 0\\ \mathrm{inStream}\left(\mathrm{port_b.rho}\right)& \mathrm{others}\end{array}\cdot \left(\mathrm{opening__act}\cdot A\right)}$

$\mathrm{port_a.hflow}=\mathrm{inStream}\left(\mathrm{port_b.hflow}\right)$

$\mathrm{port_b.hflow}=\mathrm{inStream}\left(\mathrm{port_a.hflow}\right)$

$\mathrm{port_a.rho}=\mathrm{inStream}\left(\mathrm{port_b.rho}\right)$

$\mathrm{port_b.rho}=\mathrm{inStream}\left(\mathrm{port_a.rho}\right)$

$\mathrm{port_a.T}=\mathrm{inStream}\left(\mathrm{port_b.T}\right)$

$\mathrm{port_b.T}=\mathrm{inStream}\left(\mathrm{port_a.T}\right)$

Variables

 Symbol Units Description Modelica ID $\mathrm{dp}$ $\mathrm{Pa}$ Pressure difference p $\mathrm{mflow}$ $\frac{\mathrm{kg}}{s}$ Mass flow rate mflow $v$ $\frac{m}{s}$ Velocity of flow v $\mathrm{opening__act}$ $-$ Valve opening used for Flow calculation opening_act $\mathrm{typeA_opening}$ $-$ Valve opening used if Calculation type = true and Dynamic of mass = Static (Internal calculation use only) typeA_opening $\mathrm{typeB_opening}$ $-$ Valve opening used if Calculation type = false and Dynamic of mass = Static (Internal calculation use only) typeB_opening

Connections

 Name Description Modelica ID $\mathrm{port__a}$ Water Port $\mathrm{port_a}$ $\mathrm{port__b}$ Water Port $\mathrm{port_b}$ $\mathrm{opening}$ Valve opening $\mathrm{opening}$

Parameters

 Symbol Default Units Description Modelica ID $\mathrm{WaterSettings1}$ $-$ Specify a component of Water simulation settings Settings $\mathrm{Linear}$ $-$ Select Flow calculation type  - Linear  - Square root  - Darcy-Weisbach TypeOfFlow $\mathrm{α__linear}$ $30$ $-$ Flow coefficient for Linear type alpha_lin $\mathrm{α__sqrt}$ $3000$ $-$ Flow coefficient for Square root type alpha_sqrt $L$ $0.5$ $m$ Pipe length (Only for Darcy-Weisbach) L $\mathrm{D__h}$ $0.02$ $m$ Internal hydraulic diameter (Only for Darcy-Weisbach) Dh $A$ $\frac{\mathrm{Pi}}{10000}$ ${m}^{2}$ Flow area A $\mathrm{λ}$ $0.000015$ $-$ Friction coefficient for Darcy-Weisbach equation lambda $\mathrm{dp__small}$ $0.1$ $\mathrm{Pa}$ Approximation of function for |dp| <= dp_small dp_small $\mathrm{sharpness}$ $1.0$ $-$ Sharpness of approximation for sqrt(dp) and sqrt(rho * dp) sharpness $\mathrm{T__const}$ $0.001$ $s$ Time constant for Valve opening (Only if Dynamic of mass = Dynamic) T_const $\mathrm{true}$ $-$ If true, Mass flow rate is controlled by Valve opening directly. If false, the calculation of Mass flow rate is consistent with Dynamic of mass = Dynamic (Only if Dynamic of mass = Static) CalType