SOFTWARE FOR CALCULATION OF RESERVOIR ACTIVE CAPACITY WITH THE SEQUENT-PEAK ALGORITHM

: It is presented a software developed with Delphi programming language to compute the reservoir’s annual regulated active storage, based on the sequent-peak algorithm. Mathematical models used for that purpose generally require extended hydrological series. Usually, the analysis of those series is performed with spreadsheets or graphical representations. Based on that, it was developed a software for calculation of reservoir active capacity. An example calculation is shown by 30-years (from 1977 to 2009) monthly mean flow historical data, from Corrente River, located at São Francisco River Basin, Brazil. As an additional tool, an interface was developed to manage water resources, helping to manipulate data and to point out information that it would be of interest to the user. Moreover, with that interface irrigation districts where water consumption is higher can be analyzed as a function of specific seasonal water demands situations. From a practical application, it is possible to conclude that the program provides the calculation originally proposed. It was designed to keep information organized and retrievable at any time, and to show simulation on seasonal water demands throughout the year, contributing with the elements of study concerning reservoir projects. This program, with its functionality, is an important tool for decision making in the water resources management.


INTRODUCTION
The development of computational mathematical models as a tool to support the management of water resources is a growing practice and necessary, as a consequence of fierce competition for water use in the world.In Brazil, this trend gained notoriety in the scope of the current National Water Resources Policy which includes plans and actions for the conservation of water quantity and quality.In this sense, SÁNCHEZ-ROMÁN et al. (2009a) used a dynamic systems model on a case study (Capivari and Jundiaí River Water Basins) to estimate the water supply and demand, as well as wastewater generation from the consumers.SÁNCHEZ-ROMÁN et al. (2009b) & SÁNCHEZ-ROMÁN et al. (2010) present the methodology by combining different parameters for the study of water supply basins, showing a tendency for water shortage in future to the case study.
In Brazil, the central objective of the National Policy is to "ensure to the present and future generations a sufficient supply of water having suitable quality for each respective use".At the same time, it seeks to prevent and defend against critical hydrological events and to achieve sustainable development through the rational and integrate use of water resources (ANA, 2009).In this context SILVA & FOLEGATTI (2009) develop a computer program, for water and soil conservation, with mechanisms that may support specific management matters related to the water users of federal rivers from the rural sector.
The active storage of a reservoir has the purpose of regulating the stream flow of a specific section of the river, storing the water excess in rainy season and utilizing the accumulated water in the reservoirs of these dams in order to compensate the deficiencies during the drought.This will guarantee seasonal demands, throughout the year, such as the water requirement for irrigation.Among all procedures utilized for calculating the reservoirs storage with annual stream flow regulation, those based in the critical period present great prominence.Critical periods are the period in which the reservoir is initially full and the period in which the reaches its minimum level due to water consumption (SILVA & FOLEGATTI, 2007).McMAHON & MEIN (1986) explain that the application of sequent peaks consists in one of the most important procedures based on the critical period for reservoir projects in watersheds.With its application, the required capacity of the reservoir is obtained by getting the difference between the regulated stream flow (demand) of a reservoir during its normal operation and the affluent stream flow during drought periods.According to HJELMFELT & CASSIDY (1975) the demand is frequently expressed in percentage of average stream flow, generally having values around 50 to 70% in order to, in most cases, the reservoir be economically viable.GENOVEZ (2001) describes the time interval required for the study of reservoirs depends on the storage capacity and on the required degree of accuracy.For large reservoirs, monthly data are normally adequate to determine the stream flow variations during seasons of the year, though year stream flows may frequently give results which are accurate enough for projects, as it is the case of sequent peaks.However the development of this procedure requires the application of an algorithm by means of a computational program, which, preferably, has characteristics for the easy handling of information relative to the cycle of the hydrological stream flow data.
When long series of data are used, the sequent-peaks algorithm is preferable to estimate the required storage.Losses to evaporation and seepage can also be added to the portion of water demanded in accordance with the dimensions of the reservoir.The storage required for the observed period corresponds to the maximum difference between the peak and the lowest trough found after the peak.This method provides estimates for the individual storage capacity to meet demands during the selected drought.
Today, many researchers use the sequent-peak algorithm in their study, involving a large variety of hydrological studies for water resources planning.THYER et al. (2008) used the sequentpeak algorithm to estimate the storage reliability while accounting for the predictive uncertainty in the streamflow simulations.HANSON & STEIN (2009) mention that using the sequent-peak algorithm, storage-yield relationships a multiple yield cumulative deficit plot were created as useful tools for explaining reservoir behavior.This is part of a County-wide water supply plan being developed by the US Army Corps of Engineers, which includes projecting future water demand, evaluating potential conservation measures, and evaluating sources to reach the growing demand.SULE et al. (2011) presents the hydrological analysis of Oyun River and estimation of hydropower potential of Unilorin Dam, Ilorin, State of Kwara, Nigeria.In order to determine available flow for power generation, sequent peak and flow duration analysis were carried out.According to McMAHON et al. (2007), annual and monthly streamflows for 729 rivers from a global data set are used to assess the adequacy of five techniques to estimate the relationship between reservoir capacity, target draft (or yield) and reliability of supply.The techniques examined are extended deficit analysis (EDA), behavior analysis, sequent-peak algorithm (SPA), Vogel and Stedinger empirical (lognormal) method and Phien empirical (Gamma) method.

MATERIAL AND METHODS
The linear programming models are effective tools to support initial or periodic planning of agricultural enterprises, requiring, however, technical coefficients that can be determined using computer simulation models (BORGES JÚNIOR et al., 2008).These authors present a study that involves the development, application and tests of a methodology and of a computational modeling tool to support planning of irrigated agriculture activities.In planning, design and operation of river reservoirs, the concept of critical period becomes important.For a given inflow and demand record, a critical period is the period in which the largest storage capacity is required (Figure 1).If a reservoir is designed with that largest capacity, it will completely empty at the end of the critical period.It should be pointed out that such a capacity supplies the demand at an accepted level of risk.It is also important in reservoir planning studies to determine whether the reservoir is a within-year system or an over-year system.The demand may become much higher than the inflow during certain periods in a given year, although the total annual demand is much lower than the annual low stream flow data (AKSOY, 2001).
Through the sequent-peak procedure, the calculated regulation volume is equal to the larger net amplitude of the accumulated volume (input volume minus the output volume) estimate for the series (N) of stream flow data, which is broken by the methodology into two cycles of the data series (2N), i.e., by the application of an index i = (1, 2, 3... 2N).The regulation volume is calculated by the use of the algorithm based on the Theory of Amplitudes (FIERING, 1967) compiled in this study by Delphi Programming Language (CANTU, 2006).Through de algorithm, the following equations permit us to calculate the accumulated difference between the input stream flow and the regulated stream flow.
where, dAC i -accumulated difference between the input stream flow and the regulated stream flow, m 3 s -1 ; N -cycle of data series (total of months of the hydrological stream flow), non-dimensional; d i -difference between Q i and D i , m 3 s -1 ; Q i -input stream flow, m 3 s -1 ; D i -demand (regulated stream flow), m 3 s -1 ; p y -seasonal demand weight, non-dimensional; i -index regarding to the data series (varies from 1 to 2N) = period, non-dimensional, and, y -index regarding to the month, (varies from 1 to 12), non-dimensional.
According to FIERING (1967), the procedure follows through the identification of the first peak P 1 which corresponds to the value of dAC i higher than the preceding (dAC i-1 ) and higher than the posterior (dAC i+1 ).The second peak P 2 is identified by correspondence with the next dAC i of equal or higher value than the first, i.e. (P 2 ≥ P 1 ).Between the couple of peaks P 1 and P 2 , the value of T 1 is identified within the values of dAC i and calculated the difference (P 1 -T 1 ).In the sequence, starting with P 2 , the next pick P 3 will be identified with a higher value than P 2 .The lower value T 2 of dAC i is found between P 2 and P 3 , calculating the difference (P 2 -T 2 )and so on for the sequent peaks of data series 2N.The reservoir storage capacity will be given in function of the biggest difference (P k -T k ) found (maximum amplitude), this is: where, (P k -T k ) -higher amplitude of the data series, m 3 s -1 , and, C -active storage capacity, m 3 .
To calculate the active storage volume for reservoirs, a computer program based on the sequent-peak algorithm was developed using the Delphi programming language.

RESULTS AND DISCUSSION
Through literature, RODRIGUES et al. (2007) noted that the main use of water is for irrigation.This accounts for about 70% of total consumption in the world and 64.7% of the consumption in Brazil.In the São Francisco Basin, irrigation accounts for 71.4% (160 m 3 s -1 ) of the total water demand in the basin.The authors comment that serious conflicts have occurred among the water sectors in the Paracatu River Basin (located within the middle region of the São Francisco River Basin) as a consequence of the intense growth of irrigation used in the 70's.
Usually development of dams and irrigation-drainage projects requires high investment cost.Because of financial limitations, consideration of optimization techniques for determination of reservoir capacity is clear.SATTARI et al. (2009), report that the determination of reservoir capacity by classical methods such as mass curve (Ripple method) and sequent-peak algorithm, do not consider all effective parameters in problem.They conducted a research comparison between classical and modern methods for calculating the dam capacity and, for a case study, the results showed that the dam capacity with Ripple method (mass curve) will be 13.1 hm 3 , with Sequent Peak Algorithm will be 6.86 hm 3 and with non-linear optimization will be 6.19 hm 3 .
In this context, the example for the input data used in this study has not the objective of planning, but merely to elucidate the application of our computational program.So, proceeding with the inclusion of a series of monthly mean stream flow from the Santa Maria da Vitória Stream Flow Station (also located in the São Francisco Basin), it was obtained the calculation of active storage volume with 30 years of stream flow data and weights arbitrated for seasonal demand, as shown in the final interface developed with Delphi programming language (Figure 2).The software brings all numerical information, allowing detailed analyses, including blank fields for definition of different numerical weighs, corresponding to the seasonal water demands through the year.LEGEND 2. Routines of the flowchart (second block).
routine to identify the position of the last peak; routine to the location and registration of depressions (T i ); routine to identify the position of the last depression; routine to record the amplitudes: peaksdepressions; and, routine to identify the higher amplitude, calculation of reservoir active capacity and printing of results.
The calculation of variables involved in the method is shown by the application of data series to the computational program.
In this example, the historical stream flow data saved in the hard disk is equal to 360-month data series, but stream flow series involved in studies or projects can be stored in hard disk and recovered at any time.Figure 5 shows Q i , D i and d i curves for the first cycle of data series (N).Thus, according to sequent-peaks procedure, two cycles (2N) of data series is equal to 720-month data series from 30 years of registers, so that all registrations can be checked via printing paper or by means of electronic table.In turn, the Table 1 and the Figure 6 show the detail regarding the accumulated difference (dAC i ) between the input stream flow and the regulated stream flow for two cycles (2N).The detail shows the greatest difference found (P k -T k ), i.e. (22,049.0m 3 s -1 -21,483.2m 3 s -1 ).Finally, the monthly average stream flow series and the active storage volume are calculated.For this example, the monthly average stream flow series is equal 205.2 m 3 s -1 , and the active storage volume is equal 1,466.6 x 10 6 m 3 .Through this interface, fast simulations may be done for projects that have presumed seasonal stream flow demands though the year.

CONCLUSIONS
The active storage of a reservoir accumulates the water excess in rainy season and guarantees seasonal water demands, such as the water requirement for irrigation, all over the year.To calculate the active storage volume for reservoirs, a computer program based on the sequent-peak algorithm was developed using the Delphi Programming Language.The computational program developed in this study provides the calculation of the stream flow regulation of reservoirs.It was designed to keep information organized and retrievable at any time, and to show simulation on seasonal water demands throughout the year, contributing with the elements of study concerning reservoir projects.
Input data from 30 years (from 1977 to 2009) of stream flow records from Santa Maria Vitória Stream Flow Station in São Francisco River Basin, Brazil, and arbitrated weights for seasonal demand were used to exemplify its functionalities.Thus, this computational program is an important tool for decision making in the water resources management.

FIGURE 2 .
FIGURE 2. Computational program for calculating the stream flow regulation.
Figure 3 and Figure 4 shows the flowchart in two blocks for the development of computer interface.
FIGURE 3. Flowchart (first block) to program the computer interface.

FIGURE 5 .
FIGURE 5. Overlapping Q i , D i and d i curves, considering the original cycle series (N).

TABLE 1 .
Partial values generated by the program interface.