# Documentation

Tank with two hydraulic ports, constant pressurization, and volume-dependent fluid level

## Library

Low-Pressure Blocks

## Description

The Variable Head Two-Arm Tank block represents a two-arm pressurized tank, in which fluid is stored under a specified pressure. The pressurization remains constant regardless of volume change. The block accounts for the fluid level change caused by the volume variation, as well as for pressure loss in the connecting pipes that can be caused by a filter, fittings, or some other local resistance. The loss is specified with the pressure loss coefficients. The block computes the volume of fluid in the tank and exports it outside through the physical signal port V.

For reasons of computational robustness, the pressure loss in each of the connecting pipes is computed with the equations similar to that used in the Fixed Orifice block:

${q}_{A}=\sqrt{\frac{1}{{K}_{A}}}\cdot {A}_{A}\sqrt{\frac{2}{\rho }}\cdot \frac{{p}_{lossA}}{{\left({p}_{lossA}^{2}+{p}_{crA}^{2}\right)}^{1/4}}$

${q}_{B}=\sqrt{\frac{1}{{K}_{B}}}\cdot {A}_{B}\sqrt{\frac{2}{\rho }}\cdot \frac{{p}_{lossB}}{{\left({p}_{lossB}^{2}+{p}_{crB}^{2}\right)}^{1/4}}$

${p}_{crA}={K}_{A}\frac{\rho }{2}{\left(\frac{{\mathrm{Re}}_{cr}\cdot \nu }{{d}_{A}}\right)}^{2}$

${p}_{crB}={K}_{B}\frac{\rho }{2}{\left(\frac{{\mathrm{Re}}_{cr}\cdot \nu }{{d}_{B}}\right)}^{2}$

The Critical Reynolds number is set to 15.

The pressure at the tank outlets is computed with the following equations:

${p}_{A}={p}_{elev}{}_{A}-{p}_{loss}{}_{A}+{p}_{pr}$

${p}_{B}={p}_{elev}{}_{B}-{p}_{loss}{}_{B}+{p}_{pr}$

${p}_{elevA}=\rho ·g·H$

${p}_{elevB}=\rho ·g\left(H-{h}_{BA}\right)$

${A}_{A}=\frac{\pi ·{d}_{A}{}^{2}}{4}$

${A}_{B}=\frac{\pi ·{d}_{B}{}^{2}}{4}$

$V={V}_{0}+q·t$

where

 pA Pressure at the tank outlet A pB Pressure at the tank outlet B pelevA Pressure due to fluid level at outlet A pelevB Pressure due to fluid level at outlet B plossA Pressure loss in the connecting pipe A plossB Pressure loss in the connecting pipe B ppr Pressurization ρ Fluid density g Acceleration of gravity `H` Fluid level with respect to outlet A `hAB` Elevation of outlet B with respect to outlet A KA Pressure loss coefficient at outlet A KB Pressure loss coefficient at outlet B AA Connecting pipe area at outlet A AB Connecting pipe area at outlet B dA Connecting pipe diameter at outlet A dB Connecting pipe diameter at outlet B qA Flow rate through outlet A qB Flow rate through outlet B pcrA Minimum pressure for turbulent flow in the connecting pipe A pcrB Minimum pressure for turbulent flow in the connecting pipe B V Instantaneous fluid volume V0 Initial fluid volume A Tank cross-sectional area t Simulation time

For a tank with a variable cross-sectional area, the relationship between fluid level and volume is specified with the table lookup

$H=f\left(V\right)$

You have a choice of three interpolation methods and two extrapolation methods.

Connections A and B are hydraulic conserving ports associated with the tank outlets. Connection V is a physical signal port. The flow rates are considered positive if fluid flows into the tank.

 Warning   If fluid level becomes so low that one or both of the tank outlets get exposed, no warnings will be issued. The simulation will continue and pressure at exposed outlet(s) will be set to the pressurization pressure level. If this is not acceptable, MathWorks recommends that you employ the necessary control measures to guard against this situation in your models.

## Dialog Box and Parameters

Initial fluid volume

The initial volume of fluid in the tank. This parameter must be greater than zero. The default value is `20` l.

Pressurization

Gage pressure acting on the surface of the fluid in the tank. It can be created by a gas cushion, membrane, bladder, or piston, as in bootstrap reservoirs. This parameter must be greater than or equal to zero. The default value is 0, which corresponds to a tank connected to atmosphere.

Level/Volume relationship

Select one of the following block parameterization options:

• `Linear` — Provide a value for the tank cross-sectional area. The level is assumed to be linearly dependent on the fluid volume. This is the default method.

• `Table-specified` — Provide tabulated data of fluid volumes and fluid levels. The level is determined by one-dimensional table lookup. You have a choice of three interpolation methods and two extrapolation methods.

Tank cross-section area

The cross-sectional area of the tank. This parameter must be greater than zero. The default value is `0.8` m^2. This parameter is used if Level/Volume relationship is set to `Linear`.

Tabulated fluid volumes

Specify the vector of input values for fluid volume as a one-dimensional array. The input values vector must be strictly increasing. The values can be nonuniformly spaced. The minimum number of values depends on the interpolation method: you must provide at least two values for linear interpolation, at least three values for cubic or spline interpolation. The default values, in m^3, are ```[0 0.0028 0.0065 0.0114 0.0176 0.0252 0.0344 0.0436 0.0512 0.0574 0.0623 0.066 0.0688 0.0707 0.072 0.0727]```. This parameter is used if Level/Volume relationship is set to `Table-specified`.

Tabulated fluid levels

Specify the vector of fluid levels as a one-dimensional array. The fluid levels vector must be of the same size as the fluid volumes vector. The default values, in meters, are ```[0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3]```. This parameter is used if Level/Volume relationship is set to `Table-specified`.

Port A pipeline diameter

The diameter of the connecting pipe at port A. This parameter must be greater than zero. The default value is `0.025` m.

Port A pressure loss coefficient

The value of the pressure loss coefficient, to account for pressure loss in the connecting pipe at port A. This parameter must be greater than zero. The default value is `1.2`.

Port B pipeline diameter

The diameter of the connecting pipe at port B. This parameter must be greater than zero. The default value is `0.02` m.

Port B height above port A

The elevation of port B above port A. If port A is higher than port B, enter a negative value. The default value is `0.8` m.

Port B pressure loss coefficient

The value of the pressure loss coefficient, to account for pressure loss in the connecting pipe at port B. The loss is computed with the equation similar to the one given for port A. This parameter must be greater than zero. The default value is `1.2`.

Interpolation method

Select one of the following interpolation methods for approximating the output value when the input value is between two consecutive grid points:

• `Linear` — Uses a linear interpolation function.

• `Cubic` — Uses the Piecewise Cubic Hermite Interpolation Polynomial (PCHIP).

• `Spline` — Uses the cubic spline interpolation algorithm.

For more information on interpolation algorithms, see the PS Lookup Table (1D) block reference page. This parameter is used if Level/Volume relationship is set to `Table-specified`.

Extrapolation method

Select one of the following extrapolation methods for determining the output value when the input value is outside the range specified in the argument list:

• `From last 2 points` — Extrapolates using the linear method (regardless of the interpolation method specified), based on the last two output values at the appropriate end of the range. That is, the block uses the first and second specified output values if the input value is below the specified range, and the two last specified output values if the input value is above the specified range.

• `From last point` — Uses the last specified output value at the appropriate end of the range. That is, the block uses the last specified output value for all input values greater than the last specified input argument, and the first specified output value for all input values less than the first specified input argument.

For more information on extrapolation algorithms, see the PS Lookup Table (1D) block reference page. This parameter is used if Level/Volume relationship is set to `Table-specified`.

## Ports

The block has the following ports:

`A`

Hydraulic conserving port associated with the tank outlet A.

`B`

Hydraulic conserving port associated with the tank outlet B.

`V`

Physical signal port that outputs the volume of fluid in the tank.