4 M ODELLING A PPROACH
4.4 Data Assimilation & Data Handling
4.5.3 Time-based hydraulic calculations
80
81 (Equation [3]), which takes on the form of Equation [31] for the reservoirs and Equation [32]
for the BPTs. The Euler Method was accepted as sufficiently accurate, without hesitation, due to the assurance provided by Mays (2000), as detailed in Section 2.4.1.1.
All reservoir volumes are thus integrated through an external function call that simultaneously integrates for each reservoir. The BPT and reservoir volumes are subsequently divided by their respective surface areas, as per Equation [34] , in order to calculate the current level of water within the tank. The reservoir integration function provides for a saturation volume to be reached in order to represent reservoir overflow conditions. The same is not provided for the BPTs, as it would affect the analysis of the efficacy of the control system and its ability to manage large flows. actis the activator binary variable that toggles the inflow to the reservoir based on the reservoir level.
( ) ( ) ( ( ) (t ))
res res in out
V t V t t t Q t t Q t [31]
( ) ( ) ( ( ) (t ))
BPT BPT in out
V t V t t t Q t t Q t [32]
( ) ( ) ( ( ) (t ))
res res char act demand
V t V t t t Q t t Q t [33]
( ) ( )
( )
res res
res
h t V t
A t [34]
4.5.3.3.a Level based decisions
The volume integration calculations enables the control mechanisms to reach a preferred valve/pump setting for the time-step (time t ). The positioning functions (globe valves and sleeve valves independently) utilize the BPT levels at time t , and the control system settings (Figure 18) that are located within their respective external functions in the form of a lookup table. The lookup table provides the target valve positions (xp) for the current level, to which the valve position must move, at its regulated rate. This ramped (regulated) valve movement is built into the external function through a calculation (Equation [35]) that involves the following inputs: the desired movement limit (fraction of stroke -mps), the length of the interval for which this movement is specified (tps) and the duration of each time step (t).
ps t
ps
m m t
t [35]
82 The calculated movement (mt ) is then allowed for, from the previous valve position (at
1
time t ). The ramped movement of the valves however, necessitates the following logic in order to account for a previous valve position (xtt) that would not permit the movement at the allowed rate (i.e. a movement at the calculated rate (mt) would cause the valve movement to exceed its target position (xp)).
if xtt xp & xttmt xp
t t t t
x x m
elseif xtt xp & xttmt xp
t t t t
x x m else xt xp
Although the control settings for the Ashley Drive and Wyebank Road BPTs are envisioned to be identical, provision is made for alterations in either control system by utilizing separate external functions. Control system settings may require alteration due to interaction between the two BPTs that may prove to be particularly burdensome on the Ashley Drive BPT, or if new valve settings are determined by optimization.
The program incorporates a data stack for the BPT control valve positions. This is included in order to emulate the workings of a real-world control model, where data cannot be indefinitely stored. The control valve position stack contains two levels of data; the current valve positions (time t ) in row 2, and the previous positions (time t 1) in row 1. The valve positions at
1
time t are required in order to regulate the movement of the valves as required by the control system.
83 4.5.3.4 Calculation of hydraulic parameters
DN600 globe valves
DN300 sleeve valves To BPT compartments
From Umlaas Road reservoir
Line resistance
Valve with eq uivalent characteristics to 3 xDN600 glob e valves at individu al o pen ings
To BPT compartments From Umlaas Road
reservoir Line resistance
Valve with eq uivalent characteristics to 3 x DN300 sleeve valves at
ind ivid ual op enings
Lin e resistance and 3x glob e valve lumpe d
To BPT compartments From Umlaas Road
reservoir
3x s leeve valve resistan ce
intADj P
,
PA j
linej
p
p
gvj
Figure 25 - Demonstration of the transformation of the individual flow factors into lumped terms to solve the hydraulic equations.
The combined effect of the globe valves (for each BPT) is computed through the addition of the product of the Kv and f x( )terms for all three valves, as presented in Equation [36]. The Kv value is constant, but f x( )is dependent on the current valve position, and is thus calculated through the regressed parameters (Section 4.5.2).
3 ,
1
( (x))
gv BPT l
l
R Kv f
[36]The format of the data supplied for the sleeve valves (Figure 24) however, required an additional processing step prior to this addition step. The additional processing involves the mentioned linear interpolation (Section 4.5.2.1) of the flowrate (ordinate), for the given valve position, from the nearest supplied valve position curve above and below the valve position at time t . The interpolation is carried out through an external function that contains a lookup table of data coordinates for each (𝑘𝑡ℎ) sleeve valve flow vs head curves.
The interpolation function utilizes the current valve position (xt) and a logical statement to place the current valve position between the two closest valve positions that correspond to the supplied characteristic curves (deciles). The coefficients for these two valve positions, that are obtained from the previous regression (Section 4.5.2.1), are used to find the flows (
, |
specPsv k upper
F
&
, |
specPsv k lower
F ) at the specified pressure (Psv ). The interpolation is subsequently carried according to Equation [37].
84
, ,
,
| |
| sv k sv k ( )
sv k
specP upper specP lower
k specP lower k lower
upper lower
F F
F F x x
x x
[37]
Re-regression (see Section 4.5.2.1) is then conducted using the results of the linear interpolation, in order to obtain a usable analytical equation that could be summed to obtain the combined effect of the sleeve valves, without compromising the accuracy of the model.
4.5.3.5 Hydraulic Loop- AD BPT
The attainment of the collective characteristics of each group of valves in series at time t allows for the commencement of the Newton-Raphson Method iteration loop. This method is used to iteratively solve for the flow through the AD BPT system, which is dependent on the interplay between the available head, the pipeline frictional effects and the resistance of the valves. The problem was constructed to manipulate a variable (Q) other than that utilised in its convergence criterion (P ). This was done in order to negate the interference of the relaxation parameter () on the convergence criterion.
To BPT compartments From Umlaas Road
reservoir Line resistance
Lin e resistance and 3x glob e valve lumpe d
To BPT compartments From Umlaas Road
reservoir
3x s leeve valve resistan ce
intADj
P
,
PA j
linej
p pgvj
AD AD
static j
P h Pres sure available at
en tran ce to AD BPT
Po int Ao
Figure 26 - Visualization of the parameters used in the hydraulic calculations for the AD BPT.
4.5.3.5.a Hydraulic calculations – k-value
Objective: The objective of the hydraulic solution loop is to determine the flowrate that is permitted through the BPT system at the current valve positions. The flowrate through the system is governed by three, interacting resistances (the line resistance, globe valves resistance and sleeve valve resistance). The attainment of the pressure between the globe valves and sleeve valves (PintAD) will allow for the flowrate upstream and downstream of this point (Point Ao) to be calculated explicitly. The hydraulic solution loop thus utilises the Newton- Raphson method to equate the flows upstream and downstream of Point Ao, by adjusting the
85 intermediate pressure (PintAD). Figure 26 is a visualization of the parameters used within the hydraulic loop.
The procedure is initiated by estimating the pressure (PintADj |j0) loss through sleeve valves at time t . 𝑗 is the Newton-Raphson iteration number. This in turn enables the calculation of a combined pressure loss (PA j, ) for the line (plinej) and globe valves (pgvj) corresponding to the initial guess (Equation [38] ). The unit of measurement for all pressure terms is meters of water.
, ( ) 0
A j linej gvj j
P p p
[38]
This combined pressure loss is then calculated, according to Equation [39] by subtracting the initial guess for the sleeve valve pressure loss, from the available head. The available head is the total static head (PstaticAD ) less the level of liquid in the BPT (hADj ) (BPT is bottom-fed).
, AD AD intAD
A j static j j
P P h P
[39]
These initial pressure loss guesses are then used to calculate the corresponding flow through the line and globe valves (QA jAD, |j0), and through the sleeve valves (QB,ADj |j0). Equation [40]
presents the relationship between the combined line and globe valve pressure loss and the flowrate through the system. Equation [41] is its explicit solution for the flowrate through the system.
2
, ,
,
( AD) ( 1 )
A j A j
gv AD
P Q k
R [40]
,
int 1
AD AD AD
static j j
AD A j
gv
P h P
Q
k R
[41]
The flow through sleeve valve 𝑖 (QBu,ADj) is obtained from Equation [42] which utilises the coefficients from the regression carried out in Section 4.5.2.1 for the current valve positions (xt).
Bu, 1 2
int int
( )
100 100
j j
AD
j u u
P P
Q v v [42]
86 The flowrate through each sleeve valve 𝑖, is then summed (Equation [43]) to obtain the total flowrate through the parallel configuration of the valves (QB,ADj).
3
B, Bu,
1
AD AD
j j
u
Q Q
[43]4.5.3.5.b Newton Raphson solution
The minimization function for the Newton-Raphson Method ( f( int )P AD ) is shown in Equation [44]
f( intP AD)(QAAD QBAD)j [44]
According to the Newton-Raphson method, the corresponding next guess is calculated by Equation [45].
j
is the iteration number, which is 0 for the initial guess.1 f( int )
int int
f( int ) int | j
AD
AD AD
j j AD
Pi
P P P
P P
[45]
The procedure of re-generating a next-guess pressure is repeated until the minimization function is within a specified tolerance ( ). A tolerance of 1x10-3
m3
s was deemed to be suitable as a convergence criterion for the model. The relaxation parameter was set to 5x10-3 in order to avoid observed ‘sawtooth’ overshooting of the root, thus speeding up convergence.
The gradient f( intP AD) P
was calculated through the simultaneous evaluation of the flows at a pressure α% greater thanPintADj, according to Equation [46]. The evaluation parameter (α) is included as a user-adjustable variable.
A B
f( int ) f( int ) f( int )
| |
int int int
AD AD
AD
j j
A B
P P
P
P P P
[46]
In order to optimize the algorithm for speed, the converged (final) Pint |j j j t t , 1at the previous
timestep (time t 1) is used as the initial guess (Pint |j j0,t t ) at the current timestep (time t ) for all t1, as this is expected to be a close approximation, particularly at small
time increments.
87 4.5.3.6 Hydraulic Loop- WR BPT
The Wyebank Drive BPT solution loop, in the regression model form, follows much the same format as that of the Ashley Drive BPT. The primary difference is the scaling of the per-metre
k value, which is achieved by the multiplication of the length of the pipe segment being considered, according to Equation [28]. Figure 27 is a visualization of the parameters used within the hydraulic loop.
To BPT compartments From AD BPT
Line resistance
Lin e resistance and 3x glob e valve lumpe d
To BPT compartments From AD BPT
3x s leeve valve resistan ce Pres sure available at en tran ce to W R BP T WR
p k
WR
p gv
1
psv
WR WR
static t
P h
Figure 27 - Visualization of the parameters used in the hydraulic calculations for the AD BPT.
The inclusion of the Darcy-Weisbach (1845) equation however, necessitates a complete overhaul of the structure of the loop. This loop commences with an initial guess (t0) of the flow through the network (QWRj |j0) that is also equated to the previous converged flow value
, 1
WR|
j j j t t
Q for every subsequent time-step (t1). The flowrate through each pipe run, from the Ashley Drive BPT to the Wyebank Road BPT is then computed through a series of backward-substitution type calculations.
4.5.3.6.a Hydraulic calculations (Darcy-Weisbach method)
Objective: The objective of the hydraulic solution loop is to determine the flowrate that is permitted through the BPT system at the current valve positions. The flowrate through the system is governed by three, interacting resistances (the line resistance, globe valves resistance and sleeve valve resistance). The Darcy-Weisbach equation introduces an added complexity, due to the equation being implicit with the flowrate. The solution procedure is thus amended to adjust the flowrate based upon the Newton-Raphson technique through the calculated
88 pressure losses. The line and globe valve pressure losses are all determinable with a flowrate estimate.
The initial guess of flow through the WR BPT (QWRj |j0) allows for the flow within each successive upstream line (𝑘 − 1) leading to the WR BPT (QWRj k1) to be calculated, through the knowledge of the current offtakes (Qchar,res - Section 4.5.3.2) according to Equation [47]
1 ,res
1
[ ( ) ]
y
WR WR
j k j k act char y
y
Q Q t Q
[47]The dimensionless friction factor () is then calculated through an external function call that solves the Colebrook-White equation (Equation [12]) for the friction factor, through successive substitution, according to Equation [48].
2 ,z
, 1
1
/ 2.51
2 log( )
3.7 Re
k
k
k k z
f e D
f
[48]
The friction factor, together with the other requisite physical parameters are then utilised within a Darcy-Weisbach (1845) (Equation [10]) external function, to calculate the pressure drop
pk
for each pipe segment (k ).
5
0 WR
k k
k
p p
[49]The sum of the pressure drops ( pWRk ) is then calculated through Equation [49], and subsequently subtracted from the total available static head in order to calculate the pressure available upstream of the globe valves. The total pressure drop across the three globe valves (
WR
p gv
) is obtained through Equation [50] which requires the regressed valve characteristic coefficients (Section 4.5.2) and the flowrate estimate (QWRj |j0).
2 ,
( )
WR WR j
gv
gv WR
p Q
R [50]
This enables the calculation of the estimated pressure drop across the sleeve valves (psv1) through Equation [51].
1
WR WR WR WR
sv static t k gv
p P h p p
[51]
89 Using the same flowrate estimate (QWRj |j0), the pressure drop psv2 through the set of sleeve valves can be calculated from the regressed equations (Section 4.5.2.1) and the quadratic equation. Equation [52] represents the explicit solution for the total flow through the sleeve valves (QSVWR) by summing the expressions for the individual flowrates through each valve in the parallel arrangement.
2 2
11 12 13 21 22 23
( ) ( )
100 100
WR sv sv
SV
p p
Q v v v v v v
[52]
Simple mathematical manipulations of Equation [52], yields the quadratic expression shown in Equation [53].
2 2
11 12 13 21 22 23
2 2
( )
0 ( )
100 100
WR
sv sv SV
v v v v v v
p p Q
[53]
The quadratic formula is then used to provide an explicit solution (Equation [54]) for the pressure drop through the sleeve valve arrangement (psv2). The subtraction of the square root term was found to produce the only viable root over the entire plausible range of flows.
2
21 22 23 21 22 23 11 12 13 2
2
11 12 13
( ) ( )
4 ( )
100 100 100
2 100
WR SV sv
v v v v v v v v v
Q
p v v v
[54]
The usage of the marginally more accurate quadratic-root regression equation for the sleeve valve flow-pressure relationship requires the inclusion of yet another inner loop, which was found to be unstable, particularly at low flowrates. The extra loop is required for root-finding purposes, as the root cannot be found directly. The inclusion of this loop drastically increased the computation time, regardless of the root-finding algorithm or relaxation parameter used.
The linear-root equation however, possesses an explicit solution that takes the form of the quadratic equation, whose non-complex solution over the entire pressure/flow range, corresponds to the subtraction of the square root term.
4.5.3.6.b Newton Raphson minimisation
The minimization function for this loop is constructed in terms of pressure in order to circumvent the aforementioned interference of the relaxation parameter in the convergence criteria. The minimization function ( f Q( WR)) is thus constructed as Equation [55].
90
2 1
( WR) | sv sv |j
f Q p p [55]
According to the Newton-Raphson method, the corresponding next guess is calculated by
1
min
( )
( )|
j
WR
WR WR
j j j j
WR Qw
Q Q f Q
F f Q
[56]
where
j
is the iteration number, which is 0 for the initial guess. The procedure of re-generating a next-guess pressure is repeated until the minimization function is within a specified tolerance ( ). The tolerance and relaxation parameter were maintained at the values specified for the AD BPT solution, and the gradient evaluations were conducted at the same (adjustable) percentage distance.After each Newton Raphson solution convergence, the pertinent variables are stored into separate vectors, in order to avail them for storage and further calculations. The iteration number parameter
j
is then reset to zero, and all the variable vectors are re-used for the next time-step.4.5.3.7 Fluid transient analyses
The next section of the program incorporates the water hammer calculations that are described in Section 2.4.3. The inclusion of both calculations to estimate the water hammer overpressure is discussed in Section 2.4.3. The Joukowsky overpressure estimation simplifies to Equation [57] and the steel pipe analogy simplifies to Equation.[58] lupis the length of the pipeline upstream to the valve and QBPTj is the converged flow rate from the BPT hydraulic loop, at the indicated time step.
2
( ( ) ( ))
250
BPT BPT
jou j j
wh
h
a Q t Q t t
h d
[57]
2
( ( ) ( ))
250
BPT BPT
up j j
wh
h
l Q t Q t t
h d t
[58]
91