i Hydraulic Transient Analysis of Emergency Water System at Ontario Power Generation Using Method of Characteristics A thesis submitted to the Department of Mechanical and Industrial Engineering In the partial fulfillment of the requirements for the degree of BACHELOR OF APPLIED SCIENCE Author: Waleed Ishaque Supervisor: Prof. Bryan Karney Date: December 2011
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
i
Hydraulic Transient Analysis of Emergency
Water System at Ontario Power Generation
Using Method of Characteristics
A thesis submitted to the
Department of Mechanical and Industrial Engineering
In the partial fulfillment of the requirements for the degree of
BACHELOR OF APPLIED SCIENCE
Author: Waleed Ishaque
Supervisor: Prof. Bryan Karney
Date: December 2011
ii
Abstract
Hydraulic Transients are sudden changes in velocity and pressure of a fluid in a piping system
which may exceed the design limitations causing a pipe rupture. These sudden changes are
normally caused by operation of a fluid control device such as a valve. Sudden valve closure or
opening downstream of a pressurized pipeline is a typical operation that may cause pressure
oscillations i.e. hydraulic transients in the fluid.
This phenomenon can also be explained using energy transfers. Considering a sudden valve
closure, the moving fluid with high kinetic energy when suddenly stopped gains potential
energy. In a fluid system, this potential energy is a pressure wave that travels along the system. If
this pressure wave exceeds the design limits, system failure will occur.
To demonstrate the application of hydraulic transient analysis, the paper models the Emergency
Water System (EWS) at Ontario Power Generation (OPG), Pickering Nuclear. The EWS is a
safety system at the Pickering CANDU Nuclear Station which consists of three parallel with
peak horse power of 400 capable of supplying 140 meter pressure head at the best efficiency
point.
A mathematical technique known as the Method of Characteristics is used in a MATLAB
program that models transients in simple systems. Combinations pump, valves and air pocket
were analyzed to observe water behavior as system configurations changed e.g. pump startup and
valve opening. Results show that transients due to valve opening are less severe than vale closure
operation. Also, air pocket in a downstream dead end is modeled. Results from this model show
that air pocket if sufficiently of large volume dampens the pressure oscillations. But when the
volume of air pocket is small compared to that of water the pressure oscillations become
significant and become to threaten the system. In the case of EWS, pressure oscillations are
small because of relief flow to the lake and throttling of pump discharge valves during the test
procedure.
iii
Acknowledgments
I am in debt to Professor Bryan Karney for the tremendous support he gave me throughout my
thesis. Without his guidance I would not have known my potential. Working with him brought
me closer to physics and science of the world we live in. His ambitious personality always
pushed me to achieve the greatest. In my first meeting with him, he said “make something you
are proud of”. This statement will always push me towards ambition, in preparing this thesis and
life in general. He continued to give me advice and encouragement from the moment I met him
to discuss my topic.
Also, I am grateful to the members of Ontario Power Generation who motivated me to pursue
my thesis on hydraulic transients. During my internship at OPG in year 2011, I gained
tremendous knowledge and interest in the nuclear industry. I would specifically like to thank
Carlos Lorencez, Elizabeth Mistele, Evan Davidge and Arvind Misra for being available to me
during the busiest times of their work. Without their help this thesis would not have been
possible.
Last but not the least; I would like to thank my family of non-engineers for listening to me
patiently when I talked about hydraulic transients at the dinner table.
Chapter 8 Typical System Configurations Analyzed.................................................................... 29
8.1 Introduction ......................................................................................................................... 29 8.2 Water tank with a downstream valve .................................................................................. 29 8.3 Pump with a downstream valve .......................................................................................... 32 8.4 Pump with a downstream air pocket ................................................................................... 34 8.5 Summary ............................................................................................................................. 39
Chapter 9 Case Study .................................................................................................................... 40
9.2 Emergency water system .................................................................................................... 40 9.3 MATLAB model of EWS ................................................................................................... 41 9.4 Results ................................................................................................................................. 42
10.2 Common transient system failures .................................................................................... 47 10.3 System protection ............................................................................................................. 48
and 6.14, pump discharge boundary equation 7.15 is developed:
………………………………………………. 7.15
is determined by substituting calculated
into equations 7.15 or 6.14
26
Trapped air volume
In some system configurations, often there is an air pocket trapped in the pipe. To simplify the
analysis compressibility of the liquid in the pipe is considered negligibly smaller than that of the
air pocket. The air is assumed to behave like a polytropic gas that obeys the relation
………………………………………………………………………………... 7.16
where is the absolute head , is the gas volume, is the polytropic exponent of the
thermodynamic process and is a constant. When the air volume is small compared to the
volume of water in system, the process may become isothermal and an value of 1 is assumed.
However, ,commonly, an average value of 1.2 is used for in analysis.
In equation 7.16 is the sum of three pressure heads, gauge , barometric and pipe height
. The initial volume is used to define compressed volume for all time increments and
equation 7.17 is developed that combines the three pressure heads:
……………………………………………………. 7.17
Equation 7.17 and the upstream compatibility equation 6.15 are solved simultaneously to obtain
a new nonlinear equation 7.18 with the variable :
………………………………. 7.18
To determine Wiley and Streeter (1978) suggest using the Newton’s method which uses the
expression
. Substituting equation 7.18 into this expression and simplifying it
generates:
…………………………………………….. 7.19
Equation 7.19 calculates
which is used to determine with equation 7.20:
…………………………………………………………………………… 7.20
At each time step, is then calculated using the relationship in equation 7.21:
…………………………………………………………………………… 7.21
27
Pipe Junction
In complex fluid systems, the fluid travels through pipes which eventually connect and divert
into other pipes from a junction. To model a junction, additional boundary conditions are not
required. Instead, equations of continuity are used to relate downstream and upstream flows of
different pipes. To develop the continuity equation, minor losses in the junction are neglected
and a common head is assumed i.e. the downstream head at pipe 1 and 2 is equal to upstream
head at pipe 3 and 4.
Writing the upstream compatibility equations for pipe 1 and 2, and writing the upstream
compatibility equations for pipe 3 and 4 with the flow subject of the formula:
……………………………………………………………………… 7.22
……………………………………………………………………… 7.23
…………………………………………………………………….. 7.24
…………………………………………………………………….. 7.25
Observing Figure 10, the continuity equation is written as follows:
………………………………..……………………. 7.26
Substituting equations 7.22 to 7.25 into 7.26 and rearranging the equation 7.27 for the common
head :
…………………………………………………………………… 7.27
Figure 10. Pipe Junction (taken from Wiley and Streeter (1978))
28
7.3 Summary
This chapter discusses the boundary conditions that are used in a case study that is analyzed in
chapter 9. The idea of developing a boundary condition is to setup the characteristic grid that
communicates the head and velocity information across the pipeline. The boundary conditions
dictate how the pressure and discharge behave during the time of simulation. In the next chapter,
typical system configurations are modeled and their results are discussed.
29
Chapter 8 Typical System Configurations Analyzed
8.1 Introduction
An understanding of modeling transients using the Method of Characteristics is now established.
In this chapter, typical system configurations are modeled and their results are discussed.
8.2 Water tank with a downstream valve
A simple system consisting of a water tank with a gate valve in downstream is a common
configuration in water systems. MATLAB code for both cases of gate valve opening and closing
was considered.
Sudden operation of valves can cause transients in a system as simple as a water reservoir
discharging to atmosphere. Gate valves are either closed or opened and for either operation a
MATLAB code (see Appendix A) was developed to simulate transients.
Comparing Figure 12 and Figure 13, it is observed that when valve is opened rapidly (25% per
second) the local pressure head oscillations at the gate valve are of high amplitude. Whereas in a
slow opening (2.5% per second) operation the pressure oscillations still exist but are not as
severe. A direct affect of the pressure oscillations is the formation of voids around the valve
wedge which can cause pitting leading to accelerated wear.
Figure 11. Water tank with a downstream valve
30
.
Figure 12. Gate valve opening at 2.5% per second
Figure 13. Gate valve opening at 25% per second
31
The second mode of operation for a valve is closure. Transients in a rapid closure are more
severe than in the case of valve opening. Comparing Figure 14and Figure 15, it is observed that a
rapid closure of valve can induce pressure peaks double the head supplied by the reservoir.
Whereas a slow valve closure induces pressure peaks 10% higher than the supply head.
Figure 14. Gate valve closing at 10% per second
Figure 15. Gate valve closing in one second
32
8.3 Pump with a downstream valve
A common device to provide fluid flow is a centrifugal pump. A pump behaves according to the
performance curve which dictates the pressure at certain flow supplied by the pump. When a
pump sees the low resistance in a pipeline its flow rate continues to increase until the pump dries
out of fluid. On the other hand, when pump sees a high resistance its flow rate decreases and
pressure head increases until it reaches the shutoff head at which the pump turns off.
MATLAB code (see Appendix A) was developed to observe system behavior of a pump with a
downstream gate valve. The code solves the transient equations for a pump start up. Typically in
a pump startup boundary condition, inertial effects are neglected unlike in a pump failure
situation where reverse flow and pump motor rotation plays a significant role in transient
behavior. Figure 17 shows how a pump behaves when the gate valve is ultimately closed and the
head at the pump increases until it shuts off at the shutoff head value of 140 meter.
.
Figure 16. Pump with a downstream valve
Figure 17. Pump Startup with downstream valve closing at 20 seconds
33
Figure 18 shows the pump behavior when the gate valve is started to open at 30 seconds into the
simulation. The pressure fluctuations are not severe but still exist due a change in resistance in
pipeline.
Figure 18. Pump Startup with downstream valve opening at 30 seconds
34
8.4 Pump with a downstream air pocket
Keeping a pipeline air tight can sometimes be a challenge if the system is continuously tested for
flows. A simple configuration of a pump and a downstream air pocket in a vertical line was
analyzed for transient conditions. The MATLAB code (see Appendix A) simulates a pump
startup and compares transients caused by different sized air pocket heights. Figure 20 to Figure
23 show results from the MATLAB code (see Appendix A) with different air pocket heights and
a constant horizontal pipe length of 100m.
A general observation from the results of air pocket simulation is that transients become severe
as the air pocket volume decreases. Comparing the graphs of flow discharge at the air pocket and
volume of air pocket it is evident that as water flows away from the air pocket the volume of air
pocket increases due to air expansion. The reverse flowing water then also affects the pump flow
as seen in the graph of flow discharge variation at the pump.
Figure 19. Pump with a downstream air pocket
35
Figure 20. Pump startup with downstream air pocket of 10m height
36
Figure 21. Pump startup with downstream air pocket of 5m height
37
Figure 22. Pump startup with downstream air pocket of 1m height
38
Figure 23. Pump startup with downstream air pocket of 10 cm height
39
8.5 Summary
This chapter presents the results of MATLAB simulations of simple system configurations of
upstream pump and head reservoir combined with downstream valve and air pocket. From
results of transient simulations, it was observed that valve opening causes non-significant
transients compared to a rapid valve closure. However, when opening a valve at 20% per second
the transient pressure oscillations were twice as much as opening a valve at 2.5% per second.
Also, results from the air pocket simulation show that transients are less sever for a larger
volume air pocket.
40
Chapter 9 Case Study
9.1 Introduction
Up to this point the paper has established background on the physical fundamentals of hydraulic
transients, developed the governing equations of transient analysis, discussed in detail the
Methods of Characteristics and boundary conditions. Utilizing these developments, this chapter
uses the method of characteristics to analyze the Emergency Water System (EWS) at Ontario
Power Generation, Pickering Nuclear Station.
9.2 Emergency water system
EWS is a safety system that is credited for supplying cooling water to critical reactor
components during a seismic event when all primary and backup systems have failed. Because
EWS is a poised system, it is tested to check for availability and perform maintenance if
degradation is observed.
For a safety system it is critical for a start-up to take place as soon as possible following an
accident. With this intent, a downstream valve on the 16 inch vertical line was proposed to be
left open to save approximately 12 minutes of the start-up time during an emergency start-up.
However, by leaving the valve open, an air pocket is introduced in the 9.0 meter vertical line
where the valve is located. Figure 24 shows the top view and side view of the simplified EWS
configuration. For confidentiality purposes the actual drawings are not shown here and valve
numbers are changed.
Figure 24. Simplified Emergency Water System
Pipe 7
41
9.3 MATLAB model of EWS
Using the Method of Characteristics, MATLAB code (see Appendix B) was developed to
simulate the simplified EWS. Significant challenges were faced with regards to stability of code.
With parallel pump boundaries, multiple junctions and air pocket in the downstream, the
traditional Method of Characteristics starts to show limitations. To mitigate the issue of
instability the wave speed was reduced to 500m/s and pipe length increased to 100m between
each boundary. Another alternative to make the code more stable is to use robust boundary
conditions for pumps and air pockets. State of the art modeling techniques have been developed
which may have been useful for modeling a system such as the EWS. However, due to time
constraints, advance modeling techniques were not perused. Rather, code instability was
mitigated by modeling the parallel pumps to start at the same time as if a single pump. With
pumps starting up in sequence, code was unable to perform stably. This was discovered after the
code was developed.
The existing code successfully demonstrates the EWS with a single pump or parallel pumps
starting up together. Two models were evaluated, one with throttle valves V-1 and V-2 opening
in 5 seconds and the other opening in 15 seconds. In the following section graphs from the
MATLAB code (see Appendix B) are shown.
42
9.4 Results
Figure 25. Transients at the Pump 1 and Throttle Valve 1 opening in 5 seconds
Figure 26. Transients at Pump 2 and Throttle Valve 2 opening in 5 seconds
43
Figure 27. Transients at junction 1 and 2 of the simplified EWS
Figure 28. Transients at the test nozzle (relief valve) and between junction 1 and junction 2
44
Figure 29. Transients at the air pocket downstream of junction 2
Figure 30. Transients at junction 1 and 2 of the simplified EWS with throttle valves opening in 15
seconds
45
9.5 Discussion
Observing Figure 27, junction 1 and 2 of the simplified EWS experience significant pressure
oscillations of an average 100 kPa. Though not severe, these oscillations showcase the danger
of having air trapped in system. To understand the affect of air in a system, the downstream air
pocket in EWS is replaced by a dead end and modeled in MATLAB.
Comparing Figure 31 and Figure 25 in the last 20 seconds of simulation, the transients in EWS
without air pocket are smooth unlike the sever oscillations in the EWS with air pocket. Air
pocket causes severe oscillations due to high sudden accelerations the fluid experiences as it
encounters the air pocket. Decreasing the air pocket volume has shown to worsen the transients
due to the loss of dampening effect air has on the fluid. Effect of decreasing air pocket volume is
observed through Figure 20 and Figure 23.
Also, comparing Figure 27 and Figure 30, it is observed that transient pressure peaks are lower
when the valves are opened slowly (in 15 seconds). This is consistent with the earlier results
from a simple pump and valve configuration model shown in Figure 16.
Figure 31. Transients in Junction 1 and Junction 2 of EWS (without an air pocket in dead-end)
46
9.6 Recommendations
The downstream air pocket causes minor oscillations in junctions 1 and 2 of the simplified EWS.
The affect of air pocket is not so significant due to its large volume. While performing flow test
on EWS the downstream air pocket line must be checked for any opened or leaking valves.
Research has shown that transients are severe when the trapped air is allowed to release through
a nozzle (Martino. G. D et al, 2008).
Also, the effect of valve opening rate is not the dominating factor in the transients. Only at an
opening rate of 5 seconds the transients start to get worse. In EWS the throttle valves are 18 inch
gate valves which take approximately 200 turns to fully open. Leaving the valves fully open will
affect the steady state performance of the pumps during startup. With initial throttling the pumps
will remain at the best efficiency point and as the system is filled valves can be opened
gradually. However, throttling of gate valves for extended periods is not recommended since the
transient waves passing through will causing cavitation and pitting of valve. Overtime, valves
may degrade and must be inspected for internal damage.
Overall, by comparing the two EWS models with dead end and air pocket in the downstream, it
is observed that the large volume of air amplifies the transients by 20 kPa and only towards
the end of simulation when the system is filled with water. Therefore it is safe to perform the
system flow test with the downstream valve V-3 left open, provided test nozzles are open to
allow relief flow to the lake.
47
Chapter 10 Overview
10.1 Introduction
This paper does not aim to provide expert opinion on hydraulic transients; however, through the
results of previous chapters, the goal is that the technical reader will gain a different point of
view on water systems. Often systems are designed without putting thought into how water
“feels” as it goes through it. Questions a design engineer must ask can vary depending on the
system. But using the example of sudden valve closure, an engineer should realize that flowing
water when suddenly stopped experiences forces much greater than what human experiences in a
high speed car crash. This chapter will discuss some design implementations that can mitigate
transient affects by essentially understanding water behavior. In essence a system should achieve
a balance in how it wants the water to behave and how water wants to behave by itself.
10.2 Common transient system failures
In previous chapters, specific system configurations with a combination pump startup, valve
operation, dead end and air pocket were modeled. These specific configurations were considered
to build an understanding of the OPG EWS system configuration and simplify its model.
However, to develop a broader understanding of transients in water systems, consider the
following system failures or consequences of transients (Pejovic et al, 1987):
1. Maximum pressure: Results from chapter 8 and 9 show that pressure oscillations can be
10 times that of the operating conditions. These pressure oscillations can damage the pipe
and yield the material to the point of rupture.
2. Vacuum: Oscillating pressure waves can cause vacuum conditions similar to the ones
following drainage of pipeline. Air inlet valves must be located at the high points of
pipeline. Vacuum conditions can be sufficient to collapse a thin walled pipeline.
3. Cavitation: As the local pressure drops below water vapor pressure during a transient,
vapor bubbles or voids start to form. Eventually these voids are collapsed due to adjacent
water molecules. The sudden collapse of voids causes a pressure surge that causes
vacuum and high peak pressures.
4. Hydraulic vibrations: Transients in a system at different locations can influence each
other leading to vibrations approaching the natural frequency of the network i.e.
48
resonance frequency. Resonance is capable of destroying the entire network. Naturally, it
is extremely expensive to design pipe systems that can withstand resonance; therefore, it
is best to carefully model different transient scenarios and observe their influence on the
system.
10.3 System protection
A systematic methodology must be used when designing or analyzing fluid systems. Detecting
transients in an early stage is crucial to avoid system failures. The flow chart below lays out a
comprehensive guideline to control transients in a water distribution system:
Figure 32. Flowchart for surge control in water distribution systems (Boulos. P.; et al, 2005)
49
10.4 Conclusion
Transient flow is an intermediate condition between two steady-state conditions. Transients are a
form of communication for one end to tell the other end that a change has been made. This
communication takes place in a form of a pressure wave. Often this pressure wave is too high for
the pipe and it may be capable of causing failure.
The most important aspect of hydraulic transient modeling is to gain a point of view of flowing
water in a network of pipes. “A hydrologic engineer is a water psychologist who makes water
behave by his will while also respecting its own”, (Karney. B, 2011). Expanding on this
statement, transient analysis is a tool for the water psychologist.
The intent was to explore the fundamentals of transient analysis and apply them to an industry
case. Though the analysis is complex it provides meaningful insight into the system as it goes
through changes. A comprehensive transient analysis in the design phase of water network can
improve system behavior, operation and capital cost. In modern industry with flow capacities
increasing and piping networks getting more complex a comprehensive transient analysis
become more important. Besides, “we have power to bend [water] but it is a responsibility”,
Karney. B. W (2011).
50
Appendix A – Transient model 1
%1-D TRANSIENT ANALYSIS CODE% %Using Method of Characteristics%
%This MATLAB code is capable of modeling four boundary conditions. User can
choose from 1)upstream linear rate pump startup, 2) upstream constant head
reservoir, 3) downstream valve opening, or 4) downstream valve closing
%% Pipe Data clear all; %clears stored variables from memory lenght = 100; %meter D = 0.3; %meter r = 0.26/1000; %absoltue pipe wall roughness wave_speed = 200.0; %meter/second; pressure wave speed viscosity = 1.519E-6; %meter^2/second, water kinematic viscosity at 5 celcius ps = 5; %number of pipe sections excluding boundaries total_time = 100; %seconds, total simulation time courant_number = 1.0; %program stability condition gravity = 9.806; %meter^2/second, earth gravity
%% Characteristic Grid Data delta_x = lenght/(ps+2); %meter, incremental length of pipe delta_t = courant_number*delta_x/wave_speed; %second, incremental time ts = total_time/delta_t +1.0; %number of time intervals pipe_area = (pi/4.0)*(D^2); %meter^2, pipe cross section area
%% Initializing Variables for the Characteristic Grid x = zeros(ps+2,1); %x-axis, fill ps+2 x 1 matrix with zeros t = zeros(ts, 1); %time-axis, fill ps+2 x 1 matrix with zeros H = zeros(ps+2,ts); %create a zero matrix to store H values on the grid Q = zeros(ps+2,ts); %create a zero matrix to store Q values on the grid V = zeros(ps+2, ts); %create a zero matrix to store flow V values on the grid B = wave_speed/(gravity*pipe_area); %B in the characteristic equation R_multiplier = delta_x/(2.0*gravity*D*(pipe_area^2));
%% Boundary condition data valve_open = 0; %if the valve is opening enter 1, otherwise enter 0 valve_closure_time = 5.0; %seconds, valve closure time, instant valve closure valve_open_rate = 0.05; % x 100 percentage valve opening per second valve_taw=0; valve_open_time=10; %seconds, time when valve starts to opn pump_timer = 0.0; %seconds, time when pump starts up pump_time = 20; %seconds, time it takes the pump to reach effeciency point speed_ratio = 0; %ratio of current/effeciency point pump speed, initial speed
%% Steady State Calculation H_reservoir =50; %meter, constant head reservoir if valve_open == 0 && upstream == 1 SS_Q = 1; %meter^3/second, steady-state discharge else SS_Q = 0.0001; %meter^3/second, steady-state discharge end t(1) = 0.0; %seconds, time at steady state SS_V = SS_Q/pipe_area; %steady state velocity Q(:,1) = SS_Q; %enter steady state Q in the ps+2 x 1 matrix V(:,1) = SS_V; %enter steady state V in the ps+2 x 1 matrix reynolds = SS_V*D/viscosity; friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; if upstream == 1 H(1,1) = H_reservoir; elseif upstream == 2 H(1,1) = 0.001; end H_loss = friction*(delta_x/D)*(SS_V^2/(2.0*gravity)); %Darcy Weisback
Equation for i = 2:ps+2, %calculate steady state H values for the pipe x(i) = i*delta_x; H(i,1) = H(i-1,1)-H_loss; end SS_valve_H=H(ps+2,1);
%% TRANSIENT STATE CALCULATION
for ti = 2:ts, %%% Calculate upstream boundary conditions on the grid at x=0.0 t(ti)=(ti-1)*delta_t; if upstream == 2; if t(ti)> pump_timer speed_ratio=(t(ti)-pump_timer)/pump_time; if speed_ratio >= 1 speed_ratio=1; end end if speed_ratio == 0.0 Q(1,ti) = 0; H(1,ti) = 0.01; else reynolds = abs(V(1,ti-1)*D/viscosity); f = 0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; R = f*R_multiplier; CM = H(2,ti-1)-Q(2,ti-1)*(B-(R*(abs(Q(2,ti-1))))); theta = ((B-(aone*speed_ratio))/(2*atwo)); gamma = (1-((4*atwo*(((speed_ratio^2)*140.0)-CM))/(B-
H(1,ti) = H_reservoir; reynolds = abs(V(2,ti-1)*D/viscosity); friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R = friction*R_multiplier; CM = H(2,ti-1)-B*Q(2,ti-1)+R*Q(2,ti-1)*(abs(Q(2,ti-1))); Q(1,ti) = (H(1,ti)-CM)/B; end
%%%Calculate downstream boundary conditions on the grid at x=lenght if downstream == 2 C_1=(H(ps+2,ti)+10.3-D); C_2=(Vol-delta_t*(Q(ps+2, ti)+Q(ps+2,ti-1))/2)^1; C=C_1*C_2; CP=H(ps+1,ti-1)+B*Q(ps+1,ti-1)-(R*Q(ps+1,ti-1)*(abs(Q(ps+1,ti-1)))); for newton=1:50 Vol_p=Vol-delta_t*0.5*(Q(ps+2, ti)+Q(ps+2,ti-1)); if Vol_p < 0.0004 Vol_p=0.0004; end Zp=Zp+0.5*(Q(ps+2,ti))*delta_t/pipe_area; F1=((CP-B*Q(ps+2, ti)-Zp+10.3)*(Vol_p)^pc) - C; dFdQ=(-pc*delta_t*C*0.5/Vol_p)-B*(Vol_p^pc); dQ=-F1/dFdQ; Q(ps+2, ti)=Q(ps+2, ti)+dQ; end Vol=Vol-delta_t*0.5*(Q(ps+2, ti)+Q(ps+2, ti-1)); if Vol <= 0.0 Vol = 0.0; end H(ps+2,ti)=CP-(B*Q(ps+2,ti));
elseif downstream == 1 if valve_open == 1 if t(ti)>=valve_open_time valve_taw = valve_open_rate*t(ti)/0.1; if valve_taw >=10 valve_taw = 10; end end else if t(ti)>=valve_closure_time valve_taw = 0.0; else valve_taw = -(t(ti)-valve_closure_time)/valve_closure_time; end end reynolds = abs(V(ps+1,ti-1)*D/viscosity); friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; R = friction*R_multiplier; CP = H(ps+1,ti-1)+B*Q(ps+1,ti-1)-R*Q(ps+1,ti-1)*(abs(Q(ps+1,ti-1))); CV = ((Q(ps+1,ti-1)*valve_taw)^2)/(2*H(ps+1,ti-1)); alpha = ((B*CV)^2)+2.0*CV*CP; Q(ps+2,ti) = -B*CV+sqrt(alpha); H(ps+2,ti) = CP-B*Q(ps+2,ti); end
53
%%% Calculating interior points on the grid 0<x<lenght for j = 3:-1:2, for ps_i = j:2:ps+1, reynolds = abs(V(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 friction = 0.0; else friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; end R = friction*R_multiplier; CM = H(ps_i+1,ti-1)-B*Q(ps_i+1,ti-1)+R*Q(ps_i+1,ti-
1)*(abs(Q(ps_i+1,ti-1))); reynolds = abs(V(ps_i-1,ti-1)*D/viscosity); if reynolds == 0.0 friction = 0.0; else friction = 0.25/(log10((r/(3.7*D))+(5.74/reynolds^0.9)))^2; end R = friction*R_multiplier; CP = H(ps_i-1,ti-1)+B*Q(ps_i-1,ti-1)-R*Q(ps_i-1,ti-1)*(abs(Q(ps_i-
1,ti-1))); H(ps_i,ti) = (CP+CM)/2; Q(ps_i,ti) = (H(ps_i,ti)-CM)/B; end end V(:,ti) = Q(:,ti)/pipe_area; end
%% Plotting Results
subplot(2,2,1) plot (t,H(ps+2,:)*9.8,'b') xlabel ('Time (second)') ylabel ('Pressure (kPa)') title ('a) - Pressure variations at downstream')
subplot(2,2,2) plot (t,Q(ps+2,:)*1000,'b') xlabel ('Time (second)') ylabel ('Q (kg/s)') title ('b) - Flow variation at downstream')
subplot(2,2,3) plot (t,Q(1,:)*1000,'b') xlabel ('Time (second)') ylabel ('Q (kg/s)') title ('c) - Flow variations at upstream')
subplot(2,2,4) plot (t,H(1,:)*9.8,'b') xlabel ('Time (second)') ylabel ('Pressure (kPa)') title ('d) - Pressure variations at upstream')
54
Appendix B – Transient model 2
%1-D TRANSIENT ANALYSIS CODE% %Using Method of Characteristics%
%This MATLAB code models two parallel identical centrifugal pumps in
upstream. In the downstream the code models either an air pocket or a dead
end depending on user choice. This model simulates the OPG EWS system%
%% Common Pipe Properties clear all; %clears stored variables from memory lenght = 100; %meter D = 0.3; %meter D6 = 0.5; %meter, relief line diameter r = 0.26/1000; %absolute pipe wall roughness wave_speed = 600.0; %meter/second; pressure wave speed viscosity = 1.519E-6; %meter^2/second, water kinematic viscosity at 5 Celsius ps = 10; %number of pipe sections excluding boundaries total_time = 100; %seconds, total simulation time courant_number = 1.0; %program stability condition gravity = 9.806; %meter^2/second, earth gravity
%% Data for pipe 1 and pipe 2 with upstream pump and downstream valve H1_initial=0.01; H2_initial=0.01; SS_Q1=0.0; SS_Q2=0.0; pump_1_switch = 1.0; pump_2_switch = 1.0; pump_1_timer = 0; pump_2_timer = 30; pump_1_time=60; pump_2_time=60; speed_ratio_2=0.0; speed_ratio=0.0; aone=-77.26; %pump curve constant atwo=-136.9; %pump curve constant
%% Data for pipe 3 and 4 with upstream valve and downstream junction H3_initial=0.01; H4_initial=0.01; valve_taw_1=0.0; valve_taw_2=0.0; valve_1_max=1; valve_2_max=1; valve_1_time=40; %time valve takes to open valve_2_time=40; valve_1_timer=5; % time when valve open
55
valve_2_timer=5; SS_Q3=0.0; SS_Q4=0.0;
%% Data for pipe 5 with junction on either end H5_initial=0.01; SS_Q5=0.0;
%%Data for pipe 6 with open valve in downstream pipe_6_area=(pi/4.0)*(D6^2); H6_initial=0.01; relief_valve_taw=0.9; SS_Q6=0.0;
%% Data for pipe 7 with air pocket or dead end in downstream H7_initial = 0.01; SS_Q7=0.0; pc=1.2; Zp=D; Vol=(3.142*0.25*D^2)*(10);
%%Initializing Variables for each pipe on the grid% x=zeros(ps+2,1); %x-axis, fill Nx+2 X 1 matrix with zeros t=zeros(ts, 1); %time-axis, fill ts X 1 matrix with zeros H1=zeros(ps+2,ts); %create a zero matrix to store H values on the grid H2=zeros(ps+2,ts); H3=zeros(ps+2,ts); H4=zeros(ps+2,ts); H5=zeros(ps+2,ts); H6=zeros(ps+2,ts); H7=zeros(ps+2,ts);
Q1=zeros(ps+2,ts); %create a zero matrix to store Q values on the grid Q2=zeros(ps+2,ts); Q3=zeros(ps+2,ts); Q4=zeros(ps+2,ts); Q5=zeros(ps+2,ts); Q6=zeros(ps+2,ts); Q7=zeros(ps+2,ts);
V1=zeros(ps+2, ts); %Create a zero matrix to store flow V values on the grid V2=zeros(ps+2, ts); V3=zeros(ps+2, ts); V4=zeros(ps+2, ts); V5=zeros(ps+2, ts); V6=zeros(ps+2, ts); V7=zeros(ps+2, ts);
56
Vol_storage=zeros(1,ts); %create a zero matrix to store air pocket volume
values on the grid
B1=wave_speed/(gravity*pipe_area); %B in the characteristic equation B2=B1; B3=B2; B4=B3; B5=B4; B6=wave_speed/(gravity*pipe_6_area); %B in the characteristic equation B7=B5;
%% Boundary condition data downstream = 2; % dead end = 1, air pocket = 2
%%Steady state calculation for all pipes% t(1)=0.0; SS_V1=SS_Q1/pipe_area; SS_V2=SS_Q2/pipe_area; SS_V3=SS_Q3/pipe_area; SS_V4=SS_Q4/pipe_area; SS_V5=SS_Q5/pipe_area; SS_V6=SS_Q6/pipe_6_area; SS_V7=SS_Q7/pipe_area;
Q1(:,1)=SS_Q1; %Enter steady state Q in the first column V1(:,1)=SS_V1; Q2(:,1)=SS_Q2; V2(:,1)=SS_V2; Q3(:,1)=SS_Q3; V3(:,1)=SS_V3; Q4(:,1)=SS_Q4; V4(:,1)=SS_V4; Q5(:,1)=SS_Q5; V5(:,1)=SS_V5; Q6(:,1)=SS_Q6; V6(:,1)=SS_V6; Q7(:,1)=SS_Q7; V7(:,1)=SS_V7;
for i=2:ps+2, %calculate steady state H values from x=2 till end of pipe x(i)=i*delta_x; H1(i,1)=H1(i-1,1)-H1_loss; H2(i,1)=H2(i-1,1)-H2_loss; H3(i,1)=H3(i-1,1)-H3_loss; H4(i,1)=H4(i-1,1)-H4_loss; H5(i,1)=H5(i-1,1)-H5_loss; H6(i,1)=H6(i-1,1)-H6_loss; H7(i,1)=H7(i-1,1)-H7_loss;
end
%%TRANSIENT STATE CALCULATION% for ti=2:ts t(ti)=(ti-1)*delta_t;
%Upstream Boundary at pipe 1 % if pump_1_switch == 1; if t(ti)> pump_1_timer speed_ratio=(t(ti)-pump_1_timer)/pump_1_time; if speed_ratio >= 0.8 speed_ratio=0.8; end end end
if CP1-CM4 >= 0 Q1(ps+2,ti)=-CV1*(B1+B4)+(alpha_p)^0.5; else Q1(ps+2,ti)=CV1*(B1+B4)-(alpha_n)^0.5; end H1(ps+2,ti)=CP1-(B1*Q1(ps+2,ti));
%Interior Points in pipe 1% for j1=3:-1:2, for ps_i=j1:2:ps+1, reynolds=abs(V1(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R1=f*R1_multiplier; CM1=H1(ps_i+1,ti-1)-B1*Q1(ps_i+1,ti-1)+R1*Q1(ps_i+1,ti-
1)*(abs(Q1(ps_i+1,ti-1))); reynolds=abs(V1(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end
H1(ps_i,ti)=(CP1+CM1)/2; Q1(ps_i,ti)= (H1(ps_i,ti)-CM1)/B1; end end V1(:,ti)=Q1(:,ti)/pipe_area;
%Interior Points in pipe 2% for j2=3:-1:2, for ps_i=j2:2:ps+1, reynolds=abs(V2(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R2=f*R2_multiplier; CM2=H2(ps_i+1,ti-1)-B2*Q2(ps_i+1,ti-1)+R2*Q2(ps_i+1,ti-
1)*(abs(Q2(ps_i+1,ti-1))); reynolds=abs(V2(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R2=f*R2_multiplier; CP2=H2(ps_i-1,ti-1)+B2*Q2(ps_i-1,ti-1)-R2*Q2(ps_i-1,ti-
1)*(abs(Q2(ps_i-1,ti-1)));
H2(ps_i,ti)=(CP2+CM2)/2; Q2(ps_i,ti)= (H2(ps_i,ti)-CM2)/B2; end end V2(:,ti)=Q2(:,ti)/pipe_area;
%Interior Points in pipe 3% for j3=3:-1:2, for ps_i=j3:2:ps+1, reynolds=abs(V3(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R3=f*R3_multiplier; CM3=H3(ps_i+1,ti-1)-B3*Q3(ps_i+1,ti-1)+R3*Q3(ps_i+1,ti-
1)*(abs(Q3(ps_i+1,ti-1))); reynolds=abs(V3(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R3=f*R3_multiplier; CP3=H3(ps_i-1,ti-1)+B3*Q3(ps_i-1,ti-1)-R3*Q3(ps_i-1,ti-
1)*(abs(Q3(ps_i-1,ti-1)));
H3(ps_i,ti)=(CP3+CM3)/2; Q3(ps_i,ti)= (H3(ps_i,ti)-CM3)/B3; end end V3(:,ti)=Q3(:,ti)/pipe_area;
62
%Interior Points in pipe 4% for j4=3:-1:2, for ps_i=j4:2:ps+1, reynolds=abs(V4(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R4=f*R4_multiplier; CM4=H4(ps_i+1,ti-1)-B4*Q4(ps_i+1,ti-1)+R4*Q4(ps_i+1,ti-
1)*(abs(Q4(ps_i+1,ti-1))); reynolds=abs(V4(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R4=f*R4_multiplier; CP4=H4(ps_i-1,ti-1)+B4*Q4(ps_i-1,ti-1)-R4*Q4(ps_i-1,ti-
1)*(abs(Q4(ps_i-1,ti-1)));
H4(ps_i,ti)=(CP4+CM4)/2; Q4(ps_i,ti)= (H4(ps_i,ti)-CM4)/B4; end end V4(:,ti)=Q4(:,ti)/pipe_area;
%Interior Points in pipe 5% for j5=3:-1:2, for ps_i=j5:2:ps+1, reynolds=abs(V5(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.5*D))+(5.54/(reynolds^0.9))))^2; end R5=f*R5_multiplier; CM5=H5(ps_i+1,ti-1)-B5*Q5(ps_i+1,ti-1)+R5*Q5(ps_i+1,ti-
1)*(abs(Q5(ps_i+1,ti-1))); reynolds=abs(V5(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.5*D))+(5.54/(reynolds^0.9))))^2; end R5=f*R5_multiplier; CP5=H5(ps_i-1,ti-1)+B5*Q5(ps_i-1,ti-1)-R5*Q5(ps_i-1,ti-
1)*(abs(Q5(ps_i-1,ti-1)));
H5(ps_i,ti)=(CP5+CM5)/2; Q5(ps_i,ti)= (H5(ps_i,ti)-CM5)/B5; end end V5(:,ti)=Q5(:,ti)/pipe_area;
%Downstream Boundary at pipe 6 with throttle relief valve% reynolds=abs(V6(ps+1,ti-1)*D6/viscosity); f=0.25/(log10((r/(3.7*D6))+(5.74/reynolds^0.9)))^2; R6=f*R6_multiplier; CP6=H6(ps+1,ti-1)+B6*Q6(ps+1,ti-1)-(R6*Q6(ps+1,ti-1)*(abs(Q6(ps+1,ti-
%Interior Points in pipe 6% for j6=3:-1:2, for ps_i=j6:2:ps+1, reynolds=abs(V6(ps_i+1,ti-1)*D6/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D6))+(5.74/(reynolds^0.9))))^2; end R6=f*R6_multiplier; CM6=H6(ps_i+1,ti-1)-B6*Q6(ps_i+1,ti-1)+R6*Q6(ps_i+1,ti-
1)*(abs(Q6(ps_i+1,ti-1))); reynolds=abs(V6(ps_i-1,ti-1)*D6/viscosity); if reynolds==0.0 f=0.0; else
64
f=0.25/(log10((r/(3.7*D6))+(5.74/(reynolds^0.9))))^2; end R6=f*R6_multiplier; CP6=H6(ps_i-1,ti-1)+B6*Q6(ps_i-1,ti-1)-R6*Q6(ps_i-1,ti-
1)*(abs(Q6(ps_i-1,ti-1)));
H6(ps_i,ti)=(CP6+CM6)/2; Q6(ps_i,ti)= (H6(ps_i,ti)-CM6)/B6; end end V6(:,ti)=Q6(:,ti)/pipe_6_area;
%Downstream Boundary at pipe 7 with dead end or air pocket% if downstream == 1; CP7=H7(ps+1,ti-1)+B7*Q7(ps+1,ti-1)-(R7*Q7(ps+1,ti-1)*(abs(Q7(ps+1,ti-
1)*(abs(Q7(ps+1,ti-1)))); for newton=1:50 Vol_p=Vol-delta_t*0.5*(Q7(ps+2,ti)+Q7(ps+2,ti-1)); if Vol_p < 0.0001 Vol_p=0.0001; end Zp=Zp+((0.5*(Q7(ps+2,ti))+Q7(ps+2,ti-1))/pipe_area)*delta_t; F1=(CP7-B7*Q7(ps+2,ti)-Zp+10.3)*(Vol_p)^pc - C; dFdQ7=(-pc*delta_t*C*0.5/Vol_p)-B7*(Vol_p^pc); dQ7=-F1/dFdQ7; Q7(ps+2,ti)=Q7(ps+2,ti)+dQ7; end Vol=Vol-delta_t*0.5*(Q7(ps+2, ti)+Q7(ps+2, ti-1)); if Vol < 0.0 Vol = 0.0; end H7(ps+2,ti)=CP7-B7*Q7(ps+2,ti); Vol_storage (1,ti)=Vol; end
%Interior Points in pipe 7% for j7=3:-1:2, for ps_i=j7:2:ps+1, reynolds=abs(V7(ps_i+1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R7=f*R7_multiplier; CM7=H7(ps_i+1,ti-1)-B7*Q7(ps_i+1,ti-1)+R7*Q7(ps_i+1,ti-
1)*(abs(Q7(ps_i+1,ti-1)));
65
reynolds=abs(V7(ps_i-1,ti-1)*D/viscosity); if reynolds==0.0 f=0.0; else f=0.25/(log10((r/(3.7*D))+(5.74/(reynolds^0.9))))^2; end R7=f*R7_multiplier; CP7=H7(ps_i-1,ti-1)+B7*Q7(ps_i-1,ti-1)-R7*Q7(ps_i-1,ti-
1)*(abs(Q7(ps_i-1,ti-1))); H7(ps_i,ti)=(CP7+CM7)/2; Q7(ps_i,ti)= (H7(ps_i,ti)-CM7)/B7; end end V7(:,ti)=Q7(:,ti)/pipe_area;
end
66
References
Boulos. P. F; Karney. B. W; Wood. J. D; Lingireddy. (2005) Hydraulic Transient Guidelines for
Protecting Water Distribution Systems. American Water Works Association
Chou, T (2009) The Method of Characteristics. Dept. of Biomathematics, UCLA, Los
Angeles, CA 90095-1766
Chaudhry, M. H. (1979). Applied hydraulic transients. Van Nostrand Reinhold Co.,
New York, N.Y.
Karney. B. W, (2011). University of Toronto, CIV1303 lecture
Martino. G. D; Fontana. N; Giugni. M. (2008) Transient Flow Caused by Air Expulsion Through
an Orifice”, ASCE 0733-9429; 134:9
Parmakian, J. (1958). Waterhammer Analysis. Bureau of Reclamation Denver, Colorado: Dover
Publications, Inc.
Pejovic, S.; Boldy, A.P. & Obradovic, D., 1987. Guidelines for Hydraulic Transient Analysis.
Gower Technical Press, Eng-land-USA.
Wylie, E. B., and Streeter, V. L. (1978). Fluid transients. FEB Press, Ann Arbor,