During the design of reservoirs it is often necessary to know the amount of water that can be taken from a river at a site of interest. The "firm yield" of a site on a river is the largest amount of water that can be dependably delivered from that site at all times. For an unregulated river this can be determined by constructing a flow duration curve, which is a graph of the discharge (flow) as a function of the percent of time that the flow is equaled or exceeded.
The flow duration curve can be developed for a given location on a river by arranging the observed flow rates in order of descending magnitude. From this, the percentage of time for each flow magnitude to be equaled or exceeded can be computed. Then this percentage of time of exceedance can be plotted against the flow magnitude to define the flow-duration curve. The firm yield is the flow magnitude that is equaled or exceeded 100% of the time for a historical sequence of flows.
Use the annual flow data from the Naryn River in Kyrgyzstan given in the attached file (flow.txt) to develop the flow-duration curve and determine the firm yield for this site. In the data file, the first line contains the number of following data records; the second and following lines contain two columns, the first is the year and the second is the flow (in million cubic meters).
1. Sort the flows in ascending order from smallest flow ordered as Rank = 1 and the largest flow as Rank = N, where N is the total number of years (92) in the historical record.
2. Calculate the percentage of time that flow magnitude is equaled or exceeded as 100i/(N+1) where i is the rank of the flow. That is
3. Plot x = % time equaled or exceeded versus y = flow magnitude. This is the flow duration curve.
4. The firm yield of the river at this site can be read from the flow duration graph as the flow corresponding to the highest percent of time equaled or exceeded (x ~ 100%).
Sorting (see text Chapter 9, pages 232 - 235)
How can we sort a list of numbers into ascending (or descending) order?
1. Store the numbers in an array, x. In your flow duration problem the array should have two columns, one for year and one for flow. During the sorting process, keep the year with the flow.
2. Rearrange the array so that the elements are sorted from smallest to largest. Pick out the second flow value x(2) in the array and put it in order with respect to the first flow value x(1), i.e., if it is smaller than x(1) then switch them. Then pick out the third flow value x(3) and put it in order relative to the first two values. Continue until the last flow value has been processed.
For j = 2 To rows
temp = x(j)
i = j - 1
While (i > 0 And x(i) > temp)
x(i + 1) = x(i)
i = i - 1
Wend
x(i + 1) = temp
Next
Note that the "rank" of a flow is now the row that it appears in the array x, so that computing the exceedance probabilities is easy.
Write a Visual Basic program to sort the flows and compute the exceedance probabilities of the Naryn River (see attached file: flow.txt) in ascending order. Be sure to retain the dates with the flows. You should use an array with 3 columns, first for the date, second for the flow and third for the exceedance probability.
Output from your program should be a text file with the date, flow and exceedance probability on separate lines for each year.
Open the text file in Excel and prepare a plot of the flow-duration curve with exceedance probability on the x axis and flow on the vertical axis.
Identify the firm yield for the Naryn River at this location.
1. A copy of the Visual Basic code for your program.
2. A copy of the output file for your program.
3. A copy of the flow-duration plot from Excel and indicating the firm yield.