Advances in Engineering Software 1992, 14, 55-60
Water supply headworks simulation using network linear programming George Kuczera Department of Civil Engineering and Surveying, University of Newcastle, NSW, 2308, Australia A water supply headworks simulation software package called WATHNET is described. It uses a simulation model based on a network linear programming formulation which makes the model independent of system configuration, avoids the need to define detailed operating rules, and allows simulation of systems changing over time. Particular emphasis is given to describing the user environment which consists of a portable, mouse-based graphics interface and the tools to which it provides access. This environment helps realize the potential of the model, providing tools which streamline the complex task of system definition and data preparation, and which present results in a readily comprehended form. A case study is used to illustrate significant features.
required to develop and maintain such a model. In contrast, generalized simulation models such as HEC-3, M O D S I M , WASP and I R I S are coded so that all information about the system is kept on a data file. Though some flexibility is inevitably lost, the model becomes truly independent of the system under study. One characteristic c o m m o n to all simulation models of complex headworks systems is that they require considerable input information, and can produce huge volumes of output information, particularly if synthetic hydrology is used. Recent developments in graphics hardware and software enable the development of intuitive graphical interfaces which streamline data entry tasks and, more importantly, offer the opportunity to present complex results in a form that can be readily comprehended by the engineer. This paper describes a headworks simulation package called W A T H N E T which, in the light of the previous discussion, is significant in four respects:
1 INTRODUCTION A water supply headworks system harvests, stores and transfers streamflow to demand centres serving urban, industrial, irrigation or environmental consumers. Such a system can be represented as a network of nodes interconnected by arcs. The nodes may represent reservoirs, demand centres, stream diversions, junctions and treatment plants, while arcs may represent streams and manmade conduits. Natural streamflow and demand are both stochastic implying that future behaviour can only be described statistically. Simulation models are widely used to assist in the planning and operation of headworks systems. Two distinctly different approaches can be used in developing such models. The first uses explicit operating rules to make assignments between nodes in the headworks network. It can become exceedingly complex when dealing with complex, multi-reservoir systems changing over time. The second approach circumvents such complexity by handing over responsibility for the detailed decision-making to a mathematical program (e.g. M O D S I M ] WASP 2) or a heuristic procedure guided by user-defined objectives (e.g. HEC-3, 3 IRIS4). The practical implementation of simulation models in the form of software has seen a similar dichotomy. The traditional implementation explicitly codes network configuration and operating rules into the computer program. Although the analyst has complete control over the model, considerable programming effort is
i) it uses a network linear programming (NLP) formation to make the simulation model independent of system configuration and to free the engineer from detailed specification of operating rules; ii) it is designed to readily perform dynamic simulation (in which the system is allowed to change over time) using generated streamflow and climatic data; iii) it makes extensive use of a mouse-based graphics interface to define the system network and operating criteria and to present results; and iv) it uses a simple device-dependent interface which presently will run on IBM-compatible and Macintosh computers and under the U N I X operating system using X Windows. 5
Advances in Engineering Software 0965-9978]92]$05.00 © 1992 Elsevier Science Publishers Ltd. 55
56
G. Kuczera EDNET
ll:-
WATSTRM ] Set :va~orfla°~n"fi]mea~ tdiiatry d]
Create or edit network file
am¢~ll
........
,.,,.1,m..
-:---
-,n
~-~,.,
m
........
',
SIMNET ",2
•
l
laa lode
The major focus in this paper is on the user environment which consists of the graphics interface and the tools to which it provides access. A case study is used to illustrate significant aspects of this environment. In addition an outline of the N L P formulation is presented. 2 THE W A T H N E T P R O G R A M S W A T H N E T is made up of four programs. The schematic in Fig. 1 shows the logical relationship between these programs and the files required to run each program. Each program is briefly described and illustrated below. Full details can be found in Kuczera. 6 3 EDNET: C O N F I G U R I N G T H E S Y S T E M Program E D N E T is used to interactively configure a new headworks network or edit an existing one. The operation of E D N E T is best explained by an example. Consider Fig. 2 which shows a schematic of a future
/ Tillegraflow •--..
/ L ~
./~;~..
ChichesferOow
I1~ ~ Chicheser reservoir 40000ML
\1
~ ~,,,~-., ".',~
Iii Johnsonscreek , reservoir
~t~, /
/
]
headworks system for the Lower Hunter located near Sydney, Australia. Figure 3 displays the W A T H N E T schematic for this system in which nodes are identified by the letter inside their box, solid arcs represent conduits, and dashed arcs represent streams. The important point to observe is that the W A T H N E T schematic bears close resemblance to the system schematic with which the engineer works. This visual association is exploited when presenting the results of a simulation. The mouse is used to draw the network schematic. New nodes or arcs are created in add mode which is selected by clicking the mouse on Add in the menu bar. Figure 3 shows a new arc terminating at the mouse cursor. I f the mouse is clicked and its cursor is inside an existing node box, the arc is created and a window requiring data for this arc appears; otherwise the new arc is cancelled. Existing nodes can be repositioned in move mode in which the mouse is used to drag the node to a new position. The menu bar in Fig. 3 shows all the available options. O f these Edit requires some comment. Clicking on Edit puts E D N E T into edit mode in which clicking on an existing arc or node brings up windows containing all information pertaining to that element. Any of this information can be edited. O f particular significance is the ability to change the network over time: Conduits, reservoirs and demand centres can be commissioned at nominated years with conduits also capable of being decommissioned.
.........................................................
~Mai,,and ~1 Seahamllow ~lf d. . . . d R. . . . p Graharnslown %~ / ~t e r e s e r v O i r ~ ~.S
~1, Tomagorecharge
demand
iI!I. ~"
~;
. 95
/
Johnsonsflow
Res~p /
:~
•
a
Fig. 3. Creating a new arc in a headworks network.
Fig. 1. Schematic of WATHNET programs.
~N. ii~ Tillegra ,~1 IIih reservoir ~'"'"~'*'°
/
WATOUT Analyzenetwork output file
R. . . . . p
=,amlr~
5
6
I
imm .~1
~o', ~ °.
~ diversion ~
~,:E
20000ML
Fig. 2. Schematic of Newcastle water supply headworks system.
4 WATSTRM: MANAGING STREAMFLOW, D E M A N D AND E V A P O R A T I O N DATA C o m m o n to all headworks simulation models is the need to prepare data files containing historic streamflow, evaporation and demand data. In W A T H N E T , a single data file is used with data arranged in uniquely-labelled columns. W A T S T R M was developed to help create and manipulate such a file. Among its options are ones allowing files to be merged,
Water supply headworks simulation Page, 1 _ I Page 2 I _ I Page a l Select files and ~ P 1 Set start and end dates, ] ~ l b , 1 Assign streamflow sites] simulation model J I and no. of replicates ] I to network nodes I I
]
I
Define linear annual~ demand trend I
Page 5A
I
Page 5B I _ Define seasonal ~ demand fract ons]
Page 7
Define restriction rule for a group
1
Page 8
I
~
/
_
57
Reservolr I
~Reservolr
2
Page 4 Select demand optionsand I
convergencecriteria
]
I
Page s I Assign demand sites I I t° demand n°des J
T
Page
6 I Define demand I res fiction groups
::he, [
Assign reservoirs ~ to a group j
_
Page 9 I Definereservoir ~
_I
l evap°rai°n parametersl
I
I
Page 12
[ Define end-of-season ~ tarcjet vo umes
Page 10
Define reservoircapadty and n t avo umes
I
Fig. 5. Sample water supply headworks system.
1
I Page 11 I i Define end-of-season flood centre vo umes
• satisfy all instream flow requirements; • ensure that reservoirs are at their end-of-season target volumes; • minimize delivery costs; and • avoid unnecessary spill from the system.
Fig. 4. SIMNET setup pages. column names to be edited, and statistical summaries generated. However, its main function is to provide a simple, virtually automatic means for generating synthetic streamflow and climatic data. After selecting appropriate data transformations, it uses the Matalas 7 multi-site lagone model to generate annual values which are then disaggregated into monthly values using the method of fragments first proposed by Svanidze. 8 This probability model is quite robust and gives satisfactory results in many cases. Comprehensive diagnostics are provided to alert the engineer to possible deficiencies in the probability model.
Although it is beyond the scope of this paper to fully explain the formulation, an appreciation of what is involved can be got by considering a simple example. Consider Fig. 5 which depicts a two-reservoir, twodemand system. Figure 6 shows the N L P formulation presented as a graph. For each arc in Fig. 6, minimum and maximum flow volumes are defined along with a unit penalty. The N L P algorithm finds the distribution of flows in the network such that the total penalty is minimized subject to satisfying capacity constraints. To make the N L P operate the system in accordance with the five above objectives, the network in Fig. 5 has to be expanded. The dashed arcs in Fig. 6
5 SIMNET: S I M U L A T I N G S Y S T E M O P E R A T I O N S I M N E T simulates the operation of the headworks system using a N L P to make all the assignment decisions. It performs three functions: i) It requests the necessary data to formulate the NLP. The engineer has to fill up to 12 menus or Pages of information. Figure 4 summarizes the information required for each of the Pages. About half of the Pages provide information on where S I M N E T can find data, while the remainder are used to define initial conditions, run options, demand restriction rules and reservoir target volumes. This setup is, in practice, usually very quick because S I M N E T stores the data of the last setup and displays this as the default. Typically the engineer usually only needs to make a few changes leaving the bulk of the setup exactly as before• it) It formulates the NLP which uses the following hierarchy of five objectives: • satisfy demand (which may be restricted according to predefined restriction rules) at all demand zones;
Inflow+Initial
5
I storage
.::::'I('. I('' :. /i__ , ~
I~tr~ ' "•"2)'~('i["•'"".~torage
': ':
/arcs/ I
'~'"~'~
]
e~rryo~?r
:
/i /~X~"-----="---~2............. ~
",
\
"~-
....... •" -
"" ",
rcs
Wasteinode
J
, / / i
D~eemand
/
i '; ..:
,'
....... .. • -
. •.. -
¥ RB Fig. 6. Graph of NLP for sample water supply headworks system.
58
G. Kuczera
along with the balancing node define three subnetworks which perform specific tasks: the shortfall sub-network ensures meeting demand is given the highest priority and also enables a feasible solution even when demand cannot be physically met due to a shortage of water or capacity constraints; the instream sub-network gives second highest priority to meeting flow requirements provided it is physically possible; and the storage carryover network allows storage to be carried over to the next season and ensures meeting end-of-season targets is given the third highest priority. A detailed discussion on the formulation is presented in Kuczera. 6 iii) It solves the N L P using the simplex-on-a-graph code developed by Kennington and Helgason. 9 This code takes advantage of the specialized nature of the NLP and as a consequence can solve the N L P about 100 times faster than standard revised simplex codes. In fact, this is the primary reason for formulating the headworks operation problem as a N L P rather than a linear program.
6 WATOUT: ANALYZING S I M U L A T I O N RESULTS SIMNET creates an output file which stores all the simulation results. W A T O U T is used to examine the contents of this file. The usefulness of W A T H N E T depends very much on how well W A T O U T communicates the results to the engineer. Program design was based on the belief that no assumption should be made on how the engineer wants to examine the results. To this end, emphasis was put on providing the ability to browse through the results in an unstructured manner, and to present results at different levels of detail. The use of W A T O U T is best presented by considering an example. For the system shown in Fig. 2, W A T S T R M was used to generate 500 15-year streamflow replicates with each replicate representing a sequence of flows that could occur in the next 15 years. SIMNET then simulated the operation of this system from 1990 to 2004 for each of the 500 streamflow replicates. The main purpose of the simulation was to investigate the impact of commissioning a new reservoir at Tillegra in 1992. At the start of the simulation all reservoirs were initially full. Annual demand grew from 500M1 in 1990 to 613M1 in 2004. Figure 7 displays the main menu of W A T O U T options. There are three option categories, two of which we shall consider: The first enables a detailed analysis for a selected replicate, while the second provides a statistical analysis of system performance.
~IPllI~
......
=.,,.m,,.lll, 3a.
The results for each individual replicate can be graphic-
Multiple
Replicates
Network output file = run6.dyn Number of replicates: 500 Print file: [
Select 0 0
]
option: I C
Display run information 0 N Dump network summary to print file Compress output file by deleting all replicate solutions
For s e l e c t e d replicate ~ : S - Display time series plots o f total storage a n d shortfall C) P - Playbuck network solutions 0 T Time series plots for selected arcs and nodes 0 9 Dump ~elected output to print file Statistical performance summary: 0 SD System wide demand TS Total storage 0
0 ~
SN - Selected demand node SR Selected reservoir
DB - Dump demand summary to print file OF Dump demand and reservoir summary to print file
Fig. 7. WATOUT options. ally studied in three ways: i) Time series plots of total reservoir storage and total demand shortfall which occurs when actual consumption is less than required demand, provide an overview of how the system performs. Figure 8 illustrates the window for such plots. The demand shortfalls at the end of the simulation are due to storage-triggered restrictions. At the bottom left-corner a numerical summary is provided for the time step nearest to the line cursor which tracks the mouse cursor; this feature is common to all plots produced by WATOUT. ii) Time series and cumulative frequency plots can be viewed for any arc and reservoir or demand node. Starting with a window displaying the network schematic, plots are obtained by clicking the mouse on the desired element. iii) The playback display illustrated in Fig. 9 provides a detailed picture of system operation for any time step. It has been found particularly useful in providing an intuitive feel for how the system is operated by the NLP and for identifying those system characteristics adversely impacting performance. Referring to Fig. 9, the leftmost box provides a global numerical summary. Demand nodes experiencing a shortfall,
I
Replicate: ioo L' h
46 - Total
!r
StnrQg¢
(%) v e r s u s
Time
V
Loi I.......... ig Total
gemand
25
r1~eI step
Shortfall
36
(%) v e r s u s
42
48
54
60
Time
so o ~o o 40 o 2o
7
6.1 Replicate analysis
I Main Menu:
Step: 53 ghortfal':
13
Seas I Year: 2003 30% Storage: 36X
,g
2~
3'~ T,me step
3~
4~
47
Is4
Uolumeteic
rat:
Shortfall
freq:
eo
15,0]
Fig. 8. Time series of total system storage and demand shortfalls.
59
Water supply headworks simulation
)
Step
Mode
•
Demand Node Performance Summary
Step: ss Year: 2003 Seas 3 Replete: 46
"'""-k
f
/
f
i full
0
~0~
f,~ll
I~w
f l C ....
""
,
,,"
...........................
i 13
Rre
~i~,,,
.u=e
so~
Lo.er ,,,~*re~,-eq
Karooh
r Tupe: Stveo. S076 no× fla. Oggggg9
Fig. 9. Playback window. reservoirs below target, conduits flowing near capacity and streams at or below their instream requirement are flagged on the schematic. Clicking the mouse on any node or arc brings up a detailed numerical summary in the bottom box. Clicking on Step or Back in the menu bar moves respectively the playback one time step forward or backwards, while clicking on Goto moves it to a nominated time step.
6.2 Statistical performance analysis Analysis of individual replicates, derived from either historical or generated streamflows, conveys insufficient information on how the system is expected to perform in the future. This is because future streamflows and, to a lesser extent, future demands are not known. In fact future behaviour can only be statistically described. Using the results of many simulated replicates a statistical picture of future behaviour can be constructed. W A T O U T focuses on the future behaviour of demand centres and reservoirs. For demand centres the main interest is on the temporal and spatial distribution of demand shortfalls. Such shortfalls may be due to the imposition of restrictions, capacity constaints or unavailability of water. Selecting option SN in Fig. 7 brings up the window shown in Fig. 10. Clicking on a demand node will display the plot selected in the bottom box of Fig. 10. Four plots can be viewed. The first two deal with time series of annual or seasonal shortfall probabilities. Figure 11 presents a plot of expected annual shortfall probability for the Newcastle demand node. The dynamic nature of the system is evident. Because the system is initially full, the shortfall probability starts at virtually zero and climbs to about 10% before the commissioning of Tillegra reservoir brings about a recovery. Observe that the numerical display associated with the line cursor includes 90% probability limits on the true shortfall probability. This information is considered essential for interpreting time series probability plots. It helps the engineer to appreciate the significance of
Options:
~
Rnnuol shortfall probs
0
Prob of shortfall I~ level
0
Seasonal shortfall probs
0
Average & max shortfall
Fig. 10. Demand performance option window. sampling variability on any apparent trends. The only way to reduce this variability is to use more replicates. The third plot deals with shortfall severity which is defined as the conditional probability of a shortfall being greater than some percentage of required demand. Hashimoto et al) ° have argued that knowledge of shortfall severity provides insights that reliability measures alone fail to provide. For example, consider an urban demand node for which shortfalls beyond 40% impose unacceptable social and economic costs. If the probability of shortfall is 5% for a particular season then all we know is that there is one chance in twenty of experiencing a shortfall. We know nothing about how severe such a shortfall could be. However, if, in addition, we know that there is a 50% chance that if a shortfall occurs it will exceed 40%, then action would be required to reduce this risk to an acceptable value. The fourth plot displays a time series of average and maximum shortfall for the selected demand node. For any time step the replicate experiencing the maximum shortfall is identified. This allows the engineer to study the behaviour of the system under conditions of maximum stress.
Annual Shortfall Prob (%) for Demand:
'lear: 1997 E×pected prob (%): 3 7 ; 90% limits
24,
Newcastle demQnd
52
Fig. 11. Shortfall probability time series for selected demand.
G. Kuczera
60 l,,,.
| ilr~lla
l,lll--~l,ll,l.l.*..
Quickdraw, on Apollo workstations using the Graphics Primitives library and under UNIX using X Windows? 8 CONCLUDING REMARK
5, I0 and 50 Percentile qoln for Reservoir: Tillegra ren nite
eoo
?
t3
I~
2s
31
T~
a6
,12
8
ee
step
s;~-~;lo~L,s:e;;:,; V0-%02°o°o°, 92~ ~0.xilo ~o,:,o0x
Fig. 12. Storage percentiles for selected reservoir. For reservoirs the main interest is on how full the reservoir is likely to be in the future. Selecting option SR in Fig. 7 brings up a window with the network schematic. Clicking on a reservoir node will display the 5, 10 and 50-percentile traces for reservoir volumes. Figure 12 shows such a plot for Tillegra reservoir. Observe that the traces start in 1992 when the reservoir commences to fill and that near the end of the simulation the 5-percentile trace shows a downward trend reflecting the stress due to the growing annual demand.
7 A'PORTABLE'FORTRAN INTERFACE
GRAPHICS
Brief mention is made of the approach taken developing the graphics interface. It was constrained by several requirements. It had to provide simple graphics capabilities, allow the use of a mouse as a pick device, be callable from F O R T R A N , and be implemented over a range of computers. At the time of development, no high-level graphics software was available to the author that would meet these requirements. So the wheel was reinvented with the development of a library of high-level interface procedures which depend on 15 device-dependent subroutines to perform the following basic tasks: i) initialize and close a graphics window; ii) interrogate an input queue to determine whether keyboard or mouse events have been generated by the user; iii) perform simple graphics operations including drawing text, lines and rectangles in draw or xor modes; and iv) print bitmap copies of the graphics window, or write a Postscript file. These 15 subroutines, described in Kuczera, 6 have been implemented on IBM-compatible computers using Connell Scientific graphics) ~ on the Macintosh using
The N L P formulation for the simulation model used in W A T H N E T provides a powerful capability for modelling complex dynamic headworks systems. However, to realize this potential, careful attention has to be paid to designing an environment which streamlines the complex task of system definition and data preparation, and which presents results in a form readily comprehended by the engineer. This paper has described one possible environment which is both functional and relatively simple to port onto different computer systems. 9 ACKNOWLEDGEMENT Much of the work was done while the author was visiting the School of Civil and Environmental Engineering, Cornell University. The author wishes to thank Prof. D.P. Loucks for sharing his ideas and offering enthusiastic support. REFERENCES
1. Labadie, J.W., Bode, D.A. & Pineda, A.M. Network model for decision-support in municipal water raw water supply, Water Resources Bulletin, 1986, 22(6), 927-940. 2. Kuczera, G. & G.A. Diment, A general water supply simulation model: WASP, Journal of Water Resources Planning and Management, American Society of Civil Engineers, 1988, 114(4), 365-382. 3. Hydrologic Engineering Center, HEC-3 Reservoir System Analysis for Conservation, Programmer's Manual, U.S. Army Corps of Engineers, Davis, California, 1981. 4. Loucks, D.P. & Salewicz, K.A. IRIS, An Interactive River System Simulation Program, Department of Civil and Environmental Engineering, Cornell University, Ithaca, New York, 1989. 5. Nye, A. )(lib Programming Manual Jot Version 11, O'Reilly and Associates, Sebastopol, California, 1988. 6. Kuczera, G. WATHNET, generalized headworks water supply simulation using network linear programming, Department of Civil Engineering and Surveying, University of Newcastle, NSW, 1990. 7. Matalas, N.C. Mathematical assessment of synthetic hydrology, Water Resources Research, 1967, 3(4), 937-945. 8. Svandidze, G.G. Mathematical Modelling of Hydrologic Series (translated from Russian), Water Resources Publications, Fort Collins, Colorado, 1960. 9. Kennington, J.L. & Helgason, R.V. Algorithms Jor Network Programming, Wiley-Interscience, New York, 198O. 10. Hashimoto, T., Loucks, D.P. & Stedinger, J.R. Reliability, resiliency and vulnerability criteria for water resource system performance evaluation, Water Resources Research, 1982, 18(1), 14-20. I1. Connell Scientific Enhanced Graphics Toolkit, Software Development Systems, Woodinville, Washington.