FINAL REPORT TO SOUTHEAST REGION, FWPCA
            ATLANTA, GEORGIA
      E P. LOMASNEY, PROJECT OFFICER

               September 1969

    A MODEL FOR QUANTIFYING

  FLOW AUGMENTATION BENEFITS

                    by
E. E. Pyatt, J. P. Heaney, G. R. Grantham and B. J. Carter
             University of Florida

           Gainesville, Florida 32601

-------
        • WATER POLLUTION CONTROL RESEARCH SERIES

The Water I*«fiwion Control Research Repwrts describe the Jesuits and
progress i« the control and ab&tejaent of pollution oC our 'Nation's Waters,
They, peerjde a central  source  of  information on the research, develop-
tatm and dcaoostradow acti^irie^ of she  Federal Water Pollution Cootiol
Adiaiaj«umtioat Detp&oxment  of the Interior, through in-hoase. 'research aud;
ga>9ty nwi c«ewact* vitb Federal, State, andl local agencies, re^eatch'.
institutions, and s'ndustria! c%£«raiaailons.
TriftUcat*  tear-^Htt abstract caixls are pLiced  inside the back  cover to
facilitate  information  retrieval. Space is prorited  oa  the  card for the
user's accession number  and  for  additional  keywords. Hie abstracts
attiixe the WRSIC system.

Water  Pollution  Control  Research Reports  will' be distributed • to  re-
questers as $«|»|»lies permit. Requests should be sent to the  Publications
Office, Dept. ol the Interior. Federal. Water Pollution Control AdnuQistra-
tioo, Wasl»Hijpt«3e, D. C. 20142

-------
                A MODEL FOR  QUANTIFYING
               FLOW AUGMENTATION BENEFITS
      FEDERAL WATER POLLUTION CONTROL ADMINISTRATION
               DEPARTMENT OF THE  INTERIOR
                           BY
E. E.  Pyatt, J. P. Heaney, G. R. Grantham  and  B.  J. Carter
        DEPARTMENT OF ENVIRONMENTAL ENGINEERING
                 UNIVERSITY OF FLORIDA
              Gainesville, Florida  32601
                  GRANT NO.  16090 DRM
                      AUGUST,  1969

-------
            FWPCA Review Notice
This report has been reviewed by the Federal
Water Pollution Control Administration and
approved for publication.  Approval does not
signify that the contents necessarily reflect
the views and policies of the Federal Water
Pollution Control Administration.
                        ii

-------
                            ABSTRACT
With increasing quantitative and qualitative demands being placed
upon national water resources, improved management practices are
vitally needed.  In principle, one powerful management tool is
systems analysis, wherein mathematical optimizing techniques are
employed to effect rational tradeoffs between competing demands
for water use, but this tool, in turn, rests upon the availability
of methodologies for quantifying the benefits (economic value) of
each water-use category.  That is, systems analysis, before it can
be employed comprehensively, demands a knowledge of the functional
value of irrigation, flood control, municipal water supply, etc.

Little is known of the economic implications of low flow augmentation,
one of the important water-use categories.  Beginning with the
premise that the value of low flow augmentation is measured by
sewage treatment costs avoided, a hydrologic flow simulator and a
water quality linear programming model were interfaced to develop
a procedure for determining "willingness to pay" for augmentation.
This generalized approach can be applied by others to their specific
water pollution control situations.

This report was submitted in fulfillment of Grant No. 16090 DRM
between the Federal Water Pollution Control Administration and the
University of Florida.

 Key Words:  Flow Augmentation, Water Quality Control, River Basins,
             Systems Analysis, Reservoirs and Impoundments, Benefit -
             Cost Analysis.
                               iii

-------
                          SECTION 1
                           SUMMARY
1.1 Conclusions
The overall objective of this study has been to develop a generalized
methodology for quantifying the benefits of low flow augmentation
for water quality management in a complex river system.  The benefits
of low flow augmentation have been defined as waste treatment costs
avoided.  This objective has been accomplished by integrated utili-
zation of computer based simulation and optimization methods,
visualized as a closed loop information feedback system.  The models
are structured in modular form, so that any watershed can be analyzed
by simply selecting the appropriate number of modules.

The simulation models developed in this study provide a broad-based
capability for analyzing water quality in complex river systems.
Specific use of this capability can be made to select test conditions
for the optimization model wherein it is desired to analyze the
subset of the watershed in which significant water quality inter-
dependencies exist during a selected time period.  Given this set
of conditions, the optimization model determines the combination
of wastewater treatment plants which minimizes the total cost of  ,
meeting pre-specified water quality standards for a given amount of
augmented flow.  Analysis of the results permits the quantification
of low flow augmentation benefits.  Then, the analysis may either
terminate or the procedure may be repeated for a different set of
assumed conditions.

Analysis of the cost of wastewater treatment plants and storage
facilities was undertaken within the scope of this study.  Available
cost information on primary, secondary and tertiary treatment was
reviewed and cost functions were developed for these various treat-
ment levels.  The cost of storage facilities was estimated using
statistical techniques to identify the more important variables
which determine the desired reservoir volume.  This work was combined
with reservoir cost curves, expressed as a function of volume, to
obtain a direct expression for reservoir costs as a function of the
selected variables.

A significant contribution of the simulation effort was the synthesis
of research in hydrology, hydraulics, stream pollution, and other
areas into a comprehensive simulation capability that can serve a
wide variety of purposes.  Recent developments in these specialized
research areas were incorporated into the programs.  Partitioning
                               1-1

-------
the watershed into reaches, numbering the reaches and predicting
river temperatures were effectuated using commonly accepted
procedures.  However, extensive'contributions were made in
hydrologic studies wherein synthetic hydrologic traces were
developed at multiple places in the watershed.  This work included
procedures for aggregating all'historical hydrologic gages into
a subset of independent "basis"'gages, analysis of flow regulation
and its effect on the hydroixyglc regime, and other techniques which
are described in the report'." Also," recently devised extensions of
water quality analysis which" Incorporate error- terms for the deoxygen-
ation and reaeration coefficients were incorporated into the methodology.
Finally, procedures for sensitivity analysis were included to demonstrate
the system response to changes in assumed conditions.

A separable convex programming model was developed in a generalized
network format which permits efficient formulation and solution of
optimization problems.  The model includes the capability of simul-
taneously analyzing wastewater treatment and low flow augmentation
with water of varying quality.  Equations of continuity were developed
in terms of quantities of the water, biochemical oxygen demand and
dissolved oxygen resources to facilitate the interpretation of the
results in terms of resource allocation.  Emphasis was placed upon
providing a meaningful interpretation of the results.  Examining
the dual problem permitted rigorous definition of local and regional
"market areas" for waste management.  Shadow prices impute the
marginal value (measured in terms of waste treatment costs avoided)
of low flow augmentation.  The types of regional situations which
may occur were categorized and a procedure for calculating equivalent
prices for upstream BOD was presented.  Low flow augmentation benefit
functions for single or multiple sources of augmented flow were
developed.  Also, the effect of water quality of the augmented flow
on the benefit function was analyzed.

1.2 Recommendat ions

1.  The methodology developed in this research and thoroughly
documented in this report, although subject to further refinement,
is sufficiently sound in concept and execution that it should be
embodied into extant multi-purpose project planning and evaluation
procedures.
2.  In using basic data from the Farmington River Basin (Connecticut
and Massachusetts) to construct a generalized hydrologic simulation
model, specific programs'have been developed which should have
considerable utility  (quite apart from flow augmentation) for the
various water-oriented agencies in the Hartford Metropolitan Area.
                                1-2

-------
These agencies, particularly the Metropolitan District Commission (MDC),
should familiarize themselves with potential applications.  In general,
these applications will relate to streamflows, reservoir contents,
diversions for municipal water supply and reservoir releases for riparian
commitments.
3.  Further research is needed to quantify the net benefits of flow
augmentation in a river system with competing uses for the water.  Such
work would require a methodology to determine the scarcity value of
water as determined by examining all legitimate water uses simultaneously.
This then could permit the determination of the total flow augmentation
cost function, which is needed to determine the flow at which net
benefits are maximized.
4.  An explicit executive procedure is needed to automatically select
the desired critical period and critical region from the simulation
models.
5.  The optimization model fruitfully could be extended from the
deterministic case to the stochastic case using chance-constrained
programming or a related method.
6.  The option of by-pass piping could be incorporated into the analysis
with relatively little additional effort and therefore should be a
part of future studies.
7.  Analysis of integrated use of storage facilities to provide hydro-
power, regulated flow for nuclear or conventional steam plants and
low flow augmentation should be undertaken because of the growing
importance of thermal pollution.  These investigations should include
the possibility of modifying power production scheduling of mixed
hydro and steam systems to reduce the deleterious environmental
effects.
                                1-3

-------
                             1.3
                       TABLE OF CONTENTS
                                                           Page

Title Page	„	   ±

FWPCA Review Notice	    ii

Abstract	iii

                Section 1:  Summary	1-1

1.1 Conclusions	«	1-1
1.2 Recommendations	1-2
1.3 Table of Contents	1_5
1.4 List of Figures	1-13
1.5 List of Tables	   1-16

                Section 2:  Introduction 	 2-1

    References	2-8

                Section 3;  Overview	3-1

                Section 4;  Literature Survey 	  4-1

4.1 Development of the Dissolved Oxygen Model	4-1
4.2 Systems Technique in Water Resources	4-6
4.3 Operational Hydrology	4-8
4.4 Models and Simulation	4-10
4.5 Flow Regulation - Reservoir Water Quality	4-10
4.6 Regional Water Quality Management Models	   4-12
    References	4-14

                Section 5:  Cost Analysis	5-1

5.1 Introduction	5-1
5.2 Cost of Waste Treatment	5-1
  5.2.1 Primary and Secondary Treatment Costs 	  5-1
  5.2.2 Tertiary Treatment Costs 	 5-2
  5.2.3 Annual Cost Equations	5-7
5.3 Cost of Impoundments	   5-8
  5.3.1 Summary of Methodology	   5-9
  5.3.2 Results	5-12
    References .	   5-20
                             1-5

-------
                   TABLE OF CONTENTS (cont.)

                                                           Page

                Section 6;  Theoretical Development
                          of Simulation Model	6-1

6.1 Introduction	.  6-1
6.2 Simulation	6-2
6.3 Preparation for Simulation 	  6-4
  6.3.1 Simulation of the Physical Watershed 	  6-5
  6.3.2 Simulation of Hydrology	6-10
    6.3.2.1 Edit and Fill	6-12
    6.3.2.2 Normalize . . . .	6-13
    6.3.2.3 Selecting Basis Gages 	 6-16
    6.3.2.4 Transforming Synthetic Gage Data	6-18
    6.3.2.5 Formulating Parameter Inputs 	  6-18
    6.3.2.6 Regulating Flows	6-19
  6.3.3 Preparation for Simulation Water Quality 	  6-20
    6.3.3.1 Temperature	   6-21
    6.3.3.2 Velocity Constants 	 , .  6-23
    6.3.3.3 Waste Loads 	   6-27
  6.3.4 Preparation for Simulation Time Scale	   6-28
    6.3.4.1 Representations of Time Scale 	   6-28
    6.3.4.2 Duration of Simulation . . .	6-29
6.4 Synthesis of Gage Data	6-30
6.5 Simulation of Regulated Flow	6-39
6.6 Simulation of Water Quality	6-40
  6.6.1 Flowing Streams	   6-41
  6.6.2 Reservoirs	6-45
6.7 Sensitivity of Variables	6-48
6.8 Transfer Functions 	  6-52

                Section 7:  Theoretical Development
                         of Optimization Model	7-1

7.1 Introduction	  7-1
7.2 Regional Decision-Making Structure	7-1
7.3 Physical System as a Uni-Directional Transportation
    Network	7-6
7.4 Objective Function	7-9
7.5 Physical-Technical Constraints . 	  7-11
  7.5.1 Water Continuity Equations	7-11
  7.5.2 BOD Continuity'Equations .	  7-12
  7.5.3 DO Continuity Equations	7-14
7.6 Water Quality Constraints	7-16
                           1-6

-------
                    TABLE OF CONTENTS (cont.)
                                                           Page
7.7 Summary of the Model	7-16
7.8 Post-Optimal Analysis to Determine Regional Waste
    Management Strategy	7-17
  7.8.1 States of the Treatment System .	7-18
    7.8.1.1 Infeasible Solution 	   7-18
    7.8.1.2 Present Facilities Adequate 	   7-18
    7.8.1.3 Competitive Headwater Treatment Facilities .  .  7-18
    7.8.1.4 Competitive Interior Treatment Facilities .  .   7-18
    7.8.1.5 Competitive Headwater and Interior Facilities  .7-20
  7.8.2 Flow Augmentation Analysis	7-20
    7.8.2.1 Assumed Sources of Augmented Flow 	   7-20
    7,8.2.2 Effect of Variation in Quality of
            Augmented Flow	,	7-21
7.9 Conclusions	7-21
    References	7-26

                Section 8:  Application of Simulation
                          Model	8-1

8.1 Description of Study Area	8-1
  8.1.1 Overview	    8-1
  8.1.2 Streams	8-1
  8.1.3 Streamflow Regulation	8-8
  8.1,4 Streamflow Data	8-8
  8.1,5 Population of Wastewater Discharges 	   8-8
  8.1.6 Water Supply	8-8
  8.1.7 Hydroelectric Development 	   8-21
8.2 Preparation of Input	    8-21
  8.2.1 Input to FLASH	8-21
  8.2.2 Input to WASP	   8-21
    8.2.2.1 Hydrologic Data 	     8-21
    8.2.2.2 Water Quality Data 	    8-22
8.3 Simulation Results	8-25
  8.3.1 Preliminary Programs 	    8-25
  8.3.2 Hydrologic Simulation	8-57
  8.3.3 Water Quality Simulation 	  8-67
8.4 Sensitivity Tests 	   8-68
                            1-7

-------
                  TABLE OF CONTENTS (cont.)
                                                           Page

8.5 Results of Special Studies 	 8-70
8.6 Transfer Functions .  ;	8-85
8.7 Summary and Conclusions - Simulation Model ...... 8-85
  8.7.1 Summary .	8-85
  8.7.2 Conclusions	8-89
    References	 . 8-91

                Section 9;   Application of Optimization
                       .   Model	9-1

9.1 Introduction .	9-1
9.2 Input Data for Model	9-5
  9.2.1 Changes in Hypothetical Data for Flow
        Augmentation	9-5
9.3 Treatment Model Formulation .	9-13
  9.3.1 Optimization Programs	9-19
  9.3.2 Post-Optimal Analysis of Regional Waste Treatment
        Costs	.	9-20
    9.3.2.1 Primary or Secondary Treatment Required
            At All Reaches	9-20
    9.3.2.2 Cost Allocation Among Reaches 	  9-24
    9.3.2.3 Equivalent Prices for Upstream BOD Removal . . 9-26
9.4 Post-Optimal Analysis, to Determine Regional Flow
    Augmentation Benefits ...... 	  9-30
  9.4.1 Assumed Sources of  Augmented Flow	   9-30
    9.4.1.1 Selection of Most Effective Single Source . .  9-31
    9.4.1.2 Selection of Most Effective Combination of
            Sources	9-35
  9.4.2 Effect of Variation in Quality of Augmented Flow . 9-36
    9.4.2.1 Single Source With Zero DO	9-39
    9.4.2.2 Single Source With High BOD . .	9-43
    9.4.2.3 Varying Activity Coefficients Using Single
            Source	9-43
9.5 Conclusions	9-47
    References 	 ..... 9-52

                Section 10;  Acknowledgements	10-1
                           1-8

-------
                  TABLE OF CONTENTS (cont.)

                                                           Page

                Appendix Al;  Definition of Terms Used
                            in Each Section	Al-1

                Appendix A2:  Curve Fitting Techniques .  .  A2-1

                Appendix A3:  Farmington River Basin Data .A3-1

A3.1 Maps and Geographical Data	A3-1
A3.2 Gages and Gage Data	    A3-5
A3.3 Evaporation and Temperature Data	A3-6
A3.4 Reservoir Data	,	A3-11
   A3.4.2 Colebrook Reservoir 	   A3-11
   A3.4.3 Barkhamsted Reservoir .....  	   A3-13
   A3.4.4 Sucker Brook Reservoir	    A3-13
   A3.4.5 Rainbow Reservoir	A3-18
   A3.4.6 Goodwin Reservoir . 	   A3-18
   A3.4.7 Nepaug Reservoir  	 A3-19
   A3.4.8 Compensating Reservoir 	 A3-20
   A3.4.9 Highland Lake	A3-24
   A3.4.10 Mad River Reservoir	    A3-24
A3.5 Population and Waste Load Projections	A3-25
A3.6 Irrigation Requirements	A3-25
A3.7 Existing Sewage Treatment Plants 	  A3-27
A3.8 Stream Quality Data	   A3-34
A3.9 MDC Water Demand	A3-34

                Appendix A4;  User's Instructions  	A4-1

A4.1 CHKDATA, Streamflow Data  Edit  Program	A4-1
   A4.1.1 Purpose  	  A4-1
   A4.1.2 Program Components  	   A4-2
      A4.1.2.1 CHKDATA MAIN	A4-2
      A4.1.2.2 Subroutine Input  	  A4-4
      A4.1.2.3 Subroutine INCARD  	   A4-4
      A4.1.2.4 Subroutine FILL  	 A4-4
      A4.1.2.5 Subroutine AVW and  AVM	A4-4
   A4.1.3 Program Input  	  A4-4
      A4.1.3.1 For CHKDATA  MAIN	A4-4
      A4.1.3.2 For Subroutine INCARD  	 A4-5
   A4.1.4 Program Output  	 A4-5
   A4.1.5 Definition of  Program Variables  	  A4-6
   A4.1.6 Program Logic  	  A4-8
   A4.1.7 Program Coding	•   A4-8
                              1-9

-------
                  TABLE OF CONTENTS (cont.)
                                                           Page
A4.2 Normal	A4-20
   A4.2.1 Purpose	A4-20
   A4.2.2 Program Components .	A4-23
      A4.2.2.1 Subroutine NORMAL-MAIN	A4-23
      A4.2.2.2 Subroutine DIFCHK 	 A4-23
      A4.2.2.3 Subroutine TRFM	A4-23
      A4.2.2.4 Subroutine HISTGM 	  A4-23
   A4.2.3 Program Input 	 A4-24
   A4.2.4 Program Output .	A4-24
   A4.2.5 Dictionary of Variables 	   A4-25
   A4.2.6 Program Logic	   A4-26
   A4.2.7 Program Coding 	  A4-26
A4.3 TFLOW, Gage Data Transformation Program	A4-33
   A4.3.2 Program Components 	  A4-34
      A4.3.2.1 TFLOW-MAIN 	 A4-34
      A4.3.2.2 Subroutine WEEKLY	, . . . .  A4-34
      A4.3.2.3 Subroutine TGEN	A4-34
      A4.3.2.4 Subroutine TRAN 	  A4-35
      A4.3.2.5 UPGAGE 	 A4-41
      A4.3.2.6 IREACH 	 A4-41
   A4.3.3 Program Input . 	 A4-41
   A4.3.4 Program Output .	A4-43
   A4.3.5 Dictionary of Variables .	   A4-45
   A4.3.6 Program Logic	A4-46
   A4.3.7 Program Coding . 	  A4-46
A4.4 FLASH - Synthetic Gage Data Generator Program ....  A4-57
   A4.4.1 Purpose ..... 	   A4-57
   A4.4.2 Program Components 	  A4-58
   A4.4.2.1 FLASH MAIN	A4-59
   A4.4.2.2 WFLOW	A4-60
   A4.4.2.3 TRANS .	   A4-61
   A4.4.2.4 MEAN .	A4-62
   A4.4.2.5 Subroutine FCOEF 	  A4-64
   A4.4.2.6 OUT1	A4-65
   A4.4.2.7 COREL 	   A4-65
   A4.4.2.8 S	   A4-68
   A4.4.2.9 EIGEN 	   A4-75
   A4.4.2.10 OUT4	A4-77
   A4.4.2.11 OUTS ....... 	   A4-78
   A4.4.2.12 OUTP	   A4-78
   A4.4.2.13 INP	A4-78
   A4.4.2.14 STA1	   A4-78
   A4.4.2.15 GEN	A4-78
   A4.4.2.16 ITRAN 	  A4-78
   A4.4.2.17 STA3	A4-79
   A4.4.2.18 STA4	A4-79
                             1-10

-------
                  TABLE OF CONTENTS (cont.)
                                                           Page
   A4.4.3 Program Input 	 A4-79
   A4.4.4 Program Output 	 	  A4-80
   A4.4.5 Dictionary of Variables 	 A4-84
   A4.4.6 Program Logic ... 	 A4-85
   A4.4.7 Program Coding 	 .....  A4-85
A4.5 WASP-Watershed Simulation Program 	  A4-106
   A4.5.1 Purpose .	 A4-106
   A4.5.2 Program Components 	  A4-118
      A4.5.2.1 WASP-MAIN 	  A4-118
      A4.5.2.2 SIM 	  A4-119
      A4.5.2.3 Subroutines RAN and RRN 	  A4-119
      A4.5.2.4 Subroutine GFLOW 	 . 	 A4-119
      A4.5.2.5 Subroutine QTRAN	 . .  , 	 A4-119
      A4.5.2.6 Subroutine S	A4.119
      A4.5.2.7 REG	  .  A4-120
      A4.5.2.8 Subroutine TRES 	  A4-120
      A4.5.2.9 Subroutine DIVREL . . . .	  A4-120
      A4.5.2.10 Subroutine RDATA 	  A4-120
      A4.5.2.11 Subroutine QTJAL	A4-121
      A4.5.2.12 Subroutine RQUAL 	  A4-122
      A4.5.2.13 Subroutine TGEN 	 A4-122
      A4.5.2.14 Subroutine IRAN 	 A4-122
      A4.5.2.15 Subroutine FIVREL 	 A4-122
      A4.5.2.16 Subroutine TWASTE 	 A4-122
   A4.5.3 Program Input 	  	 A4-122
   A4.5.4 Program Output 	  A4-125
   A4.5.5 Dictionary of Variables 	   A4-127
   A4.5.6 Program Logic 	   A4-130
   A4.5.7 Program Coding 	  A4-130
A4.6 AIJ	A4-157
   A4.6.2 Program Components . 	 , 	  A4-160
      A4.6.2.1 Subroutine SORT 	  A4-161
      A4.6.2.2 Subroutine NFIND . 	 A4-161
      A4.6.2.3 Subroutine AIJ 	 A4-161
   A4.6.3 Program Input 	 A4-162
   A4.6.4 Program Output	A4-162
   A4.6.5 Definition of Variables 	   A4-162
   A4.6.6 Program Logic ... 	 ....   A4-163
   A4.6.7 Program Coding . 	  A4-163
A4.7 INTERF - Interface Program . 	   A4-201
   A4.7.1 Purpose 	 A4-201
   A4.7.2 Program Components 	 , 	  A4-201
   A4.7.3 Program Input 	   A4-208
                           1-11

-------
                 TABLE OF CONTENTS (cont.)
                                                           Page
   A4.7.4 Program Output  	   A4-209
   A4.7.5 Definition of Program Variables 	   A4-209
   A4.7.6 Program Logic	A4-210
A4.8 MPS Control PROGRAM .  .  .  . .	A4-235
   A4.8.1 Purpose . .  .	A4-235
   A4.8.2 Program Components  	    A4-235
   A4.8.3 Remarks ... 	   A4-239
A4.9 LPLF - Linear Programming Model 	    A4-239
   A4.9.1 Purpose ... 	   A4-239
   A4.9.2 Program Components  	  A4-240
   A4.9.3 Program Input 	   A4-243
   A4.9.4 Program Output 	  A4-248
   A4.9.5 Definition of Program Variables 	   A4-249
   A4.9.6 Program Coding  	   A4-261

                Appendix A5;   Sample Interfacing of
                           Simulation and Optimization
                           Models	A5-1

A5.1 Introduction	A5-1
A5.2 Selection of Test Conditions	A5-1
A5.3 Input Data for Optimization Model	A5-1
AS.4 Discussion of Results	A5-3
     Abstract Cards
                           1-12

-------
                             1.4
                         LIST OF FIGURES

Figure                                                     Page

 5-1           Total Annual Hypothetical  Cost of BOD
               Removal (1968 Dollars)  	   5-3
 5-2           Comparison of Field and Hypothetical
               Cost of BOD Removal	    5-5
 5-3           Regional Reservoir Cost Curve
               The Corps of Engineers	5-17
 7-1           Assumed Regional Decison-Making Structure .  7-3
 7-2           Network Representation of River Systems . .7-7
 7-3           Flow Augmentation Benefits	7-23
 8-1           Map - Farmington River Basin .  .  t  .  .  .  .   8-3
 8-2           Location of Regulating Reservoirs.  ....   8-9
 8-3           Location of Stream Gaging Stations  ....   8-11
 8-4           Location of Population Centers  	   8-13
 8-5           Location of Wastewater Discharges ....    8-15
 8-6           Water Supply System- Metropolitan District
               Commission	8-19
 8-7           Historical Data Cumulative Frequency .  .  .   8-27
 8-8           Constant Evaluation Hydraulic Formulas  .  .   8-29
 8-9           Constant Evaluation Hydraulic Formulas  .  .   8-31
 8-10          Constant Evaluation Hydraulic Formulas  .  .   8-33
 8-11          Constant Evaluation Hydraulic Formulas  .  .   8-35
 8-12          Constant Evaluation Hydraulic Formulas  .  .   8-37
 8-13          Constant Evaluation Hydraulic Formulas  .  .   8-39
 8-14          Constant Evaluation Hydraulic Formulas  .  .   8-41
 8-15          Constant Evaluation Hydraulic Formulas  .  .   8-43
 8-16          Constant Evaluation Hydraulic Formulas  .  .   8-45
 8-17          Constant Evaluation Hydraulic Formulas  .  .   8-47
 8-18          Constant Evaluation Hydraulic Formulas  .  .   8-49
 8-19          Constant Evaluation Hydraulic Formulas  .  .   8-51
 8-20          Simulation of Operation Colebrook -
               Reservoir	8-59
 8-21          Simulation of Operation Barkhamsted -
               Reservoir	8-61
 8-22          Simulation of Water Quality - Reach 21  .  .   8-63
 8-23          Effect of release of Low Quality Water
               From Colebrook Reservoir	8-73
                             1-13

-------
                     LIST OF FIGURES (cont.)

Figure                                                Page

 8-24          Effect of Zero Dissolved Oxygen in
               Colebrook Release 	    8-77
 8-25          DO Concentration VS Regulated  Flow,
               Reach 21 (Simulated Data)	8-83
 8-26          DO Concentration VS Regulated  Flow,
               Reach 7 (Simulated Data)	  .  .8-87
 9-1           Hypothetical Region 	  9-3
 9-2           Optimization Package	9-21
 9-3           Flow Augmentation Benefits:   Release
               in Either Reach One, Two,  or Four .  .  .  9-33
 9-4           Release Sequence Which Maximizes
               Flow Augmentation Benefits 	   9-37
 9-5           Regional Waste Treatment Cost
               Augmented Flow With Zero DO  at Reach
               Two	    9-41
 9-6           Effect of BOD in Augmented Flow on
               Regional Benefit Function -  Augmentation
               at Reach Two	9-45
 9-7           Effect of Variable Activity  Coefficient
               on Regional Benefit Function-Augmentation
               at Reach Two	9-49
A3-1           Quadrangle Maps Covering Farmington
               Watershed .	A3-3
A3-2           Location of Waste Treatment Plants .  .  A3-28
A3-3           Location of Stream Sampling Points .  .  A3-33
A4-1           Program Relationship	A4-3
A4-2           Program Logic - CHKDATA	A4-9
A4-3           Program Logic - NORMAL	A4-27
A4-4           Program Logic - TFLOW	A4-47
A4-5           Array Sj^ Correlation Sub-Matrix ..  .  A4-69
A4-6           Array S22 Correlation Sub-Matrix . . . A4-70
A4-7           Array 8^2 Correlation Sub-Matrix . . . A4-71
A4-7A          Sample of Output Subroutine OUT3 . . . A4-82
A4-8           Program Logic - FLASH	A4-86
                             1-14

-------
                     LIST OF FIGURES (cont.)

Figure                                                     Page

A4-9           Program Logic - WASP	A4-131
A4-10          Program Logic - AIJ	A4-164
A4-11          Overview of Closed Loop Information
               Feedback System'. 	 A4-203
A4-12          Flow Chart for INTERF	A4-210
A4-13          Overview of MPS Procedure .  . .	A4-237
A4-14          Optimization Problem for Hypothetical
               Region 	  A4-241
A4-15          Overview of Data Set Organization - LPLF  .  A4-245
                                1-15

-------
                              1.5
                          LIST OF TABLES
Table                                                      Page

 5-1           Incremental BOD Removal With Tertiary
               Treatment	5-7
 5-2           Coefficients for Equation [5.1]  	  5-8
 5-3           Values of the Parameter Used in the
               Factorial Experiment 	   5-13
 5-4           Parameter Levels Used in Each
               Factorial Combination 	  5-14
 7-1           List of Notations	7-10
 8-1           Principal Tributary Streams Farmington
               River	8-7
 8-2           Capacity-Depth and Area-Depth Equations
               Farmington Basin Reservoirs 	 8-23
 8-3           Results of Tests for Normalizing
               Transformation 	  8-54
 8-4           Results of Tests Additional Transforms . .  8-55
 8-5           Correlation Coefficients for Various
               Basins - Estimate Gage Combinations .... 8-56
 8-6           Records - Storm of August 19, 1955
               Farmington River Basin 	  8-66
 8-7           Simulated BOD Data Special Study No. 1 . .  8-79
 8-8           Water Quality Violations 	  8-80
 9-1           Summary of Reach Input Parameters for
               Optimization Model	9-6
 9-2           Regional Stream and Wastewater Data for
               the 7 Reaches	9-7
 9-3           Regional Wastewater Treatment Data ....  9-8
 9-4           Regional,Wastewater Treatment for 1980
               BOD Removal .	9-9
 9-5           Regional Wastewater Treatment Unit
               Cost Data	9-10
 9-6           Optimal Solution With Only Primary
               Treatment (35% BOD Removal) Required . .  .  9-23
 9-7           Optimal Solution With Primary and
               Secondary Treatment (85% BOD Removal)
               Required	9-23
                            1-16

-------
                     LIST OF TABLES (cont.)

Table                                                      Page

 9-8           Sequence of Regional Waste Treatment
               DO Standard at Reach Seven	   9-26
 9-9           Shadow Prices for BOD Removal and
               Water Quality Standard in Each Reach .  .  .   9-27
 9-10          Rate of Substitution of Upstream Waste
               Treatment for Treatment at Reach Seven .  .  .9-29
 9-11          Shadow Price for Water Supply in Each
               Reach ..... 	 .....  9-30
 9-12          Treatment Required When Augmented Flow
               Entering at Reach Two has Zero DO .....  9-39
A3-1           Reach Information	  .A3-2
A3-2           Gage Location and Area ..........  A3-5
A3-3           Gage Location and Period of Record ;  .  .  .  A3-6
A5-A           Cross Section Data 	  .....  A3-6
AS^S           Evaporation Data 	  ........  A3-1Q
A3-6           Temperature Data 	  .....;  A3-iti
A3-7           Capacity-Area-Depth Data-Otis Reservoir .   A3-12
A3-8           Capacity-Area-Depth Data-Colebrook
               Reservoir 	 ;..„..   A3-14
Aj-9           Capacity-Area-Depth Data-Barkhamsted
               Reservoir 	 ........   A3-15
A3-1I3          Diversion Data-Barkhamsted  Reservoir .  .  .  A3-16
A3-11          Capacity-Area-Depth Data-Sucker Brook
               Reservoir	A3-17
A3-12          Outlet Rating Data-Sucker Brook Reservoir .A3-17
A3-13          Capacity-Area-Depth Data-Rainbow Reservoir A3-19
A3-14          Capacity-Area-Depth Data-Goodwin
               Reservoir	A3-20
A3-1S          Capacity-Area-Depth-Nepaug  Reservoir .  .  .  A3-21
A3-16          Diversion Data-Nepaug Reservoir .....   A3-22
A3-17          Capacity-Area-Depth Data-Compensating
               Reservoir	A3-23
A3-I8          Capacity-Depth Data-Highland Lake ....   A3-25
A3-i9          Outlet Discharge Data-Mad River Reservoir.  A3-26
A3-20          Capacity-Area-Depth Data-Mad River
               Reservoir	A3-27
                              1-17

-------
                      LIST OF TABLES (cont.)

Table                                                      Page

A3-21          Projected Population - Farmington
               Watershed . .	 A3-29
A3-22          Projected Waste Discharge - Farmington
               Watershed	A3-30
A3-23          Assumed Irrigation Demand	   A3-35
A3-24          Water Quality Data	A3-35
A5-1           Output From Simulation Model for Selected
               Period	A5-2
A5-2           Treatment Cost Data for Indicated Reaches . A5-3
A5-3           Optimal Solution for Sample Problem  .... A5-4
                            1-18

-------
                         SECTION 2
                        INTRODUCTION
 Planning and management of the water resources of major  river basins
 is neither a recent concept nor a recent practice.  Most notably,
 the Corps of Engineers, for some decades, has been  charged by The
 Congress with performing engineering investigations, designing,
 constructing and, in some cases, operating physical facilities  for
 the enhancement of navigation.  Likewise, the Bureau of  Reclamation,
 with jurisdiction in the seventeen western states,  has,  under the
 Reclamation. Act of 1902, promoted the development of large-scale
 irrigatioij proj ects.

..Historically, these water management schemes, although often vast
 in scope and, therefore, in cost, have not been  comprehensive
 with respect to the full array of beneficial purposes.   Development
 of the Cp|umbia River Basin, for example, has been  oriented
 primarily toward achieving economic efficiency in hydroelectric
 power generation and this achievement has been realized  at the
 expense pf foregoing opportunities to realize other beneficial
 purposes.
 More recegtiy, the federal government has not  only  encouraged,  but
 has made mandatory, the inclusion of consideration  of  beneficial
 purposes otter than those traditionally associated  with agency
 missions,.  We find, then, that the two most prominent  federal,  water-
 oriented construction agencies - the Corps of  Engineers and the
 Bureau, of Reclamation - now are required by law to  take a compre-
 hensive vi,ew of water resources planning.  The complexity of their
 in-tipusie project evaluation procedures, as well as  the evaluation
 procedures of coordinating bodies such as the  Bureau of the Budget
 and the Water Resources Council, has magnified accordingly.

 Benefit-cost analysis, or that is project evaluation,  is, by
 definition, contingent, inter alia, upon the availability of
 technique? for quantifying the expected value  of each  of the separate
 beneficial, purposes proposed for inclusion in  a given  project.
 Some beneficial purposes, such as flood control and irrigation,
 are. inherently susceptible to attempts at quantification.  Flood
 control benefits, for example, are calculated  as average annual
 flood damages expected to be averted by the proposed project while
 irrigation benefits are, quite simply, computed by  reference to the
                             2-1

-------
market value of incremental crop yield.  These procedures have been
codified through a series of government documents beginning with
the "Green Book" of 1950 (1) and progressing to Bureau of the Budget
Circular A-47 of 1952 (2), the revised "Green Book" of 1958 (3),
the Report.of the Panel of Consultants to the Bureau of the Budget
of 1961 (4) and Senate Document #97 of 1962 (5).

However, other beneficial purposes, although given brief mention in
the "Green Book",' are' elusive and very difficult to quantify.
Examples of beneficial purposes for which, to date, acceptable
quantification methodologies have not been developed are:  (1)
municipal water supply, and (2) low flow augmentation for the
assimilation of organic" loads discharged downstream to a watercourse.
This is not to say that no methodological approaches exist conceptually
nor that such approaches have not been applied.  Municipal water supply
benefits may be equilibrated to the cheapest alternative mode of
supply or they may be computed by a consideration of the sum of
the economic value of municipal water to the public health and to
industrial output (6,7).  Low flow augmentation (or water pollution
control) is discussed in the "Green Book" (3, p. 45).  It is stated
that:
   "While pollution abatement may contribute significant economic
   returns to society and individuals, under prevailing .practices
   relatively few of the benefits of pollution control are measured
   directly in monetary terms.  ... In the absence of market
   determined values to serve in the measurement of water pollution
   control benefits, economic indicators of the worth of pollution
   abatement must be sought in derived measures of value. ...  There
   is also need for extending the scope of measurement practices
   by devising simulated market conditions ... to establish a value
   for pollution abatement comparable to that obtained for other
   project purposes."

The research reported upon in subsequent sections addresses itself
to precisely that need - extending the scope of measurement practices
for low flow augmentation.  It is important to recognize that the
research sought to develop a generalized  methodology for quantifying
the benefits of flow augmentation.  All references to specific water-
sheds - mainly the Farmington River Basin in Connecticut and
Massachusetts - are made solely for the purpose of validating the
generalized  methodology.
                              2-2

-------
Central to  the  development of the methodology was the construction
of a conceptual model  for quantifying low flow benefits.  Our model
was quite straightforward and,  we think,  realistic.   The basic premise
was this:  THE  VALUE OF FLOW AUGMENTATION FOR THE PURPOSE OF WATER
POLLUTION CONTROL MOST APPROPRIATELY IS MEASURED BY THE DOWNSTREAM,
COLLECTIVE  SEWAGE TREATMENT COSTS WHICH ARE AVOIDED WHEN SPECIFIED
WATER QUALITY CRITERIA MUST BE MET.   More specifically, for stated
permissible levels  of  dissolved oxygen in a river basin and for
known raw BOD loads which ultimately must be discharged to the river,
how much will regionally coordinated sewage treatment cost with flow
augmentation upstream  and how much will it cost without flow augmen-
tation upstream?  The  difference in  these sewage treatment costs is
defined as  the  economic value of flow augmentation.

The authors recognize  that flow augmentation, by law, may not be
employed "in lieu of adequate treatment"  downstream.  The conceptual
model, then, should not be construed as advocacy to the contrary.  In
general, and especially as water quality  problems become increasingly
acute, the  downstream  treatment costs avoided will be tertiary treat-
ment costs. In any case, the methodology presented in this report
does not depend upon and does not constitute a recommendation for
violating the commonly accepted definition of "adequate treatment".

The authors also recognize that in any particular situation benefits
other than  pollution control benefits may accrue to the provision
of flow augmentation.   These may include  enhanced recreational
opportunities,  enhanced fish and wildlife, increased dependable
water supply downstream, improved esthetics and, in the case of
estuaries,  repulsion of salt water intrusion.  No attempt has been
made to quantify these aspects of flow augmentation.  We do not
regard this as  a serious deficiency  since most, if not all, flow
augmentation projects* will be initiated  because of a need for the
assimilation and dilution of pollutants.

The conceptual  quantification model, stated above, was incorporated
into a working, hypothetical (but realistic) river basin model
which could be  programmed for computer simulation.  In this manner,
input flows to  the  region could be treated as stochastic variables -
as they are in  nature  - and other variables such as streamflow
temperature, reservoir size and location, reservoir release rules,
* A "low flow project" usually can be expected to be part of a
multi-purpose project.

                                 2-3

-------
 hydrographic parameters, location of cities, levels of BOD loading
 and water quality standards all could be generalized.

 It may be helpful to the reader's understanding of our overall
 methodological approach to enumerate the steps which we proposed
 to follow at the time the study was initiated:

 1.  Construct a hypothetical river basin model - hypothetical, but
  nonetheless representative of  an  Eastern U.  S.  basin -  having a
 dendritic tributary pattern.

 2.  Selecting a typical value for long-term mean discharge at the
 mouth, synthesize hydrologic data for the main stem and its tributaries.
 Employ tables of random numbers in the generation of such data.

 3.  Assign physical (length, width, and depth) and hydraulic  (roughness)
 characteristics to the river system.

 4.  Assign  (or generate) thermal values to runoff, as a function of
 basin location and season of the year.

 5.  Locate approximately five to ten major cities, at random, within
 the watershed.  The wastes from each city would be disposed to the
 watercourse.

 6.  Develop arbitrary population,  sewage flow and raw sewage strength
 projections for each community for the next 50 years.  Assign thermal
 values to waste loads.

 7.  Estimate cost, including capital cost, of treating a unit volume
 of sewage by contemporary primary, secondary and tertiary techniques.

 8.  Estimate storage costs allocated to low flow augmentation by
 utilizing generalized cost curves of Corps of Engineers.

 9.  Employ simulation to determine the system response (D.O. levels)
 to various degrees of waste treatment at each city.  Input flows
 would be stochastic and unregulated.

10.  Employ simulation to determine the system response when waste
treatment and low flow augmentation are employed conjunctively.
                                 2-4

-------
 11.  V'ith  the  economic value  of  low  flow  augmentation  defined  as  waste
 treatment  costs  avoided,  determine that economic value by  difference,
 (for similar D.O.  levels) using  items  9 and  10, above.

 12.  Perform sensitivity  analysis.

 13.  Apply  the methodology  to a  real river basin.

 These  steps in fact were  not  followed  seriatim nor were  they followed
 without  considerable modification.*  However, they suffice  to  convey
 an overview of the spirit which  guided our research.

 The thirteenth and final  step, calls for  applying the  generalized
 methodology to a specific,  real  situation.   Any one of a number of
 •-atersheds might have been  chosen, provided  that two criteria  were
 '-etc   (1)  the  size of the drainage basin  had to be large enough to
 .•nconipass a range of physiographic and engineering complexities,
 research budget, and (2)  basic data had to be readily  available.
 because one. of the authors  (EEP) was formerly associated with  the
 Travelers Research Center,  Inc., Hartford, Connecticut at  the  time
 (1965) a comprehensive water resources study of the Farmington
 River  Basin was performed (8), and because he therefore  had access
 to voluminous  file data both at  his office and in the  offices  of
 various federal, state and  local agencies in the Hartford metropolitan
 area,  it was decided, early in the course of the research,  that the
 Farmington Basin would serve as  out test  case.

 The reader should keep in mind that from  the viewpoint of the
 objectives of  the research project, our sole interest  in the
 Farminpton Basin was to illustrate that the  general methodology will
 yield  acceptable results  in a practical situation.  In the  formal
 sense, then, we were not  seeking to develop  an operational  strategy
 for the Farmington nor were we seeking recommendations to the
 Hartford area  agencies who  so kindly provided us with basic data.
 On the other hand, it was our hope throughout the study  that, more
 by accident than by design,  some insights would be gleaned from
 the test case which could be capitalized upon by agencies such as
 the Metropolitan District** and the Farmington River Watershed
* Sections 7 and 9 represent significant modifications.

** The Metropolitan District, also known as the Metropolitan District
Commission (MDC), supplies water to the Hartford area from the
Farmington Basin.

                                2-5

-------
Association*.   Indeed, on 18th and 19th September 1969, Mr. Michael
Long, Research Engineer for MDC, and Mr. Harold S. Peters, Executive
Director of FRWA, met with the authors in Gainesville to determine
how the study might best be used to their advantage.  We believe
that the principal spin-off of the study is the capability of
simulating the hydrology of the Farmington (see Section 8).

During the third, and final, year of the research project, FWPCA
requested that we perform some special studies of our comprehensive
model (9):
   "In addition to general testing of the comprehensive model with
   the Farmington River data, hypothetical model runs should be made
   to examine the following:

   1.  Effects of varying policies

       a.  Maximum use of flow augmentation permitted to minimize
           waste treatment necessary to meet stream standards.

       b.  Flow augmentation permitted only during summer months.

       c.  Flow augmentation permitted only when natural flow
           drops below some prescribed low flow, e.g., 2-year
           7-day low flow.

           Fixed downstream flow rate must be maintained.

           Reservoir outflow must be equal to or greater than inflow
           during low flow periods.

   2.  Effects of variation in quality of reservoir releases for
       flow augmentation on resulting downstream quality

       a.  Release is from hypolimnion with zero dissolved oxygen.

           Release has high concentration of nutrients and/or BOD.

           Release is warm water from epiliminion.
 * FRWA is a non-profit, citizens' conservation group with an avid
 interest in the water resources of the Farmington Basin.
                               2-6

-------
  3.  Special attention should be given to the decrease in relative
      benefits of flow augmentation due to the essentially fixed
      maximum waste assimilation capacity of a particular basin
      compared to the ever-increasing waste loads."

These studies, essentially under the rubric of our step 12
(sensitivity analysis), are reported upon in Section 8.6.
                               2-7

-------
                         REFERENCES
1.  Proposed Practices for Economic Analysis of River Basin Projects.
Report to the Inter-Agency Committee on Water Resources prepared by
the Subcommittee on Benefits and Costs of the Federal Inter-Agency
River Basin Committee  (Government Printing Office, Washington,
May 1950).

2.  Bureau of the Budget Circular ^A-47 (Government Printing Office,
Washington, December 1952).

3,  Proposed Practices for Economic Analysis of River Basin Projects.
Report to the Inter-Agency Committee on Water Resources prepared
by the Subcommittee on Evaluation Standards (Government Printing
Office, Washington, May 1958).

4.  Hufschmidt, M.M., Krutilla, J., and Margolis, J., Standards and
Criteria for Formulating and Evaluating Federal Water Resources
Developments, Report of Panel of Consultants to the Bureau of the
Budget, Washington, B.C., June 1961.

5.  Senate Document #97, 87th Congress, 2nd Session, Policies,
Standards, and Procedures in the Formulation, Evaluation, and Review
of Plans for Use and Development of Water and Related Land Resources,
(Government Printing Office, Washington,  1962).

6.  Pyatt, E.E., and Rogers, P.P.,"On Estimating Benefit-Cost Ratios
for Water Supply Investments", American J. Public Health, October
1962.

7.  Pyatt, E.E., Rogers, P.P., and  Sheikh, H., "Benefit-Cost Analysis
for Municipal Water Supplies," Land Economics, Vol. XL,  No. 4,
November 1964,

8.  Bock, P., Pyatt, E.E. and DeFilippi, J.A., Water Resources Planning
Study of the Farmington Valley, Travelers Research Center, Inc.,
Hartford, Connecticut,  February 1965.

9.  Offer and Acceptance of Federal Grant for Research and Development.
FWPCA Project Number 16090 DRM, 23 December 1968,  p.4.
                               2-8

-------
                        SECTION 3
                        OVERVIEW
This section contains a brief description of the contents of the
remainder of the report.  The overall methodology for quantifying
flow augmentation benefits consists of two main components:  a
simulation model and an optimization model.  From the simulation
model, hydrologic characteristics of the watershed are obtained
and water quality parameters determine where and when standards
are violated.  This information is then utilized in determining
a critical period and delineating a subset of the watershed to
be analyzed.  The optimization model then performs the task of
determining the combination of wastewater treatment facilities
which meet the water quality goals at the least cost to the region
for a specified amount of flow augmentation.

The scope of this study includes analysis of the cost of waste
treatment and storage facilities.  A cost analysis of primary,
secondary, and tertiary waste treatment and the cost of storage
facilities are presented in Section 5.

The major theoretical developments associated with this study
are outlined in Sections 6 and 7 which describe the simulation
and optimization models, respectively.  Simulation as a method
for analysis of complex problems is discussed pro and con and the
reasons for its selection for this problem are set forth in Section
6.  The mathematical model components and the connecting logic
are developed into a complete'model for the computer simulation
of the stream flow and water quality at points along a stream system.
The methodology and the theoretical formulation of the optimization
model, presented in Section 7, leads to the development of a
separable convex programming model.  The objective is to determine
the combination of wastewater treatment plants which minimizes
the total .regional cost of meeting prespecified water quality
standards for a given quantity of augmented flow.  Approaches for
analyzing specific regional situations are presented to illustrate
the interpretation of the model.

The remaining sections deal with application of these methods to
selected problems.  The simulation model was tested using the
Farmlngton River Basin as the study area.  The results are
described in Section 8.  The preparation of the basic data for
                          3-1

-------
use in the model is described and the resulting equations are
presented.  The results of the sensitivity of  the system to the
various variables ace given.  Special studies  designed to show
the effects of imposed conditions are described and the results
are reported.  The optimization model was applied to a hypothetical,
but complex, region to demonstrate its operation for the purposes
of this study.  The results are contained in Section 9.  The input
data for the model are presented along with changes made in the
data when flow augmentation is considered.  The application of
the optimization model illustrates how the model is structured
and operated.  The latter part of the section  demonstrates the
value of the model for quantifying the benefits of low flow
augmentation.

Th'e appendices of the report contain the computer programs of
the models along with user's instructions on how to operate these
programs.  Definitions of terms used in this study are contained
in Appendix Al.  Two auxiliary programs which  can be used to
fit a mathematical formula to a set of data points are described
in Appendix A2.  A compilation of all of the basic data,  excepting
the actual historical gage data,  used in the application of the
simulation model to the Farmington River Basin> is found in Appendix
A3.  A detailed set of instructions for the application of the
simulation and optimization models is presented in Appendix A4.
The purpose of the various main and auxiliary programs is described
in detail.  Program input and output formats and data are listed
for easy reference.  A diagram of program logic and a dictionary
of variables are included for each main and auxiliary program.
Lastly, a sample interfacing of the simulation and optimization
models is presented in Appendix A5.
                            3-2

-------
                         SECTION 4
                      LITERATURE SURVEY
A survey of the literature in the areas of endeavor associated
with water quality, water resources and water resource manage-
ment is a formidable task, indeed*  The problems of the best
use of this most necessary of the natural resources are solved
only through interactions between engineers, economists,
politicians, industrialists and conservationists; the literature
reflects this diversity,   And because each of these groups is
vitally concerned about water, the volume of written matter is
increasing to a substantial enormity.  The present work implies
an interest limited to the engineering-economic dimension and
the associated analytical methods employed.  Even with these
limitations, the literature is extensive=

4-.1 Development of the Dissolved Oxygen Model
The first dissolved oxygen model for predicting oxygen balance
in a flowing stream was presented by Streeter and Phelps in
1925 (1).  Despite remarkable advances in the development of
equipment, techniques and methods, this classic work over the
years has withstood the tests of many investigations.  The
formulas, which are based upon two velocity constant parameters,
describe the oxygen balance in the stream as a function of
distance (01 time) from a waste load discharge point.  The first
parameter, K^> is the deoxygenation velocity constant and the
second, 1^, is che reaeration velocity constant.  These parameters
describe the action in a gross way, with the effects of several
known interacting factors considered as being included in K^
and K2«  Several investigators have proposed modifications
which separate out known factors and thus more accurately
represent the effects and improve the reproductibility of the
stream conditions by the model.

In a later work, Phelps (2) and Velz (3) describe the effects
of immediate (chemical) oxygen demand, sludge deposits, biological
extraction of pollutants by bottom growths and, aquatic plants
as a source of dissolved oxygen.  Neither presented any
quantitative data or methods for accounting for these factors.
Thomas (4) introduced a third rate constant, K^, to account for
the loss or gain of biochemical oxygen demand (BOD) due to
                                 4-1

-------
sludge deposits.  It was assumed to be equal to I^L, where L
is the BOD concentration in the stream,  Dobbins (5) considered,
in addition to Thomas K^, the addition of a constant BOD
loading along the stream, the addition of oxygen by photo-
synthesis, the removal of oxygen by diffusion into the benthal
layer and a longitudinal dispersion factor.  Dobbins concluded
that the effect of longitudinal dispersion on the oxygen
balance is negligible in most fresh water streams.

O'Connell and N. A. Thomas (6) studying the effects of benthic
algae concluded that "oxygen produced by benthic algae and
other attached plants has little beneficial effect on the oxygen
balance of streams; on the contrary nighttime respiratory
requirements can cause seriously low daily minimum DO concentrations."

Camp (7) described the findings of a study made on the Merrimack
River, Massachusetts,  He stated that atmospheric reaeration as
a source of oxygen is relatively insignificant compared to photo-
synthesis by algae and in this connection, recommended the light
and dark bottle technique for meaningful evaluation of this effect.
Camp also stated that the removal of BOD through settling is
large compared to the removal by oxidation of suspended BOD.
Some parameter values for the Merrimack were given.

Although much work has been done on the factors which can be
separated from the basic biochemical deoxygenation and atmospheric
reaeration, the literature still does not contain a usable method
or usable values of the factors.  This is not to say that it is
impossible to select values of K-^ and K2 for a given reach of
stream and expect the computed sag curve to be substantiated
by observations.  Considerable work also is being done to allow
better prediction of the oxygen conditions where only the basic
factors dominate.  The original assumption that the deoxygenation
velocity constant- K^ is dependent only upon the'waste discharge
is subject to question.  Gannon (8) demonstrated that the Ki
determined by the usual laboratory method (9) is substantially
lower than the river deoxygenation constant determined by
sampling in a river where time of flow between sample points is
known.  The implication was thaf K^ is dependent not only on
the character of the waste but also on the condition in the
stream.  It was concluded that extraction and storing of organic
materials by biological growths, mixing in the river and the
influence of nitrification in the bottle-incubated samples
all contributed to the wide difference.  That mixing makes a
                          4-2

-------
difference in the deoxygenation rate was shown by Lordi and
Heukelekian (10).

In an experiment designed to show the difference in the value
of KI determined in the BOD bottle and in a simulated stream
environment, Isaacs and Gaudy (11) concluded that the values
were not different, provided that the seed concentration in
the bottle was the same as in the stream and that a multiple
phase, or higher order, expression is used to describe the
exertion of the BOD.  The implication is, then, that in real
environments, there are mechanisms which, if they exist in
the stream, can materially affect the apparent rate at which
deoxygenation proceeds.  Additional studies of the type reported
by Saunders (12) will lead to a better understanding of the role
of attached stream bacteria but may not be of great help in
quantifying K^ until some method is worked out to determine the
extent of the growths in a stream.

The evaluation of the reoxygenation velocity constant, K2» has
recently received considerable attention.  The process of
atmospheric reaeration is physical in nature and is more
amenable to analysis than is biochemical oxidation.  O'Connor
and Dobbins (13) worked out the relationships between fluid
turbulence and the fundamental physical laws of reaeration
and presented formulas for reaeration under turbulent conditions.
They found that K2 is proportional to the coefficient of
molecular diffusion and velocity of flow and inversely related
to the depth raised to a power greater than unity.  This
theoretical approach was also used by Krenkel and Orlob (14).
Another similar formula has been proposed by Thackston and Krenkel
(15).

A group at TVA  (16) made use of the opportunity afforded them
by discharges from stratified reservoirs relatively free of
pollution, yet nearly devoid of dissolved oxygen.  Field
measurements were taken and, using dimensional analysis and
multiple regression techniques, the observed reaeration rates
were related to the hydraulic properties of the river channels.
The resulting predictive formulas for K2 were not materially
different from these developed by the more rigorous methods.
                              4-3

-------
An empirical formula obtained by plotting available laboratory
and field data has been presented by Langbein and Durum (17).
This formula relates K2 directly to the velocity and inversely
to the 1.33 power of average depth.  A coefficient in the
formula appears to vary with geographical location, implying
that slope of the river bed has some linear effect on the value
of K2-  Isaacs and Gaudy (18) found a similar relationship
between K2> velocity and depth, using a simulated stream.

In an interesting treatment of the problem, Thayer and Krutchkoff
(19) considered the oxygen balance relationship in a stream
as a stochastic process wherein BOD and DO are increased (or
decreased) by increments over a short interval of time.  This
treatment led to a joint density function for both variables
and affords a measure of variance from the mean values.
Predicted downstream DO values thus have associated probabilities
of occurrence.  Kothandaraman  (20) treated K^ and K2 as
random variables with the effects of other mechanisms in the
BOD-DO relationship (sedimentation, photosynthesis, etc.)
included in the variability of these two factors.  He states
"The most probable values for the dissolved oxygen deficits
predicted by the probabilistic model  • • • are found to be
better estimates than the values predicted by the conventional
deterministic approaches."

A similar approach was taken by Moreau and Pyatt (21) who
considered that K^ and K2 were deterministic in the conventional
manner but added an "ignorance or error" term to each.  The
error terms likewise contain the variability attributed to
the indeterminable and intermittant effects.  Nicholson (22)
applied the technique of both Kothandaraman and Moreau and
Pyatt in the development of a method for selecting among water
quality alternatives.

These recent efforts to obtain relationships which allow
prediction of values for DO for known river channel conditions
have strengthened  the methodology of Streeter and Phelps.

Attempts have been made to circumvent the problems of the
Streeter-Phelps method.  LeBosquet and Tsivoglou (23)
proposed an "abbreviation of the Streeter-Phelps procedure"
in which use is made of the linear relationships of BOD
                               4-4

-------
and rate of flow, and DO deficit and rate of flow, to obtain
proportionality constants.  Stream survey data were used to
evaluate the constants which were used subsequently to predict
quality conditions for selected stream conditions and loads.
Churchill and Buckingham (24) used multiple regression
techniques on observed data to obtain similar predictor
equations.  Okum, Lamb and Wells (25) used a comparable method
to develop regression equations in an industrial pollution
problem.

A different approach was described by Thomann (26), who used
a systems analysis technique wherein the input is transformed
by the system to result in the output.  In this application,
the input is the BOD loading at the point of discharge, the
system is the river which incorporates biochemical decay,
reaeration, flow time and other factors which occur in streams,
and the output is the DO level.  The system transfer functions
may be mathematical expressions akin to the Streeter-Phelps
equations (in differential form) or, if stream data are
available, the transfer functions may be constants determined
as the ratio of output to input.  Note a similarity to the
LeBosquet and Tsivoglou method.

It is universally recognized that water temperature is a
significant factor in both deoxygenation and reaeration in a
stream.  Although there is still controversy over the relation
between water temperature and the values of K-L and K2 (27),
experimenters are converging upon values for temperature
coefficients.  The disparity in values causes errors of
minor consequence in comparison with those due to the
imprecision in K-, and K2 values.  Thus, when temperatures
are known, methods for correcting for its effects are readily
applied.

However, a problem   appears when temperatures vary with
distance along the stream, such as occurs when cold water is
released from a stratified reservoir or warm water is
discharged from a power plant.  Temperature variations are
related to the heat budget in a stream.  Much of the methodology
in heat budget studies was developed for and during the Lake
Hefner evaporation investigations (28).  These relationships
                             4-5

-------
have been applied to stream flows by Raphael  (29) , Delay and
Seaders  (30) and Brown  (31).  In general, the technique used
is to estimate the gains and losses of energy in  a body of
water to determine the  change in stored energy.   The change
in stored energy per unit volume of water is converted to
temperature change.  The recent concern about thermal
pollution is sure to result in the development of more precise
methods for determining temperature changes in streams.

4.2 Systems Techniques  in Water Resources
The methods ofoperations research, systems analysis and modern
mathematical analysis have been applied in increasing intensity
in the past few years.  The methods admit, in many cases, to
direct application in water resources management  and, although
the number of people in the water resources field having an
ability in the systems field is relatively small, these few
have made substantial progress.  The literature attests to
this.

The first major effort to apply operations research and systems
analysis in water resources studies was by the Harvard Water
Program, which was started in 1956 and culminated in 1962 with
the publication of a textbook-like report of the objectives,
concepts, methods and techniques (32),  The program produced
disciples who continue to be active.  Fiering (33, 34, 35),
Hufschmidt and Fiering  (36), Thomas (37) and Matalas (38)
are among the many works of the group.  The subjects are all
concerned with operations research, systems and simulation
techniques in the solution of water resources design problems.

Another sprinkling of papers came from Northwestern University
where Charnes has" influenced the use of systems techniques.
Lynn, Logan and Charnes (39); Logan, et al.  (40); Lynn (41);
Deininger (42) and Heaney (43) are examples of work from this
source.  The Lynn influence has since spread to Cornell
University where such works as Liebman and Lynn (44), Loucks
and Lynn (45), and Loucks,  ReVelle and Lynn (46) have resulted.

In a U. S.  Public Health Service study of the Delaware River
Basin, extensive use of these methods of analysis was reported
by Thomann (26,47), Thomann and Sobel (48) and Sobel (49).
                                 4-6

-------
The portion of the Delaware Basin that is estuarine was included
in the study and methods were presented that allowed predictions
oi oxygen levels.  The pollution problems in estuaries are
usually more difficult of analysis than those of rivers.

The review is not intended to be complete - there are several
other groups, notably at Oregon State University, Texas A & M
University and the University of Florida, using systems techniques
in water resources studies.  Many other individuals also are
contributing to the literature.

Although the basic concepts of sensitivity are not new, one of
the bonuses that has accrued from the application of modern
mathematical methods and computers to decision-making is the
rediscovery of its value.  In many instances, computers make
its computation feasible whereas without the computer, consideration
of sensitivity is  impractical.   Sensitivity is  the change  in a
system caused by a small change in one or more of the system
variables.  Until relatively recently, the designers and
decision-makers relied upon intuition and planning experience
but now sensitivity analysis can be employed to obtain this
valuable information.

The use of sensitivity analysis in water resources planning
has been reported in several instances.  McBeath and Eliassen
(50) employed sensitivity analysis to identify the parameters
most critical to the design of activated sludge treatment
plants.  Young, Schrecongost and Fitch (51) studied the
sensitivity of variables in the design of reservoirs.  The
application of sensitivity analysis to hydrologic research
was reported by Vemuri, et al. (53).  This latter work out-
lined some of the basic theory.  In a sensitivity study on the
relative importance of variables in water resources planning,
James, Bower and Matalas (53) concluded that the importance
of the four variables studied was, in descending order; (1)
projected economic development, (2) water quality objective,
(3) dissolved oxygen modeling, and (4) hydrology.  Kothandaraman
(20) and Nicholson (22) both reported the sensitivity of K-,^
and K.2 in dissolved oxygen modeling.
                                 4-7

-------
4.3 Operational Hydrology
Operational hydrology is the application of modern mathematical
methods to generate synthetic streamflow data.  It is not a
design technique - more, it is a technique for generating design
data (35).  Several such data generators have been developed.
Fiering (33) described, in considerable detail, the development
of the multivariate Markovian model which provided design data
for the Harvard studies.  Fiering  (35) later expanded the
description in book form.  Matalas  (38) made a detailed
mathematical and .statistical analysis of the method and showed
that bias is introduced when one sample of historical data
is used to develop parameters which are used, in turn, to generate
many samples of data.  Benson and Matalas  (54) proposed to
correct these deficiencies using parameters derived from
generalized multiple-regression relations with physical and
climatic characteristics of the basin.  No detailed methodology
has appeared.  The Harvard model generated monthly flow data.

In a modification of the Harvard model, Harms and Campbell
(55) observed annual flows were normally distributed while
monthly flows have a skewed distribution that is log-normal.
They generated annual and monthly  flows separately and adjust
the monthly generated flows to correspond with the annual
generated flow.  No indication was  given as to increase in
precision, if any, afforded by this modification.

Beard  (56) developed a monthly stream flow generator based
upon multiple regression using as  independent variables:  (1)
the flow  at the  same station for the preceding month,  (2) the
flow for  the current month at each upstream station, and  (3)
the sum of  flows for all stations  for the  second through
the seventh antecedent months.  Flow values were all log-
transformed.  A  random  component was added.  Regression
coefficients are beta  coefficients relating standard deviates,
so no  regression constant  is required.

Quimpo (57) used spectral  analysis techniques  to generate
daily  flow  data  at a single station.  Detectable trends first
were removed to  provide stationarity.  Then autocovariances
for daily lags up  to 1,095  (3 years) were  computed and a
spectral  analysis was  performed.   A Fourier representation
                              4-8

-------
of the deterministic component was then made using the annual
cycle, which usually is evident in the spectral density-
frequency representation, and five subharmonics as bases,  A
random component was included.  The process can be given a
Markovian character by making the current random component
a linear combination of antecedent random components.

The Harvard synthetic hydrology generator also was modified
by Young and*Plsano (58).  The analysis was made using residuals
instead of flow data.  Residuals are essentially standardized
flow data computed by subtracting  the mean from the data
value and dividing by the standard deviation.  Data were trans-
formed to normalize.  Monthly synthetic data were generated.
This method is almost identical to the method used in FLASH,
the generator developed for this work, the most notable
difference being that FLASH generates weekly data.  The develop-
ment of the method by Young and Pisano was independent of that
of FLASH. '

Daily stream flows also were generated by Payne, Neuman and
Kerri (59).   Their model generated multiple-station daily
data to simulate historical flow sequence having frequency
characteristics similar to' those of the historical data.  The
model is similar to that of Beard, excepting that the time of
occurrence of the flows is rearranged so that peak values for
each month (year, or season) occur on the same day each month
(year or season).  After the data are rearranged, Beards'
regression technique was used.  The program was written in
DYNAMO.

The short-comings of operational hydrology methods are
beginning to appear in-the'literature.  Mandelbrot and Wallis
(60) pointed- out' that' "use of a Gauss-Markov process implies
fitting high-frequency effects first and worrying about the
low-frequency effects later."  Or, too little attention has
been paid to' extreme events* which affect designs but which do
not appear when historical data not containing extreme events
are used to generate many years of data.  They feel the methods
in use are "first approximation" and that even "first approximation"
should endeavor to represent extreme events.
                                4-9

-------
4.4 Models and Simulation
Examples of simulation abound - technical literature in every
field describes applications of simulation techniques for solving
complex practical problems.  Simulation is important to the
studies of hydrology and water quality, as is reflected by the
extent of its use.  Examples of this use are reviewed here.

The hydrology of a watershed, including those factors related
to groundwater, was simulated by Crawford and Linsley (61)
in the work widely known as the Stanford Watershed Model.
James (62) has used'the Stanford Model in a computer simulation
study of the effects of urbanization on flood peaks.  Goodman
and Dobbins (63) attempted to model the physical, economic
and administrative" interrelationships in water pollution control
programs in watersheds where water is used for municipal and
industrial supply, disposal of wastewaters and recreation.
Studies of estuarine water quality by simulation have been
reported by Thomann- (26), Thomann and Sobel  (48) and Dornhelm
and Woolhiser  (64).  Simulation methods at  present are the
only practical way to represent such a complex environment.
Analog simulation techniques have been applied recently in
the design and operation of activated sludge systems for
wastewater treatment where the system functions prove to be
difficult to solve by analytical methods (65).

Simulation as a technique also is being applied to complex
theoretical problems.  Two examples in the hydraulics field are
Streeter's work in the solution of complicated water hammer
problems  (66) and the" work of Baltzer and Lai (67) on unsteady
flow in waterways.  Of simulation, Anderson  (68) has said
"simulation is a very rewarding exercise„ 	 increasingly
frequent use will be made of simulation in hydrology for it
offers the only economical way of 'experimenting1 with large
areas and long periods of time."

4.5 Flow Regulation - Reservoir Water Quality
Modern mathematics and operations research techniques also have
been applied to flow regulation and reservoir storage aspects
of watershed management.  An early use was by Langbein (69)
who applied queuing theory to determine the amount of holdover
storage for regulating streamflow.  Stall (70) used a non-
sequential series of low-flow events to improve the mass-curve
analysis and interpretation of low-flow characteristics on a
recurrence interval basis.

                              4-10

-------
 Optimality of  design  of  a multiple-purpose  reservoir was
 investigated by  Hall  (71).  A method was  proposed  in which
 releases  from  a  reservoir were  first allocated, by means  of
 dynamic programming,  to  each purpose assuming  no compatible
 uses.  Having  allocated  water optimally under  this assumption,
 this  restriction was  removed and  the size of the reservoir
 reduced,  allowing  for multiple  use  of  the same volume of
 water.  The problem of optimal  release sequences for multiple
 reservoirs on  a  watershed was investigated  by  Worley (72) in
 a  study of the use of releases  for  water  quality management.

 The operation  of reservoirs has received  considerable attention.
 Loucks (73) developed computer'and  stochastic  linear programming
 models for defining alternative policies'for regulating reservoirs,
 The IBM/Mathematical  Programming  System was used.  James  (74)
 applied economic criteria' to the  derivation of rules for
 operating  reservoirs  and claims the greatest potential value
 of this technique  is  a realization  of  greater  benefit from
 existing facilities.

 The effects of reservoirs and reservoir operation  on the
 quality of  the stored, and released, water also is of consider-
 able  importance  in water management.   Early considerations were
 reported by Churchill (75) and, in more detail, by Churchill
 and Nicolas (76).  These studies  are typical of those from
 TVA in that they are  well conceived, authoritative and amply
 supported  by data  obtained by direct observation of existing
 prototypes.  Water quality variations  in  impoundments also
 were  studied by  Krenkel, Thackston  and Parker  (77).  This paper
 is a relatively  complete discussion and presentation of the
 current (1969) state  of the art.

An interesting method for improving impounded water quality
has been studied by Symons, et al.  (78, 79).  Water in an
 impoundment is mixed using pumps,  which raise water from the
depths and discharge  at the surface.  This practice increases
 the dissolved oxygen  in the lower levels and increases  the
overall temperature.   The practice is economically feasible
under certain circumstances.

The use of reservoirs for two purposes, flood control and
low flow augmentation for water quality control,  has received

                             4-11

-------
attention by the Federal Water Pollution Control Administration.
Many existing projects are for flood control use only and, with
the increasing need of water for pollution control, a study of
the benefits accruing to a trade-off between uses has been made
(80).   As the value of water for low flow augmentation for
water quality control increases, it is probable that a re-
evaluation of benefits will dictate changes i,n operating rules.

4.6 Regional Water Quality Management Models
Mathematical models of regional wastewater systems have been
developed by several investigators.  Following the initial work
of Deininger (42), Loucks, Revelle, and Lynn  (46), Liebman (44),
Kerri  (81), Thomann (82), Sobel (49), and Clough and Bayer (83)
have addressed themselves to the problem of finding the optimal
(least cost in this case) combination of wastewater treatment
plants subject to satisfying prespecified water quality constraints,

The rationale behind regional wastewater management is to take
advantage of the economies of scale that are known to exist.  The
output from these models has demonstrated clearly that significant
savings  could be realized jLf_ a regional management system existed.
They typically do not.  An alternate to wastewater treatment is  to
pipe the wastewater elsewhere in the system so as to better utilize
the waste assimilative capacity of the system.  Graves, Hatfield,
and Whinston (84) have examined this alternative.  However the
usefulness of their analysis is delimited by their assumption that
transfer coefficients are independent of flow.  Lastly, low flow
augmentation has been analyzed as  another alternative and results
from this analysis are described in this report.

Given  that  there are potential savings from coordinated waste
management, the problem still remains of how  to implement such
systems. This has been considered beyond the  scope of the work
to  date. For example, Clough and  Bayer  (83)  state, "The model
makes  sense only if we postulate the existence of an agency that
has the  legal authority to manage  water resources  (for example,
storage  and stream flows) on a entire river system, and if we
postulate the existence of a regulatory agency that has the legal
authority to specify and codify stream water  quality standards."
It  is  reasonable to assume that it would be difficult to promote
regional waste management solely on the basis  of the overall
possible cost reduction.  Many questions remain.  Why was this
"region" selected in the first place?  Could we still set up a
management scheme if the itn decision-making  unit in our region
refused  to participate?  How should the cost be apportioned
among  the participants?
                               4-12

-------
Relatively little work has been done to answer these questions
which need to be resolved if implementation of regional waste-
water management is to be achieved.  Upton has recently proposed
a model to determine an optimal system of taxes on water
pollution (85).  However his description of the physical system
is highly restrictive and therefore the analysis does not permit
the type of generalizations being sought here.

Lastly, in the more general case, water quality management should
be viewed as only one of many uses.  Thus, the analysis should
include the shadow price of water as a measure of its value in
an alternative use.

A mathematical programming model has been developed in a multi-
commodity network format for this purpose.  The model includes
the capability of simultaneously analyzing wastewater treatment,
and low flow augmentation with water of varying quality.
Equations of continuity are developed in terms of quantities of
the water, BOD, and dissolved oxygen resources to facilitate the
interpretation of the results in terms of resource allocation.
This approach is felt to be clearer than the use of the concen-
tration of BOD and the dissolved oxygen deficit.  Examining
the dual problem permits rigorous definition of local and
regional "market areas" for waste management.
                            4-13

-------
                REFERENCES  -  LITERATURE SURVEY
  1.   Streeter,  H.  W.  and  Phelps,  E.  B.,  "A Study of  the  Pollution
  and  Natural  Purification of  the  Ohio  River,"   Public  Health
  Bulletin  146,  February,  1925.

  2.   Phelps,  E.  B.,  Stream Sanitation, John Wiley and  Sons, New
  York, 1944.

  3.   Velz,  C. J.,  "Recovery of  Polluted  Streams",  Water  and
  Sewage Works.  Vol.  100,  No.  12,  December,  1953.

  4.   Thomas,  H.  A. Jr., "Pollution Load  Capacity of  Streams",
  Water and  Sewage  Works,  Vol. 95, November, 1948.

  5.   Dobbins, W. E.,  "BOD and Oxygen Relationships in  Streams",
  Journal Sanitary  Engineering Division,  ASCE, Vol. 90, June,
  1964.

  6.   O'Connell,  R. L. and Thomas, N. E.,  "Effect  of  Benthic Algae
  on Stream  Dissolved  Oxygen", Journal, Sanitary  Engineering
  Division.  ASCE. Vol. 91,  June, 1965.

  7.   Camp,  T. R.,  "Field  Estimates of Oxygen Balance Parameters",
  Journal, Sanitary Engineering  Division,  ASCE, Vol.  91,  October,
  1965.

  8.   Gannon, J.  J., "River and  Laboratory BOD Rate Considerations"
  Journal Sanitary  Engineering Division,  ASCE, Vol. 92, February
  1966.

  9.  	,  Standard Methods^ for the Examination of Water
  and  Waste  Water, American Public Health Association,  Inc., New
  York, 1965.

10.   Lordi, D. and Heukelekian, H.,  "Effect of Rate  of Mixing on
the Deoxygenation of  Polluted Waters" Proceedings, Sixteenth
Industrial  Wastes Conference. Purdue University, May 1961.

11.   Isaacs, W.  P. and Gaudy, A. F.  Jr.,  "Comparison of  BOD
Exertion in a Simulated Stream  and in Standard BOD Bottles",
Proceedings. 22nd Industrial Waste Conference. Purdue University,
May,  1967.
                            4-14

-------
12.  Saunders, W. M. III., "The Growth and Development of Attached
Stream Bacteria, Part 1, Theoretical Growth Kinetics of Attached
Stream" Water Resources Research, Vol. 3, No. 1, 1967.

13.  O'Connor, D. J. and Dobbins, W. E., "The Mechanism of
Reaeration in Natural Streams", Journal, Sanitary Engineering
Division. ASCE, Vol. 82, December, 1956.

14.  Krenkel, P. A. and Orlob, G. T., "Turbulent Diffusion and
the Reaeration Coefficient," Journal, Sanitary Engineering
Division. ASCE. Vol. 88, March, 1962.

15.  Thackston, E. L. and Krenkel, P. A., "Reaeration Prediction
in Natural Streams", Journal, Sanitary Engineering Division, ASCE.
Vol. 95, February, 1969.

16.  Churchill, M. A., Elmore, H. L. and Buckingham, R. A., "The
Prediction of Stream Reaeration Rates," Journal, Sanitary
Engineering Division, ASCE, Vol. 88, July, 1962.

17.  Langbein, W. B. and Durum, W. H., The Aeration Capacity of
Streams, Geological Survey Circular 542, U. S. Geological Survey,
Government Printing Office, Washington, D. C., 1967.

18.  Isaacs, W. P. and Gaudy, A. F. Jr., "Atmospheric Oxygenation
in a Simulated Stream," Journal, Sanitary Engineering Division,
ASCE.  Vol. 94, April, 1968.

19.  Thayer, R. P. and Krutchkoff, R. G., A Stochastic Model for
Pollution and Dissolved Oxygen in Streams, Water Resources Research
Center, Virginia Polytechnic Institute, Blackburg, Va., August, 1966.

20.  Kothandaraman, V.,  Probabilitic Analysis of Wastewater Treat-
ment and Disposal Systems , Research Report No. 14, University of
Illinois Water Resources Center, June, 1968.

21.  Moreau, D. H. and Pyatt, E. E., Uncertainty and Data Require-
ments in Water Quality Forecasting;  A Simulation Study, Report
to U. S. Geological Survey, University of Florida, November, 1968.

22.  Nicolson,  G. S. Jr., A Methodology for Selecting Among Water
Quality Alternatives, Doctoral Dissertation, University of Florida,
1969.
                            4-15

-------
23.  LeBosquet, M. Jr. and Tsivoglou, E. C., "Simplified Dissolved
Oxygen Computations", Sewage and Industrial Wastes, Vol. 22,
August, 1950.

24.  Churchill, M. A. and Buckingham, R, A,, "Statistical Method
for Analysis of Stream Purification Capacity", Sewage and
Industrial Wastes. Vol. 28, April, 1956.

25.  Okun, D. A., Lamb, J. C. Ill, and Wells, C. C. Jr., "A
Waste Control Program for a River with Highly Variable Flow",
Journal. Water Pollution, Control Federation, Vol. 35, August,
1963.

26.  Thomann, R. V., "Mathematical Model for Dissolved Oxygen",
Journal, Sanitary Engineering Division, ASCE, Vol. 89, December
1963.

27.  Metzger, I., "Effects o£ Temperature on Stream Aeration".
Journal, Sanitary Engineering Division, ASCE, Vol. 94, December,
1968.

28.  Anderson, E. R., Energy Budget Studies, in Water Loss
Investigations; Lake Hefner Studies, U. S. Geological Survey
Professional Paper  269, Government Printing Office, Washington,
D. C.,  1964.

29.  Raphael,  J. M.,  "Prediction of Temperatures  in Rivers  and
Reservoirs", Journal. Power Division, ASCE, Vol.  88,  1962.

30.  Delay, W. H. and Seaders, J., "Predicting Temperatures  in
Rivers  and Reservoirs", Journal, Sanitary Engineering Division,
ASCE, Vol. 92, February,  1966.

31.  Brown, G. W. "Predicting Temperatures  of Small  Streams11,
Water Resources Research, Vol. 5, February,  1969.

32.  Maass, A., et  al., Design of Water-Resource  Systems,
Harvard University  Press, Cambridge, Mass.,  1962.

33.  Fiering,  M.  B.,  "Multivariate Technique for  Synthetic
Hydrology", Journal Hydraulics Division, ASCE. Vol.  90,  Sept.,
1964.
                              4-16

-------
34.  Fiering, M. B., "Queuing Theory and Simulation in Reservoir
Design", Journal, Hydraulics Division, ASCE, Vol. 87,  November,
1961.

35.  Fiering, M. B., Streamflow Synthesis, Harvard University
Press, Cambridge, Mass., 1967.

36o  Hufschmidt, 11. M. and Fiering, M. B., Simulation Techniques
for Design of Water-Resource^ Systems, Harvard University Press,
Cambridge, Mass., T966.

37.  Thomas, H. A, Jr., Operations Research in Water Quality
Management, Report, Harvard University to U. S. Department
of Health, Education and Welfare, 1963.

38.  Matalas, N. C., "Mathematical Assessment of Synthetic
Hydrology", Water Resources Research, Vol. 3, No. 4, 1967.

39.  Lynn, W. R., Logan, J. A. and Charnes, A., "Systems
Analysis for Planning Wastewater Treatment Plants", Journal,
Water Pollution Control Federation, Vol. 34, June,1962.

40.  Logan, J. A., et al., "An Analysis of the Economics of
Wastewater Treatment", Journal, Water Pollution Control
Federation, Vol. 34, September, 1962.

41.  Lynn, W. R., "Stage Development of Wastewater Treatment
Plants", Journal, Water Pollution Control Federation, Vol.
36, June, 1964.

42.  Deininger, R. A., Water Quality Management - The Planning
of Economically Optimal Pollution Control Systems, Doctoral
Dissertation, Northwestern University, Evanston, Illinois,
1965.

43.  Heaney, J. P., Mathematical Programming Model for Long-
Range River Basin Planning, Doctoral Dissertation, Northwestern
University, Evanston, Illinois, 1968.

44.  Liebman, J. C. and Lynn, W. R., "The Optimal Allocation
of Stream Dissolved Oxygen", Water Resources Research, Vol. 2,
No. 3, 1966.
                             4-17

-------
45.  Loucks, D. P. and Lynn, W,, R. , "Probabilistic Models for
Predicting Stream Quality", Water  Resources Research, Vol. 2,
No. 3, 1966.

46.  Loucks, D. P., ReVelle, C. S. and Lynn, W. R. "Linear
Programming Models for Water Pollution Control", Management
Science, Vol. 14, No. 4, December, 1967=

47.  Thomann, R. V., "Time-Series  Analysis of Water-Quality
Data", Journal, Sanitary Engineering Division, ASCE, Vol. 93,
February, 1967.

48.  Thomann, R. V. and Sobel, M.  J., "Estuarine Water Quality
Management and Forecasting", Journal, Sanitary Engineering
Division, ASCE, Vol. 90, October,  1965.

49.  Sobel, M. J. "Water Quality Improvement Programming Problems1,'
Water Resources Research, Vol. 1,  No. 4, 1965.

50.  McBeath, B. C. and Eliassen,  R., "Sensitivity Analysis of
Activated Sludge Economics", Journal, Sanitary Engineering
Division. ASCE. Vol. 92, April, 1966.

51.  Young, G. K., Schrecongost, R. W. and Fitch, W. N., "Design
Sensitivity of Pollution Control Reservoirs", Journal, Sanitary
Engineering Division, ASCE, Vol. 94, October, 1968.

52.  Vemuri, V., Dracup, J. A., Erdmann, R. C, and Vemuri, N.,
"Sensitivity Analysis Method of System Identification and its
Potential in Hydrologic Research", Water Resources Research.
Vol. 5, April, 1969.

53.  James, I. C. II, Bower, B. T., and Matalas, N. C., "Relative
Importance of Variables in Water Resources Planning."  In Press.

54.  Benson, M. A. and Matalas, N. C., "Synthetic Hydrology
Based on Regional Statistical Parameters", Water_jtespurc.es
Research. Vol. 3, No. 4, 1967.

55.  Harms, A, A. and Campbell, T. H., "An Extension to the
Thomas-Fiering Model for the Sequential Generation of Streamflow",
Water Resources Research, Vol. 3, No. 3, 1967.
                              4-18

-------
56.  Beard, L. R., "Use of Interrelated Records to Simulate Streamflow,"
Journal, Hydraulic Division, ASCE, Vol. 91, September, 1965.

57.  Quirapo, R. G., "Stochastic Analysis of Daily River Flows",
Journal, Hydraulics Division, ASCE, Vol. 94, January, 1968.

58.  Young, G. K. and Pisano, W. C., "Operational Hydrology Using
Residuals", Journal, Hydraulics Division, ASCE, Vol. 94, July,
1968.

59.  Payne, K., Neuman, W. R. and Kerri, K. D., "Daily Stream-
flow Simulation", Journal, Hydraulics Division, ASCE, Vol. 95,
July, 1969.

60.  Mandelbrot,  B. B. and Wallis, J. R., "Noah, Joseph and
Operational Hydrology", Water Resources Research, Vol. 4,
October, 1968.

61.  Crawford, N. G. and Linsley, R. K., Digital Simulation in
Hydrology; Stanford Watershed Model IV, Technical Report No. 39,
Stanford University, July, 1966.

62.  James, L. D., "Using a Digital Computer to Estimate the
Effects of Urban  Development on Flood Peaks", Water Resources
Research, Vol. 1, No. 2, 1965.

63.  Goodman, A.  S. and Dobbins, W. E., "Mathematical Model for
Water Pollution Control Studies", Journal, Sanitary Engineering
Division. ASCE. Vol. 92, December, 1966.

64.  Dornhelm, R. B. and Woolhiser, D. A., "Digital Simulation
of Estuarine Water Quality", Water Resources Research, Vol. 4,
December, 1968.

65.  Burkhead, C. E. and Wood, D. J., "Analog Simulation of
Activated Sludge  Systems", Journal, Sanitary Engineering Division,
ASCE. Vol. 95, June, 1969.

66.  Streeter, V. L. and Wylie, E., Hydraulic Transients,
McGraw-Hill Book  Co., Inc., New York, 1967.

67.  Baltzer, R. A.  and Lai, C., "Computer Simulation of
Unsteady Flows in Waterways, "Journal, Hydraulics Division,
ASCE, Vol. 94, July, 1968.
                             4-19

-------
68.  Anderson, D. V., "Review of Basic Statistical Concepts in
Hydrology", Proceedings, Hydrology Symposium No., 5, McGill
University, February, 1966.

69.  Langbein, W. B., "Queuing Theory and Water Storage",
Journal, Hydraulics Division, ASCE, Vol. 84, October, 1958.

70.  Stall, J. B=, "Reservoir Mass Analysis by a Low-Flow
Series", Jourr^j_Sanit^2^^&2^^il^^^^^^.^c^;» Vol. 88,
September, 1962.

71.  Hall, W. A., "Optimum Design of a Multiple-Purpose
Reservoir", Journal, Hydraulics Division, ASCE, Vol. 90,
July, 1964.

72.  Worley, J. L., A System Analysis Method for Water Quality
Management by Low Flow Augmentation in a Complex River Basin,
MS Thesis, Oregon State University, June, 1963.

73.  Loucks, D. P.,  "Computer Models for Reservoir Regulation",
Journal. Sanitary Engineering Division, ASCE, Vol. 94, August,
1968.

74.  James, L. D., "Economic Deviation of Reservoir Operating
Rules," Journal, Sanitary Engineering Division, ASCE, Vol. 94,
September, 1968.

75.  Churchill, M. A., "Effects of Storage  Impoundments on Water
Quality",  Transactions, ASCE, Vol- 123, 1958.

76.  Churchill, M. A., and Nicholson, W. R,, "Effects of Impound-
ments on Water Quality", Journal, Sanitary  Engineering Division.
ASCE, Vol. 93, December, 1967.

77.  Krenkel, P. A., Thackston, E. L., and  Parker, F. L.,
"Impoundment and Temperature Effect on Waste Assimilation",
Journal, Sanitary Engineering Division, ASGE, Vol, 95, February, 1969

78.  Symons, J. M.,  Irwin, W. H, and Roebuck, G. G., "Impound-
ment Water Quality Changes during Mixing",  Journal, Sanitary
Engineering Division. ASCE, Vol. 93, April, 1967.
                             4-20

-------
79.  Symons, J. M., et al., "Management and Measurement of DO
in Impoundments", Journal, Sanitary Engineering Division, ASCE,
Vol. 93, December, 1967.

80.  Young, G. K. , "Reservoir Management:  The Tradeoff between
Low Flow Regulation and Flood Regulation and Flood Control",
Water Resources Research, Vol. A, June, 1968.
                       i
81.  Kerri, K. D., An Investigation of Alternative Means of
Achieving Water Quality Objectives, Ph.D. Dissertation, Oregon
State University, Corvallis, Oregon, 1965.

82.  Thomann, R. V., "Use of Systems Analysis in Estuarine Water
Pollution Control," Proceedings, Western Resources Conference. Univ. of
Colorado, Boulder, 1964.

83.  Clough, D. J., Bayer, M. B., "Optimal Waste Treatment and
Pollution Abatement Benefits on a Closed River System,"
Operational Research Society Jour.. j3, 3, 1968.

84.  Graves, G. W., Hatfield, H. B., and Whinston, A., "Water
Pollution Control Using By-Pass Piping." Water Resources Research,
.5, 1, 1969.

85.  Upton, C. "Optimal Taxing of Water Pollution," Water Resources
Research, 4, 5, 1968.
                             4-21

-------
                        SECTION 5
                       COST ANALYSIS

5.1 Introduction
An analysis of the cost of waste treatment and the cost of storage
facilities is presented in this section.  Waste  treatment costs
are determined for primary, secondary and tertiary facilities.
Reservoir storage :cost evaluations  include a regression analysis
relating required reservoir storage and a set of independent
variables.

5.2 Cost of Waste Treatment
An evaluation of low flow augmentation as a means of maintaining water
quality entails some knowledge of the costs of waste treatment.  When
combined with the costs of providing varying levels of flow augmen-
tation, these-may be-compared-with  the benefits  derivable from
maintaining various standards1 of water quality.  Ideally this com-
parison leads to optimal levels of water'quality, flow augmentation
and waste treatment.  It is the purpose of this  section to estimate
the total annual costs'of waste treatment to achieve various levels
of efficiency of BOD removal.  Primary, secondary and tertiary
treatment processes'are considered, utilizing-both field and hypo-
thetical costs'for-treatment plants of differing capacities.  A
more complete description for this phase of the  investigation is
contained'in (1).

5.2.1 Primary and Secondary Treatment Costs
Three field studies of sewage treatment plant construction costs
by Rowan et_ al. (2), Logan £t al. (3) and the Public Health
Service (4) were selected and compared.  The Public Health Service
construction cost index, based on 1957-59'costs/mgd, was used to
adjust construction costs from all  three' studies to the same year,
1968.  Similarly, operation and maintenance cost studies by Rowan,
Jenkins and Howells (5) and Logan &t_ jil. (3) were compared after
adjustment to 1968-dollars by means of the Bureau of Labor Statistics
Common Labor Indajci  Updated construction costs  for each study
were weighted',by the sample size from which the  costs were derived
and a least-squares equation'was developed for the average construction
cost/mgd for primary, trickling filtration and activated sludge
treatment.  A similar equation was developed for operation and
maintenance;'costs;  It was not' possible to calculate a coefficient
of variation' for- the' final-regression curves' since the original
data were«'ijtpt readily available.  However, results from the
individual studies were similar in most cases.

Application of the equations to this study was limited by a number of
factors.  First, the dependence upon indices for converting cost data
in various parts of the country to a single base introduces error due
to regional differences, primary among which are construction methods.
                             5-1

-------
Second, specific local problems are not accounted for.  Third, definitive
conclusions concerning the precision of the final construction cost
equations are not possible.  Fourth, and most significantly, no determin-
ation could be made of the sensitivity of treatment costs and efficiencies
to variations in unit process design or operation.  For these reasons more
detailed cost data were deemed necessary.

Logan et_ al. (3) designed a series of treatment plants composed of unit
processes for which construction, operation and maintenance costs were
calculated.  Total costs were obtained by adding the individual unit
process costs.  Logan's approach was adopted and expanded upon in this
study.  Construction costs at Kansas City for the various sizes of unit
processes were presented in term's of 1960 dollars.  These were adjusted
to 1968 dollars for the average of the 20 cities comprising the PHS Index,
under the assumption that labor and management productivity does not vary
among the cities.  Assuming that variations in unit process parameters
are minor, annual operation and maintenance costs also were adjusted to
1968 dollars.  Hypothetical treatment plants utilizing a large number of
treatment process combinations were analyzed to determine total annual
costs of Operation.  A design period of 20 years was chosen.  Construction
costs were increased by 25 percent to allow for legal and engineering
fees, and the total capital cost was then amortized at an interest rate
of four percent.  The latter was chosen to represent interest rates on
municipal revenue bonds.

The efficiency of BOD removal was determined for each of the process
combinations and curves were drawn for each hypothetical treatment plant
capacity relating total annual cost to percent removal of BOD.  Capacities
considered were 0.25, 1.0, and 10.0 MGD.  These curves are shown in
Figure 5-1 and they are compared in Figure 5-2 to curves derived from
the field cost studies.  The hypothetical curves are presented as
"envelopes" indicating the range of costs to be expected for any effluent
quality desired.  The existence of a range reflects the variation in
total annual costs attributable to sludge disposal costs, which are not
included in this study.  Sludge disposal coses will determine the expendi-
ture necessary for sludge treatment and handling, which in turn will
determine the location within the envelope.  The bounds of each "envelope"
may therefore be interpreted as representing high or low sludge handling
costs.  With the exception of the 0.25 MGD plant capacity, comparison of
the hypothetical cost curves with those calculated from the field costs
indicates close similarity between the two cost curves, as shown in
Figure 5-2.  The more detailed cost curves will be used in this study
to determine the effect on water quality of incremental changes in
primary and secondary waste treatment.

5.2.2  Tertiary Treatment Costs
As a parameter of waste treatment efficiency, BOD removal is not of
primary significance when tertiary treatment is under consideration.
                                  5-2

-------
u>
       I4O
       120
     o
     o
     2

     0100
     o
     o
       60
      40
      20
                                         FIGURE  5-1

                      TOTAL  ANNUAL HYPOTHETICAL  COST OF BOD REMOVAL

                                        (1968  DOLLARS)
                  025 MGD
                   1.00 MGD
                   IO.O  MGD
       X
       o
       A
PRIMARY  TREATMENT

STANDARD RATE TRICKLING FILTER

HIGH RATE TRICKLING FILTER

ACTIVATED SLUDGE

TERTIARY TREATMENT
                 10
20
                                    30
                                                            I
                                             40       50        60

                                                 BOD   REMOVAL  (%)
                                               70
                                      80
II     II

    90       100

-------
  140
  120
0100
5
\
O
o
O

** 80
OT
O
O
  60
  40
_i
<
  20
                      FIGURE 5-2
          COMPARISON OF  FIELD AND HYPOTHETICAL
                   COST OF BOD REMOVAL
                                      HYPOTHETICAL COST
                                      FIELD COST
            0.25 MGO
1.00  MGO
           10.0 MGD
             100.0 MGO
            I	  I    I    I
          I    I    t
                                         I
            10
          20
30
                                      40       5O       60
                                          BOD  REMOVAL (%)
                                                     70
                                            80
90
100

-------
Other parameters become important, among which are total dissolved solids
(IDS), ammonia, nitrogen, nitrate nitrogen, chemical oxygen demand (COD),
suspended solids, phosphate, and bacterial count (MPN).   However, BOD is
removed by many of the tertiary unit processes, thereby enabling calcula-
tion of annual costs of BOD removal up to nearly 100 percent.

The four tertiary treatment processes considered are combinations of unit
processes that are assumed to receive secondary effluent from an activated
sludge unit that has already removed 94 percent of the BOD.  The processes
and their incremental efficiencies of BOD removal are listed in Table 5-1.
                             TABLE 5-1
          INCREMENTAL BOD REMOVAL WITH TERTIARY TREATMENT

        Process                            Incremental BOD Removal (%)

1.  Polyelectrolyte Coagulation +
    Filtration                                         95

2.  Polyelectrolyte Coagulation +
    Filtration + Absorption                           100

3.  Foam Separation                                    30

4.  Polyelectrolyte Coagulation +
    Filtration + PO^ Removal +
    NH  Removal                                        95
Data determined in experimental studies at Lake Tahoe were used to calculate
capital and operating costs for the first two processes (6) .  The design
period was assumed to be 20 years and the interest rate was maintained
at four percent.  The tertiary plant was assumed to be operating during
the 120 day period of lowest flows, while remaining inop^erational for the
remainder of the year.  Cost data or foam separation are' limited with the
result that the calculated annual costs of this form of treatment are of
limited accuracy.  The last process was included for purposes of compari-
son.  It is identical to the first process except that the removal of two
other parameters normally associated with tertiary treatment are included.
It therefore reflects more accurately the probable required expenditure
associated with tertiary treatment.  Capital costs for the first two
processes were increased by 25 percent to cover engineering and legal fees;
however, it was not possible to determine whether such an addition had
already been made to the last two process costs, so the increase was
omitted.  All costs are considered to be slightly conservative.
                                5-7

-------
 5.2.3 Annual Cost Equations
 For the purpose of this study, it was necessary to present the annual
 costs of waste treatment in two forms.  The first, relating annual
 cost to percent removal of BOD for various flow rates, has been shown.
 It was also desired to relate annual cost of waste treatment to flow
 for various efficiencies of BOD removal.  Equations of the form
                          aQb for 1 < Q <  100	[Eq.  5.1]
 where:
 Y    =  total annual waste treatment costs,
 a,b   =  coefficients,  and
 Q    =  design capacity of treatment plant,
 were determined at  seven  points of BOD removal,  thereby dividing  the
 convex  curves of Figure 5-2 into linear segments for incorporating
 into a  linear programming model.  The coefficients  a and b  for
 specified  levels of BOD removal are shown in Table  5-2.   These
 equations  are valid within a range of treatment  plant capacity  from
 one  to  one hundred  MGD.
                          TABLE  5-2
               COEFFICIENTS  FOR  EQUATION  [5.1]
 Segment

    1
    2
    3
    4
    5
    6
    7
 47,000
 49,600
 54,500
 60,000
 66,000
 74,000
110,000
-0.31535
-0.31740
-0.33175
-0.34065
-0.34460
-0.34655
-0.37020
BOD Removal (%)

     30
     50
     70
     80
     85
     90
     95
5.3 Cost of Impoundments
While waste treatment reduces the sources of pollution, low flow aug-
mentation can be used to enhance the assimilative capacity in the
receiving waters in two ways.  First, it brings about an increased
degree of dilution of the pollutants.  Secondly, it displaces the
demands placed upon the dissolved oxygen resource  in a stream to
points downstream of the waste sources.  Although their mechanisms
are different, waste treatment and flow augmentation can be used
jointly to meet a set of water quality standards in a stream.  The
fact that marginal costs increase sharply at high levels of waste
treatment suggests that consideration be given to an economic trade-
off between these two methods.  This requires data on low flow
augmentation costs.
                               5-8

-------
In 1960, Cook  (7) developed a set of regional reservoir cost curves for
the United States•  These curves, which express cost per unit volume as
a function of  total volume, indicate definite economies of scale.  Economic
factors indicate that it is unlikely that a reservoir might be built ex-
clusively for  low flow augmentation.  Rather it is a potential single use
of a multiple-purpose reservoir.  In this multi-purpose framework, the
problem of evaluating the costs of low flow augmentation is quite elusive.
Each purpose exhibits a unique pattern of water demands and claims on
reservoir storage space over time.  As a result, both conflicting and
complementary  situations arise, which must be resolved and accommodated
by means of operating rules.

Therefore, in  a multiple-purpose project, a series of analyses must be
performed before the cost of low flow augmentation can be meaningfully
evaluated.  The process may be described in two basic steps.  The first
step concerns  the reservoir as an entity which serves a multitude of
purposes, but which nonetheless has one overall cost associated with it.
This cost can be linked directly, by means of curves similar to the ones
Cook derived,  to the reservoir volume.  It follows that the cost of a
reservoir is determined ultimately by the seasonal patterns for the dif-
ferent purposes.  Given the inflows, an overall operating rule, and the
seasonal target demand pattern for the combination of uses, the reservoir
capacity required over a certain length of time can be calculated.  In
this investigation, such a process was carried out, under varying
hydrologic conditions and policies.  The result was a regression relation-
ship between required capacity and the variables which largely defined
the operation  of the model.  At this point the breakdown of the overall
demand by purpose had not yet been considered.

The second step examines the internal situation of the reservoir,
namely how low flow augmentation and their demands interact to produce
claims on storage space.  If the value of releases from the reservoir
can be measured in comparable units, it is feasible to derive a set of
operating schemes which would maximize overall net benefits.  This
approach permits the investigation of complementarity and competition
among the different purposes.

5.3.1  Summary of Methodology
A functional relationship between required reservoir storage and a set
of pertinent variables was developed (8).  These variables reflect the
nature of the  inflows and overall demands, and the probability that the
reservoir would not become empty.  This information was then trans-
lated into cost data by using the regional reservoir cost curves developed
by Cook.

A small-scale synthetic streamflow generator was used to provide inflows
to the reservoir for the desired time period.  The variables in the
generator were:  average monthly flow, monthly standard deviation, and
monthly serial correlation coefficients,based on a one-month lag.
                                5-9

-------
 The results of curve-fitting experiments conducted on hydrologic data
 were relied upon for simplification purposes.  These results indicate
 that the variations of the above variables with respect to time exhibit
 a definite and consistent cyclic pattern.   All three parameters show
 approximately sinusoidal patterns, of a different nature in each case.
 The average monthly flow varies according  to a sine curve of one cycle.
 The average monthly coefficient of variation, which is a surrogate for
 the standard deviation,  also exhibits a sinusoidal pattern of one cycle,
 but is  shifted 180 degrees with respect to the above.  The monthly serial
 correlation coefficient  is found to approximate a sine wave of two cycles.
 The likeness of each of  the first two patterns to its trigonometric
 counterpart is enhanced  by means of a logarithmic transformation.

 In this program,  the upper and lower limits to the range of these sinu-
 soidal  variations are specified, and thereby determine the remaining
 monthly values of the parameters.   Several runs of the reservoir operation
 model were conducted, using different sets of these three upper and
 lower limits,  to  observe varying responses in storage requirements for
 certain demands.   The monthly streamflow values obtained from the generator
 were in all cases subjected to a logarithmic transformation.

 The link between  reservoir inflows and outflows is provided by a set of
 operating rules.   Essentially,  these rules set the amount of  water to be
 released at any time, given the storage level, the inflow rate,  the
 outflow rate,and  the season of  the year.   In this phase  of the study, no
 breakdown of water demand  by  user  was made.   Instead,  consideration was
 given to the combined effect  of withdrawals  for different purposes,  by
 means of time-varying release rates.

 The operating  rule used  in the  program is  a  modified version  of  that
 developed by Moran (9).  Basically,  the operating rule states  that  if
 the amount of  water available is less  than a preset  target  release,  the
 entire  amount  present will be released.  On  the other hand, if  the  amount
 of  water available is greater than a  certain specified value,  releases
 in  excess of the  target  rate  will  be  made  to avoid overflow.   The modi-
 fications  introduced into  the model  consist  of  the use of  actual  inflows,
 storage  volumes,  and outflows,  instead  of  their distributions.  Also  the
 capability  for  handling  time-varying  target  release rates  is  incorporated.

 For simplification purposes,  the target release  pattern was represented
by  a  sine  curve of  a yearly cycle.  The parameters which  determined  the
monthly  values were  an upper  limit, a  lower  limit, and a  phase-shift
value.   These  three  parameters were also assigned varying values to
measure  their  relative impact on the behavior  of  the system.

The assumed  sinusoidal pattern provides a  useful  and simple parametric
tool.  In a  specific  instance where the target  release pattern is known,
                                5-10

-------
it might be expressed more accurately in terms of another function or
superposition of functions.  In that case, the use of deterministic
parameters, although more complex, would still be desirable from the
standpoint of regression analysis.

Next, a method was devised to examine the relationship between storage
capacity and the probability that the reservoir may become empty in any
given year.  This probability was obtained by operating reservoirs of
different sizes for a certain number of years and calculating the ratio
of the number of years in which there was deficiency to the total number
of years.  A computer version of the mass diagram analysis calculated
the storage volume required for no deficiencies, using a relatively
short time period.  The trial reservoir capacities were values higher and
lower than the above, in order to provide a wide testing range.  These
reservoirs were operated in the main program to determine their deficiency
ratios.

Prior to formulation of a method for operating the model and drawing
statistical conclusions, it is worthwhile to review the variables involved:

1.  OMAX:   maximum average monthly streamflow, in MGD/square mile.
2.  QMIN:   minimum average monthly streamflow, in MGD/square mile.
3.  CMAX:   maximum average monthly coefficient of variation of stream-
flows.
4.  CMIN:   minimum average monthly coefficient of variation of stream-
flows.
5.  SMAX:   maximum average monthly coefficient of serial correlation
of streamflows.
6.  SMIN;   minimum average monthly coefficient  of serial correlation
of streamflows.
7.  DMAX:   maximum monthly demand rate, in MGD/square tirlle.
8.  DMIN:   minimum monthly demand rate, in MGD/square mile.
9.  DLAG:   the time period elapsed between the largest flow and the
largest demand, in months.
10. PROS:   the probability that the reservoir will not become empty in
any given year.

The square of each of the variables was included to permit investigating
non-linear effects.

In the main program, variables 1 through 9 define the monthly inflows and
outflows for each of the different trial reservoir capacities.  Variable
10 is a part of the output from this program.  Subsequently, a multivari-
ate regression analysis is performed.  In this program, variables 1 through
10 are the independent variables, and the response of interest, V, is
the storage volume required for a certain probability level.
                               5-11

-------
A statistical framework well-suited to this case is the factorial experi-
ment.  As its name implies, this experiment permits the simultaneous
examination of the effects of varying two or more factors.  This technique
assigns certain specific and constant values, or levels, to each factor
and then proceeds to examine subsequent responses.  In the analysis of
the results, the effect of each factor can be established with the same
degree of accuracy as if only one factor had been varied at a time;  the
interaction effects between the factors can also be determined.

If two levels, high and low, are assigned to each of the nine factors (not
including the probability terms, which are dependent upon these), the
total possible number of combinations of factors would be 29, or 512.
This number is more than is needed to estimate the parameters in the
desired functional relation, so a complete factorial experiment was not
employed.  Instead, the statistical device used was a fractional fac-
torial experiment, in which only a fraction of all the possible factor
combinations was investigated.  Because there were only 9 parameters to
be estimated in the functional relation of these factors, it seemed that
the minimum number of experiments consistent with a fractional design
was 16.  Thus, a 1/32 fractional factorial design was selected.

The application of this technique permits evaluation of the main effects,
i.e., those resulting solely from the influence of a single given factor.
However, a penalty is paid in terms of the decreased accuracy in the
evaluation of those effects because they are confounded with other inter-
action effects which involve a large number of factors.

Table 5-3 shows the upper and lower values of the parameters used in the
simulation.  Table 5-4 indicates the combinations of upper and lower
levels in each of the 16 "loops" in the main program.

5.3,2  Results
The relationships investigated were of two types.  One consisted of an
additive relationship of the form:

             Y - a + bx X! + b2 x2 + ... + bn xn	[Eq. 5.2]

the other was expressed in the multiplicative form

             Y = a Xlbl x2b2 ... xnbn   	[Eq. 5.3]

where the x's represent the independent variables and Y the estimate of
the dependent variable.  Eight different transformations of the independent
variables in the two forms were considered.  Numerous criteria could be
used to determine the best regression equation.  In this study, the equa-
tion chosen is that which produces the largest cumulative multiple corre-
lation coefficient.  The square of this number indicates the proportion
                               5-12

-------
                                                    TABLE 5
                            VALUES OF THE PARAMETERS USED IN  THE FACTORIAL EXPERIMENT
                      Parameter
                         (1)
                                    Upper Level
                                        (2)
                                 Lower Level
                                     (3)
I
M
CO
1.  Maximum average flow

2.  Minimum average flow

3.  Maximum average coefficient
        of variation

4.  Minimum average coefficient
        of variation

5.  Maximum serial correlation
        coefficient

6.  Minimum serial correlation
        coefficient

7.  Ratio of maximum demand to
        average flow

8.  Ratio of minimum demand to
        average flow

9.  Month in which peak demand
        occurs
0.9 MGD/square mile

0.7 MGD/square mile


       1.0


       0.5


       0.75


       0.5


       0.8


       0.4


       9
0.7 MGD/square mile

0.5 MGD/square mile


       0.5


       0.25


       0.5


       0.25


       0.4


       0.2

-------
                              TABLE 5-4
         PARAMETER LEVELS USED IN EACH FACTORIAL COMBINATION'
Combination
Number

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Parameter Number"
1
L
U
u
L
U
L
L
U
L
U
U
L
U
L
L
U
2
L
U
U
L
L
U
U
L
U
L
L
U
U
L
L
U
3
L
U
L
U
U
L
U
L
U
L
U
•L
L
U
L
U
4
L
L
U
U
U
u
L
L
U
U
L
L
L
L
U
U
5
L
U
U
L
U
L
L
U
U
L
L
U
L
U
U
L
6
L
U
L
U
L
U
L
U
L
U
L
U
L
U
L
U
7
L
L
U
U
L
L
U
U
L
L
U
U
L
L
U
U
8
L
L
L
L
U
U
u
u
L
L
L
L
U
U
U
U
9
L
L
L
L
L
L
L
L
U
U
U
u
u
u
u
u
   denotes upper level; L denotes lower

Enumerated on Table 5-3.
                                  5-14

-------
of the total variability of the dependent variable which is accounted for
by the independent variables.

The final relationship chosen was :

           v » -194 + 305(DMAX) + 251 (SQPR) + 71.2 (CMAX)

               + 5.05 (DLAG)  +118 (DMIN)- 88.9(WMIN) + 46.7 (CMIN)

               - 143(PROB) + 41.2
-------
I-1
       220


       200


      0180
      o
      cr
        140
2] 120
Q_

co 100


2 80

o
Q 60


~ 40

co

8 20
          20,000
                                                FIGURE 5-3

                                       REGIONAL RESERVOIR COST CURVE B

                                     BY THE CORPS OF ENGINEERS   (7)
                     100,000                   1,000,000

                                CAPACITY IN ACRE FEET
                                                                   I	I
                                                                               I I  I
10,000,000

-------
Substitution of equation [5.5] into equation [5.7] gives the generalized
cost relation for region B.

          C = 1800{A[-194 + 251(SQPR) + 71.2(CMAX) + 5.05(DLAG)

              + 46.7(CMIN)  - 143(PROB) + 41.2(SMIN) - 24,1(SMAX)]

              + [197CZ!) + 76.8(Z2) - 57.2(Z3) - 19.6(Z4) ] }°'8 [Eq. 5.8]

The results of this study permit the estimation of the required reser-
voir size in terms of the desired deficiency level and statistical para-
meters describing streamflows and demands.  The cost of storage may then
be obtained from existing generalized regional cost curves,

The regression equation accounts for roughly 80 percent of the variability
of the response.  The single most significant variable is the maximum
monthly demand.  This parameter, along with the square of the probability
of no deficiency, and the maximum monthly correlation coefficient, account
for the majority of the variability in the required storage,
                                  5-19

-------
                       REFERENCES

1.  Pyne, R.D.G., "Cost Curves of Sewage Treatment for Low Flow
Augmentation." M.S. Thesis, U. of Florida  (1967).

2.  Rowan, P.R., Jenkins, K.H., and  Butler, F.D.W. » "Sewage
Treatment Construction Costs."  Jour. Water Pollution Control
Federation. 32.  6, 596 (1960).

3.  Logan, J. A., Hatfield, W. D;, Russell, G.S., and Lynn, W.R.,
"An Analysis of  the Economics of Wastewater Treatment."  Jour.
Water Pollution  Control Federation, 34. 9, 860  (1962).

4.  Anon.  "Modern Treatments Plants—How Much Do They Cost?"
U. S. Dept, of Health, Education, and Welfare, P.H.S. Pyblication
No. 1229 (1964).

5.  Rovan, P.P., Jenkins, K.H-., and Howells, D.H. , "Estimating
Sewage Treatment Plant Operation and Maintenance Costs." Jour.
Water Pollution  Control Federation, 33, 2, 111  (1961).

6.  Rodehilk, R.E. and Gulp, R.L., "The Lake Tahoe Water Reclamation
Plant."  Annual Meeting of the Water Pollution Control Federation,
Atlantic City, N. J.  (1965).

1.  Senate Select Committee on National Water Resources, Reprint
No. 32, Washington, D.C.  (1960).

8.  Perez, A. I., Schaake, J.C. andpyatt,  E.E., "Simulation Model
for Flow Augmentation Costs," Jour. Hydraulics Division, ASCE
(accepted for publication).

9.  Moran, P.A.P., "A Probability Theory of Dams and Storage Systems."
Australian Jour, of Applied Science, 5, 116, 124 (1964).
                              5-20

-------
                             SECTION 6
            THEORETICAL DEVELOPMENT OF SIMULATION MODEL

6.1  Introduction
In this chapter, the rationale, concepts and mathematical models for
the simulation of water quality in a river system are developed.
Emphasis is placed upon the theoretical aspects.  The more practical
aspects, such  as how the problems are formulated for the computer
and what input and output formats are used, are covered in Appendix
A4, entitled "Users Instructions."  Although the "Users Instructions"
are a complete set of instructions and can be used independently,
the reader should review this chapter carefully to gain the necessary
insight to the overall simulation methods. Then, when the simulation
model is being set up and used, this chapter may serve as a reference
for and adjunct to the "Users Instructions."

The simulation model is made up of a group of mathematical models
which are linked together by a programmed logic.  The purpose of the
model is to generate a reasonably accurate representation of the
stream flow and oxygen balance in a river system.  The value of
the simulation model depends to a great extent upon the use of the
high-speed digital computer for fast and accurate computations and
application of logic.  The speed of the computer not only provides
the results within an acceptable time but also reduces materially
the costs to obtain the results.  In short, the computer is a necessary
appurtenance in the use of the simulation model.  For this reason,
the development of models, techniques and logic is made for direct
application of computer methods.

This chapter briefly discusses simulation as a method for analyzing
the response of intricate systems and shows that simulation is, for
the problem at hand, the method that is most likely to succeed in
acceptable system representation.  A portion of the chapter is
devoted to the description of river system data needed for simulation
and its preparation for use in the programs of the simulation model.
Following this, the method for simulating river flows, flow regulation
and water quality parameters is developed.  Finally, brief discussions
are presented on the subjects of sensitivity of variables and transfer
functions, the latter for use as a rapid means of predicting the
system response to an imposed set of conditions.
                              6-1

-------
6. 2 Simulation
In this age when designs are complex and involve many millions of
dollars, it becomes necessary to make the best use of all available
design methods.  Two of the methods used in planning and testing
are the techniques" of modeling and simulation.  Modeling is the
representation of a system," or part of a system, in a mathematical
or physical form- to demonstrate the behavior of the system.
Simulation involves development of the model and subjection of
the model to1 various environmental situations to explore the nature
of the results which are equivalent to, or in some way represen-
tative of, the results it is desired to investigate in the system.

If it is possible to develop a mathematical model of a system that
is both a reasonable representation of the system and is amenable
to analytical solution, the mathematical model as a method is usually
more precise, less costly and quicker than simulation.  When a
system is too complex to be described by a single, manageable
mathematical model, the technique of simulation often can be used.
Simulation involves the construction of an overall model which can
be described by a number of • interdependent mathematical models,
each having behavior that can be determined analytically, and
operating the overall model in such a manner that the interdepend-
encies are recognized and accounted for so that it is representative
of the system.  Thus", a large complex system is represented by a
series of interrelated mathematical models which are used in a
natural order or sequence as directed by logic or operating rules
to obtain the overall effect of the interaction of the individual
models.
The use of simulation as a tool for planning, construction and
operation of complex systems has increased in geometric proportions
in the past two decades.  It is suggested that the real reason is
attributable to the development of the digital computer.
Simulation, no doubt, has led to the development of many complex
systems, but also it has allowed better planning and analysis of
systems that would have been built anyway.  Additionally, it allows
the analysis' of existing natural systems to work out control devices
and operating procedures for the best use of the natural system.
Simulation is ideally suited to provide the information needed in
the analysis of' the economics of water use where multiple uses are
in competition for available water.  This is the use of simulation
in this work.
                              6-2

-------
The role of the digital computer in simulation is extremely important.
Aside from the fact that the computer makes mathematical computations
with unbelievable speed and accuracy, it is able to store and recall
mathematical formulas and data in copious quantities.  It is possible
to formulate the coding so that parameter values can be changed during
the simulation "run."  A principal advantage in the use of the
computer is its ability to simulate in "fast time"; i.e., the
simulation by the computer proceeds at a much faster pace than the
real system would operate.  This advantage is obvious when it is the
purpose of the simulation to generate hundreds of years of data, which
the computer does in minutes.  The whole program coding and data are
contained in a manageable "deck" of cards or magnetic tape and in a
matter of minutes simulation can proceed.  Also, with proper attention
to input data and parameters, the program may be used to simulate in
a different environment.

Simulation is not a panacea for all analysts of complex systems.  It
has limitations.  The method is similar to experimentation as a means
of determining cause and effect.  It takes a series of trials wherein
the input parameters are varied to be able to predict the optimum
solution.  It is not possible to determine analytically the maximizing
stationary point nor is it possible to look at the dual solution to
determine the parameter sensitivity.  To have arrived at the optimum
solution in the first simulation run would be blind luck or would
imply a relatively precise knowledge of the system.  Even if the
analyst is lucky on the first run, he probably would not recognize
the results as being optimum until other runs show that it is.  Thus,
simulation is used as a replacement for experimenting with the real
system because the latter is too inconvenient, too time consuming
or too costly, or because it is not physically possible to create
the test conditions in the real system.

As implied above, simulation is, compared to mathematical modeling,
a relatively imprecise technique.(3)  It provides data for statistical
analysis rather than exact results and compares alternatives rather
than generating the optimum.  As a consequence, simulation is
relatively expensive to use, particularly when the purpose is to
determine the sensitivity of the values of the parameters which govern
the model results.

Although the limitations of simulation might, at this point, seem
to discount its usefulness, it is still a most powerful tool, having
many advantages over alternative methods, if indeed there happens
to be an alternate method.  Goode and Machol(^) state that, "it is
safe to say that no large-scale system would be constructed today
without some simulation, and in a well-executed system design,
simulation would be used continually."
                                 6-3

-------
The steps in a simulation study are:  (1) development of the model,
(2) preparation of the computer program and (3) design and performance
of experiments and analysis thereof.  The development of the model is
covered in the balance of this chapter while the preparation of the
computer program is described in Appendix AA entitled "User's
Instructions."  The design and performance of experiments and analysis
of results is the subject of Section 8, entitled "Application of
Simulation Model."

6.3 Preparation for Simulation
The analysis of a system by simulation"requires that the analyst be
thoroughly familiar with the-operating realities of the system and
with the objectives of the study.(5)  The analyst begins by establishing
the overall real system.  He then begins to break down the real system
into components, being careful to maintain the continuity of flow
with each step.  The components are, in turn, broken down until each
one can be expressed by a mathematical model which"reasonably represent?
its real system counterpart.'  The linkage is maintained throughout
this process.  Operating rules must then be established to govern the
functioning of the mathematical models.  For example, if condition A
exists in the simulated system, the model does operation C, but if
condition B occurs, the model then shifts to operation D.

When all models, linkages and operating rules are ready, they must be
tested to assure first that they operate, and secondly that the results
are correct.  Usually it is advisable to set up the'various parts as
subroutines.  Testing begins on the individual subroutine and continues
as subroutine after subroutine is added until the overall model is
in satisfactory operation.  Often-it is necessary to use a desk cal-
culator to check the results of one "pass" of the simulation to be
assured that they are, in fact, correct.  If there is available any
information about the behavior of the real system, it is advisable
to input the corresponding conditions and see if the model reproduces
the behavior within acceptable limits.

In the formation of the simulation model, it is well to be aware of
the admonishment of Hillier and Lieberman that "...the simulation
model need not be a completely realistic representation of the real
system.  In fact, it appears that"most simulation models err on the
side of being overly realistic-rather than overly idealized.  With
the former approach, the model easily degenerates into a mass of
trivia and meandering details, so that a great deal of programming
and computer time is required to obtain a small amount of information.
                                6-4

-------
Furthermore, failing to strip away trivial factors to get down to
the core of the system may obscure the significance of those results
that are obtained."(5)

In the balance of the written work which follows, the thrust is
toward the application of simulation to a watershed to create an
acceptable approximation of river flow and water quality in that
watershed.  Accordingly, the topics will be:  (1) simulation of the
physical watershed, (2) simulation of stream flows in the watershed
and (3) simulation of water quality in the watershed.

6.3.1 Simulation of the Physical Watershed.
A basic need for development" of a watershed model is a topographic
map.  The U. S. Geological Survey topographic maps, called Quad-
rangles, covering 7 1/2 minutes of latitude and longitude  on a
1:24,000 scale are admirably suited for this purpose.  For large
watersheds, i.e. several thousand square miles in area, the 15
minute Geological Survey maps may be better suited, however.

The first step is to determine the drainage areas of the watershed,
the tributaries and upstream of each gage location.  To do this,
the- ridge lines around the watershed and tributaries are drawn
by interpretation of the contour lines on the map.  The areas are
then determined with a planimeter.  Ordinarily, it is not necessary
to outline and measure e4ch'branch.  In a dendritic stream pattern,
it usually is not necessary to separate out the drainage areas
for more than the highest three orders of streams excepting where
a lower order stream contains a reservoir of significant importance,
in which case the areas up to and including the reservoir should
be separated and measured.  Areas tributary to gage locations are
required, regardless of stream order.

The order of streams by Horton's classification (6) is determined
by the following criteria.  A stream having no tributaries is
a first order stream.   Where two first order streams meet, they
form a second order stream.  Where two second order streams meet
a third order stream is formed.  This system of classification
is carried on for the watershed for which a simulation model is
needed.  The separation of more than the highest three orders of
streams is tending toward over-realization and will result in
little value gained for much additional detail.
                            6-5

-------
The second step is to discretize the stream pattern by dividing it
into "reaches."  The stream system is continuously changing from
its headwaters to its mouth; the flows increase, the slopes usually
get flatter, the width and depth increase and the' velocities generally
increase.  The changes in the stream" are most apparent at the points
where tributaries" discharge and if the1 minor1 changes" between
tributaries are neglected, the stream is discretized.  This establishes
one of the criteria for establishing "reaches"; i.e., a reach is a
portion of the stream between" significant tributaries.

The reason for discretization of the stream into reaches is that it
is necessary to assume the stream is made up of a number of connected
segments in which each segment has constant properties.  Reaches are
therefore established so that at every major or significant change
in the stream there is a new reach.  Significant changes are, in
addition to the confluence of a tributary, a definite change in stream
bed slope, the discharge of a waste load and, because of its major
affect on the stream, each reservoir must be" considered a reach.  A
long section of stream having acceptable" uniformity of nroperties
should not be divided into two or more reaches because of its length.
It is not necessary that reach points be established at gage locations.

Obviously, the selection of reaches is a place in the formulation
of the watershed model where the tendency toward over-realization
would be. great.  There is no real reason for limiting the number of
reaches, excepting perhaps to meet the constraint of available
machine storage, but more than 50 reaches is likely to be cumber-
some to operate and analyze.  The program coding is limited to a
watershed having a maximum of 50 reaches.
An important step is the numbering of the reaches.  Experience
the test watershed has indicated that" if is best to number the
reaches in the following manner.  Beginning at the downstream end
of the main stem, number consecutively upstream on the main stem,.
The selection of the upstream tributary which is the main stem
is arbitrary but one, preferably the" longest", " should be "main
stem."  Following the consecutive' numbering of the main stem
reaches, begin at the downstream-most" tributary and, without skipping
any numbers, number the" reaches of " this tributary.  Work upstream,
tributary by tributary, until all reaches are numbered.  The reach
numbers should be a complete set of 1, 2, 3, ..., n where n is
the total number of reaches.
                            6-6

-------
The next step is to determine the hydraulic characteristics of each
reach of the system.  The rate of flow, Q, in the reach will have
been determined by the hydrology simulation.  It is necessary to
determine the mean velocity so that the time of flow, needed in
the quality simulation, can be determined.  Additionally, if values
of the reaeration velocity constant are not otherwise available,
they may be computed knowing the mean velocity and mean depth of
flow in the reach.   The length of the reach and its average slope
can be obtained from the map.

There are several ways to determine' the needed velocity and depth.
One way would be to select an average cross section in the reach
and using a current meter, develop a rating curve in the manner
described by Linsley, Kohler, and Paulhus. (?)  The data for the
rating curve can be used to formulate mathematical relationships
between velocity and discharge and depth discharge so they may
be concisely included in the program coding. 'It should be noted
that the velocity-discharge and the depth-discharge relations,
when plotted on semi-logarithmic paper, are straight lines.
Theoretically, a minimum of two measurements at different flows
would be enough to' define the relationships.

Another method, involving a small amount of field work, utilizes
any of the well-known open channel flow formulas.  One of them
is the Manning formula:
              Q = AV - A      n    R    S1'* .  .  .  FEq. 6.1]

where ,
Q « The discharge rate, in cubic feet per second, (cfs.)

A = The area of the cross section, in square feet,  (ft.2)

V = The mean velocity, feet per second (ft. /sec.)

n = The roughness factor

R = The hydraulic radius » area of cross section/wet perimeter,
    in feet (ft.)

S = The slope of the hydraulic grade line = average slope in reach.
                                6-7

-------
 The  cross sectional area is  the product of  the average  width  and  the
 average depth,  A=wd.   For most  river cross-sections,  R  *=  A/w *=  d.
 Equation 6.1 becomes:

             Q = AV ~ wd (1.486    d2/3 S1/2)	[Eq.  6.2]
                           n

 and  solving  for d:


             d = I   Qn       \  3/5	[Eq.  6.3]
                   1.486 w S1/'"
In this form, w, n  and  d  are  not  known.   If  the  shape of  the cross
section is such  that w  is approximately  constant for a wide range
of Q and if n can be considered constant,  then:
                                      3/5	[Eq. 6.4]
where,                         .
                        K =    I    n    \ 3/5  ...  [Eq. 6.5]
                               \ 1.486 w

The value of w can be obtained by field measurements, or by scaling
from the map if the river is large, to determine an average w for
the reach.  The value of n may be selected from compilations of
photographs and descriptions for stream channels in which roughness
coefficients have been determined.(°)

To obtain a feeling for the significance of an error by the assump-
tion that w is constant, take the example Q = 2256 cfs., S^-/2 =
0.0292, A = 618 ft.2, d = 6.18 ft., w = 100 ft.  If w = 90 ft.
instead of 100 ft., a 10 percent error, the value of d for the
given values of Q and S, is d = 6.6 ft., which is 6.8% in error.
The value for velocity is 3.65 ft./sec. for the given example.
If the value of w is 90 then V = 3.81 ft./sec. which is 4.7% in
error.

If the selected value of n is 10 percent too high, the computed
value for d will be about 5.5 percent too high and for n 10 percent

                                  6-8

-------
low, the value for d will be about 6.1% too low.  The value of v
will be  1/0.9= 11.1% high for n 10 percent too low and 9.1% low
for  n 10 per cent too high.

This method is presented without recommendation.  It affords
considerable savings in field work, which is traded for a possible
loss in precision if the assumptions made are in error.

A third method, which Involves no field work on the part of the
investigator, can be used.  It makes use of the studies of
geomorphology carried out by the U. S. Geological Survey and
reported by Leopold and Haddock^9).  It was found that if the
frequency of occurrences of discharge is the same at all points
along a stream, then the relationships between width and discharge,
depth and discharge, and velocity and discharge are constant for
the stream.  These relationships vary as some power of the discharge
such that:

                          w = aQb	[Eq. 6.6]

                          d = xQf	[Eq. 6.7]

                          v = kQm	[Eq. 6.8]

where a,  b, c, f, k and m are constants, w=width, d = mean depth
and v = mean velocity.  These relationships, which plot as straight
lines on semi-log paper, hold for all ranges of discharge up to
bankfull stage.  It was also shown that because:

                       Q = area x velocity = wdv .  [Eq. 6.9]

           Q = aQb x cQf x kQm - ack Qb + f + m .  [Eq. 6.10]

it follows that:

                         b + f + m - 1.0	[Eq. 6.11]

and
                         axcxk=1.0	[Eq. 6.12]

In these  equations,  the constants b»  f>  and m are the slopes of
the lines on the semi-log plot and a,  c and k are the intercepts.
                                 6-9

-------
 The  values of the constants  are  determined  at  the  locations of the
 gaging  stations  by obtaining the rating  curve  and  cross section at
 each station from the  U.  S.  Geological Survey.  The depth-discharge
 relation  is obtained by plotting the  rating curve  on  semi-log paper.
 The  width is obtained  from the cross  section,  with width and discharge
 being related by corresponding depth  values.   The  discharge divided
 by the  product of  width and  depth gives  the velocity.

 The  above  description  of methods for  obtaining the hydraulic char-
 acteristics  of the  reaches of the watershed is not intended to be
 exhaustive.   Use should be made  of available data  in  the best manner
 possible.  Resort  to the latter  method should  be made only if no
 other supporting data  are available.  Keep  in  mind that the assump-
 tion  is made  that  the  discharge  frequencies at all points are equal.
 For a large watershed, where  the geographic features  affect the
 distribution'of rainfall and where base  flows  are  significant and
 different  in  the tributaries, the use of these relationships may
 result in  unacceptable error.

 6.3.2 Simulation of Hydrology
An important  factor in the simulation of water quality, and the
 effect augmentation of the flow  rates has on it, is an accurate
 determination of how much water  will  be available  and what fre-
 quency distribution it will have.  Designers and planners need
 a reliable estimator of the mean flow and a  knowledge of the
variations that can occur in this mean flow.   Designs of water
 regulating and water quality control  structures are made to span
 economic time horizons of forty  to fifty years  or more.  There-
 fore, the  flow estimator and its variations must be known for at
 least an equal period.

 Water which appears in streams originates from  rainfall, often
 with  little  lag in time.  The many conditions which must be met
 to cause rainfall make the occurrence of rainfall  a stochastic
 process and,  understandably, the occurrence  of  stream flow  is also
 stochastic.   Accurate'numerical  description  of  these stochastic
 processes  is  given in  terms of statistical parameters determined
 by the analysis of replicate random samples.  Therefore, to be
 able  to describe stream flow accurately, the  statistical properties
must be determined from a number  of random samples.

 Few streamflow records span forty years,  particularly in a develop-
 ing watershed.  Therefore, the available data barely provide one
                              6-10

-------
sample where eight to ten are needed to allow even small sample
statistical procedures.  The development of the digital computer,
and the mathematical methods which extend its utility, provide
a tractable means to generate* additional samples.  The assumption
is made that the statistical parameters of the historical data
are unbiased of the population of data.  These parameters are
statistically the same as the sample of historical data.  The
generated data are simulations of the historical data.  The beauty
and utility of the method lie in- the fact that the computer can
simulate hundreds of years of data in a matter of minutes and
samples as good as the historical data may be selected from the
output.  The method does not increase the precision or confidence
in the mean but surely it extends the  confidence that can be placed
in the variability of the data.

The stream-gage flow generator is described in a following section.
A description of the preparation for its use follows below.

The primary source of streamflow data is from the U. S. Geological
Survey which maintains many recording gages on streams and
tributaries throughout the country.  These data are made available
as average daily flows, in cubic feet per second, in published
form or, more appropriately for the use here, they are obtainable
on magnetic tape.

A magnetic tape will contain all the available data for each
of several stations and represents an attractive savings in
the logistics of securing and preparing of these data for use.

Sometimes it is possible to obtain streamflow data from other
sources.  Some of the states maintain gaging stations and make
the data available to the public.  Additionally, industries,
notably the power companies and others which use large quantities
of water, maintain a few gaging stations.

To use the historical data as a basis for generating synthetic
data by the method used in this work, it is necessary that there
be a complete trace of data for each station, and that the span
of years of the data be the same for each station.   Also, it is
necessary that the data be transformed to a normal frequency
distribution, if they are not already normal.  Data preparation
therefore involves editing the raw data traces and filling any gaps,
selecting the gages to be used to give the maximum length of data,
while still using gage locations that adequately describe flows
                              6-11

-------
 in  the  region,  and  selecting  a normalizing  transform.  Three
 computer  programs have  been prepared to accomplish these tasks.
 The bases for these programs  are discussed  below.   The computer
 programs  and their  use  are described in greater detail in Appendix
 A4.

 6.3.2.1 Edit and Fill
 The raw data must be checked  to determine that they are for the
 proper station, that the1 data for all stations have the same
 beginning  time and  ending time and that all data are in the proper
 time sequence.  Data on  cards usually will  have the station number,
 year, month and a number 1, 2, 3 or 4, there being four cards to
 store one month's daily  flows.  A single station having 50 years
 of data will have 2600   cards.  Data on tape must be printed out
 for editing and filling.  It  is obvious thati this preparation is
 a formidable task.  A computer program is included which reads the
 data from tape or cards, checks  for the proper sequence of data,
 determines which data-points  are missing, fills them and outputs
 the information on  tape, on cards or on the printed page for use.
The program also computes average weekly gage readings, or average
monthly gage readings,  if instructed to do  so by a control statement.
The program is called "CHKDATA."

The procedure in filling missing data points is statistical in
nature.   When a data point is found missing, note is made of the
day, month and station.  The  computer finds the mean and standard
 deviation of all other data for that day, month and station and
 computes the missing data points by the formula:
where;                               ,
Q.  . . • the computed value of the ktti missing point for day i
  *']'    of the year and jth station.

y      - the mean of all other data for day i of the year and jth
  '•^     station.

a±  .   • the standard deviation of all other data for day i of the
  *J     year and jth station.

r      - the random variable associated with the kth missing data
         point.


                                6-12

-------
6.3.2.2 Normalize.
A study of the frequency of occurrence of the daily average values
of stream flow at any gaging station usually shows that the majority
of the data values is less than the mean of all values.  This is
caused by a small number of very large values which increase the
value of the mean to a value greater than the median.  Where the
mean is greater than the median, the distribution is said to be
skewed right .

To generate gage flow data that are statistically identical to
the historical data would require that the three statistical
parameters needed to describe the distribution be duplicated in the
generated data.  Although a technique has been developed to
consider skewness, it is generally not used in favor of trans-
forming to normalize skewed data, then using a simpler equation
which generates normally distributed data.  Inverting the trans-
formation then returns the skewness to the distribution of the
generated flow.

To illustrate the difference in the two generating equations,
the normal generating equation, in simplified form for one station,
is:
                                                                 ' 6'14]
whet e :
x-£+l  x. = flow at time points i+1 and i.

      VJ  = mean flow.
       X

      a  = standard deviation of flow.

   p  d) = the lag-one serial correlation coefficient.

   E.,..  = a standard normal random deviate,  (0,1).

Note that two parameters, mean and standard deviation, along with
the serial correlation coefficient are needed to generate serially
correlated normal data.  To include the effect of skewness, the
standard normal random deviate, e^+j must be replaced by:

                                    Y2  )3  -  1  ...  .[Eq.  6.15]
                                 6-13

-------
where:
                     Y^ = [1 - PX(D]   Yx ........  [Eq.  6.16]
                          [1 - px^ (I)3/2]

where:
£.,, = the new random component which is approximately gamma distri-
       buted (preserves skewness) .

Y*.   = the skewness of £.

Y    = the skewness of the historical data.
 A

H. ,-, = standard normal random deviate.

p (1)= the lag-one serial correlation coefficient of the historical  data.
 X

If the attraction of the simpler equation is not enough to  direct  the
user to the transformation - normal equation - inverted transformation
route, the requirement for normal data in order to apply the multivariate
techniques used in the multi-station generator most certainly does.
It is necessary, then, to consider normalizing transformations.

The normal distribution function is defined  by:

                        p(x) »   1    -_        ' '  '
where:
U is tl
The probability that a variable is less than or equal to x is:
                   o
U is the mean and o  is the variance,  parameters  of  the  distribution.
                        "fT/Hc      -oo     2a ^   dt .  .  [Eq.  6.18]
where t is a dummy variable.
If (x,u) are data points of a skewed distribution,  then u = f(x)  and
the cumulative distribution function is:

                        P(x)  = $ (f(x))	[Eq.  6.19]

from whence:
                    dP(x) - p(x) = 4(f (x))  df(x)  ....  [Eq.  6.20]

                          i        (f(x))2
                    (x)i=72ire"    2     fl(x)
                                                  .  .  .  .[Eq. 6.21]


                               6-14

-------
The variable x is not normally distributed but the function f(x) is
normally distributed.  Theoretically, it is possible to find the
function f (x) which transforms the skewed distribution into a normal
one. (ID

The problem is to find a new representation of u = f(x) which will
result in u being normally distributed.  In general, the function
will be of the type:

                f(x) = g(x) - g  (u)   ......... [Eq. 6.22]

where g(x) does not contain unknown parameters.  The most likely
candidate is:

                           g(x) = log x	[Eq. 6.23]

which has been widely used in transformations of this type.  Chow
writes "It is generally found that hydrologic data of many kinds
are lognormally distributed."(12)  A log-normal distribution is
defined as one in which the logs of the variable are normally
distributed.

Other transformations which change the scale of the variable are
possible.  A few of them are:

                        8l(x) =  (x)n

                        82(x> =  I
                                 x
                        g3(x) =  I
                                x-fa	[Eq. 6.24]
                        g4(x) = log (x+a)

                        g5(x) =  (x+a)n

In general, it is better not to introduce additional parameters so
that the distribution is described fully by the mean and variance.

In this work, six transformations have been selected which give
a range of scale changes in an effort to obtain, by trial, the
transform that normalizes.  The transforms are in two forms:

                        gl(x) =  (x)n	[Eq. 6.25]

where n = 0.25, n = 0.5, and n = 0.75;
and,
                        g4(x) = log (x+a)	[Eq. 6.26]

where a=0, a=0.25, u and d = 0.5y.


                                6-15

-------
The next problem is  to work out a  technique  to determine if the
transformed  data are indeed normally  distributed  and,  if more than
one transform normalizes,  which  is the best. This  is  a problem  in
nonparametric statistics and  involves determining how  well  a set
of data approximates a known  distribution.   The  classical test is
the x^ test  for goodness of  fit.   An  alternate  test, the Kolmogorov
Smirnov test, is said (13) to be more powerful  than the x^  test.
The latter test is used here.

The Kolmogorov-Smirnov test proceeds  by letting  F(x) be the
cumulative distribution function (cdf ) of a  completely specified
theoretical  cdf,  the normal  cdf  in this case.  Let  S (x) be the  cdf
of the sample based upon n observations.   Form the  d?fference:

                   D(x) = max  (F(x) -  Sn(x)) ...... [Eq.  6.27]

where D is the maximum difference between the distributions, which
occurs at  x.  This maximum difference, D(x)  is compared against
tabulated  (14) values for various  levels  of  significance,  For
values of  n  greater than 35,  the  critical value  for level of
significance, a =  0.05,  is given by:
                     d   n  =  1,36/fn   ........  [Eq. 6.28]
                     3

which  is  compared  to D(x)  in terms  of  relative  frequency.  If the
maximum difference in relative  frequencies  is less than d  (n) ,
the conclusion  is  made  that  the data are normal.

If more than one of  the transformations is  shown by the test
to be normal, it has been  assumed that the  one  having  the  smaller
value of D(x) is the "better" transform and should be  used.

6.3.2.3 Selecting  Basis Gages.
A basis gage is one  for which historical data are used to  develop
the parameters for generating synthetic gage data, and the synthetic
gage data of which is used to generate the  streanr flow.  A gage
selected for one use automatically becomes  used for the other.
Where there is the possibility  of selection, i.e. where the water-
shed contains more than five to seven gaging stations, the selection
of basis gages is of importance.  Obviously, where gages in the
watershed are few and the records are short, all available data
should be used and the  problem of selection is non-existent.

The need for selection  of basis gages is most apparent when the
watershed contains more than ten gages.  The programming in this
                                6-16

-------
work limits the number to ten,  A less obvious reason is that a
significant portion of the simulation program length results
from storage of gage parameters and from their computation and use.
The elimination of unneeded gages requires less" machine- storage
and would shorten computation time, both of which may be desired.
Of course, the savings in storage can be' realized only if the
proper DIMENSION statements- ate1 modified' to show the- true number
of gages used.  Gages should be eliminated only if the simulation
program is constrained by limits on machine storage and computation
funds and only if ic can be demonstrated, as described below, that
considerable interdependence exists between gages,

A brief insight tc the method of computing stream flows illustrates
the rationale used in the reduction of the number of basis gages.
The computation of stream flows at reach points is a process of
interpolation and extrapolation of the synthesized gage data.
The assumptions are made that:  (1) the flow at a gaging station
is derived from the watershed upstream with each unit of area
upstream contributing to the flow; and (2) the flow at any reach
point is a linear combination of the gage flows for gages nearest
that reach.  The weight factors in the linear combination are
functions of the watershed areas upstream of the gages and of the
reach points.  A gage located well upstream on a long tributary
leads to a considerable extrapolation of the gage data in com-
putation of stream flows for the mid-reaches of that tributary.
A spring near the gage may result in a flow at the'gage having
little variation which, when extrapolated downstream, would
exhibit a steadiness of flow that is not realistic.  This gage
should not be used as a basis gage when the gage configuration is
such that data of this gage are extensively extrapolated in com-
puting flows in reaches some distance downstream.

With only a few modifications, the routine which develops the
transformation matrix used to compute reach point flows from
gage data can be used to aid in the selection of basis gages.
The process is essentially trial and error and careful thought
and analysis can lead to the proper selection with only a few
trials.  The method involves using the historical data available
for each gage, selecting several gages as basis gages and the
others as "estimate" gages   The routine uses the basis gage
data to compute the iiow at the estimate gage location and then
compares the computed data with historical data for that estimate
gage.  The correlation between the historical data and the estimate
data for a gage indicates the degree of interdependence of the two.  If
                              6-17

-------
 the correlation is high, it can be concluded that the estimate
 gage would provide nearly the same information as the basis  gage
 and therefore that estimate  gage can be eliminated.

 In general,  basis gages should be selected from among those  gages
 having the longest record and the largest upstream area  provided,
 of course, that the likely candidate is not materially affected
 by upstream regulation.

 Computational methods and details of the computer routine  used
 in the selection of basis gages are described in Appendix  A4.3.

 6.3.2.4 Transforming Synthetic Gage Data,
 The stream flow at any reach point in the watershed is a linear
 combination of the generated gage flow data and weighting
 coefficients which are functions of areas upstream of the  gages
 and reach points.  The assumptions made are set forth in the
 sub-section above.  The computation is programmed and the  only
 preparation needed is to determine the upstream areas corres-
 ponding to all reaches and gages.   These reach numbers,  gage
 numbers and areas are inputs to subroutine TRAN which computes
 the transformation matrix,  the elements of which are  the weight
 coefficients.

 The method of  computation for the  five possible gage-reach
 location combinations is set forth in detail  in Appendix A4.5.

 6.3.2.5 Formulating  Parameter Inputs
 There  are  three ways to  handle parameter  and  data inputs to
 the simulation program.   The first, and preferable  way,  is to
 formulate  the relationships  in mathematical terms and  equations
 and  control  their  use  by a set of  programmed  operating rules.
 The  second way is  to enter the relationships  in array  form and
 control  the  selection  of  the appropriate  value  by a set  of
programmed operating rules.   This  second  way  requires more
machine  storage.   The  third  way  is used where  the data inputs
cannot be represented  by programmed relationships,  in which case
 the data are placed  on punched  cards  and  read  in  as required.

Two programs have  been written to  fit mathematical  relation-
 ships to data.  One  program  is  for data which show  periodicity,
while the other fits either  a polynomial  of degree  up to 7 or
 exponentials of the  type:

                       f(x)  = AxB	[Eq.  6.29]

                       f (x)  =  AeBx	[Eq.  6.30]
                              6-18

-------
These programs are described in detail in Appendix A2.

6.3.2e6 Regulating Flows.
Regulation, as referred to :in this work, is the change in natural
stream flow due to the operations 3t man.  Regulation therefore
includes the change in flew caused by increasing or decreasing
the storage in a reservoir or lake, evaporation of water from
the surface of a reservoir or lake, diversion of water out of
the river basin or to another reach not immediately downstream
from the point of regulations irrigation v;ithdrawals from the
river and any other withdrawals or discharges for municipal and
industrial use.

The regulation effects of a reservoir are governed by the operating
rules which translate reservoir or flow conditions into releases.
When the release rules are well defined and inclusive of all
conditions, it is not difficult to program them for simulation.
The principal variable affecting the choice of the appropriate
operating rule is the current elevation of the water surface.
For instance, in a multi-purpose reservoir, if the water surface
elevation is above the lower level of the flood control pool, the
rule may specify both the release of the surplus water and its
rate of release.

To simulate the river system, it is necessary to maintain an
inventory of water stored in each reservoir.  The change in
storage is equal to the volume flowing in, less the volume flowing
out, and less any losses during the time frame.  The change is
added to the total volume stored in the previous time frame to
obtain the new volume.  A change in storage affects the level of
the water surface which, in turn, affects the releases.  The
relationship between volume of water stored and the corresponding
depth must be known.   Ordinarily, this relationship is obtain-
able from the owner or the reservoir and is often furnished
either as a curve or in tabular form.   The relationship should
be converted to a polynomial or exponential form for programming.

An inevitable loss from a reservoir is that due to evaporation.
The magnitude of this loss is a function of the evaporation rate
and the surface area of the reservoir,  For a given reservoir, the
surface area is a function of the volume of water stored and it
is necessary to determine this relationship,  Surface area-depth
curves or tables often are available from the reservoir owner or
can be determined from maps containing water depth information.

                            6-19

-------
The relationship also can be converted to a polynomial or
exponential form.

The evaporation rate is dependent upon the heat budget in the
reservoir and generally is periodic in nature, with an annual
primary frequency.  Often monthly or weekly evaporation rates,
expressed in inches per unit of time, are available from the
reservoir owner, U. S. Geological Survey, Soil Conservation
Service, Forest Service or from local water utilities.  These
data can be fitted by a trigonometric series to obtain the
parameters needed for mathematical expression of the evaporation
rate - time of year relationship.  The program FITCRV (see
Appendix A2) can be used to determine the necessary parameter
values.  Usually, only one, or possibly 2 or 3, harmonics will
be necessary for a good fit of evaporation data.

Diversion of water is another factor in the regulation of stream-
flows.  Diverted water usually is obtained from a reservoir or
impoundment.  The loss to the watershed is accounted for by direct
subtraction of the diverted water from the flow into the reservoir.
It is necessary to obtain data on the demand for diverted water.
These data usually are amenable to fitting by a periodic equation
or, sometimes, by a polynomial.  Long term trends usually can be
represented by a polynomial of low degree which changes the mean
term in the periodic equation each primary period during simulation.

Where water is stored for use in power generation, either for
hydroelectric power or for cooling water in steam plant generation,
there is regulation of the stream flow that must be considered.
The relationship between rate of use and time should be determined
and a mathematical model set up for ease in programming for
simulation.  The variety of possible conditions precludes making
any specific statements or recommendations.

Similarly, withdrawals from the river system for irrigation and
other uses, and/or discharge to the river, are peculiar to a
given system and must be programmed the best way possible.  Consider-
ation should be given to neglecting all except the very significant
changes in flow rate due to withdrawals and discharges.

6.6.3 Preparation for Simulation - Water...Quality
The simulation of water quality in this work is limited to those
parameters having to do with oxygen balance in the stream.  Other
quality parameters, conservative or non-conservative, can be
simulated by the same techniques used here.  Only the mathematical
models describing the interactions need be changed.
                                 6-20

-------
 The oxygen balance in the stream is dependent upon the bio-
 chemical degradation of  waste loads discharged to the stream,
 physical factors,  such as sedimentation of the solid fraction
 of the waste load  and recxygenation to replenish oxygen used,
 and biological factors such as the producticn of oxygen by the
 plant and animal life in the stieam.   Almost every physical,
 biological and chemical  relationship  in the stream is temperature
 dependent.   It therefore is necessary to account for temperature
 and its time dependent variations so  that those factors which
 are significantly  affected by temperature are properly represented.

 6.3.3.1 Temperature
 For many rivers, stream  temperature data are not routinely
 collected in a systematic program,  as are stream flow records.
 For this reason, it  may  be difficult  to find adequate temperature
 records for  streams  in a developing river basin.   Temperature
 data are important to t:he pollution control agencies,  fisheries
 bureaus and  the  electric utilities' stream generating plants and
 therefore these  agencies may be  a source or records.

 Although watei-temperature variability is less  than  that of air,
 there  are many factors which affect water temperature and,  indeed,
 considerable variability has been observed.   It  has  been reported
 (15)  that  considerable variation in stream temperature occurs due
 to  the exposure of the stream to the  sunlight.   Stream sections
 exposed to direct sunlight  several hours  per day  are  heated more
 than those which are  shaded  much of the  day.  Shallow,  fast-
 flowing streams heat  up  more quickly  than slower,  deeper streams
 when the  air  temperature  is  higher than  the  water  and  cool  more
 quickly when  the air  is  cooler than the water.  Reservoirs,
 particularly  those which  stratify, have a considerable moderating
 effect  on river temperatures  and, in  general, tend to  result  in
 cooler  temperatures when  long  term averages  are determined  (16).

 Ideally, a stream quality simulation project would be  provided
 with several years of  temperature records  for several  locations
 in the watershed,  These records  could be  fitted with  time-dependent
 mathematical expressions and  reach-indexed to account  for the
 variation with time and along the stream.  If the temperature
 record is lesser in extent than  this ideal, a combination of
 techniques and assumptions will be needed  to make the best use
 of available data.   The use, tor  instance, of a time frame, or
 averaging interval,  of one week instead of cne day precludes
 refinements to account for variations  having periods of less than
one week.

                                6-21

-------
Ward (16) found that the annual variation in stream temperature
could be described by the simple sine function:

                     T(L) = a sin (bx+c) + T . .  .  .  [Eq. 6.31]

where T(L) is the temperature corresponding to the time angle, b;
a is a constant representing the maximum amplitude of the variation;
c is the phase angle to account for the occurrence of the peak at
time other than bx =• V and T is the mean annual temperature.  Ward
also found that the average annual temperature does not vary
appreciably from year to year and further, the analysis of the
twelve monthly average temperatures yields almost the same equation
as the analysis of the 365 daily temperature' readings.  There are,
however, variations in temperature (16) and these variations can
be simulated by use of the formula:

                      T± - T(L) + aTR±	[Eq. 6.32]

where T. is the estimated temperature in the ith time interval, T(L)
is the temperature for the Ltn week of the year corresponding to
the ith time interval, aT is the standard deviation of the historical
temperature data and R^ is a standard normal random deviate.

If the simple sine curve, [Eq. 6.31], does not adequately represent
the temperature-time relationship in the stream, it may be possible
to fit a periodic curve having several harmonics to the historical
data.  The method is described in Appendix A2  "Curve Fitting
Techniques."  The technique described in Appendix A2 fits periodic
data having a shape which deviates from that of the classical sine
curve.  For instance, using this technique, a mathematical expression
can be developed to fit historical data which  exhibit several months
of constant temperature, say 0°C as would be the case in the north-
ern streams, with otherwise typical variations for the balance of
the year.

An important temperature-dependent factor is the limit of solubility
of atmosphere oxygen in water,  Solubility also is dependent upon
the concentration of dissolved solids  (17).  The solubility of
oxygen decreases slightly with an  increase in  dissolved  solids,  but
this decrease is neglected in  this work,  A mathematical relation-
ship has been developed  for the solubility of  oxygen  in  distilled
water  (18):

    D.O. -  14.652 - 0.41022T + 0.0079910T2 - 0.000077774T3  .  [Eq. 6.33]
                                   6-22

-------
where D=0. is the saturation concentration in mg/1 of dissolved
oxygen at temperature, Ts  in degrees centigrade..   This formula
has been "rcunded off" t~:

     D = 0, = 14.65 - 0-+IT + ChOOST^ - 0-00008T3 ,  .  , [Eq. 6.34]

for computations in :his work

6.3.3.2 Velocity Const^.nts
Two processes operating simultaneously prodace a balance in the
concentration of dissr. I.-ed oxygen when organic pcllutional material
is introduced into a xiver   The decxygenation process uses available
atmospheric oxygen which hds been dissolved in the river water
while the resxygenatien process replenishes this dissolved oxygen
supply from the atmosphere

The deoxygenation ptccess is biochemical in that microscopic
organisms utilize the organic material for their life processes
and in so doing oxygen is used and organic material is stabilized.
The rate at which oxygen is used is dependent upon several factors:
temperature, availability zi the organic material as food for the
organisms, mixing, presence cf tocks upon which growth is localized
and many others=  It is seen that these factors are properties
both of the nature of the organic material and of the stream.  The
rate of deoxygenation is chatacterized by the velocity constant,
K]_, defined as the ratic of oxygen demand satisfied in a unit of
time to the oxygen demand present at the beginning of that time.
The reaqtlon is assumed t: be first crder; that is, the rate of
satisfaction of oxygen demand is proportional tc the remaining
oxygen demand„

The reoxygenation process is physical in that only physical
processes are involved in the solution of oxygen from air at the
water surface and the transport ci this oxygen into the water
volume, ' Henry's Law, "The weight or a given gas that dissolves
in a fixed quantity of a given liquid, at constant temperature,
is found to be directly proportional to the partial pressure
of the gas above the solution"(i9) governs the solution.  As
soon as  the oxygen concentration in the water decreases, oxygen
is obtained from the air, a supply T-hat. is relatively constant.
The oxygen dissolved at the surface is carried into the water by
advection, convection and/or molecular diffusion-  The rate of
reoxygenation therefore must be a function of the rate of solution
and the  rate of transport uf the dissolved gas,  The overall
rate of  reoxygenation is  characterized by its velocity constant,
K2, which is defined as the constant or proportionality in the
relationship:

                    dc * K2  (ce - ct) . ,  .  ,  , . ,  [Eq.  6.35]
                    dt

                              6-23

-------
in which the rate of change in concentration of dissolved oxygen,
dc/dt, at any time, t, is proportional to the degree of under-
saturation, cg - ct, at that time.

The concentration of dissolved oxygen  (DO) in a stream carrying
an organic pollutional loading is dependent on the interaction
of these two processes.  The DO concentration in a river system is
not only dependent upon the amount of organic material and the
amount of water in the stream but also upon the rates which the
oxygen demand is exerted and the oxygen is replenished.  Most
of the mathematical formulations of the oxygen concentration as
a function of time (also distance in a flowing stream) utilize
the velocity constants, K-^ and K^, as parameters.  The exception
are those formulations based upon regression of "cause and effect"
data  (20,21) which require a considerable supply of data.  It is
necessary, thens to determine values of K-^ and Kj to model the
oxygen balance in a river system.

The traditional method for determining K,(22) ^s to determine
the biochemical oxygen demand (BOD) of the waste in the standard
method (23) excepting that several BOD-time pairs are determined
to obtain the BOD-time relationship.  Analyses of relationships
to find the value of K^ can be done in several ways (24 25, 25) ^
There is considerable evidence (27, 28, 29, 30)f however, that
the value of K. determined under quiescent conditions in the
laboratory is not representative of the K^ that would result
in streamflow conditions even if corrected for the temperature
difference.  Quantitative results that allow evaluation of the
factors affecting stream values of K^, however, are not available.
The procedure used in this work is to  evaluate K, in the traditional
manner, i.e. using the BOD bottle technique, and to add an error
term, r, which is described below.

The state of the art of evaluation of K»  is much the same as the
evaluation of K-, <,  The physical nature of reaeration makes the
problem a little more amenable to analysis and there has been
considerable work done recently, hopefully leading to a better
evaluation of K2 (31» 32, 33, 34, 35).  in the latest of these,
Thackston and Krenkel propose  the predictive formula:

              K, - 0.000125 /I +  ( u )1/2\ Se 1//2  . .  [Eq. 6.36]
                                  _— »»
                                  Tgh
                                            0
                                            —
                              6-24

-------
where 5 is the mean velocity, g Is r~he gravitational  constant,
h is the mean depth and SQ is the slope of" the energy grade  line.
Other formulas are of  the general form:

                        K.? - au      0 ,-, c  „  , o  „  o  o [Eq0  6«37]
                             ^

The formula of Langbein and Durum  -  "^ was shown co fit  the  river
and laboratory data of many cf the previous  investigations„  This
formula is:
                                     .  .  o    ,  „  o  .  ,[Eq. 6.38]

Previously, the method used to estimate  K2-was to  determine the
deoxygenation constantr K-j., usually by laboratory methods, and
using this value of K-^, fit a predicted  oxygen sag curve to an
observed sag curve by varying K^ until a satisfactory fit is
obtained.  This method requires a stream survey  to obtain an
observed sag curve,  It would appear, with the advances being
made in estimating F^, a reverse procedure,  i<,e. estimating K,
from an observed sag curve and K^ value, might be more appropriate,

In a system as complex and' variable  as a river,  it can be
expected that other discernible factors  affect the overall
oxygen balance.  Factors which have received attention (36, -*7, 38,39)
are the removal of solid BOD fraction1 from the water of the stream
by sedimentation, the addition of BOD to the water by the bottom
sludges, the removal of BOD by slimes or growth  on rocks and by
rooted plants and the alternate addition and use of DO by aquatic
plants in the photosynthetic process.  It is common practice
to refer to the rate of tern-oval by sedimentation using K~, a
third rate constant.  While there is considerable evidence that
these other factors are present, there have been few data reported
which allow use of the relationships to obtain numerical results.
A few data for a specific liver syscam are presented by Camp (38).

Although the original oxygen balance relationships set forth by
                    /' r* f\ \                        f             *
Streeter and Phelps ^Zz^ considered only deoxygenation by organic
material in solution and suspension and reoxygenation only from
the atmosphere, these investigaturs recognized that other factors
were present.   They chose to include the effects of these other
factors into the overall deoxygenstion and reoxygenation constants.
A similar method recently was proposed by Moreau and
                                 6-25

-------
They write "In lieu of accounting for additional factors individually,
as proposed by Dobbins and others, with attendant difficulties of
parameter estimation, for purposes of this study, it is sufficient
to lump added factors for BOD and DO into  'ignorance* or 'error'
terms that can be described as random variables."  They add a factor
r, called deoxygenation error term, to the general deoxygenation
equation (see section 6.6 below) to get:

                       dL = -K,L + r   .o ........ [Eq. 6.39]
                       dt

where L is the BOD concentration and t is  time.  Similarly, they add
a factor s, called the reoxygenation error term, to the general
oxygen sag (DO deficit) equation to get:

                       dD = I^L - K2D + s  ........ [Eq. 6.40]
                       dt

where D is the DO deficit.  If r and s are considered to be constant
over the integrating time interval, then integration of equations
[6.39] and [6.40] gives, respectively:

                   L = (L  - r_ ) e-K].* + r.  ....... [Eq. 6.41]
                             Kl          Kl

and,

                                                  + De-Kt [Eq. 6.42]
where L is the BOD at time of flow t after the BOD was LQ, D is the
DO deficit at time of flow t after the initial conditions of LQ and
Do and other variables are as previously defined.  These equations
are based upon steady-state, uniform flow and unvarying "constants"
for the integrating time interval and their use describes the river
conditions in a series of discrete steps to approximate continuously
changing (with respect to time and distance) river conditions.

If stream quality survey results are available, it is possible,
using equations [6.41] and [6.42], to determine values of r and s
and find their means and standard deviations.  Then the values of
r and s to be used in equations  [6.41] and [6.42] for predicting
stream conditions would be r and s where:
                                6-26

-------
                            f .- r + arR	[Eq. 6.43]

                            s - I + osR	[Eq. 6.44)

where r and I are observed mean values of r and s, ar and as are the
standard deviations of the observed values of r and s, and R is a
standard normal random deviate.

Mention also should be made of the work of Kothandaraman (41) who con-
sidered KI and K£ to be random variables.  The work of Kothandaraman
and Moreau and Pyatt was extended by Nicolson (42) who presented equa-
tions for expected values and variances for L and D with K^, K^, r and
s considered as random variables.

It is not intended in this work to present an exhaustive and authori-
tative discussion of the evaluation of Kj_, K2 and other factors, with
specific recommendations as to methods to use.  The simulation model
is set up to receive parameter inputs for K, , r and s which must be
estimated or determined by the user for the specific application.  The
values of Ko are computed using the Langbein and Durum formula (Eq. 6.38]
for each reach.  The values of K^ are waste load-indexed while r and s
are reach-indexed.  It is a simple matter to convert K^ to reach-indexed
if desired.

6.3.3.3  Waste Loads.
The quantitative aspects of the water quality simulation are obtained by
placing waste loads on the system.  Waste discharges constitute a signi-
ficant change in the stream conditions and therefore they enter the upper
end of a reach by reason of the fact that reaches are delineated by the
significant changes in the river system.  The assumption is made that
waste discharges become completely mixed at the point of entry to the
stream.

The waste load data needed for-the simulation model are the reach loca-
tion of the discharge, the rate of discharge, and the BOD and DO concen-
tration of the waste.  The reach location is the geographical location
of the waste discharge point in terms of the reach index system described
previously.  Where two or more discharges are made close together and
the stream conditions do not otherwise change enough to warrant division
into reaches, the discharges can be considered to occur at one point.
The rates of discharge are added and the concentrations are adjusted to
their weighted means.

Waste load data usually are computed from predictions of future popula-
tion, from planning reports, and from projections of future activity by
industries.  Typically, the data are extrapolations of recorded data,
or possibly an enthusiastic guess of planners, and are often later proven
to be not very accurate.  One of the beauties of simulation is that

                                 6-27

-------
quickly, and relatively inexpensively, several levels of growth and ex-
pansion can be tried and a feeling for the sensitivity of the resulting
stream conditions to population change can be obtained.

Waste loads are usually variable, having hourly, daily, weekly and
monthly fluctuations, and, because of growth, a long term trend.  The
fluctuations having periods less than the averaging interval, as described
below, need not be considered.  The fluctuations having periods greater
than the averaging interval can be described by fitting a mathematical
equation or by time-indexing the data.  Long term trends usually can be
expressed by a polynomial of low degree or by programming increments to
be added in the appropriate "do loop."

6.3.4  Preparation for Simulation - Time Scale
There are two considerations with respect to time that must be dealt with
in preparing a model for water quality simulation.  First, it must be
decided how the time scale is to be represented during the simulation
run and,secondly, it must be decided how many years of simulation are
needed to obtain the data required to substantiate the decisions that will
be made.

6.3.4.1  Representation of Time Scale
Simulation as a technique for analysis may be either continuous with
respect to time or sequence of events, or it may be step-oriented with
respect to time or sequence of events.  Usually, continuous simulation
complicates the mathematical representation by the necessary inclusion
of the time variable.  The simulation of a continuous system can be
approximated by a series of discrete simulations assuming steady-state
conditions over a time interval.  Naturally, the shorter the time inter-
val, the closer the approximation is to the continuous simulation.  Dig-
ital computers are unable to handle the continuous problem, except as an
approximation using discrete steps with accuracy achieved by taking small
step (time) increments.

River systems are, in the strict sense, continuous and unsteady with
respect to time in all aspects; flow, quality, temperature, biological
life, to name a few.  Because river systems are so complex, mathematical
representations are usually made in terms of steady-state conditions and
changes are considered as step changes.  Such a method is required when
the system is simulated using a digital computer.

The success and usefulness of the simulation of river systems depends
considerably upon the length of the time step selected.  Although a short
time step or averaging interval will more nearly approximate system con-
ditions, it imposes the burden of providing the mathematical model and
data needed to develop such precision.  A short averaging interval also
produces more data to analyze; for example, a weekly averaging  interval


                                 6-28

-------
produces one-seventh as much data as a daily averaging interval.

The selection of the averaging interval should be governed by considera-
tion of what time interval will allow indication of the significant vari-
ations in system response while entailing a minimum of detail.  If the
objective of the simulation -is to determine if the low flow criterion of
the minimum flow for seven consecutive days at a frequency of once in
10 years, as has been adopted by many states (43), is met under the simu-
lated conditions, then there is little to be gained by using an averaging
interval shorter than seven days.  Further, if to make an operations
change in a treatment plant or a regulating structure to obtain reason-
ably steady conditions at the new level of operation requires a lead time
of several days, the averaging interval should be not less than the lead
time required.  Also, shorter averaging intervals require more computer
storage to program and increase the cost of simulation runs,

The computer program set up in this work employs an averaging interval
of one-forty eighth of a year, which is 7.6 days.  A monthly averaging
interval may possibly miss a 7 day period of low flow and attendant crit-
ical conditions, whereas a daily averaging interval would increase the
detail needed for data, the cost of a computer run, the program storage
required, and the amount of output to analyze.  The averaging interval
of 1/48 of a year, rather than 1/52 normally defined as one week, offers
nominal advantages in computing periodic functions and in programming
for the computer.

6.3.4.2  Duration of Simulation
The selection of the length of time for simulation depends upon the use
to which the results are to be put.  Simulation of water quality in a
stream may be time-varying or time-independent when considered from the
standpoint of duration.  If one of the purposes of simulation is to estab-
lish the time when an event will occur, or a change is needed, then it is
necessary to input time-varying data to represent the growth and/or
changes in the system.  If the purpose is to determine the state of the
system at a given time in the future, the inputs will be time-constant
and of the level that are estimated to exist at that time.

The time-varying simulation allows the determination of how time affects
the river system and when changes are needed to maintain water quality
goals.  It is necessary to input waste load data that reflect the increased
discharge rates and organic loadings that occur as a result of population
growth and industrial development.  Anticipated significant changes in
water use and regulation also must be considered.  These changes must be
programmed into the simulation model.  Each simulation run therrvill be
one sample of river conditions for the selected period, probably thirty
to fifty years.  It will be necessary to make ten or more such simulation
runs to obtain the information needed to establish the relationship be-
tween the degree of change and the time when the change should be made.

                                 6-29

-------
If it is desired only to determine the state of the Driver system at
some given future time, the simulation need is much more simple.  The
input data and information must be those estimated ..to, exist at that
future time and therefore it is not necessary, to-pxogram changes into
the simulation run.  In this case, each year of simulation is a sample
of the result,and the conclusion to be drawn as to the state of the sys-
tem at that future time can be obtained by statistical analysis of the
samples.  Thirty or more samples, i.e. years of simulation, would be
appropriate.

6.4  Synthesis of Gage Data
Simulation of water quality in a river system requires that data be avail-
able from which stream flows at all reach points can be determined.  These
data must faithfully represent the stream flows that can be expected to
occur at the times and places encompassed in the simulation.

The lack of adequate stream flow data is one of the major reasons for re-
sorting to simulation for studies in the areas of water regulation and
water quality control.  Methods have been developed to generate or syn-
thesize stream flow data which are statistically identical to the avail-
able recorded flows and are therefore considered, to be estimates obtained
from the population of stream flows.  Further, methods have been developed
to simulate stream flow gage data that are not only serially correlated
for faithful representation of the observed serial correlation at a single
gaging station and cross correlated between stations for faithful represen
tation of basin-wide observed conditions, but also cross and serial cor-
related for faithful representation of basin-wide conditions in multiple
time lags.

The method used in this work is classified as a multivariate Markovian
gage data generator.  The basic method was developed elsewhere, as re-
ported in the literature (44, 45, 46), but has been modified and extended
in this work.

Multivariate indicates that more than one trace of data is generated and
Markovian indicates that the value of each variate at a given time is
dependent upon, or correlated with, the value of that variate in the
first preceding time interval but is independent of any values previous
thereto.  It is assumed that the interval in which serial correlation
occurs is one month, to correspond to the observed natural phenomenon
that serial correlation of daily and weekly average flows exists for
periods of up to one month but are unreliable for longer periods.

The method for synthesizing gage data is described in detail below.  The
programming, inputs and outputs and program coding for the generating
process by digital computer are contained in the Appendix A4.


                                 6-30

-------
It should be understood at the outset that the goal in the generation of
synthetic streamflow data is to develop sequences of data for each stream
gaging station for which historical data are used as a basis.  In this
work a gage, the historical data from which are used to compute the para-
meters for generating flow data, is defined as a "basis gage."  Although
stream flow data at all points along the river system are needed for the
water quality simulation, the first step is to generate the gage data.
The generated gage data are then transformed to stream flow data.

As stated above, the generated gage data are developed so as to be statis-
tically identical to the historical data.  The development in this sec-
tion assumes that the data are normally distributed or that they are
transformed so as to be normally distributed.  See 6.3.2, above.  The
model therefore needs only to preserve the mean and standard deviation
of the historical data in order to preserve the statistical identity.

The historical data are analyzed statistically to determine the mean,
standard deviation, and the multiple-lag correlation coefficients for
each basis gage and for each time period, j; the period being equal to
the averaging interval.

The historical data can be shown in matrix form as:
                                 6-31

-------
X2.1
X48,l   X48,2
                                            . [Eq. 6.45]
                                                   2,m
                                         Year 1
                                                   [48,m
                                  p4-2 ,m
                                         Year K
                                                  the
where p • 48K and m is the number of stations.  The value of y^ 4, tne
mean flow at station i for the jtl1 "week" of the year, is given'by summini
all the elements having a j index in the column corresponding to the itlr
station.  Similarly, the values of Qlt4 and a±ti can be computed,  a^j
is the standard deviation of the data for the  itn station and jtn week
and PIJ is the serial correlation, for station i, between the j"1 week
and, say, the (j-l)st week; i.e., the lag-one serial correlation.

If a single station is considered first, the generating model is the
recursive equation:
                6-32

-------
                                                               [Eq. 6.46]

where the data value, xp+j+i» is generated from the last one generated,
Xp+j .  gj is the regression coefficient for estimating the value of any
j+1 indexed value from the j indexed value, Rj+1 is a standard normal
random deviate, Oj+i is the standard deviation of the j+1 indexed values,
and PJ is the serial correlation coefficient between the jth and (j+l)st
values.  p equals 48 times the number of years of data already generated.
This model preserves the mean, variance and the serial correlation of
the historical data and, because the x's are normally distributed, pro-
vides a complete statistical description of the data.

This single station model, [Eq. 6.46], can be extended to handle multiple
stations and multiple time lags.  In this case, the mean, standard devia-
tion and serial correlations for each station remain the same, but it is
necessary to compute cross correlations between stations and cross-serial
correlations between stations for multiple time lags.  The model becomes
a matrix equation:

                                                                   . 6.47]

where x denotes an mxl matrix, m is the number of stations (variables),
y, a and R are also mid matrices, while £ is a pm x pm matrix, p is the
number of lag periods considered, and p_ is also a pm x pm matrix.

Note that the order of the sjquare matrices for 8 and p is (pm x pm) ,
where p equals the number of lag periods and m is the number of stations.
It makes no difference in the development of the correlation matrix
whether the correlations are cross (between stations) or serial (between
different time lags for the same station).  That is, it is immaterial
whether the a-j^ element, for instance, in the correlation matrix is the
correlation between the station 1 - station 3 data at zero time lag or
is the correlation between station 3, time t data and station .1, time t-2
data.  Thus pm = n equals the number of variates under consideration.
In this work, the number of lag periods is taken as four, corresponding
to the assumption that weekly average flows exhibit dependence upon pre-
ceding flows for one month.

The correlation matrix is then  (n x n) and is of the form shown below
for three gaging stations and four weekly lag intervals:
                                 6-33

-------
              Station 1                 Station 2                Station 3
         lag 0 lag 1 lag 2 lag  3   lag  0  lag 1 lag 2 lag 3  lag 0 lag 1 lag 2  lag  3



  lag 0   au   a12   a13   a14    a15   a16   a17   a18    a19  ano  am   a112



o lag 1   a21   a22   a23   a24    a'
                                   25
    2   a31   a32   a33   a34



lag 3   a     a     a     a
N lag 0   a51   a52




o lag 1   a61 * * *


3     o

      2   a
                                                                                      [E<1'

         71 ' ' '
            ...
  lag 3   a81







  lag 0   aq-i . . .
CO



.olag 1   aioi' • •




4-1 lag 2   a-i 11. . .                                                              .
{/J          J»i X

                                                                                 •


  lag 3   al21* * '                                                     ... ^1212

-------
The element 334, for example, is the correlation between the flow at sta-
tion 1, lag 2, and station 1, lag 3, and is equal to a^3, while a25 » a52
is the correlation between station 2, time t, and station 1, time t-1.

The elements in the correlation matrix are computed by the equation:

                            l" = ~; r*:7!.-.-	[Eq. 6.49]
where x and y are deviations from the mean and r is the correlation coef-
ficient.

If the cross correlation coefficients are all equal to zero, indicating
that the gage data for each station and time are independent of the data
for every other station and time, the problem reverts to a series of
single station models.  It is highly unlikely that the cross correlations
will be zero, so a multivariate process is needed to handle the cross
correlations.

The basis for the following development is contained in textbooks on
multivariate statistical analysis (47).  Consider, in vector notation,
the random vector X which can be partitioned into two sets:
                              and     X(2)  = fX,._J   	[Eq. 6.50]



                        Xq                   [Xp

where:                        X ™|x* M.  .  . .  .
                                  |y(2) I
                                  L   J

Assume the p variables have a joint normal  distribution with means:

                E [X(1)] = y(1) and E [X<2)] =  y(2)	[Eq. 6.52]

and covariances:

                                            = Sn	[Eq. 6.53]

                                            = S22	[Eq. 6.54]

                                            - S12  - S2l  -  •  •  •

The mean vector has been partitioned into:
 and the covariance matrix has been partitioned  into:

                                  6-35

-------
                                                               [Eq. 6.57]
                               S21
 Note  that if Xw and X^' are independent, S12 = S21 - 0.

 Reference (47) continues, developing expressions for the joint density,
 fCx^1', x^2'), and the marginal density of x'v at-jp2' and from these
 an expression for the conditional density, f (x^'|x'2').  By reason that
 conditional distributions derived from joint normal distributions are
 normal, the density f(x(l)|x(2)) is normal and consists of q variates.
 Further, this conditional density has a mean:
               E[XU>jx<2>] - VM+S12S22-KxW- y(2)) .... [Eq, 6.58]

and the covariance matrix is:
                                                               [Eq. 6.59]
The matrix S^2S22   is the matrix of regression coefficents of x' on
x(2).  The vector [Eq. 6.58]  is called the regression function.  Note
that the first two terms of the generating model are the regression
function where:

                           BJ - S12S22   ...........
is the regression coefficient.

For simplicity, consider only two variates and the conditional distribu-
tion of X^, given X2 - X£-   In this case, Sjj - a^2, S22 = 
-------
R, preserves the variance of the historical data in the generated data,
as described below.
The covariance matrix:
                             su-s22  s21
              [Eq. 6.63]
is a  (q x q) symmetric matrix having real elements.  These properties
in a matrix assure real, positive eigenvalues, orthogonal eigenvectors
corresponding to the eigenvalues, and that the matrix can be diagonalized.
Further, the elements of the diagonal matrix are the eigenvalues (48).

The characteristic values of the covariance matrix are principal com-
ponents which are linear combinations of random variables having special
properties in terms of variances (49) .  Anderson (49) proves that a
q-component random vector, X.» having E[X] =0 and E[XX'] = S_, has an
orthogonal linear transformation:
                               U - BX  .  .  ,  ,

such that the covariance matrix of tJ is E[UU']

                            AI o o . .  .0
              [Eq. 6.64]
V where:
                        V
                            0  \2 0. . . 0
                            00.  . . X
                                         qJ
                                                               [Eq. 6.65]
where, further, X-,>X_>A_> • . .>X >0 are the roots of the correlation
matrix, S^.  Further, the rc^ component of tJ has the maximum variance
of all normalized linear combinations uncorrelated with Uj... Ur_i.  This
is to say that the variance associated with the rfc^ eigenvalue is greater
than that associated with any smaller eigenvalue.

Further, Anderson (49) shows that "The generalized variance of the vec-
tor of principal components is the generalized variance of the original
vector, and the sum of the variances of the principal components is the
sum of the variances of the original variates."  Thus, the principal
component analysis of the original covariance matrix preserves the vari-
ance of the historical data in the generated data.

The principal components are linear transforms of the original covari-
ance matrix elements and are orthogonal - that is, independent.  They
are essentially correlations between fictitious stations each of which
is unaffected by all others.  Thus, all cross correlations equal zero
and all correlations may be represented by serial correlation using the
                                 6-37

-------
 single station model,  [Eq. 6.46].  After these independent correlations
 are made,  the linear transformation is inverted and the resulting matrix
 elements are used appropriately to generate synthetic data by [Eq. 6.47],

 In the programming (see Appendix A4.4), the regression coefficients are
 designated B± and the variance coefficients are designated C^.  It is
 interesting to note that in test simulations using the Farmington River
 gage data approximately one-third of the values of Ci, corresponding to
 the smaller eigenvalues, are zero within the limits of accuracy carried.
 This indicates that the variance in the historical data is all accounted
 for by  only part of the coefficients and that there is, in fact, a mea-
 sure of dependence in the data.

 Values  of Bi and C^ are determined for each week of the year.  These
 values apply only to the gage pattern corresponding to the basis gages
 used in their development and a change in basis gages requires recompu-
 tation of the B^ and C^.  The program is set up to output the B^ and C^
 on magnetic tape so that in subsequent runs using the same basis gages,
 it will not be necessary to generate them again.

 The  multivariate generating equation [6.47] can be rewritten in the
 form:

 Qt,l " Ar.i + ^ j^ j£x BT-j,i(Qt-j,i-AT-j,i) + RtCT-j.i  • •  [Eq. 6.66]

 where:

 Qt  1 * the generated flow for the current week, t, for gage i,
       t - 1 ... 48 N, where N « the number of years of generation.

 AT i " the deterministic component for gage i for the Tth week of the
   '    year, corresponding to week of the year of t.

 BT_4 £ » the regression coefficient which relates the current gage flow
         being generated to the gage flows for other gages and times
         previously generated, j - 1,2,3,4 corresponding to the multiple
         lags.

 IL « a standard normal random deviate, t, is the time frame after start
     of generation.

 CT_4 ^ » the coefficient which relates the variance of the generated
         data to the historical data.

 T -  the week of year corresponding to t, T - 1,...» 48, and

n «  the number of basis gages.

                                 6-38

-------
This form more nearly describes the manner in which the data are
generated by the program algorithm.

The values of AT ^ are periodic in nature with an assumed principal
period of one year.  They are determined by a least squares fit of the
historical data by a Fourier series of six harmonics.  The program FLASH
computes the AT ^, BT_. ^, CT_. ^ and generates the gage data.  The pro-
gram and its use are described in Appendix A4.4.

6.5  Simulation of Regulated Flow
In the previous section, the method for generating synthetic gage data
was described.  Simulation of stream flow at any point in the river system
requires that these gage data be transformed into stream flow data and
then account for any flow regulation resulting from the withdrawals, dis-
charges and changes in storage in the river system.

The transformation of gage data to streamflow data at any reach point is
based upon the assumptions that:  (1) the rate of flow at any point in
the river system is proportional to the area of the total watershed up-
stream of that point, and (2) the rate of flow at any point in the river
system is a linear combination of the gage flows of the nearest upstream
and downstream gages only.  Having obtained the watershed areas upstream
of all basis gages and reach points, knowing the location of the gages
with respect to the reach points and applying the above assumptions, it
is a simple matter to compute the weight factors needed to make the
transformation.

For example, if reach point 0 has an upstream area of DAO and it is
desired to compute 00, the flow at reach point 0, find the nearest gages
upstream and downstream from point 0.  If the nearest upstream gage is
S2 and the nearest downstream gage is Si having areas DAS2 and DAS1, and
flows QS2 and QS1, respectively, then:

                      00       QS1   .     QS2
                      DAO = al DAS1 + "2  DAS2	[Eq. 6.67]

where c^ and &2 are functions of the areas upstream of 0, SI and S2.

In this case:

                                DAO-DAS2        	[E   6§68]
                           al   DAS1-DAS2                       H

                           a, = DAS1-DAO     	[E   6.69]
                            2   DAS1-DAS2                       4

where c^ and a2 are factors of a linear interpolation of the area up-
stream of point 0 between the upstream areas of Si and S2.

                                 6-39

-------
The weight factors are given by:
             wt(.
                                     DAO  DAO-DAS2
                                        /DAO-DAS2 \
                                        \DAS1-DAS2J
                                     DAS1|DAS1-DAS2|	[Eq. 6.70]

             wt(  2) = Q°  » a DAP  _DAO /DASl-DAO \
                       QS2    2DAS2"~DAS2|DAS1-DAS2|	[Eq. 6.71]

 Thus:

                    QO = wt(.,l)QSl + wt(.,2)QS2	[Eq. 6.72]

 There  are five possible combinations of gage-reach point locations and
 therefore there are five different formulas for computing the weight fac-
 tors.  These are described in detail in Appendix A4.3.

 The program coding is arranged so that given only the various reach
 indices, the corresponding upstream areas, and the gage locations by
 reach  index and their upstream areas, the weight factors are computed for
 all basis gages for all reaches and are placed in a matrix format.  Then,
 for a  given set of generated gage flows set up in vector form, the unreg-
 ulated streamflows at all reach points are computed by matrix multipli-
 cation.  The unregulated flows then are corrected for regulation to ob-
 tain simulated stream flows in each reach.

 Regulation of stream flows, in the context used in this work, includes
 any man-made changes in the flow and any changes that result in the water
 mass balance due to man's activities.  An example of the latter is the
 water  lost to evaporation from a man-made reservoir.

 There  is nothing profound about accounting for the changes in flow due
 to regulation.  The manner of regulation in each reach must be determined
 from a study of the watershed and any proposed plans for regulation.  The
 regulation is programmed, in mathematical terms if possible, for computer
 simulation.  The regulation in each reach and each time frame is computed
 The regulated flow in any reach is assumed to be the unregulated flow in
 that reach plus the sum of the regulations upstream of that reach.  If
 the time of flow in the river system is greater than the time averaging
 interval, it will be necessary to program the regulations to account for
 the difference in time.   However, in a river system of such magnitude
 that the time of flow is  greater than the averaging interval, it may be
 proper to consider two or more regions or possibly consider neglecting
 all except the major regulation effects.  Appendix A4.5 contains typical
 reservoir operating rules programmed for simulation.

 6.6  Simulation of Water  Quality
The water quality considerations in this work are limited to oxygen
balance relationships. As described briefly above, the oxygen balance

                                 6-40

-------
equations . formulated by Streeter and Phelps (22), modified by the deoxy-
genation error term, r, and reoxygenation error term, s, as proposed by
Moreau and Pyatt (40) ,  are the basis for the water quality simulation
model.  Two reach situations are modelled, one for the normal flowing
river, and the other for a reservoir or impoundment.  In the latter, it
is assumed that the reservoir contents are completely mixed.

Although there have been a few studies and surveys made on water quality
in reservoirs (49,  50,  51), no one yet (1969) has developed a satisfactory
methodology for considering the fate of BOD in a reservoir and its effect
on the DO concentration in the reservoir and effluent.  This is probably
due to the considerable variability of reservoirs and the considerable
variability, with time, of conditions in a given reservoir.  Fortunately,
the majority of reservoirs are built in the upper reaches of the streams
and on tributaries  at locations upstream of significant BOD loads and
the problem therefore may not arise.  However, formulas are developed in
6.6.2, below, for complete mixing in reservoirs.

6.6.1  Flowing^ Streams^
The basic deoxygenation equation developed by Streeter and Phelps (22)
is:

                             dk = -KiL    ........... [Eq. 6.73]
                             dt

in which the time rate of change of BOD,   -, is proportional to the
remaining BOD, L.  As described previously, K]^ is the proportionality
constant.  Because of the variability of K19 an error factor, r, is
added to give:

                           4L = -KjL + r    ..........  [Eq. 6.74]


To solve the differential equation,  [Eq. 6.74], make a Laplace  trans-
formation and manipulate algebraically in the following steps :
                       sL(s)-L(o) = -K^Ks) + r
                                              "S"
                        L(s) [s+K  ] - f + L(o)

 to obtain:
                                        r     r  _,_  L(oJ
                                          ~ -    +        *  '  '
 Noting that  L(o) = La, the initial BOD, and making  the  inverse  trans-
 formation :

                                 6-41

-------
                                              e"Klt
 and rearranging:
                     L(t) - (La-e'Kl* +   -  ........ [Eq. 6.76]
L(t) is the BOD t days after the initial BOD was La, and Kj^is the deoxy-
genation velocity constant.

The dissolved oxygen deficit equation, also developed by Streeter and
Phelps (22) is:

                            |P- - K-jL - K2D   ......... [Eq. 6.77]


or the time-rate change of the dissolved oxygen deficit is the sum of
the deoxygenation and reoxygenation rates.  K2 is the reoxygenation
velocity constant and D is the dissolved oxygen deficit.  If the reoxy-
genation "error" term, s, (40) is added, equation [6.77] becomes:

                         |P- » KXL - K2D + s  ......... [Eq. 6.78]


Let p « s, the reoxygenation "error" term, so as not to confuse the con-
ventional s used for the transformed variable, and make the Laplace
transformation to solve the equation:
                 sD(s) - D(o) = KxL(s) - K2D(s)

                   D(s)(s-HC2) • K-^s) + D(o) +
Substitute the value for L(s)  given by [Eq. 6.75]  and note that D(o) =


                                                                  . 6.79]
V
Using the partial fraction expansion, combining terms and making the
inverse transformation gives:
                + Dae'K2t  ..................  [Eq. 6.80]

Equation [6.80] is the equation for the dissolved oxygen, D, at  time  t
after the BOD was La and the DO deficit was Da.

                                 6-42

-------
The critical deficit, defined as the maximum DO deficit  (that  is, where
the' DO in the stream is minimum) is of major interest  in water quality
studies.  The critical deficit is found by taking  the  derivative of
equation [6.80] with respect to t, equating this derivative  to zero  and
solving for t » tc:
       dt         K2-Ki   Ka-

                     + (r+s)e"K2t - DaK2 e"K2t    .......  [Eq.  6.81]

Set dD(t) _ o  and divide by    /K]La       r  )  _K, t   to 8et:
     dt   "                   *        ~ K-K
                         V a  2      If  Tl  4- fr+o\e>   L
                         IS.O6  *•      t*.i)U  T ViTS^e              re1*.  £ QOl
                0 - -1 + —	 - 	—	^-  '  '  [E1'  6'82]
                             ir*.    v IV T          I  —K - t
                           K_—K-i t    K-t I Kn ii_     _.  \_  1"
                          1®          I      —      I
                                      \Kn~K-i  Ko~Kn I



which, when rearranged, gives:

               e(K2-K!)t  a ^2 _ [K2Da-(r+s)]  (K2-KX)  ....  [Eq.  6.83]
Take the logarithm of both sides and divide  through by (K2-K1)  to get:

                     ,       /K2    [K2Da-(r+s)](K2-K1)\   .  .    rEq.  6.84]
              ^  ^        1 T^ I  - •••   "            "   ' - -. _1         »  *      *
               C   K2"K1     1^1
                                               ^2-Kl> \ .... [Eq. 6.!
                                               -r)     J.
If t  is evaluated and  substituted for t in equation [6.80], the resulting
D • 6C, the critical  deficit.

Note  that  in  the  event  KI = K2,  equations [6.80] and [6.84] become indet-
erminate.  In this case,  the integrated form of equation [6.78] becomes:
            D(t)  =  [Kl(La-£->t + Da +  Eae!  -    .  . . . [Eq. 6.85]


 Further,  the  critical condition, obtained in the manner above, is given
 by:

                                          r+s _ ....... [Eq. 6.86]
 Again,  substitution of tc for t in equation [6.85] gives Dc, the critical
 deficit, for the condition when K^ = K2-
                                  6-43

-------
A principal use of the simulation model is to determine where and when
there is a violation of a stream standard minimum DO level.  The model
computes the DO deficit at the upstream and downstream ends of each
reach and checks to determine if a maximum, or critical point, occurred
within the reach.  It then selects the maximum value of the three DO
deficit values; that is, at the upper end of the reach, the lower end
of the reach or at a critical point in the reach (if one exists) and
subtracts it from the DO saturation value to obtain the minimum DO con-
centration in the reach.  This minimum value is checked against the
minimum standard and if the value is less than the standard, the program
indicates a violation, giving the minimum DO value and the reach and
week in which it occurred.

The assumption is made that there is complete and instantaneous mixing
at the reach points.  Where a BOD load is discharged, at the upper end
of a reach, the La, or initial BOD in the reach is given by:
                            n BODOUTi x Qi +
             La - BOD±n - ^ - - - —   . . . [Eq. 6.87]

                                     £  Qi + Qw
                                    i-1

where BODin is the BOD concentration at the upstream end- of the reach
of interest, BODOUT1 is the BOD concentration at the downstream end of
the reach (es) immediately upstream, Qi is the rate of flow of the
reach (es) immediately upstream, BODW is the BOD concentration of the
waste discharging at the upstream end of the reach of interest, and Qw
is the corresponding rate of waste discharge, and n is the number of
tributaries at the upstream end of the reach.  Similarly, the value of
D  is obtained for the initial DO deficit in the reach.
 a

The assumption also is made that the K! value of the mixed waste and
streamflow is obtained by the formula:
                             — -    .......  [Eq. 6.88]
                              tn
                              2  QL + QW
                             L-l

where K,R is the deoxygenation velocity constant  in  the  reach of interest,
K,T  is the velocity  constant in the reach(es)  immediately upstream, QL
is  the corresponding rate  of flow, KX and Q   are  the velocity constants
and discharge rate of the  waste, and m is the number of  tributaries
immediately upstream which have received BOD  loads upstream.  Note  that
If  an upstream  reach is  not subject to an upstream waste loading, its
value of K-. is zero and the 0* in the denominator applies  only to  those
branches immediately upstream that are subject to upstream  waste loading.

                                 6-44

-------
The simulation model starts at the upstream-most reach and progresses
downstream computing the simulated water quality data for one time
frame.   The time is then incremented one time interval and the process
of computing the data is repeated.  The number of years of data to be
simulated is a program input parameter.

6.6.2  Reservoirs.
As indicated previously, the assumption is made that the contents of a
reservoir are completely mixed at all times.  The program maintains a
mass balance between the BOD and DO deficits in the incoming flows and
the outgoing releases and diversions.

The rate of flow into the reservoir, Qin» is given by:

                       QIN = I QREG(K) - QVAP	[Eq. 6.89]
                             K
where QREG is the regulated flow in the reach discharging into  the reser-
voir and QVAP is the loss in the reservoir due to evaporation.  K is the
number of branches of the system immediately upstream discharging into
the reservoir.  The rate of flow out of the reservoir is:

                         Qout • RREL + DIV   	[Eq. 6.90]

where RREL is the rate of release and DIV is the rate of diversion from
the reservoir.

Let y(t) be the BOD concentration in the reservoir at time  t.   Let Yln
be the concentration of BOD entering the reservoir, computed by equation
 [6.87].  The differential equation for the rate of change of BOD con-
centration in the reservoir is:
                                                                   .  6.91]
 The factor K3 is included  to account  for  the  loss  in BOD in the reser-
 voir contents due to settling  to  the  bottom of  the reservoir of solid
 matter having BOD.  K3 is  assumed to  vary linearly with the storage vol-
 ume.
 Equation  [6.91] can be solved for Y(t)  as  follows.   Let Z = *y- and
 ur a Q°ut,  The Laplace transform of  [Eq. 6.91]  is:

            sY(s) - Yo =  -KiY(s) + ZYin -  WY(s)-K3Y(s)  ....  [Eq. 6.92]
                                     s

 which  leads to:


                                 6-45

-------
                     Y(s)[s-HC1+W+K3J = Yo +    n     ......  [Eq. 6.93]
                                             5   «

                          A - Kx + W + K3   ..........  [Eq. 6.94]

 which when substituted into equation [6.93] gives:
Expanding by partial fractions gives:

                    Y(s) -
The Inverse transformation of equation  [6.96] gives:

                              ~AT
                    Y(t) = Yoe
                                     A
Yo is the BOD concentration at t=o and T is the time since t-o.  The
value of Y(t) is the concentration of BOD in the reservoir at time t.

The average outflow BOD concentration, Y is computed by:

                                  /T
                                  n Y(t)dt   .........  [Eq. 6.98]
                                  °

This integral equation is also solved by using Laplace transformation as
follows :
                                -Y(8)   ..........  [Eq. 6.99]

Substitute the value shown above for Y(s) from equation  [6.96]  to get:

                  Y(s) -  Yo/t  + ZYin/AT _ ZYin/AT
                         s(s±A)      s2      s(s+A)  .

Using partial fraction expansion and taking the inverse  transformation
gives :

                   Y - JL(Yo-ZXin) (l-e~AT) + ZYin  ......  [Eq. 6.100]
                       AT     A               A

Y is the average BOD concentration in the water leaving  the reservoir
during the time interval from 0 to T.

The dissolved oxygen deficit, C, in the reservoir and the average DO
deficit, C, in the water leaving the reservoir are similarly computed.

                                 6-46

-------
The differential equation for the time-rate of change of C is:


                 ^- = -K2C + Cin
Gin, the incoming dissolved oxygen deficit, is constant over the aver-
aging interval.   Making the Laplace transform of equation  [6.101] gives:


             sC(s) - Co = K2C(s) + zcin _ WC(a) + Kiy(s) .  . . [Eq.. 6.102]
                                    s


Let                          B = K2 + W   ..........  [Eq. 6.103]


and substituting into equation [6.102] gives:
                    C(s)
                                  ZCin
                             _
                           s+B   s(s+B)    s+B


Substitute y(s) from equation [6.96] to get:


        C(s) = _Co + ZCin/B _ ZCin/B +    YoKl    - K]ZYin/A
               s+B      s       s+B    (s+A)(s+B)    s(s+B)

                         _  KlZYin/A    ...........      6

                           (s+A) (s+B)


Expand, using partial fractions, take the inverse Laplace  transform and
combine terms to obtain:
                         + Z   (Cin +  l)  .........  [Eq.  6,106]
                           B           A   •


 C(t) is the DO deficit concentration at time t  given  a  deficit  of  Co  and
 BOD of Yo at t=0 and Cin and Yin the incoming deficit and  BOD,  respec-
 tively .

 The average deficit concentration in the  reservoir is:
                          c -
                              TJo
 This  integral equation  can be  solved  using Laplace transforms as follows:


                                  6-47

-------
                           C(s) »-L c(s)	[Eq. 6.108]


 which when the fully expanded value for C(s) from above is substituted
 gives:


   C(s) = 'if  Co   + ZCin/B _ ZCin/B + K1Y<> + K1Y° + KjZYin _ K-^Yin
          T[S(S-H*)     s2     s(s+B)   B-A    A-B      AB       AB
                                       s(s+A) s(s+B)    s2     s(s+B)

                           KjZYin   l^ZYin \
                         - A(B-A) + A(B-A) I	[Eq. 6.109]
                           s(s+A)   s(s+B) /

Making a partial fraction expansion and taking the inverse Laplace trans-
form  leads to:
                                                              [Eq. 6.110]
C is the average DO deficit in waters leaving the reservoir in the inter-
val encompassed by t=0 to t-T.

In the simulation, when the sequential computation of water quality data
encounters a reservoir, the program switches to the subroutine EQUAL
which computes the average BOD concentration, Y, and the average DO
deficit concentration, C, in the waters leaving the reservoir.  These
values become the corresponding incoming values for the next downstream
reach .

The factor Ko, sedimentation constant, has been included in this develop-
ment as a means to account for any storage-related phenomenon that may
be found to affect the basic oxygen balance relationships.  It could
account for, as inferred above, the settlement of a portion of the solid
fraction of the BOD to the bottom and the subsequent satisfaction of a
part of that BOD without drawing from the DO resources in the reservoir.
It is suspected, without substantiating information, that K^ is of small
magnitude and for preliminary simulation runs, at least, K3 should be
set equal to zero.

6.7  Sensitivity of Variables.
When the simulation model is complete, it would be of advantage to have
a means to determine the relative importance of the variables that have

                                 6-48

-------
been included.  If a small change in one of the variables makes a.
significant change in the simulated conditions, it may be necessary to
be thorough and painstaking in determining the parameter or initial value
of that variable.  On the other hand, if a small, or even large, change
in another variable results in little change in the result, its effect
may be such that little effort and expense need be allotted to its evalu-
ation.  It may be found that the variable could be replaced by a constant
or even could be eliminated.  A sensitivity analysis affords the oppor-
tunity to look back at the model that has been assembled to learn of
its characteristics and of the relative importance of its components.

Intuitively, the sensitivity of a system to a variable of the system is
the change in the system caused by a small change in the value of the
variable.  If change is defined as the ratio of the differential varia-
tion of the function to the function itself, the change becomes dimen-
sionless (52).  The sensitivity function is defined as:
               F (k)
              s     = change in system response. F(k)    . .  .  [Eq. 6.111]
               k           change in parameter, k

and in the dimensionless form:
                               dF(k)/F(k)    .........  [Eq. 6
                          k.      dk/k

 If the change in the system response for a  single  system variable  is
 considered, the problem is two-dimensional  and  the sensitivity is  the
 slope of the system function with respect to the variable.   If the sys-
 tem response to changes in two system variables is considered, the sys-
 ten function becomes a response surface.  Although more  than three
 dimensions are difficult  to visualize,  this concept may  be  extended  in
 a mathematical sense to n dimensions, or n  variables  of  a system.

 In classical mathematics, the sensitivity of a  function  to  a variable
 is given by the partial derivative  of the function with  respecc&fco the
 variable.  Consider for simplicity, a function  y = f(x,y) of two varia-
 bles.  If it is desired to find the sensitivity of y  with respect  to x,
 assign a fixed value to y , i.e. , y  = yo.  The resulting:
y
                               =  f(x,  y) ...........  [Eq.  6.113]
                                       o
 is a function  of a  single variable,  x.   Equation [6.113]  is the equation
 of the  intersection of  the  surface of  y  = f(x,y) and the plane y - y0.
 The rate of  change  of y at  (xo,  yo)  is given by:

                du_|     =  nm f(x0+h,y0) -  f(x0.y0)  .... [Eq. 6.114]
                dx  | x=x0   h->0          H


                                  6-49

-------
 extending  to n variables:

                         v - g(x1,x2,...xn)   	 [Eq. 6.115]

 the  rate of change of v for a small change in one of the independent
 variables, xi§ is given by:

      3V  _ 1 J__  ff iJT'm "V-*     V  -^ Vl    V \ — «• ^-V      V     w \
      v  ™ Aim  »*-Al»A2 *   'Ai   "»*'>xn^   8vx1>•*•>*4 >* * *xn'
      ^^^         ^	~	
      3xi  -b>0                        H"~"

                                              	 [Eq. 6.116]

 In this case, the system response is v and the changing parameter is Xj.

 In the case of unconstrained optimum conditions, •$^r » 0, so for smooth
functions in the immediate vicinity of the optimum  point, v is insensi-
tive to small changes in x^.  For the constrained optimum case, it can
be shown (53) that:
                                 " -*i  ........... [Eq. 6.117]
where A., sometimes called the sensitivity coefficient, is the
Lagrangian multiplier.  The value of -\± at the constrained optimal
condition is the sensitivity of the function v to small changes in the
variable x^  It can be shown (54) that the Lagrangian multipliers and
the dual variables in a linear programming problem are identical and
both then provide a measure of the sensitivity of a variable to the ob-
jective function of a linear optimization problem.

If the independent variables in the relationship:

                        v • g(xlfX2,...,xn) ......... [Eq. 6.115]

are random, then v is a random variable.  The sensitivity of v to change
in one of the x^ can be approximated by determining that portion of the
total variance of v that is attributable to x^.  Beginning with:

                              Y - g(x)  ........... [Eq. 6.118]

the expected value of Y is:
                              f
                              J
                             J
                      E[Y] -  /    g(x) f(x) dx	[Eq. 6.119]
                             J —CO


where f(x) is the density function of x.  If g(x) is difficult to evalu-

                                 6-50

-------
ate (55),  expand [Eq. 6.118]  in a Taylor's Series about  point  a:

          Y - g(x)|   - g(a) + 8
                   a              i:           2i
or,                          oo
Now let a = y, the mean of g(x), and substitute into Eq.  [6.121] :
                      g(x) =  I  gOQCx-y)    .......  [Eq.  6.122]
                             i-0      i!

Write the first three terms of Eq, [6.122]:

               g(x)  = g(u) + g'(vO(x-y) + g"(y)(x-y)2  ....  [Eq.  6.123]
                                              2

Taking the expected  values of each term:

           E[g(x)]  = g(y)  +g'(y)E[x-y] + g"(y)E[(x-y)2].  .  .  [Eq.  6.124]

But, E[x-y]  = 0 and  E[x-y]2 • V(x) , the variance of x, so  that:

                   E[g(x)] - g(y) + 1/2 gtt(y)V(x)  ......  [Eq.  6.125]

To find the approximate variance of Y = g(x), expand Eq.  [6.122]  in a
Taylor's Series of  two terms and take the variance of both sides:

                       Y £ g(y) + g'(y)(x-y)  ........  [Eq.  6.126]

                    V(Y) = 0 + [g'(y)] E[(x-y)2]   ......  [Eq.  6.127]

or:                     V(Y) - [g'(v)]2V(x)  .........  [Eq.  6.128]

This development can be expanded for functions of several  variables (55) .
The approximate mean is given by :

E[v] - g(yXl,yx2,...yxn) + I/2{z ^ + - • -% xh2] .....  [Eq.  6.129]
and the approximate variance is given by:
            V[v]  »-^-a-ax 9- + 1^-0-2 + ... +JL-S-0-   2  .  .  .  [Eq.  6.130]
                   3x^ xl    3x22  2          9xn2  n
                                 6-51

-------
 From equation [6.130] it is possible to obtain the relation needed, that
 is, 3g/3x., the rate of change of the function g with respect to x^.
 The partial derivatives in equation [6.130] are evaluated using nominal
 values of the variables and thfe total variance is computed.  The sensi-
 tivity of each variable is obtained by taking each right hand factor
 one at a time, for variable x  for instance, and setting up the relation:
                                                              [Eq. 6.131]
Both V[v] and ax ^ are known and equation [6.131] can be solved for
the sensitivity of the function g to change in variable x^.           k

When the analysis of a system is carried out by simulation methods, the
method for determining the sensitivity of the system to changes in a
variable depends upon the nature of the variable.  If the variable is
deterministic, having a nominal or assigned value, sensitivity is
determined by making two simulation runs and comparing the results.  In
one run, the nominal value of the variable of interest is used.  The
second run is exactly the same as the first excepting that a small
change is made in the variable of interest.  The sensitivity is computed
using a modified form of equation [6.104]:


                         sF(k)
where AF(k) and Ak indicate the observed function change and directed
variable change, respectively.

If the variable is random, its sensitivity is determined using equation
[6.131].  In this case, the simulation is made and the data so obtained
are analyzed for the total variance, V[v] in equation [6.131], and the
variance of each variable, cx2.  Then 9g  is obtained.
An unsophisticated way to approximate the sensitivity of a random vari-
able is to make a simulation run for each variable parameter in the
system.  Each run is made allowing the variable of interest to vary as
usual but assigning to all other random variables their expected value.
The sensitivity is then computed using equation, [6-132] .  A run using  the
nominal values of the variables gives the value F(k) and k is known.
The change made is Ak and the  simulation produces AF(k).


6.8  Transfer Functions.
The water quality simulation model can be used to develop a cause and
effect relationship between waste loads and downstream water quality

                                 6-52

-------
that,  in turn,  can be used to estimate or predict the effect of a waste
load,  or set of waste loads, on the downstream reaches.  The idea is
obtained from the field of systems engineering (56).

The river,  between a point of waste discharge and a downstream point,
is considered to be a system.  A system is any mechanism that trans-
forms  an input  variable into an output variable according to the system
function.   A waste load, the input variable, enters the river, the sys-
tem, which  operates on the waste load to transform it into a water
quality condition, the output variable.  In this case, the system func-
tion could  be represented by the Streeter-Phelps equations (22).  The
upstream BOD and DO deficit concentrations La and Da, respectively, are
transformed into downstream BOD and DO deficit concentrations, L and
D according to  the relationships:
and,
                            L - Lae Klt   	[Eq. 6.133]
                  D -       Ce'-e~> + »ae-    .....  [Eq. 6.134]
                        ~
Following  in the manner of Moreau and Pyatt (40), let:

                            a± = e'^i   ..........  [Eq. 6.135]

                            c± = e~K2ti   ..........  [Eq. 6.136]

and,                     bi = (a^Ci)   Kl     ........  [Eq. 6.137]
                                     K2~K1 '

Then  equations  [6.133]  and [6.134] can be written:

                              L - a.jLa  ...........  [Eq. 6.138]

and,                       D = b^ + c^ ^  .........  [Eq. 6.139]

General  equations can be developed for the system function or transfer
function for BOD and DO deficit.  The following development is based
upon  the reach  numbering system that was previously proposed (see section
6.3.1).

For a waste  load at the upper end of reach 1,  equation [6.138] can be
written:

                            L1L = a!L!U  ...........  ^Eq' 6.140]


                                 6-53

-------
 where  the  index  1 indicates the reach number and the indices U and L
 indicate the upper and lower ends of the reach, respectively.  For a
 load at reach 2  and reach 1:
                      L1L " alOkLU + r12a2L2U>   .......  [Eq. 6.141]

where r12 is the ratio of the rate of flow in reach 2 to the rate of
flow in reach 1, the inverse of the dilution ratio afforded the reach
2 waste load.

Similarly, for a waste load at reaches 3, 2 and  1, the BOD at  the lower
end of reach 1 is given by:
             L1L " a!L!U + alr!2a2L2U + 3lr12a2r23a3L3U  *  '  *

If the following assignments are made:

                         ot31 » ax r12 a2 r23 a3 .......  [Eq. 6.143]

                         A31= ai a2 33 ...........  [Eq. 6.144]

                         AH = a± ..............  [Eq. 6.145]

and

                          r31 = r!2 r23 ...........  [Eq. 6.146]

then equation [6.142] becomes:

             LIL * ^11 ^1U + ^21 r21 ^2U + ^31  r31 L3U'  *  '  *  ^Eq* 6. 147]

The general equation can then be written as :
                           n
                    L1L =  £  AA1 r±1 L-LU, i > j  ......  [Eq. 6.148]
                          i-1

where j is the number of the downstream reach (the lower end)  for which
the BOD is being estimated, the  i's are the upstream reach numbers
where loads L... are discharged and n is the number of such loads.  A. .
and r./. are as defined above.

The transfer function relationships for the DO  deficit can be  developed
in a similar manner.  Starting at the downstream reach, using  equation
[6.131], write:
                       D1L = bl L1U + cl D1U
                                 6-54

-------
for the DO deficit at the downstream end of reach 1 for a BOD  load of
LIU and DO deficit of D... at the upstream end of reach 1-  Similarly,
place a load L2u and deficit D2u at reach 2 and compute D^L.   For reach
2:

                       D2L = b2 L2U + C2 D2U   ........  [Eq. 6.150]

but,                       DIU = r2l D2L   ..........  [Eq. 6.151]

and,                 LHJ - r2^ L2L = r2^ a2 L2y  .......  [Eq. 6.152]

Using equation  [6.1A9] and substituting knowns for DUJ an

           D1L  = r21 L2U (bl a2 +  cl b2^-+ r21  cl C2 D2U

which gives the value of the DO deficit at the lower  end  of  reach  1  for
a load L2u and  deficit D2U at  the upstream end of reach  2.

Using the same  approach, it can be shown that  for a BOD  load and DO
deficit at the  upper end of reach 3, DIL is:
 D1L '  r31 L3U(bl  a2  a3 +  cl b2  a3  + cl C2 b3>  + cl C2 C3 r31 D3U
                                                     ..... [Eq. 6.154]

 For a  load  and  deficit at reach 4:

     D1L *  r41  L4u(bl a2  a3 a4  + cl b2 a3 a4 + cl C2 b3 a4 + cl C2 C3 b4)

                       +  c^ c2  03 C4 r4i D4u  ........ [E<1* 6-155]

 For a  load  and  deficit at reach 5 :

    D1L = r51 L5U
-------
         (4)  All  terms  to  the left of b. are  c's with terms and  sub-
             scripts  in proper order.

 If  loads  and deficits  occur at more than one reach point, the effects
 of  each load and deficit  are computed separately and added.

 The point in developing equations [6.145] through [6.148] is primarily
 to  show that the BOD and  DO deficits at any  point downstream is a linear
 combination  of the BODs and DO deficits at all upstream reaches.

 It  is obvious that for a  large number of reaches, the use of formulas
 of  the type  developed above would become very involved.  The simulation
 model offers a means to determine the coefficients , AJJ , in equation
 [6.148] and  an overall coefficient, V± . , to  substitute for the  relation-
 ships developed above.  The method is to apply a unit BOD load  and unit
 DO  deficit at an upstream reach and simulate to determine the BOD and
 DO  deficit at all downstream reaches.  This  is repeated, placing unit
 loads at different upstream reaches so that  the system is determined for
 each quality parameter for each possible i-j combination.

 Because of the variability in the stream system, the transfer function
 coefficients are considered to be random variables.  They are deter-
mined by simulation  of the system for unit loads and deficits for a
number of years to determine their variability.  The overall transfer
functions determined in this manner contain  the effects of variable
 flow rates which can be accounted for as indicated below.
If the overall transfer function is called a.., then:
                                                                   6.157]
where a^ relates the BOD concentration at the lower end of reach j to
the unit BOD concentration at the upper end of reach i, r, . relates the
flow rate at the lower end of reach j to the flow rate at The upper end
of reach i and a±. is defined as the ratio a^/rj*.  This leads to:

                          a±j - BOD.j/BOD1, .......... [Eq. 6.158]

                            rij " Qj/Qi  ........... [£<1- 6.159]

and,

                        ai1 * aiJ " BODjQj .......... [Eq. 6.160]
By simulating the system operation for a number of years, it is possible
to obtain enough aij~ri* pairs for each averaging time interval to develop
a regression equation ol the transfer function a^ on the ratio of flow
rates r^j .  Assuming the relationship is linear, the regression equation

                                 6-56

-------
would have the form:

                                                                   6.161]
where a^ .^ is the BOD transfer coefficient from the upper end of reach i
to the lower end of reach j during the 1th week of the year; BJJ^ is the
slope and A^ji is the ordinate intercept of the linear regression equa-
tion for the transfer function i-j for week 1 and ri:n is the flow rate
ratio for week 1.

Similarly, the DO deficit relationships can be developed to obtain:

                                                                  . 6.162]
Here the deficit transfer coefficient is dn and the regression equa-
tion constants are C^i and
The reader is referred to Appendix AA.6 for more information  about  these
transfer coefficients and their use.
                                  6-57

-------
                              Section 6

                              References
 1.  Chestnut, H.,  Systems  Engineering Tools, John Wiley and Sons, New
     York, 1965, p.  111.

 2.  Hillier, F. S.  and Lieberman,  G. J.,  Introduction to Operations
     Research, Holden-Day,  Inc.,  San Francisco,  1967, pp. 439-440.

 3.  See Reference  2,  p.  470.

 4.  Goode, H. H. and  Machol,  R.  E., System Engineering, McGraw Hill Book
     Co., New York,  1957.

 5.  See Reference  2,  p.  444.

 6.  Horton, R. E.,  "Erosional development of streams and their drainage
     basins; hydrophysical  approach to quantitative morphology," Bulletin
     The Geologic Society of America.  Vol. 56,  1945, pp. 275-370.

 7.  Linsley, R. K., Jr., Kobler, M. A., and Paulhus, J. L. H., Applied
     Hydrology, McGraw Hill Book Company,  New York, 1949, pp. 182-212.

 8.  Barnes, H. H.,  Jr.,"Roughness  Characteristics of Natural Channels,"
     U.S. Geological Water  Supply Paper 1849, U.S. Government Printing
     Office, 1967.

 9.  Leopold, L. B.  and Haddock,  T., Jr.,  "The hydraulic geometry of
     stream channels and  some  physiographic implications."  U.S. Geolog-
     ical Survey Professional  Paper 252, 1953.

10.  Matalas, N. C., "Mathematical  Assessment of Synthetic Hydrology,"
     Water Resources Research, Vol. 3, No. 4, 1967, p. 937.

11.  Hald, A., Statistical  Theory with Engineering Applications, John
     Wiley and Sons, New  York  (1952).

12.  Chow, Ven Te,  "Determination of Hydrologic  Frequency Factor,"
     Journal, Hydraulics  Division.  ASCE. Vol. 85, July 1959.

13.  Ostle, Bernard, Statistics in  Research, Iowa State University Press,
     Ames, Iowa, 1963, p. 471.

14.  Massey, Frank  J., Jr., "The Kolmogorov-Smirnov Test for Goodness of
     Fit,"  American Statistical Association Journal. March, 1951, p. 68.

                                 6-58

-------
15.  Ward, J. C., "Annual Variation of Stream Water Temperature,"
    Journal. Sanitary Engineering Division. ASCE. Vol. 89, December,
    1963.

16.  Brown, G. W., "Predicting Temperatures in Small  Streams," Water
    Resources Research, Vol. 5, February 1969.

17.  	, Standard Methods for the Examination of Water arid
    Waste Water, American Public Health Association, Inc., New York,
    12th ed., 1965, p. 409.

18.  	, Committee Report, "Solubility of Atmospheric Oxygen
    in Water," Journal, Sanitary Engineering Division, ASCE, Vol. 86,
    July, 1960.

19.  Sisler, H. H., Vanderwerf, L. A., and Davidson, A. W., College
    Chemistry, 2nd ed., The MacMillan Company, New York, 1961, p. 223.

20.  Churchill, M. A. and Buckingham, R. A., "Statistical Method for
    Analysis of  Stream Purification Capacity," Sewage and Industrial
    Wastes.  Vol. 28, No. 4, April, 1956.

21.  LeBosquet, M., Jr. and Tsivoglov, E. C., "Simplified Dissolved
    Oxygen Computations," Sewage and Industrial Wastes, Vol. 22, No.
    8, August, 1950.

22.  Streeter, H. W. and Phelps, E. B., "A Study of the Purituation
    and Natural  Purification of the Ohio River," Public Health Bulle-
    tin, No. 146. Washington, D. C., 1925.

23.  See Reference 17, p. 415.

24.  Fair, Gordon M., "The Log-Difference Method for  Estimating the
    Constants of the First Stage BOD Curve," Sewage  Works Journal,
    Vol. 8, No.  3, May, 1936.

25.  Thomas, H. A., Jr., "The Slope Method of Evaluating the Constants
    of the First Stage BOD Curve," Sewage Works Journal, Vol. 9, No.
    3, May, 1937.

26.  Moore, E. W., Thomas, H. A., Jr. and Snow, W. B., "Simplified
    Method for Analysis of BOD Data," Sewage and Industrial Waste,
    Vol. 22, No. 10, October, 1950.

27.  Lordi, D. and Heukelekian, H., "The Effect of Rate of Mixing on
    the Deoxygenation of Polluted Waters," Proceedings, 16th Purdue
    Industrial Waste Conference, 1961.

                                6-59

-------
28,  Camp, T.  R.,  "Field Estimates  of  Oxygen Balance Parameters,"
     Journal,  Sanitary Engineering  Division, ASCE, Vol* 91, No. SA5,
     October,  1965.

29*  Gannon, John  J.,  "River and Laboratory BOD  Rate Considerations.
     Journal,  Sanitary Engineering  Division, ASCE. Vol. 92, No. SA1,
     February, 1966.

30.  Isaacs, W» P. and Gaudy, A. F.,  Jr.,  "Comparison  of  BOD Exertion
     in a Simulated Stream and In Standard BOD Bottles,"  Proceedings,
     22nd Purdue Industrial Wastes  Conference, 1967.

31.  O'Connor, Dr  J.  and Dobbins, W.  E.,  "The Mechanism of  Reaeration
     in Natural Streams," Journal,  Sa^ijzary^ngineering Division, ASCE,
     Vol. 82,  SA6, December, 1956.

32-  Krenkel,  Peter A., and Orlob,  Gerald, T., "Turbulent Diffusion
     and the Reaeration Coefficient," Journal, Sanitary Engineering
     Division. ASCE.  Vol. 88, No.  SA2, April, 1962.

33.  Langbein, Walter B. and Durum, W. H., "The  Aeration  Capacity of
     Streams," Geological Survey Circular 542, U.  S. Printing  Office,
     Washington,  D. C., 1967.

34,  Isaacs, W- P. and Gaudy, A. F., Jr., "Atmospheric Oxygenation  in
     a Simulated  Stream," Journal,  Sanitary  Engineering Division, ASCE.
     Vole 94,  No.  SA2, April, 1968-

35-  Thackston, E- L. and Krenkel, P. A., "Reaeration  Prediction  in
     Natural Streams," Journal, Sanitary  Engineering Division, ASCE^
     Vol. 95,  No.  SA1, February, 1969-

36-  Thomas, H. A., Jr., "Pollution Load  Capacity of Streams,  Water and
     Sewage Works, Vol. 95, 1948-

37,  Dobbins, W.  E.,  "BOD and Oxygen Relationships in Streams," Journal,
     Sanitary Engineering Division. ASCE. Vol.  90, SA3, June,  1964.
38,  See Reference 29.

39.  See Reference 30.

40=  Moreau, D. H. and Pyatt, E. E., "Uncertainty and Data Requirements
     in Water Quality Forecasting: a Simulation Study," Final Report to
     U. S. Geological Survey, University of Florida, November, 1968.

                                 6-60

-------
41.   Kothandaraman, V.,  "Probabilistic  Analysis  of  Was-tewater  Treatment
     and Disposal  Systems," Research Report  No.  14,  University  of
     Illinois Water Resources  Center, June,  1968.

42.   Nicolson, G.  S.,  Jr., "A  Methodology  for  Selecting Among  Water
     Quality Alternatives," Doctoral Dissertation,  University  of Florida,
     March, 1969.

43.   Ray, W. C.  and Walker, W.  R.,  "Low-Flow Criteria for Stream Stan-
     dards," Journal,  Sanitary Engineering Division.  ASCE. Vol.  94,  SA3,
     June, 1968.

44.   Fiering, M. B.,  "Multivariate  Technique for Synthetic Hydrology,"
     Journal, Hydraulics Division.  ASCE, Vol.  90, HY5, September, 1964.


45.   Hufschmidt, M. M. and Fiering, M.  B., Simulation Techniques for
     Design of Water-Resource  Systems,  Harvard University Press,
     Cambridge,  Mass., 1966.

46.   Matalas, N. C.,  "Mathematical  Assessment  of Synthetic Hydrology,"
     Water Resources  Research, Vol. 3,  No. 4,  1967.

47.   Anderson, T.  W.,  An Introduction to Multivariate Statistical Analysis,
     John Wiley  and Sons, Inc., New York,  1958,  Chapter 2.

48.   Hadley, G., Linear Algebra, Addison-Wesley  Publishing Co.,  Inc.,
     Reading, Mass.,  1961.

49.   See Reference 47, Chapter 11.

50.   Churchill,  M. A., "Effects of  Storage in  Impoundments on  Water
     Quality," Transactions, ASCE.  Vol. 123, 1958.

51.   Kittrell, F.  W.,  "Effects of Impoundments on Dissolved Oxygen
     Resources," Sewage and  Industrial Wastes, Vol. 31, No. 9, September,
     1959-

52.   D'Azzo, J.  J. and Houpis, C. H., Feedback Control System  Analysis
     and  Synthesis, McGraw-Hill Book Co.,  New  York, 1960.

53.   Cue, R. L.  and Thomas,  M. E.,  Mathematical Methods in Operations
     Research, The Macmillan Company, New  York,  1968.

54.   Burns, J. F., Classroom Notes, University of Florida, 1968.


                                 6-61

-------
55.  Meyer, P.  L,,  Introductory Probability  and  Statistical Applications ,
     Addison-Wesley Publishing Co.,  Reading, Mass.,  1965,

56,  Thomann, R,  V-, "Mathematical Model  for Dissolved Oxygens"  .'curnal.
     Sanitary Engineering Division.  ASCE, Vol. 89, No. SA5, October,
     1963,
                                  6-62

-------
                       SECTION 7
     THEORETICAL DEVELOPMENT OF OPTIMIZATION MODEL

7.1  Introduction
The overall objective of this section is to develop a methodology
to quantify the benefits of low flow augmentation in a complex
region.  These benefits are to be measured in terms of wastewater
treatment costs avoided'.  A complex region is viewed as one with
multiple reservoirs and/or waste sources arranged in a configuration
such that significant interdependencies exist among these entities.
It is assumed that preliminary'delineation of the subset of a
watershed, defined as a region, has been determined.  This selected
subset is then partitioned into reaches which provide a mutually
exclusive and collectively exhaustive representation of the
region.

A  separable convex programming model has been developed to determine
the combination of wastewater treatment plants and low-flow
augmentation reservoir releases which minimizes the total cost
of meeting prespecified water quality standards.  The optimal
solution can be specified for any combination of decision-making
units vis-a-vis analysis of the dual problem.

7.2 Regional Decision-Making  Structure
The decision-making structure within this region is shown in
Figure 7-1.  A headwater reach may contain either one or two
decision-making units - a reservoir or  a waste discharge source.
Headwater reaches are defined as  those  with no reaches upstream
from  them.  Reservoirs  can  exist  only on headwater reaches.
Consequently, interior  reaches  contain  only a single decision-
making unit - a waste discharge source.  The investment decision
regarding wastewater treatment  facilities or storage facilities
is usually related to installing  a facility capable of satisfying
some  extreme condition, e.g.,  7 day low-flow which might  be
expected  to occur every 10  years.  Thus the primary focus for
comparing alternatives  will be  on the critical period.

The regional authority  seeks  to act in  the best  interests of
the entire region by inducing decision-making units  to
coordinate their activities.   This authority transmits to
the decision-making units  a set of water quality standards  for
each  reach.  Each  set of  standards has  been  established  after
                          7-1

-------
                                               FIGURE  7-1
                                     ASSUMED REGIONAL DECISION-
                                             MAKING STRUCTURE
                                                  REGIONAL
                                                  AUTHORITY
I
U)
        RESERVOIR
           I
WASTE
SOURCE
WASTE
SOURCE
  2
WASTE
SOURCE
  3
WASTE
SOURCE
   P
               REACH I
             HEADWATER
                   REACH 2
                  HEADWATER
              REACH 3
              INTERIOR
                         REACH P
                        INTERIOR

-------
careful examination of the water quality needed to attain
specified goals.•

The regional authority provides the market mechanism for
permitting any two or more individual decision-makers to make
mutually advantageous transactions in order to reduce the
total cost of satisfying a specified water quality standard.
Previous investigators have restricted their analysis to cases
where all of the intermediate decision-makers worked together.
The more general case of specifying optimal decision rules
for any subset of participating decision-makers will be
included in the subsequent analyses.

Given a set of standards, the waste discharger in each reach
is responsible for meeting that standard.  The assumed objective
of each waste discharger is to minimize the cost of meeting this
standard.  The waste discharger in a headwater reach has two
alternatives available to him:  construct wastewater treatment
facilities, or obtain augmented flow from some upstream point.
A waste discharger in an interior reach has a third alternative
available to him:  he can pay an upstream waste discharger to
increase his treatment so as to reduce the waste inflow to the
specified interior reach.  Knowing his own wastewater treatment
cost function, the waste discharger can estimate what he would
be willing to pay for a unit reduction in BOD load entering his
reach.  However, in order to reduce the BOD load by one unit at
that point it is necessary to remove more than one unit upstream
due to BOD decay.

A reservoir may be considered to be a firm which supplies a
product, water, according to the demand from potential users.
The analogy of this system to the marketplace is evident if one
views other suppliers of waste  treatment and augmented flow as
producing their product upstream and then transporting it to
the market area (the reach) via the river system.  The prospect
of a reservoir adding low flow  augmentation to its purposes
may bring about a readjustment  of operational decisions.

Two factors determine the usefulness of a parcel of water for
low flow augmentation.  The first factor is dissolved oxygen
concentration, which varies according to the action of
oxygen sources and sinks.  The  second factor is the rate of
change in oxygen availability which can be expressed in terms
of a reaeration coefficient.  The value of this coefficient
has been found to decrease with flow.  Consequently, the
                          7-5

-------
production of flows for assimilative purposes is subject to the
principle of diminishing marginal productivity.  It is not flow
augmentation that is desired per se but rather DO augmentation.

7.3 Physical System as a Uni-Directional Transportation Network
The region under study is partitioned into a set of reaches
arrayed in a dendritic configuration.  In a network format^ a
reach consists of two nodes connected by a transport branch,  as
shown in Figure 7-2.  Reaches one and two are headwater reaches.
Nodes have been classified into four types, as listed in Figure
7-2.  The modeling procedure traces the movement of one or
more commodities through the same or slightly modified network.
In this study, water, biochemical oxygen demand (BOD) and
dissolved oxygen (DO) are routed through the network resulting
in a three commodity network problem.   The following convention
is used for identifying the three commodities.

               Commodity                 k

                water                    1

                BOD                      2

                DO                       3

In the simplest case, supply and demand related to these
commodities as well as their transport properties do not depend
on the activity levels of other commodities.  In the more general
case, which is considered in this section, interdependencies
exist between commodity .flows.

An important input to the analysis is the supply of water
entering the region in each time period.  Starting with
historical hydrologic data, a simulation program has been
developed to generate synthetic traces.  The supply of BOD is
determined as the product of a BOD coefficient times the
appropriate activity level, e.g., population, crop acreage.
The estimated demand for water is based on water use coefficients
and activity levels.  The commodity flow along a given branch
is determined by equations of continuity with regard to each
commodity.  Water is considered to be a conservative commodity.
                          7-6

-------
            FIGURE 7-2
NETWORK  REPRESENTATION  OF  RIVER
              SYSTEM
              
-------
The flow of BOD and DO are considered to be nonconservative so
that it is necessary to describe the associated attenuation and
amplification factors.

It is assumed that the activity levels have been projected to
the end of the planning horizon.  In addition to projected changes
in the demand pattern, future modifications in the supply system
are also tabulated.  Lastly, a criterion was needed to measure
the desirability of transporting a commodity along a given branch.
The criterion chosen in this study was to minimize the wastewater
treatment costs required to satisfy a specified water quality
goal for a given quantity of augmented flow.   The notation used
in the analysis is defined in Table 7-1.

7.4 Objective  Function
The analysis of wastewater treatment indicates that the cost
functions are convex in the range of concern.  The objective is
to find the combination of flows of commodity 2  (BOD) which
minimize the value of  the objective function, Z, or


        minimize Z =   £    f(Q. (2T))    .......  [Eq.  7.1]
 and f(Qj) is such that for any pair of values  of
 say Qr <2T> and Q±HW> :
                                        <  cf>  +


         (1 - O f(Q1,(2T))        .........   [Eq.  7.2]
 where   0 < C i 1.0

 It is possible to  separate  this  convex function of a single
 variable as accurately  as desired  using a piecewise linear
 function.  Clough  and Bayer's model (1) uses  a logarithmic
 objective function and  critizes  the use of a  piecewise linear
 objective function as being less accurate. However existing
                           7-9

-------
                        TABLE 7-1
                     LIST OF NOTATION
A£       Set of all contributing reaches above reach i

F.£       Set of all contributing reaches immediately above
         reach i

G.       Set of all recipient reaches downstream from reach i

V^       Set of all treatment plants in the region (q elements)

s(kT)    Flow of commodity k into treatment plant in reach i

S UO     New supply of commodity k entering reach i

Q^(kT)   Flow of commodity k from treatment plant to reach i

Q (k)    Flow of commodity k at beginning of reach i

         Flow of commodity k at end of reach i

         Attenuation  or amplification of commodity k in transit
         through reach i

p (k k)  change in flow of one commodity k1 through reach i per
         unit of flow of another commodity k through reach i
   (kT)
C.,       Cost of transporting a unit of commodity k along
         treatment branch b in ith reach

         Flow of commodity k along treatment branch b in
         ith reach

         Upper bound on

Qib(kT)  Lower bound on

y (k)    Minimum allowable flow of commodity k in reach i

Z        Value of the objective function

n        Number of treatment branches

p        Number of reaches

q        Number of treatment plants
                          7-10

-------
computer  codes  permit  comparable levels of accuracy to be attained
efficiently with piecewise approximations.

The piecewise linear approximations are obtained by partitioning
Q (2T)  into n segments where b = l,2,...,n.  Then, breakpoints,
                                can be defined such that
                  +  ?  Q.  <2T> =
                         .
                          D
Thus the objective is to

          minimize Z - E    E
                      i-1  b-1
                                                    * ' [Eq' 7'4]
wherein 0 <

                                      treatment segments.
7.5 Physical-Technical Constraints
Given a network format, continuity equations can be written using
Kirchhoff node" laws.  Water is assumed to be a conservative
commodity.  The description of the nonconservative BOD and DO
movements follows the development by Loucks, Revelle, and Lynn
(2) of the Camp (3) and Dobbins  (A) formulations of the Streeter-
Phelps equations.  This formulation has been modified to express
the commodities in mass units rather than as BOD and DO concen-
trations.  The purpose of this modification is to simplify inter-
pretation of the dual problem.

7.5.1 Water Continuity Equations
The flow of water from the treatment plant to the river in the
ith reach, Qi^1T^, is simply the quantity of water entering the
treatment plant, S^11), or
Qi
                            (1T)
                                                         [Eq.  7.5]
 The flow of water in the ith inte
 of j upstream inflows,   I  Q  (1)
                                                (1)
                                terior  reach,  Q.,  is  comprised
                                    the inflow from the  waste
                             7-11

-------
treatment plant, Qiv  ^ , and the tributary inflow, S.v ', or


                 Q±(l) - Z   Q CD + Qi<1T> + S^D        ..[Eq. 7.6]
For headwater reaches,  E    Q.    = 0, so that
                       jeFi   J

                       » QlUT> +8^"                     ..[Eq. 7.7]


7.5.2 BOD Continuity Equations
The rate of change of BOD concentration with time, dB/dt, is
proportional to the concentration of BOD present, B; and to the
rate of BOD addition, R, due to runoff and scour; or


                  dB/dt = -(K^ + K3)B + R    ........   [Eq. 7.8]

where
K^ •• rate constant for deoxygenation: day~l
K^ * rate constant for sedimentation and absorption: day
B  = BOD concentration: #/MG
R  « rats of BOD addition due to runoff and scour: ///MG/day
Integration of  equation  [7.8] yields
   Bt =  [B^R/CKit-Ka)] exp  [-(Ki+K3)t] +R/(K1+K3)     .  .  .    [Eq.  7.9]

where B0 - BOD  concentration  at  time 0  : #/MG
      Bt = BOD  concentration  at  time t  : #/MG

Rearranging equation  [7.9]  yields


     Bt - B0  exp  [-(K1+K3)t] +  R/(K1+K3){l - exp [-(K1+K3)tj;.  [Eq.  7.10]


Let  \t -  exp [-(K1+K3)t],  and
                             7-12

-------
Then
            Bt = Xt B0 + yt   ...........  [Eq.

Using the notation, -in Table 7-1 »


            B0 - Qi^VQ^1), and
Substituting for Bo and Bfc in equation  [7.11] and noting  that
  A1' *    *1'
                 5— o —
               yields


                     ^ Qj/2^ + (^t) Qi^1^   •  •  •  [Eq.  7.12]


where
          ', and
 t    i

so that
                                                    [Eq>  7.13]
Given equation [7.13], it is straightforward to write  the  continuity
equations for BOD at the treatment plant node and the  head of
the reach.  For the treatment plant node,  the BOD leaving  the  treat-
ment plant. Qj_-, plus the BOD removed at the treatment plant.
'        21', equals the BOD inflow to the treatment plant, S^T) f or
                             = S4 (2T)	[Eq.  7.14]
        •J.       - "-  'J.U        1


The BOD entering the reach, Q^/  ,consists of a water dependent component,




                             7-13

-------
                 ; the decayed upstream BOD quantity,  Z  e
 e±                                                     j^
the treatment plant effluent, Qi(2T); and the BOD contained in the
tributary inflow, S.^2); or
                      Q (1) + (e (2))Q  (2)j + Q±(2T) + s  (2).[Eq. 7.15]
                       J        J     J
7.5.3  DO Continuity Equations
Lastly, the DO continuity equations are obtained by the following
manipulations.  The rate of change in DO deficit, dD/dt, is propor-
tional to the concentration of BOD present, B; the existing DO
deficit, D; and the rate of change of oxygen production or reduction,
M, due to plant photosynthesis and respiration; or


     dD/dt -  I^B  - K2D-M           	[Eq.  7.16]


where
K« -  zeaeration rate constant:  day
D  -  DO deficit: #/MG
M  -  ocygen production  (M>0) or reduction  (M<0) due to plants
     and benthal deposits: #/MG/day

Integrating  equation [7.16] yields


      Dt - K1/[K2-(K1-HC3)]^IB0- R/(K14*3)}[exp-(K1+K3)t-exp(-K2)t]j-


                         - M/K1][l-exP(-K2)t]+D0exP(-K2)tj»  .  [Eq.  7.17]
                              7-14

-------
Let <*t**  exp(-K2)t
    •Yt-  Klflearf-Ki-KaH - exp(-K2)t])./  [Ko-OC-,  + K,) ] ,  and
                    K3)] + Kj/KatR/CJCi + K3)- M/K i
Then,  equation  [7.17]  becomes

    D-t-  (at) D0 + (Yt)  B0 + &t           ............   [Eq. 7.18]

where   Do - DO  deficit at time 0 : #/MG
       Dt - DO  deficit at time t : #/MG

The following equations,

           JJ±t<3)                  ...............   [Eq< ?il9J

                                   ...............   [Eq. 7.20]
                                                                   [Eq. 7.22]
where Qj_    -  saturation DO quantity at the beginning  of the reach, and
      Q^i ^3) = saturation DO quantity at the end of  the reach,

are used  to express  equation [7.18] in terms of oxygen resource availa-
bility.   Thus
    Q±i(3) -  (l-«t)  Qi(3)  + (at)Qi(3) - Yt Qi(2) -  (et)Qi(1)  •  •   IE«I- 7'23]

In the above  relationship, let

          -  kt  (3>1)  Qi(1),and    ...............   [Eq. 7.24]

           (3jl)  (1 - «fc) - Bt    ...............   EEq. 7.25]
where kt  (3,1) s  saturation DO concentration  : #/MG.
Then the  quantity of  DO at the end of the reach is  found by substituting
Equations [7.24]  & [7.25]  into Equation [7.23] to obtain
         -  (Yt) Qi     - (Y^  Qi2  + (at)Qi          ......   [Bq. 7.26]

where  ^ -  p. (1,3)
              (2,3)
       Yt -PI
       ot -  6l(3)
•o that
                                 (2,3)) Ql(2) +  (ei<3>)Qi(3).  .   [Eq.  7.27]

                                 7-15

-------
                                            (3T)
 The DO  leaving  the  treatment plant node, Q  v    > is assumed to equal  the
 specified  DO  availability in the wastewater, 8^(31), Or
    Qi
       (3T)
                                                                   [Eq. 7.28]
 The DO leaving the reach node, QJ^ ', is comprised-of

a. the water dependent upstream DO term, ,Zp.(Pj     )Qj   >

b. the BOD dependent upstream DO term, .1  (PJ(2»3))0-(2);

c. the upstream DO reaeration term,  Z  (e-^3')Q>
                                    jeFi  J     J
d. the DO in the wastewater effluent,  Q1-^3T);  and

e. the DO in the tributary, S
                                  or
                                                                            -  7.29]
7.6 Water Quality Constraints
The DO standard for each reach requires that the quantity of DO  leaving
the reach, Q^'^), be not less than a specified minimum quantity, Y^O).
Thus, equation [7.27] is restated as the inequality

                  _  (PlC2.3))Ql(2)+(Ei(3))Ql(3)  >  y.(3)  .....  [Eq. 7.30]

The constraints are formulated such that the quantity  of DO at the  end
of the reach shall be greater than or equal to a specified minimum  value.
This assumes that dD/dt S 0 in equation [7.16] so  that the time  of  travel
in the reach is less than or equal to the critical time.  This is not
a significant restriction on the applicability of  the  analysis,  since
the reach selected is arbitrary and so this condition  can be satisfied
by manipulating the number of reaches.

7.7 Summary of the Model
The complete primal problem is presented below in  matrix notation:
                    Minimize Z - [C(2T>] '  [Q<2T)]
     subject to
             0       0

          :>  A<2>    0

          )  p(2,3)  A(3)

     D (1,3) D(2,3)  D(3,3)

     000
0
T(2)

0
0

I








Q
Q(2)
X
Q(3)
Q<2T).
X







s^>"
s(2)

SO)
Y(3)
~
Q(2T)
                                                               .  .  [Eq.  7.31]
                                 7-16

-------
 where  [A>J] = (p+q) x(p+q)  matrix of water continuity coefficients;
        [A^j]81 (P+q) x(p+q)  matrix  of  BOD  continuity coefficients;
        *A(1 IT ^P+q^ X^p+q^  matrix  of  DO continuity coefficients;
        I ri'^n!" iP+q> x(p+q)  matrix of water-BOD interdependency coefficients;
        ! (2 3),  (P+q) X(P+<1>  matrix of water-DO interdependency coefficients-
        Efl*3^   (p+q) x(p+q)  matrix of BOD-DO interdependency coefficients;
        r f2S{]" *P) x(p"fq)  matrix  of  water-DO quality coefficients;
        [D;''^-J" (?) x(P+q)  matrix  of  BOD-DO  quality coefficients;
               ]• (p) x(p+q)  matrix  of  DO quality coefficients;
             ]• (pxq) x(nxq)  matrix  of  BOD  treatment alternatives; and
        [I]- (nxq) x(nxq)  identity matrix of upper bounds  on BOD removal.

 Associated with the primal, or resource allocation, problem is the dual,
 or resource valuation, problem.  The dual problem, presented below in matrix
 notation, provides important insights as will be  shown later.

 Maximize Z* - S(1>  IT(
     subject to
          ,(2)'
p(1.3)'
P(2,3)'
A«>'
0
V * A V
D(li3). H
D<2.3)' o
D<3,3) 0
0 I




VD-
,<2)
^ -
_7T(5)_
0

0

0

C(2T)
                                                                    [Eq.  7.32]
       [ir(l)],[Tr(2)],[ir(3)]JTT(4)]>[7r(5)] unrestricted in sign

where  the vector  of  dual  variables are associated as follows:
       [ITCD] -with [S(l)];  [ir<2>]  with [s(2)]; [T(3)] with [S<3)];
       [ir(4)] with [j(3)];  and [IT(5)]  with [Q(2T)J.
 The analyst may solve either the primal or dual problem since  they are
 equivalent.  Available computer codes such as IBM's Mathematical Programming
 System/360 contain efficient algorithms for solving either problem.  The
 MPS/360 code employs  the bounded variable — product  form of  the inverse
 revised simplex method.   The bounded variables routine permits a significant
 reduction in the size of the problem since the bounds would otherwise have
 to be included as explicit constraints.

 7.."8 Post-Optimal Analysis to Determine Regional Waste Management Strategy
 the. various solutions which may result when attempting to find the optimal
 combination of wastewater treatment plants for a given water quality standard
 are described.  Then, the effects of considering waste treatment and flow
                                  7-17

-------
 augmentation simultaneously are discussed.

 7.8.1 Spates of the Treatment System

 7.8.1.1 Infeasible Solution
 Maximum wastewater treatment is insufficient to satisfy one or more of
 the water quality standards.  In this case low flow augmentation is the
 only available alternative.

 7.8.1.2 Present Facilities Adequate
 The value of the objective function in this case would equal zero and
 accordingly the value of [Tr(2>] = [Q],  The existing wastewater treat-
 ment system is adequate and the analysis terminates.

 7.8,1.3 Competitive Headwater Treatment Facilities
 If ir^2) > o for one or more of the headwater reaches and 7r^2' = 0 for
 all interior reaches then there is no further need to analyze the multiple
 reach problem since the headwater reaches are, by definition, independent
 of each other.  The analysis may then proceed to independently comparing
 low flow augmentation with waste treatment at each individual reach.

 7.8.1.4 Competitive Interior Treatment Facilities
 If Tr.^2) > o for one or more interior reaches then it is necessary to
 further analyze the regional interdependencies which exist to define
 the solutions of interest.   If ir.(2) > o for an interior reach then it
 necessarily follows that ir.v2) > o, for jeA^, i.e., a change in BOD
 discharge of any contributing reach, j, will have some positive impact
 on the cost of waste treatment at reach i.  However, it is not yet known
whether the shadow price represents the value of an incremental unit of
 BOD removal to only one, or more than one, downstream reach.  Consequently,
 it is necessary to examine the dual price vector [TT(^)] with regard to
 the water quality standards.  If TT.(^) = 0 for any contributing reaches
 then these units are treating more than their required amount, and thus
 reduce the waste treatment costs of downstream units.  Assume that
 TT-^vA) > o for only a single reach, i, so that it is known that upstream
 shadow prices (TT.:'^) represent the value to the ifch reach of a unit
of BOD removal at any of the upstream reaches for the specified water
quality conditions.

The interpretation of these shadow prices provides important information.
Tf.(2) represents the marginal cost of BOD removal at reach i.  Recall
that since this waste discharger is located on an interior reach an
upstream plant could be requested to increase their waste treatment so
that the BOD load entering the ith reach is reduced by one unit.  However,
because of instream self-purification it is necessary to remove more than
one unit upstream in order to effect an equivalent removal of one unit
of BOD measured at the inlet to reach i.  Accordingly the value of upstream
                                 7-18

-------
waste treatment diminishes in the upstream direction  so  that
    V   ' V"  i£|;,;<« > 0 *« ^At        ..........  [Eq.  7.33]

It is desired to know the relationship

                      for jeAi                 ..........  [Eq.  7
for all upstream reaches.  Knowing that it     > 0  implies  that  the  associated
constraint in the primal problem is binding, i.e. ,  is  an equality.   Conse-
quently it is possible to calculate 0^ for all jeA±.  Knowing this
relationship it is then possible to proceed upstream as far  as  desired
by substituting for Qi(l), Q^^2), and Q^3) and analyzing  the commodity
2 terms.  From before


   Qt<2> - iCCpj^WD + C^1'2^,'2) ] + Qi<2T> +  s±<2>  .  [Eq.  7.15]
   Ql(3)  -'   (P-,'1'3'  Qj'1'  -(pj(2'3>)Q     + (ej<3))Q(3)] + Qi(3T)
                                                                   [Eq.  7.29]

                                                           ....  [Eq.  ?.30]

wherein the  last equation is now written as an equality.   For a given j
eEif substituting equations [7. 151 & [7.29] into equation  [7.30] & combining
all coefficients of G±(21) (, ^(.2) yields

   - + (Pj"'3').!0'^"  +  . . .  -Ii»>.tKq.7.35]

Then, the  rate  of substitution of Qj (2) for Qj.^21^ is

   By - [(Pi(2'3))e/2)  + (p/2'3))El(3>]/p1(2.3) .......  [Eq.  7.36]

Equation [7.36]  gives the trade-offs between reach i and  any contributing
reach immediately above reach i.  This recursive relationship can  be extended
further upstream to obtain the rate of substitution between BOD removal
at reach i and  any upstream reach, jeAi.  This general relationship is
dhown in Equation [7.37].
                                                                 jeA±.[Eq. 7.37]
Thus precisely what waste discharger i would pay to have upstream waste
treatment  at  some point j can be found if 0^ and the marginal cost of

                                 7-19

-------
waste treatment in reach i are known.   Furthermore,  the G^j  are
independent of the value of the standard at reach i  so that  a vector of
upstream shadow prices,  [TTJ (2) ], can be generated for any binding waste
treatment standard at reach i.

7.8.1.5 Competitive Headwater and Interior Treatment Facilities
If Tr^2) > 0 for at least one interior reach and if   r^W > 0 for at
least one headwater reach then the interpretation presented  in the last
section needs to be modified slightly .  Recall that" the shadow price with
respect to BOD removal,  ir^CZ) = 3Z*/3Si(2) .  But ir^2) can consist of
two components:  the marginal value of treating at reach i,  and the
marginal value of treatment at reach i relative to a recipient downstream
reach.  Thus         .             .
         =  3Z*/ Si(2) +  I  OZ  /3S'2J)  ........... [Eq. 7>38]
where GJ = set of all recipient reaches downstream from reach i, so that
the total value of the shadow price with respect to S^2' can be partitioned
into its individual components.  The value of each component can be determined
using parametric programming in such a way that the water quality constraints
in each affected reach are systematically relaxed so that BZ^/as^4) = 0
and the marginal value in all reaches is determined accordingly .  This
procedure determines aZ*.,/3S.' ' over a prespecified range of S. <• 4' <
Si W < g±<4)           i   i                                 "*

7.8.2 Flow Augmentation Analysis
Simultaneous consideration of waste treatment and flow augmentation with
water of varying quality encompasses a wide range of alternatives.  Thus
it would be impractical to specify ,a priori . procedures for analyzing all
of these cases.  Therefore, approaches for analyzing specific regional
situations are presented to illustrate the interpretation of the model.
Similar methods can be used when investigating related questions.

7.8.2.1 Assumed Sources of Augmented Flow
The problems of investigating the most effective single  source  or combina-
tion of sources of augmented flow are very similar.  First it is desired
to determine the value of an additional unit of flow in  any of  the headwater
& interior reaches.  The information needed for this analysis is obtained
from the optimal solution to the primal problem shown in equation  [7.31]
or the equivalent dual problem shown in equation  [7.32].  The required
information is the vector of dual variables associated with  tS^'l-  These
values are the shadow prices with respect to flow,  or 3Z*/3Si(-   , where
i - 1,2, . . .,p.  Since the potential sources of flow are at the beginning
of the headwater reaches one would  deduce that the  shadow prices in  the
upper reaches are greater than  or equal to  the shadow prices  in the  recipient
reaches downstream,  [G.^]  or
     3Z*/aSi(1) >  3Z*/3SjCD For jeGi         ...........  [Eq.  7.39J


                                 7-20

-------
Using parametric programming, the relationship for determining flow
augmentation benefits can be obtained for a single source or a combination
of sources.   A graphical illustration relating flow augmentation benefits
to the quantity of augmented flow is shown in Figure 7-3.  Specific
analysis of  these cases and illustrations of the applied procedures are
shown in more detail in Section 9.

7.8.2.2 Effect of Variation in Quality of Augmented Flow
Once the sources of augmented flow have been investigated for the region,
then analyses can begin on the effect of water quality, and the varying
activity coefficients which £re dependent on flow.  The importance of
these initial quality conditions would tend to decrease as the water moves
downstream.   For example, release of a water with zero DO might have a de-
trimental effect on the first reach but could subsequently contain enough
DO to be of  positive benefit to users further downstream.  An analysis of
the effect of augmented flow, with zero DO, and with high BOD is presented
in Section 9.

The effect of varying activity coefficients when flow is augmented is an
interesting  question.  If the coefficients in the activity matrix shown
in equation  [7.31] were independent of flow, then it would be simple to
determine the value of low flow augmentation using parametric programming.
Unfortunately this is not the case.  The dependence of the reaeration
coefficient  on the river's depth and velocity is well established (5).
Also, the rate of deoxygenation is dependent on river discharge.  With these
factors taken into consideration, the curve shown in Figure 7-3 could be
derived by determining the optimal solution for selected quantities of
augmented flow.   However, it is relatively laborious to manually regenerate
the matrix for each selected flow value and the corresoonding activity
coefficients and then determine the optimal solution.  Thus, a computer
program was  written to expedite the matrix regeneration.

An efficient way to approximate the flow augmentation benefits is by
examining limiting conditions.  First assume that the coefficients in the
model are independent of flow.  Using parameteric programming, trace an
estimate of  the  benefit function for the augmented flow with the coefficients
of the base  flows, S^^).  From these results, select an upper bound on the
quantity of  low  flow that might be desired, Si^1).  Then rerun the model
With the new matrix for this upper bound.  The parameterization in this
case takes place from S^^)  to Sj^l); i.e., from the maximum flow conditions
to the base  flow.   A specific analysis is shown in Section 9 to illustrate the
procedure in more detail.

7.9 Conclusions
The purpose  of this section was to present the theoretical developments
associated with  the optimization model formulation.  It is felt that this
approach can be  applied, in a general sense, to analyzing multiple commodity
flows of water,  and selected water quality conditions in river systems.

                                 7-21

-------
                      Fl GURE 7- 3

               FLOW AUGMENTATION BENEFITS
u.
IU
z
Hi
m

z
o
z
u
s
o
D
O
J
u.
AUGMENTED
                                    FLOW
                                 7-23

-------
The model structure permits direct interpretation of the dual in terms
of resource valuation of water, BOD & DO and describes how these valuations
change as one moves along the region.  A wide variety of analyses can be
made without significant modifications in the model.  Discussion of the
analyses germane to this study are contained in Section 9,
                                  7-25

-------
                             REFERENCES
                              SECTION  7
1.  Clough,  D.  J.,  and Bayer, M. B.,  "Optimal Waste  Treatment  and  Pollution
    Abatement Benefits on a Close River  System."   Operational  Research
    Society  Journal. £,  3(1968).

2.  Loucks,  D.  P.,  Revelle,  C.  S., and Lynn, W. R.,"Linear  Programming
    Models for Water Pollution  Control." Management Science,  14,  4(1967).

3.  Camp,  T.  R., Water and Its  Impurities. Reinhold  Publishing Co.,  New
    York (1963).

4.  Dobbins,  W. E., "BOD and Oxygen Relationships  in Streams."  Jour.
    San. E.  Div.. ASCE.  90_,  3 (1964).

5.  Langbein, W. B., and Durum, W.  H. "The Aeration  Capacity of Streams."
    Geological  Survey  Circular  No. 542,  U.S.G.S.,  Washington,  B.C.  (1967).
                                 7-26

-------
                              SECTION 8
                   APPLICATION OF SIMULATION MODEL
8.1 Description of Study Area
The study  area selected for application of the methodology developed
in this  work was the Farmington River Basin in north-central Connecti-
cut and  southwestern Massachusetts.  This river basin was chosen as
being representative of the type of river basin prevalent in the
populous eastern and northeastern sections of the United States,
where stream pollution problems are and will be most acute.

8.1.1 Overview
The Fartnington River is not a large river nor has it been devastated
by pollution.  In fact, organic waste pollution has affected only
one tributary, the Pequabuck River, which drains the industrial area
of Bristol.  The size of the river, in terms of length, and the river
basin, in  square miles of drainage area, are of advantage in the
application of the methodology because they are large enough to
contain most of the features of very large basins yet are small
enough so  that the exercise is not bogged down by masses of data.  As
for pollution, the potential is there, for it is anticipated that  the
eastern third of the basin will develop into very desirable bedroom
communities for residents who work in the Hartford business and
commercial center and the New Britain-Bristol and Windsor-Windsor
Locks industrial areas.

The Farmington River Basin is important to central Connecticut.   It
supplies water for most of Greater Hartford  in a unique system which,
by gravity,  brings  filtered  water to much of Hartford.   The Basin is
an excellent place  for  the urban  population  to recreate and its
.facilities are well used the year around.  Sixteen state parks and
forests, more  than  44 square miles in extent, nrovide bathing,
boating, camping, fishing, picnickinp and skiinr  only a few minutes
drive from the  state's  populated  centers  (1).  Industry in  the Basin
 can be  classified as  light, but small manufactuting  plants  are to
be found in  each  of  the Connecticut  villages.  Industry plays  the
major role in  the internal economy of the Basin.  Agriculture  is
 important  too  in  that  significant acreaee in the  Basin  produces
 fine  leaf  tobacco used  in wrapping cigars.   The  southeastern  area,
 between Granby and  Plainville, has some  of Connecticut's  richest
 and most productive land.  Large  dairy herds also contribute  to the
 value of the land.   And later,  the main water courses  of  the  Basin
 will become  mundanely important  as the  carriers  of  its  waterborne
 wastes.

 8.1.2 Streams
 Figure  8-1 is  a map of the  Farmington River  Basin showing the towns
 and major  tributaries.   A  concise description of the Basin and its
 streams is contained in the  Corps of Engineers Interim Report (2).
 For the convenience of the  reader, this  description is reproduced
 below.


                               8-1

-------
          I-JBECKET
                                               IGURE   8-1

                                                    MAP

                                       FARMiNGTON  RIVER  BASIN
       SAND1SFIE-"
NORFOLK  /
                                    HARTLAND

                                        LL
COLESROOK
                           ^BARKHAMSTED
                                           EAST

                                           GRANBY
                                                                    WINDSO
                                                                     LOCKS
           ^X
           * \
     WINCHESTE
                                    CANTCX  /
     TORRINGTON
                   HARTFORD

                 L
                           BURLINGTON1 \
                                                FARMINGTON
    tKISTIMC OiU


•I EX :STIM6 RESERVOIRS


•-— TOWK BOUMOAMV


"    COUHTV BOUNDARY


~— STATt eOUNOARY
                                PLAINVILLE °
                                   6-3

-------
"LOCATION AND  EXTENT

The Farmington River  Basin,  the fourth largest subbasin of the
Connecticut  River  system,  is located in southwestern Massachusetts
and north-central  Connecticut 
-------
(4) The Pequabuck River.  The Pequabuck River has its source in
Harwinton, Connecticut, flows southeast for about 5 miles, east
for about 7 miles, and thence northeast for about 5 miles to its
confluence with the Farmington River at Fannington, Connecticut.
It has a drainage area of 58.4 square miles and a total fall of
about 780 feet.

(5) Salmon Brook.  Salmon Brook is about 2.1 miles in length with
a total fall of about 10 feet.  It is formed by the confluence of
2 branches, each of which has an approximate length  of 11.5 miles.
The West Branch Salmon Brook rises in Hartland, Connecticut and
flows in an east-southeast direction; and the East Branch Salmon
Brook has its source in Granville, Massachusetts, and flows in a
southerly direction.  The 2 branches merge near Granby Station in
the town of Granby, Connecticut, to form Salmon Brook, which in turn
flows southeast to its confluence with the Farmington River near the
village of Tariffville, Connecticut.  The West Branch Salmon has a
total fall of about 965 feet, and the East Branch Salmon has a total
fall of about 505 feet.  The combined drainage area of the Salmon
Brook and its 2 branches is 67.3 square miles.

(6) Minor tributaries.  There are also a large number of smaller
streams in the Farmington River system, many of which are sources
of high runoff during periods of intensive rain or rapid snowmelt."

Table 8-1 contains information about the locations and drainage areas
of the principal tributaries of the Farmington River.

The tributaries, in general, begin as drainage ways from the swamps
and ponds which are formed in the upland valleys.  The velocity of
flow in these upper reaches is often low.  Where the tributary leaves
these upland areas, the slopes increase and the stream becomes a
rushing "mountain" brook.  Downstream, where the main stream starts,
the slopes are flatter, the channel is wider and deeper-and the flow
velocity again becomes low.

Consider the main stream (also called the main stem in this work)
is the Farmington River extended up the West Branch, Farmington
River for its full length.  This results in a "main stem" that has
a  total length of 79 miles.

The upstream-most four miles of the main stem has flat slope and flow
is from swamp to pond.  For the next 32 miles (to mile 43), the
stream slope is steep and the water rushes over the rocky bed.
From mile 43 to mile 39, the water passes through a small impoundment
over two small dams and through a steep, rocky gorge.  At mile 39
the river enters the main valley; slopes are flat, and the channel
becomes deeper.  Excepting for passage through another gorge, from
mile  14 to mile  12, where-the slope is again steep, the river flow
 to the  outlet  into  the Connecticut River is characterized as valley
 flow.
                                 8-6

-------
                             TABLE  8-1

                   Principal Tributary  Streams
                          Farmington  River
scream D


Farmington River, at mouth
Salmon Brook
East Branch Salmon Brook
West Branch Salmon Brook
Bissell Brook
Hop Brook
Pequabuck River
Copper Mine Brook
Negro Hill Brook
Roaring Brook
Nepaug River
Cherry Brook
East Branch Farmington River
Hubbard River
Valley Brook
West Branch Farmington River
Still River
Sandy Brook
Mad River
S locum Brook
Clam River
Buck River
rainage Area
(sq. miles)

602.0
67.2
33.5
19.9
6.4
13.0
58.4
18.1
3.9
7.6
31.8
13.1
65.8
20.5
7.1
236.0
86.6
33.8
33.3
9.2
32.0
8.9
Source: Interim Report on Review of Survey,
Miles from
Mouth of
Farmington
0
14.3
16.4
16.4
17.7
19.5
31.3
39.0
42.0
35.5
42.5
43.1
46.3
58.3
58.3
46.3
55.0
56.3
60.9
60.7
65.2
67.3
Farmington River Basin,
New England Division, Corps of Engineers, Waltham, Mass.  December, 1958.
                                8-7

-------
8.1.3  Streamflow Regulation
StreamS.low in the Farmington Basin is  regulated by no less than ten reser-
voirs or  impoundments, which are  located as  shown on Figure 8-2.   For a
description of the reservoir use,  operating  rules and other features of
each reservoir and control  structure,  the reader is referred to Appendix
A3.2.

Other reservoirs  exist in the  Farmington Basin, but their effects on the
Basin have been neglected.  The Whigville Reservoir, owned by the city of
New Britain, is a part of that city's  water  supply system.  The tributary
area is relatively small, 3.95 square  miles, and the reservoir contains
only 5 million cubic  feet when full.   The reservoir was built in 1908.
The regulatory effects of Whigville Dam have been neglected because they
are embedded in the data of gage  1890, which is located downstream.
Similar reasoning accounts  for neglecting the several small reservoirs
in the city of Bristol water supply system.

8.1.4  Streamflow Data
Records of observed stream  flow in the Farmington Basin are obtained and
processed by the  U. S. Geological Survey. Data are available for thir-
teen locations in the Basin, as shown  in Figure 8-3.  A brief description
of the location and years of record are listed in Table A3-3 of Appendix
A3.

At the time the historical  Streamflow  data on magnetic tape were obtained,
in the early months of the  project, data were available only through the
1963 water year which ended in September, 1963.

8.1.5  Population and Wastewater  Discharges
Population figures, current and projected, for the Farmington Basin are
contained in Tables A3-20 and  A3-21 of Appendix A3.  Waste loads are.
dependent upon population and, in this work, are a primary reason for
interest  in numbers of people  and their locations.  Waste load figures,
current and projected, are  contained in Table A3-22, Appendix A3.  To
convey a  feeling  to the reader of the  distribution of population and
waste loads in the Basin, Figures 8-4  and 8-5 are included.  The princi-
pal population centers, with projected 1970 and year 2000 populations
indicated, are shown  on Figure 8-4 while wastewater discharge rates
for like  periods  are  shown  on  Figure 8-5.

The population and wastewater  information was obtained from the report,
Water Resources Planning  Study of the Farmington Valley by The Travelers
Research Center,  Inc., Hartford,  Connecticut, February, 1965.

8.1.6  Water Supply
The hydrology of  the  Farmington River Basin, and as a consequence,  the
water quality in  its  rivers,  is  affected to a considerable extent by the
diversion of water from the Basin for water supply.


                                 8-8

-------
M
                                                   PIGURE   8-2
                                                  LOCATION    OF
                                            REGULATING   RESERVOIRS
                          OTIS  RESERVOIR
                      COLEBROOK
                         RESERVOIR
                           GOODWIN
                            RESERVOIR
     MAD RIVER
       RESERVOIR
                                  BARKHAMSTED
                                    RESERVOIR
                  HIGHLAND
                    LAKE
                                  COMPENSATING
                                    RESERVOIR
                                                           RAIN/BOW
                                                               RESERVOIR
                       NEPAUG  rf'
                     RESERVOIR r
SUCKER
BROOK
RESERVOIR
                                                                  SCALE  IN
                                                                    i L e 3
                               8-9

-------
          F IG URE   8-3
          LOCATION  OF
    STREAM  GAGING STATIONS
        NUMBERS INDICATE
     USGS GAGE  DESIGNATION
                        0  I  234
                         SCALE IN
                          MILES
       890
8-11

-------
                                             FIGURE
                                         LOCATIO N
                                         POPULATION
                                          8-4
                                            OF
                                           CENTERS
                                          PLACE  (600, 1200)
                                          INDICATES  1970  POP = 600
                                                     2000  POP = 1200
                  OTIS
                  620, 1170)
 WINSTED
(11800,18800)
                                  GRANBY
                                    (8200,35000)
                                    SIMSBURY
                                    (12819,23869)
         NEW  HARTFORD
          ,(3533,5632)
                                              AVON
                                              (6886,15336)
COLLINSVILLE
  ( 5892,11142)
                                               WINDSOR LOCKS
                                              /(!838,4520)
                                            X   I   !(
                                                  BLOOMFIELD
                                                    1(4840,5200)
                                                      ll
                                                   J WINDSOR
                                                       (4088,5880)
                                                                r
                                              FARMINGTON
                                              "(15406,25406)
                                                                    3  4
            PLYMOUTH
            (7685,9150)
                                                SC4.L E  IN
                                                  lies
                                 BRISTOL
                                 55000,84300)
                               8-13

-------
                                      FIGURE   8-5
                                     LOCATION   OF
                                WASTEWATER  DISCHARGES
                                     PLACE  (1.00,2.00)
                                     INDICATES  1.00 IS 1970
                                     AND  2.00  IS YEAR 2000
                                     PROJECTED  DISCHARGES,
                                     MILLION  GALLONS / DAY
         OTIS
         (0.04,0.11)
                                             GRANBY
                                             (0.53,3.32)
      WINSTED
     (1.74,2.96)
                           SiMSBURY
                           (1.11,2.54)
 NEW  HARTFORD
 (0.28,0.56)
COLLINSVILLE
   (0.20,1.11)
 AVON
(0.59,1.60)
                                       FARMINGTON
                                         2.41.4.04)
                  WINDSOR LOCKS
                   (1.08,1.95)
                    ) BLOOMFIELD
                      '(047, 0.62)

                        WINDSOR
                         (1.28,2.09)
PLYMOUTH 1
 (0.82.I.I8T
                  SCALE IN
                    MILES
                      .BRISTOL
                      i 9.00,14.43)
                    8-15

-------
There is  available for diversion approximately 100 million gallons per
day (mgd)  firm supply (3).   At present, Metropolitan District Commission
(MDC), the water utility for a major portion of the greater Hartford
area, is  diverting about 55 mgd from the Barkhamsted and Nepaug Reser-
voirs. MDC considers that  the firm supply from these two reservoirs is
82 mgd.   The demand is expected to reach that rate about 1978.

The history of the Hartford water supply is interesting and is briefly
related here as background  information.  Prior to 1916, Hartford obtained
water from the eastern slopes of Talcott Ridge which, for a considerable
distance, forms the eastern boundary of the Farmington Basin.  Refer to
the location map, Figure 8-6.  In 1913, construction was begun on Nepaug
Reservoir and by 1916 water was diverted from the Farmington.  To com-
pensate the downstream riparian owners for the loss of water during low
flow periods resulting from this diversion, Compensating Reservoir was
built on  East Branch Farmington River.  In 1929, MDC was formed and
became the regional water utility.  When the demand for diverted water
increased, Barkhamsted Reservoir was built a short distance upstream of
Compensating Reservoir.  Later, in 1961, to replace the compensating
water lost for that use by  its storage in Barkhamsted Reservoir, Goodwin
Dam  (Hogback Reservoir) was built on West Branch Farmington River.  Com-
pensating water was then supplied from Hogback Reservoir with the stored
water in Compensating Reservoir held in reserve.

The  latest change is the construction, by the Corps of Engineers with MDC
participation, of the multi-purpose Colebrook Dam and Reservoir located
in the pool of Hogback Reservoir.  Additional water will be available for
water supply and for compensating riparian owners from Colebrook Reser-
voir.  The plan for development of this additional water supply calls
for  construction of a tunnel from Hogback Reservoir to Barkhamsted
Reservoir to divert the needed additional supply from the West Branch to
the  MDC system  (4).  The empty level at Hogback Reservoir is at elevation
540  (overflow is at elevation 640) and the overflow level of Barkhamsted
Reservoir is at elevation 530.  This system is expected to develop  the
full 100 mgd water supply capacity of  the Farmington River, estimated to
provide adequate water supply to MDC until the year 2000  (1).

The  operating plan for the completed system is to hold the Barkhamsted
pool at elevation 520, ten feet below  the spillway level and divert from
Hogback Reservoir only enough water to maintain that level.  The balance
 of the system will be operated as it is now  (4).

 8.1.7 Hydroelectric Development
 In the past, the Farmington  Basin contained several hydroelectric gener-
 ating systems but only one of any consequence  remains.  The  system  at
 Rainbow, near Windsor Locks,  Connecticut, remains in operation for
 peaking purposes.  The system is owned and operated by the Farmington
 River Power Company.  The fall  is about 50 feet at Rainbow Dam and  the


                                  8-17

-------
                             FIGURE 8-6
                      WATER SUPPLY SYSTEM
                     METROPOLITAN DISTRICTIC
                             COMMISSION
  GOODWIN
  r RESERVOI
  S)
             BARKHAMSTED
                RESERVOIR
               COMPENSATING
                  RESERVOIR
PAUG
   RVOIR
                 "PIPE
               v *r~ LINE
                              FILTER
                              PLANT
           8-19

-------
operating pool contains about 100 million cubic  feet  of water.

Generation is usually scheduled to meet peak loads without  exceeding  the
limits of pond capacity.  Normal gate and flashboard  leakage  amounts  to
25-50 cfs (5).  The flow in the Farmington River immediately  downstream
from Rainbow Dam is this leakage plus the water  released  through  the
turbines, the latter being intermittent.  Spills, water passing over  the
overflow, are infrequent.

8.2  Preparation of Input
The simulation model is in two parts, the stream gage flow  generator,
FLASH, and the stream flow and water quality simulator, WASP.  These
two parts have been set up as separate entities  because the combined
program size, about 426,000 bytes, exceeds the normal core  storage capacity
of many computers.   With only minor programming  changes,  the  two  parts
can be combined.

8.2.1  Input to FLASH
The input to FLASH is prepared by using the three preliminary programs,
CHKDATA, NORMAL and TFLOW described in Section 6 and  Appendix A4.
CHKDATA receives raw stream gage data on cards or tape, edits, fills
missing data and computes weekly gage data and outputs this information
on tape for input to FLASH.  NORMAL scans the tape prepared by CHKDATA
and outputs information which guides the operator in  selecting the proper
transformation.  TFLOW also uses the tape prepared by CHKDATA to  output
information which guides the operator in selection of basis gages.

The input to FLASH consists of the edited data tape from  CHKDATA  and values,
selected by the operator, for a series of control variables which instruct
the computer how to proceed and what to output.  No deviation from this
general method was needed to apply the Farmington River Basin data.

8.2.2  Input to WASP

8.2.2.1  Hydrologic Data
Simulation of hydrology requires synthetic gage  data  from FLASH,  reach
and drainage area information and flow regulation information.  Reach and
drainage area information were prepared from maps and information gathered
In reconnaissance of the Basin.  The basic data  are contained in  Appendix
A3.  The programming in subroutines TGEN and TRAN prepares, internally,
the data necessary for simulation of unregulated flows.

Regulation of flows requires that operating rules and physical character-
istics of the regulating device, for all possible conditions of operation,
be programmed.  Operating rules have been programmed  for  the basic data
and information described in Appendix A3.

-The reservoir operating rules have been programmed in relation to the
                                 8-21

-------
depth of water in the reservoir pool and the reservoir capacity at over-
flow.  The physical characteristics of each reservoir have been cast in
mathematical terms which are listed in Table 8-2.  The equations are
"least squares" best fit equations developed from curves or tabulated
data.

The correction for evaporation in reservoirs was made using the equation:

               E - 0.6125 sin (7.5L+252°44') + 0.8175   .... [Eq. 8.1]

which was developed by "least squares" fit of the data contained in
Table A3-5 in Appendix A3.  E is the evaporation rate in inches per "week"
and L is the week of the year (L=l,...48).

The corrections for withdrawals for irrigation were indexed by reach and
week and applied at the proper time and place by program checks made in
reach and week "do loops."  The corrections for the Farmington River are
contained in Table A3-23 in Appendix A3.

Water supply diversions from Barkhamsted and Nepaug Reservoirs were pro-
grammed as periodic equations in six harmonics, prepared using the program
FITCRV (see Appendix A2).  The equations are:  for Barkhamsted,

    DB = 21.10 + 10.4923 cos(L+l.3312) + 4.5649 cos(2L40.2589)

         + 3.5464 cos(3L-2.3756) + 2.2172 cos(4L+1.6153)

         + 0.9459 cos(5L+3.0593) + 1.2392 cos(6L-0.8807)   . .  . [Eq. 8.2]

and for Nepaug:

    DJJ - 25.25 + 7.9133 cos(L-2.7662) + 2.9285 cos(2L-3.0423)

         + 1.9733 cos  (3L+0.6910) + 2.1480 cos(4L-1.6692)

         + 0.7230 cos(5L+2.1691) + 0.6434 cos(6L-0.8756)   . .  . [Eq. 8.3]

D is the diversion rate in million cubic feet per  "week" and L is the
week of the year.  These equations were developed  from data contained  in
Tables A3-10 and A3-16, Appendix A3.

8.2.2.2  Water Quality Data
Simulation of water quality requires the regulated flow in each reach,
furnished by the hydrology simulation described  above, temperature  data,
waste  load data including rate  of flow, BOD and  DO concentration, values
for parameters K-, , r and  s for  river reaches, values  for parameters K2
and K3 for reservoir   reaches and initial values  for  the BOD and DO in
 the  reservoirs.   In addition, values for  constants c,f,k and m are  needed
                                 8-22

-------
                              TABLE 8-2

               Capacity-Depth and Area-Depth Equations
                     Farmington Basin Reservoirs


Reservoir                                          Equation**

Otis                      Capacity:        C = -0.55 + 6.0d + 0.86d2
                          Area:            A = 1.65 + 1.95d
Colebrook                 Capacity:        C = 537 - 12.Old + 0.1614d2
                          Area             A = 0.4 + 0.1692d + O.OOOSd2
Barkhamsted               Capacity         C = 2009 + 71.5d + 0.567d2
                          Area:            A = 70 + 1.167d
Sucker Brook              Capacity         C = -0.535 + 0.104d + 0.0205d2
                          Area:            A = 0.0408d +-.161
                          Outlet:          Q - 16.25d°'4874
Rainbow                   Capacity:        C = 81.8 - 5.33d + 0.15d2
                          Area:            A = 1.69 + 0.006d + 0.0031d2
Goodwin                   Capacity:        C = -14 + 0.073d + 0.04d2
      ^                   Area:            A = -2.63 + 0.14d - 0.0004d2
Nepaug                    Capacity:        C = 494 + 26.5d 4- 0.21d2
                          Area:            A = 25 + 0.5d
Compensating              Capacity:        C = 90.8 + 7.2d + 0.21d2
                          Area:            A = 7.10 + O.Ald
Highland  Lake             Capacity:        C = 233.5 + 13.46 -I- 0.32d2
                          Area:            A = 13.72 + 0.624d
Mad River                 Capacity:        C = 25.3 - 1.944d + 0.0276d2
                          Area:            A = 0.1122 - O.OOlSd + 0.0003d2
                          Outlet:          Q = 42.2d°'48


 For top  24 feet  in  reservoir.

  C in million cubic feet, A in million square feet, d in feet, Q in cfs.
                                 8-23

-------
 to  compute velocity and depth by equations [6.7] and [6.8].

 River water temperature data were available for only one location in the
 Farmington Basin and for slightly more than one year.  The data are con-
 tained in Table A3-6 in Appendix A3.  These data are expressed by the
 equation:

                    T = 12 sin (7.5L+2400) +11   	[Eq. 8.4]

 obtained by a least squares fit of the data.  In equation  [8.4], T is the
 temperature in degrees centigrade in the Lth week of the year.  The mean
 recorded temperature is 11°C.  There were not enough data  to be able to
 compute the standard deviation.  In the Farmington simulation, temperature
was considered deterministic and had the value given by equation [8.4].

Data on waste loads discharged by treatment plants in the  Farmington River
Basin are meager.  Determinations are not made by the plant operators,
but the Connecticut Water Resources Commission does make infrequent
 (average of two per year) determinations on one-day composite samples.

 In  the simulation runs made, the waste discharge rates have been computed
 on  the basis of:  (1) 100 gallons per capita per day, (2)  a raw sewage
 BOD of 220 mg/1 and 90 per cent BOD removal by treatment,  leaving a BOD
 concentration of 22 mg/1 in the discharged waste, (3) a DO concentration
 of  2.0 mg/1 in the discharged waste, (4) K]_ at 20°C equal  to 0.276 and
 (5) values of r and s equal to 0.005.  In the reservoir reaches, values
 of  K2 at 20°C have been assumed 0.10 for Otis, Colebrook,  Sucker Brook,
 Goodwin, Nepaug and Highland Lake and 0.15 for Barkhamsted, Rainbow,
 Compensating and Mad River Reservoirs; the lower value is  used for deeper
 and more wind-protected impoundments.  The value for {£3 of 0.005 was used
 in  each reservoir.  Values of initial BOD and DO concentrations  in the
 reservoir were each placed at 0.2 mg/1, excepting for Rainbow Reservoir
 which is downstream of waste discharges.  Values of 0.5 and 1.5 mg/1,
 respectively, were assumed for Rainbow.  The effect of these initial values
 is  removed after one or two weeks of simulation.

 The evaluation of the constants c,f,k and m for the velocity and depth
 equations was made by analyzing the plots of data from Table A3-4,
 Appendix A3.

 Recall that a requirement  is that the frequency distribution of the flows
 must be  the same for various points along the river  to be  able to use
 the relationships in equations .[6.6],  [6.7] and  [6.8].  A  plot of the
 cumulative frequency of  the  data for the  four stations for which cross
 section-velocity data were available is shown as Figure 8-7.  This plot
 shows that the frequency .distributions  of the flows  at the four stations
 are nearly the same, so  that it will be acceptable  to use  these relation-
                                  8-24

-------
ships.   Incidentally,  the cumulative frequency data used to plot Figure
8-7 are  obtainable from the output of NORMAL.

Data for stations 1-1860, l-t!878, 1-1890 and 1-1895, for flow versus width,
flow versus depth and  flow versus velocity are plotted as shown on Figures
8-8 through 8-19.  Straight lines were drawn by eye through the plotted
points  and the coefficients were determined.  The values found result in
the following equations:

                         w = aQb = 36.68Q0'11	[Eq. 8.5]

                         d = cQf = 0.241Q0'33	[Eq. 8.6]

                         V = kQm = 0.113Q0'56	[Eq. 8.7]

The values of c,f,k and m determined above give reasonable values of velocity
and depth in the Farmington River.  During August, 1968 cross sections were
measured* and, where possible, current meter velocity readings were taken.
Unfortunately, the flow in the river was so low at that time that depths
were too small to accommodate the meter, or, if the depth was great enough,
the flow was pooled by downstream obstructions.  In one cross section, at
the Old Farmington Bridge near Farmington, Connecticut, the flow was mea-
sured at 117 cfs, average depth was 0.96 feet, width at surface was 78 feet
and the average velocity was 1.58 feet per second.  Application of equa-
tions [8.5], [8.6] and [8.7], using Q=117 cfs, gives d=1.16 feet, w=62
feet and v=1.63 feet per second.

8.3  Simulation Results

8.3.1  Preliminary Programs
The application of the programs CHKDATA, NORMAL and TFLOW to the Farmington
River historical stream gage data is described below.

The program CHKDATA was used to check, edit and compute average weekly or
average monthly historical gage data.  The "raw" data used were obtained
on magnetic tape from the U. S. Geological Survey, Washington, D. C.
These data contained no missing values.  However, data values were removed
to test the program's ability to: (1) detect and fill missing data values
if less than 30 consecutive days of data were missing,  (2) detect and call
EXIT if more than 30 consecutive days of data were missing, and (3) detect
and call EXIT if, for all years of data being checked, all data for one
day of the year were missing.  The program functioned properly in these
 tests.  In addition, CHKDATA was asked to output successively, daily data,
average weekly data and average monthly data.  It performed as required.


  by G. R. Grantham
                                   8-25

-------
      1.0
                                                   FIGURE 8-7

                                                 HISTORICAL DATA

                                               CUMULATIVE  FREQUENCY
 •

'
     <
     • >
     _i
     'i
     ^
     >
     .-

     •
     •

     -
     UJ

      •
     :•


     5
2
                              1878
                                      1890
                                  25
                                                  50
                                        Q,    PERCENTILE
75

-------
                                          FIGURE-8-8
                                     CONSTANT EVALUATION
                                      HYDRAULIC FORMULAS
GAGE  I860
                                                              WIDTH- Q
10
       1.5
                                        0, CFS

                                       8-29

-------
     FIGURE  8-9
CONSTANT EVALUATION
 HYDRAULIC FORMULAS
                          STATION  I860
                          DEPTH-Q
  Q, CFS


   8-31

-------
     FIGURE 8-10
CONSTANT EVALUATION
 HYDRAULIC FORMULAS
                              GAGE  I860

                              VELOCITY-Q


                                           000
  8-33

-------
                                           FIGURE 8-11

                                      CONSTANT EVALUATION

                                      HYDRAULIC  FORMULAS
                                                            STATION   1878


                                                            WIDTH  - Q
U.
  ±H
   H
 effLtH:

    i±l±i±
                ••T:

                ~'~T- :'::
                                T±
                        ^lIiiLl^;-^!!
                                                 ~T~

                                                 :H1:
ti'jTii
                                      ::HiJ irrHjl^
                                      ieiifiliiii
                                                                     —£-—

                                                                                  -1H
                                         Q, C FS
                                        8-35

-------
w-F-r
•
i,
7

5
*-
I
.5
2-
.5.
;
•
i
•
•
•
2.5.
!
1,5
I.J





: -:



• . -










































: : :









'


,












;








i


1.5




: ::v.






'
:





.














'






,

2




X























































.


















'







'







1

.





























































.











•

'

FIGURE 8-12
CONSTANT EVALUATION
HYDRAULIC FORMULAS














.










1
2.5 3 456







.





'
















---
















: •'#
'•:'
flli

























....









































*


'


7 8 9 10
10
Q, CFS
8-37







































:





1.5


-n 1
" "! "-]




STAT
DEPT
• r 	


.





























:














r
2 2.5






























•












'






•
: :


.


: -
.
.















ON
-
•










.








.

:





1878
1











.




1









.







.
.

:


[


























3 4 i 6







- .:






















-





%







.



















789'
II
H
IL
1 -
<
C)
III
;>
(.
CD
<
m
H-
C.
Ul
Q

-------
                                                 FIGURE  8-13
                                           CONSTANT  EVALUATION
                                           HYDRAULIC FORMULAS
                i    HYD
STATION  1878

VELOCITY - Q
  KfCiri
  M:
13.:
 Lt
                                          w
                                      J i.
                                                                                t-':!"]r;

                                                                                             	I	;
 « ^T;:.H...:
  ^:gy
  ±|±j:ri:| [j
     %ft
     .
      L
                                                                           :r;:-«:l..j;:|,
                                                                           LJ.:J-;l:_.i
         1.0
                   2,5  3
.i_::.: L'-ii
                                                                             .L_i...;.
                                  a   6
                                         7  8  fl  1U
                                                 1C

                                               Q , C F

                                            8-39
                                                                   2.5   3
                                                                                  5   6789
                                                                         I 00

-------
                                                 FIGURE  8-14
                                           COi-JS'iAr'T  EVALUATION
                                            HYDRAULIC  FOM.ViULAS
STATION   1890

WIDTH - 0
i. ±1.
                                                                                     Jili
3,

U.
u.

 is:
   i-
   it:
    H'l-t;-:x
    -|;.!.~;T
         1,3
  10
                                                                         i •-—i
                                                                               I  i
4     >    6   7   0  S 10
                   100
                 0 , C F S
                                                                                    0   b   7
                  8  S i',
                     1000

-------
     FIGURE 8-15
CONSTANT EVALUATION
 HYDRAULIC  FORMULAS
STATION   1890
                          DE PTH —Q

          _!_;
                                             9 1C
                                             1000
   Q, CFS
  8-43

-------
     FIGURE 8-16

CONSTANT EVALUATION
 HYDRAULIC  FORMULAS
STATION  1890

VELOCITY - Q


 8  9 10
     100

  Q, CFS


  8-45
              769
                    IOOC

-------
                                         FIGURE  8-17
                                   CONSTANT EVA LUATiON
                                    HYDRAULIC FORi.ULAS
                                  STATION   1895
                                                             WIDTH -  Q
  "1 ' :
  -T-! ; :
                                                         T~
    mm
       • h-  !-:
                                            -f-—:
                             ;_..!.'_ i_^:....}_	L	.. i.^"_:.:.;.
                                                                       m
                                                                           ~r
                                                                              I - - i
                                                                          -P-4-
                                                                      IE
                                                                                  tt
15. i
  IS!
                  — -f-
                    . -1-
                                                                              t~V 1
                                                                                  — •.—r:t—n
  UV:! i'.
  tm;
  J-;-1

                                                 "v-:
                                         	j.:L~:"":-:- -;
                                         : : ;.: !:_-." :; " i
  gTLi::
      i

                                         '"
                                 .    .    .-.-.•(-••     •• |-..- |
                                   ! .  . '          '   '   - ' -
                                                   :.L..  . _L
  10
        1.5
                 2.3  3
4    5   fa   'I  6 S lu
                 100
                                                    l.j
                                                         2   2.0   3
                                                                           5   b   7  8  9
                                                                                      1000
                                       Q,  C F S


                                         8-47

-------
                                           FIGURE 8-18
                                     CONSTANT EVALUATION
                                      HYDRAULIC  FORMULAS
                          STATION  ISS5


                          DEPTH - Q
  ii
     I -I-!.
     [ii
p;;- i- •
. .. ; .'.'. ...! . ""..
. \.'..
!•
-
; • j
t ; ;
„.....;]..„
:T :j::
• :i ';
iirlviJT-

iti]

. . :
j

— 	 _. i .
.:.'l . . , ! : „
TrfH i i-i-f
".ITIi'lTil..! :
! i • ' :
; ;-,;!
i!:!

      1.5
10
                2,5
?  8  9  10
      100

   Q , C F S


   8-A 9
                                                  1.5
                       _J	L
                        2.5   3
"4 	5~  6   7
                9 K.

                 10 0 0

-------
     FIGURE 8-19
CONSTANT EVALUATION
 HYDRAULIC  FORMULAS
                                 STATION   1895

                                 VELOCI T Y - Q
           .
     . /-.  ;




             .

                                 5  67891
5   6  7  8 9 ti
  Q, CFS


  8-51

-------
 The  program  CHKDATA read,  checked  and edited  all  available  Farmington
 River  Basin  TJSGS historical gage data (see Table  A3-3),  computed average
 weekly flows and both  printed and  punched cards as  output in  8.77 minutes
 execution  time  on  an IBM 360/50 computer.  In doing so,  4,510 lines were
 printed and  3,648  cards were punched.  The total  charge, at. $200 per
 hour of computer time, with adjustments made  for  punching cards, was $48.70.

 The  program  NORMAL was given average weekly gage  data, prepared by CHKDATA,
 for  all the  USGS gaging stations in the Farmington  River Basin and was
 instructed to determine if the data were normally distributed and, if not,
 which  of six transformations normalized the data  within  the test limita-
 tions  imposed.  The program performed as directed and produced the results
 given  in Table  8-3.

 The  data.dn  Table  8-3  indicate that for the Farmington Basin  the trans-
 formation most  likely  to normalize streamflow data  is the log transforma-
 tion.   It was found, however, that the log transformation does not always
 normalize these data and that a check should  be made to  assure that it
 does so.  Wherever the log transformation failed  to normalize these data,
 it was  the best of the transforms  tried, based upon the  criterion of
 minimum value of the maximum cell  difference  (see Section 6.3.2.2).

 Five additional scale-changing transformations were tried on  the five sta-
 tions which  were not normalized by the transformations shown  in Table 8-3.
 The  results  are shown  in Table 8-4.

 Note that none  of  the  twelve transformations  normalizes  the data from
 stations 1-1855 and 1-1800.  Of those tried,  the  transformation,
 qa.qO.10^ produced  the  distribution nearest to normal for both stations.
 In both instances,  the test failed in only one of the 17 cells and by
 0.0025  for stations  1-1855 and by 0.0049 for  station 1-1880,  based upon
 the  total cumulative frequency equalling 1.000.   The implication is that,
 for  these stations,  the normalizing transform is  not of  the type q^Q*5.

 The program  NORMAL,  running on all Farmington River Basin historical
 stream  gage  data,  and using the seven initial transformations, as indicated
 in Table 8-3, required 4.94 minutes execution time  on the IBM 360/50
 computer at  a cost  of $16.46.   The number of  lines printed was 3,198.

 Recall  that  NORMAL  contains programming to determine the normalizing
 transferors)  for the average flows for each week  of the year,  the dis-
 tribution being computed over the number of years of data.  This feature
 of the  program was  tested on data from two stations and was found to
 give the desired result.   Forty-eight times as much data are  produced
when distributions  of weekly data are obtained as when the distributions
 are computed  using all the data for each station.  The execution time will
be, however,  only about three times longer.


                              f 8-53

-------
Gaging
Station
1-1855
1-1860
1-1861
1-1865
1-1870
1-1873
1-1874
1-1878
1-1878.5
1-1880
1-1890
1-1895
1-1900
Years of
Data**
49
7
6
14
25
16
22
33
41
31
21
16
23
                                TABLE 8-3

                           Results  of Tests  for
                        Normalizing Transformation
                                      Transformation Number*
                                  234567
                                                                 ***
transformations are:   (1) q - Q°'25,  (2) q - Q0'5,  (3) q - Q°'75.
 (4) q - Q,  (5) q - log Q, (6) q - log(Q+0.25y)  (7)  q - log(Q+0.5j),

**0ne year of data lost in converting  from "water year" to calendar year
  (see Table A3-3).

***+ indicates transform normalizes; - indicates transform does not
   normalize.

-------
                              TABLE 8-4

                           Results of Tests
                        Additional Transforms
Gaging Station                          Transformation Number
                                   8      9      10      11      12

1-1855                             -

1-1870                                                            +

1-1874                             +      +       -r       +

1-1878                                            +

1-1880                             -


transformations are:  (8) q - Q0'10, (9) q - Q0-05, (10) q - Q°'15
 (11) q - Q0-20, (12) q - log(Q-O.lii) .
The program TFLOW, designed to guide the operator in selection of basis
gages for simulation, was given edited historical average weekly gage data
for the eight gaging stations from which suitable data are available
for simulation and was Instructed to compute correlation coefficients
for various combinations of basis and "estimate" gages.  The program
performed as directed and produced the data given in Table 8-5.

Table 8-5 contains only a few of the possible basis-estimate gage com-
binations (there Sre 5714 possible combinations if there is used at least
one basis gage and one estimate gage).  To find the optimum combination,
defined as the combination having the highest overall correlation coeffi-
cient, would be a lengthy process.  It would be an interesting exercise,
beyond the scope of this work, to develop an algorithm that would find
the optimum combination, or the combination having the least number of
stations, while still having a correlation coefficient of  .9500.

If the correlation coefficient value of 0.9500 is considered indicative
of acceptable correlation, then the test results in Table  8-5 indicate
that:

(1)  gages 1874 and 1900 likely could be eliminated as basis gages if
gages 1855, 1865, 1880, 1890 and 1895 were retained as basis gages.
(2)  gage 1865 likely could be eliminated as a basis gage  if gages 1874,
1878.5, 1890, 1895 and 1900 were retained as basis gages.


                                 8-55

-------
                               TABLE 8-5

                        Correlation Coefficients
                       For Various Basis-Estimate
                           Gage Combinations

 Run No.        Basis Gage Numbers*        Estimate Gage       Correlation
                                              Numbers          Coefficients

 1         1855, 1865, 1880, 1890, 1895        1874               ,9697
                                               1878.5             .6742
                                               1900               .9532
 2         1855, 1865, 1874, 1878.5, 1900      1800               ,9143
                                               1890               ,9198
                                               1895               .9326
 3         1855, 1874, 1878.5,  1895, 1900      1865               .9483
                                               1800               ,9042
                                               1890               .9150
 4         1855, 1865, 1874, 1880, 1890        1878.5             .6584
                                               1895               .9464
                                               1900               .9470
 5         1855, 1865, 1874, 1878.5, 1880      1890               .8973
                                               1895               .9347
                                               1900               .9384
 6         1874, 1878.5,  1890,  1895, 1900      1855               .9469
                                               1865               .9595
                                               1880               .9389
 7         1878.5,  1880,  1890,  1895, 1900      1855               .9213
                                               1865               .9345
                                               1874               .9365
 8         1865, 1880, 1890, 1895, 1900        1855               .9459
                                               1874               .9578
                                               1878,5              .7062

 *USGS  gage designations
 (3)   gage  1874  likely  could be  eliminated as ft basis gage if gages 1865
 1880,  1890,  1895  and 1900 were  retained as basis gages.                '
 (4)   gage  1878.5  cannot be adequately represented by combinations of
 basis  gages  and therefore should not be eliminated.  By the same token
 however, gages  located near gage 1878.5 should not be eliminated because
 the effect of Rage  1878.5 extrapolated too far would result in poor
representation  of the  expected  flow values.

A subsequent run  of TFLOW using the six gages, 1855, 1865, 1878.5, 1880
1890, and 1895, as basis gages  and 1874 and 1900 as estimate gages re- *


                                   8-56

-------
suited in correlation coefficients of 0.9697 and 0.9533, respectively.
It is interesting to compare these correlation coefficients with those
in Table 8-5, run number 1.  Note that including gage 1878.5 as a basis
gage had negligible effect on the correlation coefficients of these two
estimate gages.

The above analysis of the results of TFLOW is not intended to be exhaus-
tive or conclusive; rather, it is included here to indicate how TFLOW may
be used in the selection of basis gages so that a minimum of them can
be employed.

The eight runs of TFLOW that produced the results shown in Table 8-5, re-
quired a total of 9.68 minutes of execution time for a University of
Florida billing cost of $46.58.  The output for each run produced 849
lines when the source deck was used and 239 lines when the object deck
was used.

8.3.2  Hydrologic Simulation
The hydrologic simulation is made in two parts.  The first part generates
simulated gage data through the use of the program FLASH.  The second part
converts the gage data generated in the first part to simulated stream
flow at the reach points in the river and makes the necessary corrections
to account for regulation.  This second part is carried out in the program,
WASP, through subroutines TRAN and REG.

The program coding as set forth in Appendix A4 separates the two parts of
the hydrologic simulation for the reason that together the total program
length presents a problem to all except the very large computers or
requires extra data storing facilities.  The procedure used in the
Farmington River application has been to place the output from FLASH on
magnetic tape which is read as an input to WASP.  It is not difficult to
combine the two programs.

The programs FLASH and WASP have satisfactorily simulated the streamflow
conditions in the Farmington Basin.  All of the regulation conditions
have been checked and the programmed operating rules control the releases
and diversions in the desired manner.  The programs output the simulated
gage data, unregulated stream flows, regulated stream flows, reservoir
inventories, releases, diversions and evaporation losses, all on a weekly
basis.

Figures 8-20, 8-21, and 8-22 are included to illustrate the hydrologic
and water quality simulation results.  Understandably, these figures only
show a very small portion of the total output.

The results of 100 weeks of simulated operation of Colebrook Reservoir
are illustrated in Figure 8-19.  These data were generated using a trial
set of release rules wherein the minimum release was 150 cfs and incoming


                                  8-57

-------
                            700
    FIGURE  8-20
SIMULATION OF OPERATION
 COLEBROOK RESERVOIR

-------
    FIGURE  8-21
SIMULATION OF OPERATION
 BARKHAMSTED RESERVOIR

-------
                  FIGURE 8-22
              SIMULATION OF WATER
                QUALITY-REACH 21
                                                                              10
                                                                              a:
                                                                              z
                                                                              200
                                                                               *
                                                                               o
                                                                              BO
30
           40
                      SO
                    WEEKS
                                 60
                                            ro
                                                       80
                                                                  90
                                                                             100

-------
flow greater than 150 cfs was stored unless the water supply and fisheries
pools were full.   Reservoir inventory, flow in and release rates are shown.

The results of 100 weeks of simulated operation of Barkhamsted Reservoir
are shown on Figure 8-21.  The operating program called for diversion
according to the demand curve (periodic curve) and release of water in ex-
cess of capacity at spillway level.  Note that overflow (release to down-
stream) occurs when the reservoir is full and the inflow exceeds the diver-
sion, according to plan.

The results shown on Figure 8-22 are generated by hydrologic and water
quality simulation in reach 21 for a two-year period (96 weeks).  The
dissolved oxygen (DO) concentration, flow in the reach and temperature
are plotted.  It is evident that the DO concentration is closely related
to flow but also it can be seen that the temperature has an effect.  Note
that the DO concentration recovers in the fall while the flow is still low
and that the DO concentration decreases in the spring while the flow is
still relatively high.

The computer can be programmed to produce the simulation data results
in graphical form.  Although the program for these plots is not difficult,
its preparation is not within the scope of this work.  Plotting programs
designed to output pictorial data would need to be prepared with a specific
objective in mind, such as the operation of a particular reservoir or the
quality of water in a given reach.  The programs contained in this model
could easily be extended to include this type of output.

In the application to the Farmington Basin an interesting problem was
encountered.  The span of historical data used contained record of the
storm of mid-August, 1955, which was a very extreme event.  On August !£,
1955, a hurricane centered over the Basin and the rainfall and resulting
runoff exceeded all records.  Pertinent data are shown in Table 8-6.  The
flow at gage 1900 was affected by considerable flood-plain storage.

The effect of such a storm is compounded when it is realized that the
normal August flows are usually at their minimum, often about 5 percent
of mean flows.  The problem encountered was in the computation of the
statistical parameters for the third week in August, wherein the standard
deviation turned out to be a relatively enormous value.  This resulted
in some wildly varying flows being generated for that week.  The variance
factor (third factor, right hand side of the generating equation [6.66])
can,for that week, override the effect of the regression factor and result
in a set of generated flows where an upstream flow is somewhat larger than
the flow at a downstream point.  While this is possible in long rivers and
at a given instant of time, it is not possible for rivers having a total
time of flow less than the averaging interval of the simulation.


                                   8-65

-------
                                TABLE 8-6

                   Records  - Storm of August 19,  1955
                         Farmington River Basin


 Gaging      Tributary       Recorded       Flow,    Rainfall     Annual Mea
 Station    Area,  Sq.Mi.     Flow,  cfs    cfs/sq.mi.  in./24 hr.   Flow, cfs n

 1855          90.5           16,100          178         6.6        192 Q
 1861          18.4           10,200          555        20.6         23*9
 1865          89.6           24,800          277        10.3        190*0
 1870         127.0           52,000          409        15.2
 1873          20.4           5,000          245         9.1         35 2
 1874           7.2           2,040          284        10.5         13'8
 1878          23.6           4,000          170         6.3         33*3
 1878.5         0.6              34          58         2.2          i'6
 1880           4.1             673          164         6.1         78'0
 1890          45.6           6,500          143         5.3         82*7
 1895          33.6          18,400         548        20.4
 1900         585.0          69,200         118         4.3       1029 0
 To eliminate the problems caused by this condition in the data,  the  pro-
 gramming was modified slightly to check for upstream flows in  excess of
 downstream flows and when found, to set the downstream flows equal to
 the next upstream flow.

 The occurrence,  during one of the simulation test  runs,  of an  extreme
 event  as a result  of the high variance for the  third week in  August
 allowed  a system check of the operating rules of the flood control reser-
 voirs.   In this  run,  Colebrook,  Mad River  and Sucker Brook Reservoirs
 were filled to overflowing and the program routed  the water in accordance
 with the programmed rules.

 Although the  overall  thrust in this work is to simulate water  quality in
 a  stream,  the programs first simulate  the  natural  and regulated stream
 flows and  can be  used, without modification,  if only hydrologic simula-
 tion is  needed.   A  saving in computer  time will result, however, if sub-
 routines QUAL and RQUAL and their  supporting  subroutines are removed
 during the hydrologic simulation.

The program FLASH read, from punched cards, 21 years  of historical weekly
average gage  data from six  basis gages  and  generated  thirty years of
simulated data for  these  six gages  in  10.3  minutes execution time at  a.
University of Florida billing  of $34.33.  The output was both placed  on
                                   8-66

-------
magnetic tape and printed on paper.  The printed output amounted to 2736
lines.

8.3.3  Water Quality Simulation
The water quality simulation is carried out by the program WASP and
particularly by subroutines QUAL and RQUAL.  Simulation runs have been
made using Farmington River Rasin data and the results appear to be
accurate.  Desk calculator computations have been made for situations
selected at random from the simulation output to check the computer-
made computations.   These have shown that the programming is correct.

In the application of the Farmington River data, the year 2000 wa.ste
loadings, assuming 90% BOD removal in treatment plants, have been applied
and it has been found that violations of the minimum stream standard of
4.0 mg/1 dissolved oxygen have been few.  Violations that did occur invari-
ably coincided with low flow and high temperature conditions.  Several test
runs wherein special water quality and/or regulation situations have been
imposed have been made and the results of these are described in Section
8.5 below.

The effect of placing a single extra heavy BOD loading on one reach during
one week, to simulate a possible industrial waste spill, was investigated.
A loading of 5.1 mgd having a BOD of 650 mg/1 was introduced at the upper
end of reach 19 (at Granby, Connecticut on Salmon Brook).  The rapid time
of flow carried the waste downstream before it exerted much of its demand,
until it was detained in Rainbow Reservoir.  Here, even with the substan-
tial dilution afforded by the main stream flow, the BOD was exerted, driving
the dissolved oxygen concentration to zero.  The DO also was zero in reach
1 below Rainbow Reservoir.  Actually, the printed output showed negative
DO concentrations in the Reservoir and downstream.  Because the system
equations (Streeter-Phelps) do not describe the negative DO situation, nor
does negative DO have accurate physical meaning, the program was modified
to check for a DO concentration less than zero and, if it is, EXIT is
called and the execution is stopped.

The program WASP, in object form, reading from magnetic tape the synthetic
gage data produced by FLASH, simulated the stream hydrology and water
quality for 30 years in an execution time of 25.38 minutes.  This is at
a rate of 0.846 minutes per year.  When the source deck is used, 3.4
minutes additional time per run is required.  Off-line printing by IBM
1401 computer is used for output of the generated data.  The cost of a
30 year run, using object deck and off-line printing is $84.60 for execu-
tion and $38.50 for printing, for a total billing of $133.10.

The output, amounting to 69,300 lines, contains weekly natural flows,
regulated flows, reservoir inventories, reservoir releases and diversions,
KI values, K2 values, minimum DO concentrations, BOD concentrations and
DO deficit concentrations for each reach.      For 48 weeks, 30 years and
43 reaches in the Farmington Basin, the output contains 61,920 sets of
data.


                                    8-67

-------
 8.4  Sensitivity Tests
 Sensitivity tests were run for eleven variables or parameters using the
 basic Farmington River data and year 2000 waste loads.   In the base or
 comparison run,  the normal values of all variables and  parameters  were
 used and the water quality conditions were simulated for a two-year
 period.   Then,  one by one, each of the eleven variables and parameters were
 given values different from their normal values and the water quality  con-
 ditions  were simulated, also for two years.   The same tape of gage data
 was used for each test so that the stream flow at each  point in space  and
 time was the same for each run, thus eliminating the variability caused
 by flow.

 The runs were analyzed by determining the mean difference in the DO concen-
 tration  for each reach and week between the  base run and the run in which
 a variable was  changed.  This was done for each of 18 reaches affected by
 the loading, for 15 weeks of the year and for two years, a total sample
 of 540 differences.  The 15 weeks selected were the summer weeks when
 the effect of the change is most pronounced.

 The variable change and resulting effect on  the average stream DO  for  each
 run are  summarized as follows:

 (1)  Run S-lt  The temperature of the water  was increased 10  percent,  from
 21.3°C to 23.4°C mean temperature.   The effect was to decrease the stream
 DO concentration an average of 0.3591 mg/1 with a variability indicated
 by a standard deviation of 0.0564.   Using the dimensionless form,  equation
 [6.132], the value of sensitivity function S£(K'  was given by
 -0.3591/8o2173/2.1/21.3 - -0.4430.   The mean DO concentration in the base
 run was  8.2173  mg/1 - standard deviation, 0.3456.

 (2)  Run S-2.  The value of the reoxygenation velocity  constant, K2, was
 decreased 50 percent, from a mean of 1.8770  to a mean ^ of 0.9385.  The
 effect was to decrease the mean DO  concentration by 0.2494 mg/1  with a
 standard deviation of 0.1206.   The  value of  the sensitivity function was
 given by 0.2494/8.2173/0.9385/1.8770 - 0.0606.

 (3)  Run S-3.  The value of the regulated flow was decreased  10  percent.
 The effect was  to decrease the mean DO concentration 0.0406 mg/1 with a
 standard deviation of 0.0057.   The  value of  the sensitivity function was
 0.0406/8.2173/0.1 - 0.0490.

 (4)   Run S-4.  The value of the reoxygenation  "error" term was changed from
+0.005 to -0,05e   The effect was  to increase  the  average DO concentration
by  0.0131 mg/1,  standard deviation  of  0.0029.   The  value of the  sensitivity
function was  0.0131/8.2173/-0.055/0.005  »  0.0001.                         y

 (5)   Run S-5.  The value  of  the  deoxygenation  "error" term was changed from
+0.005 to +0.05,  a  ten-fold increase.  The mean DO  concentration was de-


                                  8-68

-------
creased 0.0014 mg/1 with a standard deviation of  0.0003.   The value of the
sensitivity function was -0.0014/8.2173/10 - -0.000017.

(6)  Run S-6.   The value of the deoxygenation velocity constant, K^, at
20°C was increased 10 percent from 0.276 to 0.307.   The effect was to de-
crease the mean DO concentration by 0,0105 mg/1 - standard deviation of
0.0033.  The sensitivity function = -0.0105/8.2173/0.1 = -0.0128.

(7)  Run S-7.   The value of the evaporation loss from the reservoirs was
increased 10 percent.  The effect on the DO concentration in the stream
averaged 0,,0017 mg/1 decrease - standard deviation, 0.0010.  The sensi-
tivity function = -0.0017/8.2173/0.1 = -0.0021.

(8)  Run S-8.   The value for the waste loading to the stream, expressed
as mg/1 BOD, was increased 10 percent from 22 to 24.2.  The effect was
to decrease the average DO concentration in the stream 0.0148 mg/1 -
standard deviation, 0.0048.  The sensitivity function = -0.0148/8.2173/
0.1 = 0.0180.

(9)  Run S-9.   This is a companion to Run S-8 in that the value of the
waste loading to the stream was decreased 10 percent from 22 to 19.8 mg/1.
The effect was to increase the average DO concentration in the stream
0.0160 mg/1 - standard deviation 0.0078.  The sensitivity function »
-0.0160/8.2173/0.1 = -0.0195.

(10)  Run S-10.  The value of the DO concentration of the waste  load dis-
charges to  the stream was decreased 10 percent from 2.0 mg/1 to  1.8 mg/1.
The effect was to decrease the average stream DO concentration 0.0137
mg/l _ standard deviation, 0.0037.  The sensitivity function equals
0.0137/8.2173/0.1 - 0.0167,

(11)   Run S-ll*  The values  of the constants m and f  in the Leopold and
Haddock equations  [6,7] and  [6.8] were changed from m « 0.56 to  m = 0.51
and from f  =  0»33  to f  « 0,38.  The change  made was about  10 percent
decrease in m.  To preserve  the requirement that the  sum of exponents  in
these  equations  (also equation  [6.6]) equal 1.00,  the value of  f was
changed accordingly.  The  effect  of this  dual  change  was to decrease  the
velocity and  increase the  depth.  The average  stream  DO concentration  was
decreased  0.4939 mg/1 with a standard deviation  of 0.1476.  The  sensitivity
function,  computed with respect to  the  change  in m, was 0.4939/8.2173/
0.05/0.56  = 0,6732,

The overall water  quality  conditions  in  the Farmington  Basin  are affected
by the relatively  fast  time  of  flow  throughout the length  of  the river.
The mean  time of  flow from Winsted, mile 60.9  (on  the Still  River),  to
Rainbow Reservoir,  mile 10,  is  1.34  days, an average  velocity of 2.32
feet  per  second.   Winsted  is the  load point most distant  from the mouth
of the Farmington.   This  rapid  flow (and relatively  short  distance)  does
                                 8-69

-------
 not  provide  time for the time-dependent decay forces  of the  deoxygenation
 reaction to  exert themselves  to drive the DO  down to  its least  value.
 Only part of the total  effect of the waste loading is felt within  the
 limits  of the river  being investigated, the rest  is being imposed  down-
 stream.   For example, at a temperature of 21.3°C,  the mean temperature
 during  the sensitivity  runs,  a waste load having  a K^o value °f 0.276
 discharged at Winsted would have only 39 percent  of its BOD  satisfied at
 the  mean time of flow of In 34 days,  when it arrives at Rainbow.  In addi-
 tion, the relatively high values of  K£, obtained  using the Langbein and
 Durum equation ([6.38]), consistently replenish the DO used  so  that the
 function value,  the  DO  concentration, remains high and causes low-appearing
 sensitivity  function values.

 Considering  the  values  of the sensitivity functions of the various runs
 it may  be concluded  that DO concentrations in the stream are (1) relatively
 sensitive to the values  of the constants in the velocity and depth equa-
 tions and the water  temperature,  (2)  somewhat less sensitive to the reoxy-
 genation velocity constant, K2,  and  the regulated flow,  (3)  sensitive to
 a low degree to  the  magnitude of waste loads, DO  concentration  in  the
 waste and the deoxygenation velocity  constant K^,  and (4) insensitive to
 the  deoxygenation and reoxygenation  error terms,  r and s, and the  evapora-
 tion loss in the reservoirs.

 The  analysis  of  Run  S-3,  where the regulated  flow  was decreased 10 percent,
 showed  that  the  time of  flow  from Winsted to  Rainbow  was  increased 5.8
 percent.   The effect of  this  change  in flow on the DO concentration proved
 to be of low significance.  This  is  contrary  to other evidence, as shown
 in Figure 8-22 for instance,  and  common knowledge.  The  small amount of
 the  change in DO concentration in this  test is probably  due  to two off-
 setting  effects.   One,  tending to increase  the DO  concentration, is the
 loss in  diluting water by the decrease  in flow, and the  other, tending to
 decrease the DO  concentration,  is the increase in  time afforded the
 natural  deoxygenation process.   Under normal  circumstances,  the latter
would predominate but, with the  short time  of  flow, it has not had time
 to exert its  full effect.

 If water quality simulation is  the only objective,  the correction for
evaporation  loss may be  omitted.  However,  if  the  results of hydrologic
 simulation are also  of interest,.evaporation  should not be neglected.
The  maximum  evaporation  rate  in  the Farmington Basin  is 5.72 inches per
month, which, when Barkhamsted Reservoir  is full,  amounts to a weekly
loss to  evaporation  of 11.76  million  cubic feet (about 18 cfs).

8.5  Results  of  Special  Studies
A series  of special  studies were made to  simulate  the  system when
different  reservoir management practices  are employed  in augmenting flows


                                  8-70

-------
for quality control and when the released water quality has been impaired
by detention in a stratified reservoir.   The studies were applied to
the Farmington River system and the special conditions were imposed only
upon the management and releases of Colebrook Reservoir.

The Colebrook Reservoir operating rules used in these special studies
were those expected to be in force in the year 2000 when diversions
to Barkhamsted Reservoir will be made for MDC water supply (4).
These operating rules are:  (1) minimum release is 50 cfs; (2)
release at the inflow rate when the inflow is greater than 50 cfs but
less than 150 cfs; (3) release 150 cfs when the inflow exceeds 150 cfs
and store the balance; (4) operate flood control and fisheries pools
as at present; (5) divert to Barkhamsted Reservoir at a rate required
to maintain the level in Barkhamsted at elevation 520;  (6) make no
diversions if the stored volume in Colebrook decreases to 315 million
cubic feet (mcf) and, (7) release only that amount of inflow that
causes the volume to exceed 315 mcf.

A simulation run was made to determine the effect of releasing,  from
Colebrook Reservoir, water which has a BOD of 10 mg/1.  The normal
year 2000 waste loads were also imposed on the system, all of which
are downstream from Colebrook and Goodwin Reservoirs.  The result was
that most of the released BOD was satisfied in Goodwin Reservoir where
the detention time during the summer months Is usually in excess
of 30 days.  The DO in the Goodwin release was somewhat lower than
when no loading is applied but recovery was rather rapid downstream.
This is illustrated in Figure 8-23 on which is plotted the result
of the 27th week of the second year, the week in which the
poorest water quality was found.

The effect of Goodwin Reservoir under these conditions was determined
by a second simulation run, identical to the first excepting that the
BOD load of 10 mg/1 was shifted from the Colebrook release to the
Goodwin release.  This result also is shown in Figure 8-23.  Note
that in this latter case, the BOD is being exerted in the stream
below Goodwin Dam decreasing the stream DO a significant, but not
critical, amount.  Much of  the remaining BOD is carried into Rainbow
Reservoir x^here the detention for this particular week was 5.32 days.
The DO decreases still further in and below Rainbow Reservoir.

The BOD at each main  stem reach point below Colebrook Dam is  shown  in
Table 8-7.  These data substantiate  the  conditions described  above.
Note that the BOD was reduced from 10.00 to 0,62 mg/1 in Goodwin
                                 8-71

-------
                                                                                       FIGURE  8-23
                                                                                    EFFECT OF RELEASE
                                                                                  OF LOW QUALITY  WATER
                                                                                  FROM COLEBROOK RESERVOIR
00
I
   6.S
NO BOD IN COLEBROOK RELEASE
                10 MG/L BOD
                IN GOODWIN
                RELEASE
                                    10 MG/L BOD
                                    IN COLEBROOK
                                    RELEASE
                                                               TIME OF  FLOW, OAYS~V

                                                                0.15     I    0.10
                                                MILES  UPSTREAM  FROM  MOUTH
                                                                                                  10

-------
Reservoir when the Colebrook release contained 10 mg/1 BOD.  Note also
that the downstream BOD values are nearly the same as the run where
no BOD was released from either dam.  When the Goodwin release was loaded
to 10 mg/1 BOD, a portion of the BOD was exerted in the river reaches,
considerable BOD was exerted in Rainbow Reservoir and an increased
BOD loading was discharged in the Connecticut River.

A second special simulation- run was' made setting the DO concentration
equal to zero in the water released from Colebrook Reservoir.  The
result for week 27, year one of this simulation run is plotted on
Figure 8-24.  The 30 days detention and the assumption of corrolete
mixing in Goodwin Reservoir resulted in recovery of the DO concentration
to 7.53 mg/1 in the Goodwin release.

Reaeration in the stream below Goodwin Dam resulted in complete recovery
from the imposed condition in the stretch of river between Goodwin
Dam and its confluence with East Branch, a distance of about ten miles.

The condition of zero DO in the Goodwin Reservoir release was also
simulated.  The resulting DO concentration in the stream was also
plotted on Figure 5-24.  Note that recovery was rapid from the release
point to reach 10 (Nepaug River).  Recall that the rate of reaeration
is a function of the undersaturation.  The effects of decreasing reaeration
rates and waste loadings cause the rate of recovery to decrease.  Full
recovery had occurred at the upper end of Rainbow Reservoir.

The results obtained from these test runs are as expected.

Another test run was made to determine where, when and how much water
would be needed for low flow augmentation.  Again, the Farmington
River Basin year 2000 waste loads and conditions were imposed.  The
operation of Colebrook Reservoir was as described above.  The run was  for
30 years giving 30 one-year samples of the state of the river at the
year 2000.

The simulation output recorded 24 water quality violations in the 30
year run.  A quality violation is where the average DO in the reach
for the week is less than 4.0 mg/1.  The location, week, minimum reach
DO and average weekly regulated flow for each violation are  listed
in Table 8-8.  Note that there was only one main stem violation, reach
7 during the 33rd week of year 12.  Where the DO was 2.124 mg/1 and
the average flow was 1 cfs.  This was a particularly dry week following
a period when the water for maintaining the minimum release  from
Colebrook Reservoir could not be met.
                                8-75

-------
   10
oo
            o
           At
            */
                       .SATURATED  RELEASE  FROM  COLEBROOK
                                                   FIGURE  8-24
                                                 EFFECT  OF ZERO
                                                 DISSOLVED  OXYGEN
                                               IN COLEBROOK  RELEASE
                   ZERO  DO  RELEASE
                  "AT COLEBROOK
                                       ZERO  DO RELEASE  AT  GOODWIN
                     O.JS
                                   0.12
 o.u
	L
                                                0-09
                                                               TIME OF FLOW. DAYS

                                                                    0.17
                                                                                          0.12
                                                                                                0.04 0.03   6.12
                                                                                                                 PLOW. CFS
                                                                                                                  0.12
                                                               10
                                                   MILES  l'°STREAM  FROM MOUTH

-------
                              TABLE 8-7
                         SIMULATED BOD DATA
                       SPECIAL STUDY NO. 1
Location
Colebrook Dam
Goodwin Dam
Still River
East Branch
Nepaug River
Burlington Brk.
Unionville
Pequabuck River
Avon
Simsburg
Salmon Brook
Spoonville Br.
Rainbow Rsvr.
Connecticut R.
BOD in
Stream
mg/1*
10.00
0.62
0.66
1.22
1.25
1.30
1.28
2.43
2.56
2.67
2.78
2.76
0.99
1.29
BOD in
Stream
mg/1**
0.00
10.00
9.74
5.78
4.91
5.10
4.85
5.21
5.17
5.19
4.93
4.89
1.76
2.04
BOD in
Stream
mg/1***
0.00
0.00
0.06
0.92
1.00
1.04
1.05
2.29
2.36
2.50
2.64
2.62
0.94
1.24
Reach No.
(Downstream
  end)

  14

  13

  12

  11

  10

   9

   8

   7

   6

   5

   4

   3

   2

   1
*    Load  in Colebrook  release.
**   Load  in Goodwin release.
***  No  load in Colebrook or Goodwin  release.
                                  8-79

-------
                            TABLE 8-8
                     WATER QUALITY VIOLATIONS
Year     Violations    Location,      Week       DO        Reg. Flow
         in Year       Reach          of Year    Cone.        cfs.
                                                 mg/1

 1          0
 2          0
 3          0
 4          1            21             33      3.4640         7
 5          1            21             33      3.2479         6
 6          1            21             36      3.9352         9
 7          0
 8          0
 9          1            21             33      3.1265         5
10          l            21             33      3.6988         8
11          2            21             33      2.4915         2
                         21             34      3.9439         10
12          3            21             33      2.3865         2
                         34             33      3.0198         1
                          7             33      2.1240         1
13          0
14          0
15          3            19
                         21
                         21
16          3            21
                         21
                         21
17          2            21
                         21
18          1            21
19          0
20          0
21          0
22          i            21
23          l            21
24          i            21
25          l            21
26          0
27          i            21             36      3.6283
28          0
29          0
30          0
                                 8-80
33
33
34
29
32
36
32
33
36
3.2907
2.0942
2.5281
3.8156
3.9580
2.5844
3.8470
2.5844
2.5256
1
0
2
10
10
2
10
4
2
33
33
36
36
3.8145
3.7176
2.8902
3.5252
9
8
3
6

-------
Excepting one violation each in reaches 7,  19 and 34,  all violations
were recorded in reach 21 into which the Bristol, Connecticut sewage
treatment plant discharges.   Reaches 19, 21 and 34 are tributary
reaches and flow augmentation releases from Colebrook Reservoir
would not relieve the conditions causing the violation.   It would
be necessary to obtain water for flow augmentation upstream on
the appropriate tributary.

The rate of release of augmenting flow needed to forestall a water
quality violation can be determined only from information fed back
from some point downstream where a condition which indicates a
violation will occur can be sensed.  The condition must be sensed
and the water must be released in the same time frame.  The internal
sequence for computing flow regulation and water quality must start
upstream and proceed downstream.  This presents a problem and would
require that a subroutine be set up which,  when a violation is
detected in a reach, would return the sequence to the upstream
reach where the release is to be made and recompute regulated flow
and water quality in the reaches downstream therefrom.  The amount
of flow to add to the original release must be determined.

The additional or augmenting flow can be determined by analysis
of the simulation run wherein no return for recomputation is made.
Plot the DO concentration versus regulated flow rate for only those
flows which result in the DO being near the minimum quality standard.
Data points both above and below the standard should be used.  The
rate of flow needed to maintain the quality standard can be determined
from the plot, either from a line drawn through the median of the
plotted points or, better, through the lower of the plotted points.
This has been done for reach 21 and the result is shown in Figure
8-25.  Note that, on the average, 10.4 cfs will result in a DO
concentration of 4.0 mg/1.  The lower curve on Figure 8-25 shows
that for the 30 samples used, 11.6 cfs will assure at least 4.0
mg/1 DO.  This can be done for all reaches that experience a
violation in the simulation run.  The recomputation routine can
then be set up to add, to the original flow, the required augmenting
flow, which was determined by the graphical method described above,
to obtain a new value for the regulated flow.  Then, using the
new regulated flow, the water quality values for reaches down-
stream from the reservoir can be recomputed.  The total added flow
may be expressed in terms of volume to give the reservoir space
needed for the flow augmentation use.
                                  8-81

-------
                           FIGURE  8-25
                   DO CONCENTRATION VS REGULATED
                          FLOW,  REACH 21
                         (SIMULATED   DATA)
  o'
  z
  o
  UJ
  o
00°
002
  O
  UJ
  o
  CO
                                                             O
                                                             jl
                                                             o
0>
                                                                   to
 Q 2
                                                           10
                                                     REGULATED FLOW.CFS
                  15
20

-------
If few violations occur in the simulation run,  it is an easy matter
to compute the volume needed in a reservoir for flow augmentation
using a desk calculator or by hand.   For instance,  in Table 8-8,
note that in year 11, the additional flow needed to assure 4.0 mg/1
DO in reach 21 is 11.6-2 =9.6 cfs =6.4 million cubic feet (mcf)
for week 34 for a total of 7.5 mcf.   In year 15, it would require
(11.6 4-9.6) 0.657 = 13.9 mcf.  This is the maximum requirement
for flow augmentation reservoir space as determined by the 30
samples from the simulation run.  This volume must be provided
upstream of reach 21 on the upper end of the Pequabuck River.

A similar plot of the reach 7 data yielded two data points (see
Figure 8-26) and an indicated flow of 19.8 cfs is the minimum that
will result in no violation.  The single main stem violation would
then require low flow augmentation volume of 19.8-1 = 18.8 cfs =
12.4 mcf upstream of reach 7.  Similarly, it was found that 0.85
mcf would be required to forestall the violation in reach 19 and
0.72 mcf would be required in reach 34.

These computations and plots were made by hand in a few minutes
time from data contained in the simulation run.  If the number
of violations is great and many reaches experience violations, it
may be of advantage to program these computations for the computer.

8.6 Transfer Functions
Because the development of the transfer function program was beyond
the scope of the original project, low priorities for time and
computer funds were assigned to the application of this phase.
The program AIJ was not afforded a final run to produce transfer
function coefficients for the Farmington Basin.

8.7 Summary and Conclusions - Simulation Model

8.7.1 Summary
The objective to develop a simulation model that can be used to
simulate the hydrology and water quality in a stream system having
a dendritic pattern has been accomplished.  The capability of the
model to simulate for various conditions imposed on the system
has been demonstrated.  Tests have been made to assure the correct
operation of the model under all feasible conditions and safequards
have been introduced to prevent simulation under impossible real-
life situations.  Desk calculator computations have been made to
                               8-85

-------
  - c;
 Z
 o
 LU
 o
 o
 o
 Ill
 o
„>-
 o 3
 UJ


 O
 CO
                         FIGURE 8-26
                DO  CONCENTRATION  VS REGULATED
                        FLOW,  REACH 7
                       (SIMULATED  DATA)
                              10
      20
REGULATED  FLOW, CFS
30
                                                                                                            40

-------
assure that the mathematical models and program logic have functioned
correctly.

The model is flexible and can be readily adapted to any watershed
if proper attention is paid to obtaining accurate base data.  The
model has been applied successfully to the Farmington River Basin
in Connecticut and Massachusetts.

8.7.2 Conclusions
Simulation techniques can be applied to a river system to determine
the effects of the various decisions available to those whose task
is to manage, or police the management of, the system.  The system
has been programmed to the digital computer which, if basic data
inputs are accurate, will quickly and inexpensively provide a
reasonable representation of the system response to the applied
condition.  A few of the advantages of this method of analysis
over other methods which accrue to the user are:  (1) The user is
afforded an answer not only of an expected value but also a
valuable indication of its variability by obtaining several
simulation runs wherein the random variables in the system are
allowed to vary as observed in nature, (2) The expected answer
is the mean of several samples of system response to the set of
imposed conditions, (3) The model can simulate a given set of
conditions to determine the time when a resulting event is likely
to occur, and the associated probability, (A) The model can simulate
the future state of the system under as many different conditions
as desired and at various levels of each condition variable by
merely making minor changes in the input data, (5) The simulation
will be completed in a matter of minutes and at a fraction of the
cost of other methods, (6) Although the simulation model
produces much detailed information, the output of information
can be programmed to suppress all unwanted data to result in a
concise data package that is readily analyzed, all without
affecting the simulation, and (7) The rapidity and relative in-
expense at which runs can be made and the ease with which variable
values may be changed affords the opportunity to determine the
sensitivity of the syste™ to small changes in each variable.  In
short, a hydrology and water quality simulation model which accurately
represents the watershed is a tool that can be of considerable
use in making decisions relative to the planning and/or operating
of a river system.
                                 8-89

-------
The application and testing phase of the project has shown that the
simulation of hydrology in the Farmington River system produces
an accurate representation of actual conditions.  The lack of water
quality data on the Farmington prevents drawing conclusions as to
the accuracy of the water quality simulation.  It can be said that
the water quality values produced in simulation are reasonable and
in line with those that could be expected under the imposed conditions.

This inability to check the water quality simulation prevents
drawing conclusions about values of K^ and K2 which were used.  It
is suspected that the values of 1^ which result from the use of the
Langbein and Durum formula (equation 3.38) are too high.  Midway
in the testing period the coefficient in that equation was arbitrarily
changed from 3.3 to 1.3 and more reasonable results were obtained.
This latter value may even prove to be somewhat high.  A conclusion
in this regard is to, if at all possible, find a way to determine
the values of these constants from stream surveys of the watershed.

The sensitivity tests show that the dissolved oxygen concentration
system function is:  (1) relatively sensitive to the values of the
constants in the velocity and depth equations and to the water
temperature, (2) somewhat less sensitive to the reoxygenation
velocity constant, K£ and the regulated flow, (3) sensitive to a
low degree to the size of the waste loads, DO concentration in
the waste loads and the deoxygenation velocity constant, K^ and,
(4) insensitive to the deoxygenation and reoxygenation error factors,
r and s, and to evaporation loss in the reservoirs.

The results of simulating releases from Colebrook Reservoir (the
one most likely to stratify), which are either low in dissolved
oxygen or relatively high in BOD, show that the effects on the
downstream water quality are localized and that below reach 7,
recovery from these imposed conditions is essentially complete.
Colebrook Dam is at mile 58 and reach 7 begins at mile 31.3.
                                 8-90

-------
                         REFERENCES

1*  	,  Interim Report on Review of Survey, Farmington
River Basin, United States Army, Corps of Engineers, New England
Division, Waltham, Massachusetts, December, 1958.

2.  See Reference 1, pp. 8-9.

3.  See Reference 1, p. 14.

4.  Long, Michael J., Personal Communication.

5.  Sprong, R. C., Personal Communication.
                            8-91

-------
                         SECTION 9
                APPLICATION OF OPTIMIZATION
                           MODEL
9.1 Introduction
The methodology developed for the optimization model was applied to
a hypothetical watershed to permit testing of the model.  Given a
watershed, a region is then defined as a subset of the watershed.
The hypothetical region used in this study consists of an area
encompassing multiple reaches.  Once delineated, the region may
be analyzed as an independent part of the watershed.  The critical
period used in this case was a design flow, usually considered
as the minimum average consecutive seven-day flow expected once
in 10 years.

The hypothetical region was divided into headwater and interior
reaches, with potential reservoir locations only at the beginning
of the headwater reaches.  The region used for testing the model
is shown in Figure 9-1.  It consists of six wastewater treatment
facilities in the seven designated reaches, with a reservoir at
any of the three headwater reaches.  The reach nodes represent
the beginning or end of a reach.  Each wastewater treatment
facility shown adjacent to a node affects the water quality in
the region by the amount of BOD released into the reach.  The
population and industrial growth in the area  is expected to
increase the BOD loads so that additional treatment and/or low
flow augmentation will be necessary.  In order to prevent floating
solids from entering the stream,each facility is required to
remove at l,east 35% of its BOD load.  For this case, a 90% maximum
BOD removal was also assumed for the treatment facilities.

This generalized approach used in developing the model rendered
the model applicable to a variety of watersheds with minimal
alterations.  The model was constructed in modular form so that
any watershed can be examined by simply selecting the appropriate
number of modules.  The objective of the-optimization model is
to determine the combination of wastewater treatment facilities
and flow augmentation which meet the water quality goals at the
least cost to the region.
                              9-1

-------
                      FIGURE  9-1
               HYPOTHETICAL   REGION
                    \
                      \
                        \
                           \
 R
A
—  REACH NODE
—  REACH NUMBER
—  POTENTIAL  RESERVOIR
O — WASTEWATER  TREATMENT  FACILITY
                             9-3

-------
9.2 Input Data for Model
The input data for the optimization model are output data from a
simulation model for the critical period at the selected region
in the watershed.  The parameters used as input to the optimization
model are summarized in Table 9-1.  The hydrologic, wastewater, and
economic data used in this study were taken from a 1967 article
by Loucks, Revelle, and Lynn (1) and are shown in Tables 9-2 and
9-3.  Upon accepting the data, the model internally generates all
of the elements' for the mathematical programming tableau.
Information obtained from its solution may then trigger further
analysis within the optimization model or call for new simulated
data.  The model is capable of handling a region with up to 50
reaches and generating a new matrix for any changes in the input
data.

The costs and limiting bounds set on the variables in the objective
function for the mathematical programming model were determined from
predicted annual cost data of BOD removal.  The nonlinear convex
cost functions for the treatment facilities were divided into piece-
wise linear segments representing various percentages of BOD removal.
The bounds on the variables were determined from the mg/1 of BOD
removed within each segment.  The units of the BOD removed were
transformed from mg/1 to pounds, as shown in Table 9-4.  From this
datum, unit costs were determined for each of the treatment facilities
and are  listed in Table 9-5.

9.2.1 Changes in Hypothetical Data for Flow Augmentation
When considering flow augmentation from S.W, the base  (unaugmented)
flow, to  3^  ',  the maximum flow, the following assumptions were
made in  obtaining new parameter values for the data in Table 9-2:

1.  The  reaches  in  the  region under analysis are established with t
-------
                          TABLE 9-1
  SUMMARY OF REACH INPUT PARAMETERS FOR OPTIMIZATION MODEL

Symbol                  Description

   T                Flow time through reach r, days

   QW               Wastewater inflow, MGD

   QT               Tributary inflow, MGD

   C5               Saturation DO concentration, mg/1

   5                Maximum allowable DO deficit, mg/1

   D                Minimum allowable DO concentration, mg/1

   Cw               Wastewater DO concentration, mg/1

   Cx               Tributary DO concentration, mg/1

   BW               Wastewater BOD concentration to treatment
                    facility, mg/1

   g-p               Tributary BOD concentration, mg/1

   K                Deoxygenation rate constant, days
                                                   _i
   v                Reaeration  rate  constant, days
   K2
                    Sedimentation  and  absorption rate constant, days ~^

                    Oxygen  production  (M>0)  or  reduction  (M<0) due
                    to  plants and  benthal  deposits, mg/l/day

   P                % BOD removal  of 1980  load  with existing waste-
                    water treatment  facility

   R                BOD addition rate  due  to runoff and  scour, mg/l/day
                                9-6

-------
                         TABLE 9-2
  REGIONAL STREAM AND WASTEWATER DATA FOR THE  7  REACHES (1)
Reach     T        QW     QT     CS      D        D      CW     CT
  No.   (days)    (MGD)  (MGD)   (mg/1)   (mg/1)  (mi/I)  (mg/1)  (mg/1)
1
2
3
4
5
6
7
Reach
No.
1
2
3
4
5
6
7
.235
1.330
1.087
2.067
.306
1.050
6.130
BT
1.66
0.68
-
1.00
-
-
-
5.
37.
8.
14.
0.
26.
41.
1355. 10.20
1290V 9.95
0. 9.00
296. 9.54
0. 9.00
0. 8.35
0. 8.17
Kl . K2 ,
(days'-1-) (days •*•)
.31
.41
.36
.35
.34
.35
.30
1.02
.60
.63
.09
.72
.14
.02
3.20
2.45
2.00
3.54
2.50
2.35
4.17
(days"1)
.02
.03
.04
.04
.05
.06
.00
7.0 1.0
7.5 1.0
7.0 1.0
6.0 1.0
6.5
6.0 1.0
4.0 1.0
M
(mg/1 /day)
.85
.14
.18
.05
.39
.07
.00
9.5
8.0
• -
9.7
-
-
-
R
(ing/I/day)
.15
.14
.14
.11
.11
.13
.00
                               9-7

-------
                TABLE 9-3
REGIONAL WASTEWATER TREATMENT DATA (1)

VO
1
00





Reach
No.
1
2
3
4
5
6
7
BW
(mg/1)
248
408
240
1440
0
2180
279
P
%
67
10
26
24
0
12
26
Annual Costs of 1980
35%
0
546,000
160,000
324,000
0
385,000
670,000
50%
0
552,000
170,000
339,000
0
408,000
690,000
BOD Removal
60%
0
630,000
210,000
413,000
0
500,000
840,000
: Dollars
75%
22,100
780,000
277,500
523,000
0
638,000
1,072,000

85%
77,500
987,000
323,000
626,000
0
790,000
1,232,500

90%
120,600
1,170.000
378,000
698,000
0
900,000
1,350,000

-------
          TABLE 9-4
REGIONAL WASTEWATER TREATMENT
    FOR 1980 BOD REMOVAL

VO
1
VO




Reach
No.
1
2
3
4
5
6
7
Existing
BOD Removal
%
67
10
26
24
0
12
26
Pounds
6900
12600
4200
40400
0
108700
8600
Future BOD Removal in Indicated Treatment Segment: Pounds
35%
0
31500
1400
18500
0
108700
8600
50%
0
18900
2400
25200
0
70900
14300
60%
0
12600
1600
16800
0
47300
9500
75%
830
18900
2400
25200
0
70900
14300
85%
1030
12600
1600
16800
0
47300
9500
90%
520
6300
800
8400
0
23600
4800

-------
                          TABLE 9-5
                   REGIONAL WASTEWATER TREATMENT
                          UNIT  COST DATA


Existing        Unit Cost of  BOD Removal in Indicated Treatment Segment:
BOD Removal     	Dollars/Pound  of BOD Removed



1
M
0





Reach
No.
1

2
3
4
5
6
7

%
67

10
26
24
0
12
26

35%
0

17.4
111.0
17.5
0
3.5
78.0

50%
0

0.3
4.2
0.6
0
0.3
1.4

60%
0

6.2
25.0
4.4
0
2.0
15.7

75%
26.7

7.9
28.1
4.4
0
2.0
16.2

85%
53.6

16.4
28.4
6.1
0
3.2
16.8

90%
83.4

29.1
68.7
8.6
0
4.6
24.6

-------
The relationships used in calculating how these parameters vary with
changes in Q were" based on the-stream studies of river systems by
Leopold and Maddock (2).  They detected that the following relation-
ships hold for natural cross sections:

                        w - a Q1  ,	[Eq. 9.1]

                        d - c Qf	[Eq. 9.2]

                        v * k Qm	  [Eq. 9.3]

where:
Q =  discharge i
w •  water surface width,
d ~»  mean depth,
v *  mean velocity , and
a,c,f,k,l,m are numerical constants'
The relationship for calculating discharge in a stream is:

                        Q - Av .	[Eq. 9.4]

where A - cross-sectional area of the stream.
For rectangular cross sections,

                        A - wd    	[Eq. 9.5]

Substituting  equations  [9.1],  [9.2],  [9.3] and  [9.5] into [9.4]
 indicates that

                         Q - a c k Qf+1+m	[Eq. 9.6]

 iff

                         a c k - 1.0	[Eq. 9.7]

and

                         1 + f + n -  1.0	[Eq. 9.8]
                                /
Average values of the exponents 1,  f, and m were obtained from these
empirical studies.  The average values of  the constants  were found to
be:
                                 9-11

-------
                           1 = 0.26

                           f - 0.40

                           m = 0.34

 Using  the Leopold-Haddock article as a source,  Langbein  and Durum  (3)
 stated that  "As  a  river rises in response to  an increase in discharge,
 it  increases its depth  and velocity, a condition causing the reaeration
 coefficients to  decrease.   In general, rivers increase in depth and
 velocity at  about  the 0.4  power  of the discharge.  Hence, at any given
 location, the coefficients of reaeration- decrease at  about the 0.13
 power  of the discharge."  The above estimate  will be  used in analyzing
 the coefficient  of reaeration, or
                       K£ - g  Q-°'13   .  .  .  .  .  .  .  ;  .  [Eq. 9.9)!

With the values of Si ^ as boundary conditions, the value of the
constant, g, can be determined for  each  reach  from  equation
[9.9],  The amount of time it  takes the  water  to flow  from the
beginning of a reach to the end can be determined using  equation
[9.3] and noting that

                        v * L/T .....  .......  [Eq. 9.10]
where L - length of the reach.

Therefore

                         L/T = k Qm

or

                           T - (L/k)Q-m	[Eq. 9.11]


The travel time in each reach was found by letting m = 0.34.
                                9-12

-------
Similarly, as in equation [9.9], the value of the L/kcan be determined
from the known boundary conditions for the base flow, §.'•*•'.

9.3 Treatment Model Formulation
The multi-commodity network format utilized in the optimization
model is believed to simplify tracking commodities being trans-
ported down a region of a watershed.  This network is essentially
viewed as a unidirectional transportation system conveying three
commodities:  water, biochemical" oxygen demand, and dissolved oxygen.
The carrier commodity, water, is conservative while in transit
through the network, but the two water quality constituents, BOD
and DO, attenuate or amplify while in transit.

The methodology developed for the treatment model and the relation-
ships incorporated into its network format are found in Section
7.  Equation {7.31] is now used in matrix notation for application
to this hypothetical problem.  The.objective function is as
follows:
                      Min Z - [C(2T)]' [Q<2T>]	[Eq. 9.12]
where:
           unit cost matrix for transporting a unit of commodity
           2 (BOD) along treatment branch b in the plant in reach
           i, and
           matrix for'the amount of BOD removed at the corresponding
           branches.
The unit cost'matrix may be partitioned as follows:
               [c(2IV
                                ,(2T)
                                '2b
[Eq.  9.13]
                                9-13

-------
        (2T)
where [C^b  ] is the cost vector for branch b  (b denotes upper bound
on % BOD  removal) in the treatment facility in the ith reach.  In
this problem reach five has no treatment facilities, therefore
[C^T)]  is a null vector.  The required minimum of 35% BOD removal
permits restricting the analysis to the convex portion of the cost
function.   Selecting reach two as a numerical example yields the
following unit cost vector for up to 90% BOD removal:
C(2T)
°2,10
C(2T)
C2,35
r(2T)
C2,50
r(2T)
C2,60
r(2T)
L2,75
r(2T)
C2,85
r(2T)
_2,90_
/


=



0
17.4
0.3
6.2
7.9
16.4
29.1
                                                      .  .[Eq. 9.14]
Likewise
                 can be partitioned as follows:
                              (2T)
               [Q2T]  =
                             0(2T)
                             Q2b
                              (2T)
                                                         [Eq. 9.15]
                               9-14

-------
        (2T)
where [Q^b  ] is the BOD commodity vector for the treatment facility
in the ith reach.  The vector for reach two is as follows:
~€lo~
<#B
0(2T)
Q2,50
Q(2T)
^2,60
Q(2T)
^2,75
Q(2T)
^2,85
0(2T)
•2,90



-


t
I
12,600.
31,500.
18,900.
12,600.
18,900.
12,600.
6,300.
                                                      . .  .  [Eq. 9.16]
Given  the objective function, the physical - technical constraints
of  the primal problem shown in equation  [7.31] ar6 restated below:
                       0
          (12)
         p(13)     p(23) A(3)   0
                   (23)
                  00




Q~(2)
qO)
Q(2T)
— +.

si


?
~73)

Q(2T)
                                                        Y    [Eq.  9.17]
                                                  >  0
                                  9-15

-------
where the following vectors are defined in reach i, i=l,2,..,7
[s 1 ]
[SC2)]
        =  flow of  commodity 1,
        =  flow of  commodity 2,
        =  flow of  commodity 3,
       ]=  amount of BOD  removed  at  the  corresponding  branches
          in the plant,
          additional amount of commodity  1  entering system,
          additional amount of commodity  2  entering system,
          additional amount of commodity  3  entering system,
         minimum allowable f,LQW of  commodity  3, and
         upper bound on  [(Q^    )J

A description of the above matrices  [A], [P],  [D], [T], and
[I] is presented below.  A(k),  k =  1,2,3,  is  the matrix of
continuity coefficients for the three  commodities:  water,
BOD and DO, respectively.   The  attenuation and amplification
coefficients describe the  change in BOD and DO between reach
points.  Using the network  format developed for the mathematical
programming model, the nodes are the rows  and the branches
connecting the nodes are the columns (variables) in the matrix.
The general form of the A'k) matrix is shown below:
                            BRANCHES
            1234567
            P  P  P  P   P   P   P
            3355678
            P  P  P  P   P   P   P
            k  k  k  k   k   k   k
                                   12   34678
                                   B  B  B  B  B  B  P  Source Node No
                                   1234679
                                   P  P  P  P  P  P  P  Sink Node No.
                                   k  k  k  k  k  k  k  Commodity


N

0

D

E

S



k IB
k IP
k 2B
k 2P
k 3B
k 3P
k 4B
k 4P
k 5P
k 6B
k 6P
k 7B
k 7P
k 8P
                     1
                     "4
                       U
                          "6
1
1
1
-1
1
-1
1
-1
1
-1
1
-1













1
                                                        [Eq. 9.18]
                                 9-16

-------
where
U)j * -1
tjj =~"^.«
i i
u< =^a.
for
for
for
k =
k =
k -
i;
2;
3;
i =
i =
i -
1,
1,
1,
2,. ..,7
2,. ..,7
/,..!,/
Other coefficients describe the interrelationship between the
commodities in transit through each reach.   The interdependencies
between any two of the three commodities can be represented in
the following manner.
                k',k
               1,2
               1,3
               2,3
                                    Commodity Interrelationship

                                          Water, BOD
                                          Water, DO
                                          BOD,    DO
The general form of   lp     ]>  representing the matrix of
dependency coefficients,  is shown below:

                          BRANCHES
                                                           inter-
                   1234567
                   P  P  P  P  P  P  P
                   3355678
                   P  P  P  P  P  P  P
                                         Source Node No,
                                         Sink Node No.
                   k1 k' k1 k' k1 k' k'  Commodity kf
         N

         0

         D

         E

         S
k IB
k IP
k 2B
k 2P
k 3B
k 3P
k 4B
k 4P
k 5P
k 6B
k 6P
k 7B
k 7P
k 8P
                   vl V2
                        V3
                                     V7
                                          ={pk'»k]
.[Eq.  9.19]
                                 9-17

-------
 where
\jj =-u. for k' ,k
\>± »-V1 for k'.k
vi =
        for
                    1,2
                    1,3
                    2,3
For i = 1,2,...,7
For i = 1,2,...,7
For i = 1,2,...,7
 Using  similar  notation and letting [D»]  represent the matrix
 of  coefficients  for water quality DO standards,  then k',k
 signifies  in  the following the relationship between each
 commodity  and the DO  in  the reach.
            k'.k
             1,3
             2,3
             3,3
                                   Cotnmo.dity Interrelationship

                                        Water, DO
                                        BOD,   DO
                                        DO,    DO
 Shown below  is  the  general  form of  the [D  ,  ]  diagonal matrix:
where
                           BRANCHES

                      1234567
                      P  P  P  P   P  P   P
                      3355678
                      P  P  P  P   P  P   P
          kQUALIP
       N  kQUAL2P
       0  kQUAL3P
       D  kQUALAP
       E  kQUALSP
       S  kQUAL6P
          kQUAL7P
        for k;,k = 1,3
        for k ,k = 2,3
        for k'.k = 3,3
                                           Source Node No.
                                           Sink Node No.
                     k' k' k' k1 k' k1 k'  Commodity k1
                        n2
                           n3
                                                       •   [Eq.  9.20]
                           For  i =  1,2,....7
                           For  i =  1,2,...,7
                           For  i =  1,2,... , 7
                                9-18

-------
Let [Tl represent the matrix of BOD treatment alternatives
with  the  general  form  shown below:
N
0
D
E
S

2 IB
2 2B
2 3B
2 4B
2 6B
2 7B
                          BRANCHES

                       123467
                       b  b  b  b  b  b
                       222222
                      «v              •«*••
                       B
Source Node No•
Treatment Segment
BOD Commodity No.
                                                         [Eq. 9.21]
where
0 • sum vector with n components
n * number of linear segments representing percent treatment
    at a facility.

The remaining matrix [I] in Equation [9.17] is the identity matrix
of upper bounds on BOD removal.

9.3.1 Optimization Programs
The theoretical development and application of the optimization
model necessitated the development of two main computer programs
and one auxiliary program.  These three routines make up  the
optimization package and were programmed for an IBM 360/65
computer.  Below is a brief discussion of each routine.   A
thorough description and coding of the optimization package is
contained in Sections A4.7, A4.8, and A4.9 of the appendices.

1.   INTERF - Interface Program
The objective of this main routine is to accept specified stream
and wastewater data from a simulation model and to generate the
mathematical programming model in the format specified for the
MPS/360 Processor.  The program contains the flexibility  of
handling a region with up to SO reaches and generating a  new matrix
for any changes in the simulated input data.
                               9-19

-------
 2.   MPS Control Program
 The objective of the  auxiliary routine is to specify the optimization
 procedures  to be used in providing the necessary outputs needed
 for analysis.   Depending only on the statements used in this
 control program,  post-optimal procedures may be applied wl'Eh"~"bnly
 minor  changes in the  matrix-generated by INTERF.

 3.   LPLF -  Linear Programming Model
 The objective of this main"routine is to allocate waste treatment
 requirements  and/or low flow augmentation to meet preset water
 quality standards and determine'the optimal  solution for a
 specified region in a-watershed'.   The linear programming mode],
 developed in  a multi-commodity network format, is composed of the
 output from INTERF, the MPS Control Program, and predetermined
 treatment cost data along with waste treatment bounds.

 These  routines in the optimization package may be considered as
 components  of  a closed loop information feedback system,  giving
 solutions to  any changes in exogenous or endogenous  data.
 Information obtained  from its output,  via  control points,  may
 trigger further analyses of the optimal solution or  specify
 changes in  the original data as shown in Figure 9-2.

 9.3.2  Post-Optimal Analysis of Regional Waste Treatment  Costs

 9.3.2.1 Primary or Secondary Treatment Required at All Reaches
 Given  the water quality standards,  each of the seven reaches
 seeks  to  find  the least cost way  to meet  the standard.   The
 optimization model provides  the decision-makers with the  information
 needed to achieve the above objective.   The  summary  output
 for  the seven  reaches with  a minimum  of  primary treatment required is
 tabulated in Table 9-6.   The summary  output  for the  case where
 secondary treatment is  required at all waste sources  is  tabulated
 in Table  9-7.   The regional  authority  now knows  the  "best"
 combination of  wastewater  treatment facilities.   Note that the
 total  cost  to  the region  is  higher if  secondary treatment  is
 required.   If  secondary treatment  is not required at all reaches,
 then more intensive treatment  is provided where it is most
 effective.  The addition  of  a  secondary  treatment constraint
 cannot  decrease the regional  cost.  However,  the  regional  cost
will be unchanged if  this additional  constraint  is not binding,
 i.e., all waste sources are  already removing more than 85% of
                              9-20

-------
                                               FIGURE  9-2
                                         OPTIMIZATION PACKAGE
                                      INPUT—STREAM AND WASTEWATER DATA
                                      OUTPUT-OPTIMAL SOLUTION AND POSTOPTIMAL
                                            ANALYSIS
                                       0  —CONTROL POINTS
vo
N)
   INPUT
GENERATE
 MATRIX
-O
             INTERF
 SPECIFY
PROCEDURE
            MRS CONTROL
              PROGRAM
                                                        GENERATED
                                                          MATRIX
                                COST  DATA
                                   AND
                              WASTE TREATMENT
                                  BOUNDS
 MPS/360
PROCESSOR
                                                                                                OUTPUT
                                                            LPLF

-------
              TABLE 9-6
 OPTIMAL SOLUTION WITH ONLY PRIMARY
TREATMENT (35% BOD REMOVAL) REQUIRED

% BOD Removal
Reach
Present Future
1
2
3
4
5
6
7
67
10
26
24
—
12
26
67
69
50
89.9
—
90
50
Total Cost »
OPTIMAL
SOLUTION
(85%
Annual Cost Reach: mg/1
$ x 103 Actual Allowable
0
715
170
696
—
900
690
3171
9.7
7.9
8.5
6.0
8.3
7.3
4.0

7.0
7.5
7.0
6.0
6.5
6.0
4.0

TABLE 9-7
WITH PRIMARY AND SECONDARY TREATMENT
BOD REMOVAL) REQUIRED
% BOD Removal
Reach
1
2
3
4
5
6
7

Present
67
10
26
24
—
12
26
Total
Future
85
85
85
89.9
—
85
85
Cost -
Annual
Costs
$ x 103
77
987
323
696
—
790
1232
4105
Future Minimum
D.O, in Reach:
mg/1
Actual Allowable
9.7
8.4
8.8
6.0
8.6
7.4
4.9

7.0
7.5
7.0
6.0
6.5
6.0
4.0

                      9-23

-------
the BOD.  From analyzing the primary treatment solution,  it  is
apparent that requiring 85% treatment, i.e., secondary treatment,
at all sources would increase regional costs.  In fact, the
costs are increased from $3.17 x 106 to $4.10 x 106 because of
this secondary treatment constraint.  The analysis will be extended
to provide a methodology which is applicable  to  a wide variety
of actual circumstances.  For example, how should this total
cost be apportioned among the decision-making units?  How much
would augmented flow be worth to any combination of these units?
This will provide the requisite information to permit not only
formulation, but also implementation of optimal regional waste
management strategies.

9.3.2.2 Cost Allocation Among Reaches
Given the solution to the primary treatment case, how should
the total annual cost be apportioned among the decision-making
units?  It would be inequitable to assess the costs as shown in
Column four of Table 9-6.  Comparison of columns five and six
in this table tells which reaches are providing excess treatment.
Reach six is overtreating - apparently to assist reach seven
in meeting its constraint.  The decision-maker in reach six
would be irrational to participate in this plan since it would
cost him more than he would have to pay to just meet his standard.
Reaches two and three are also overtreating while reach four
is just treating enough to meet exactly its water quality
standard.   Reach one would be indifferent as to participating
since it is also overtreating but has zero unit cost, up to
67% removal.  For this system, reach seven should be willing
to pay the upstream reaches for providing the supplementary
treatment to meet its standard.
                             9-24

-------
The response of reach seven to any DO standard can be determined
by parametric programming.   Table 9-8 shows the system response
as the dissolved oxygen standard at reach seven is varied from
one to seven mg/1.   At one mg/1 the standard is being met by
a combination of treatment at reaches one, six, and seven.
Reach one is providing 67.0% removal (32.0% for reach seven)
due to the fact that the cost is zero up to that level and is
thereby the favored alternative.  Reach six"is providing 70,9%
treatment of which 1.A% is attributable to assisting in meeting
the reach seven constraint.  All of the treatment in reach seven
naturally goes to meet the standard in thaf reach since it is
the last reach.  Reaches two and four are providing exactly
enough treatment to meet their local standard, while reach
three is treating at the 35.0% minimum requirement.

As the water quality standard increases toward 4.0 mg/1,  the
amount of treatment continues to increase in reach six.   All
other reaches  stay the same.  This means that, over this  range,
treatment in reach six is  the most economical.  However,  as
the standard approaches 4.0 rag/1, reach six attains its maximum
capacity and it becomes necessary to treat elsewhere.  Examination
of the basis changes in the range from 3.5 to 4.0 mg/1 indicates
that  the most  economical treatment sequence is to utilize 15.0%
of the capacity at reach three;  then the remaining capacity of
reach four  (0.1%); and then begin to utilize capacity at  reach
two  (12.8%).   Between 4.0  and 4.5 mg/1, the model initially
continues to increase treatment  at reach  two and  then switches
to reach seven.  The .procedure  continues  in this manner until
the parameterization stops at 5.81 mg/1 -  the point at which an
infeasible  solution  is reached.  This Indicates that all  of
the facilities are treating at  full  capacity and  it is impossible
to achieve  any higher level of water quality goal.
                               9-25

-------
                           TABLE  9-8
      SEQUENCE OF REGIONAL  WASTE  TREATMENT  AS DO  STANDARD
          AT REACH  SEVEN VARIES  FROM  1  TO  7 mg/1.
D.O.  Standard                   Incremental %  BOD Removal in Each
at  Reach  Seven                  Reach  to Meet  Reach  7  Standard
    mg/1	12346       7
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
5.81
>5.81
9.3.2.3 Equivalent Prices
32.0 0
32.0 0
0
" 0
0
" 0
" 12.8 15
" 19.9 15
19.9 15
32.0 29.9 15
55.0 34.9 55
0
0
0
0
0
0
.0
.0
.0
.9
.0
0
0
0
0
0
0
0.1
0.1
0.1
0.1
0.1
INFEASIBLE
for Upstream
BOD
1.4
5.0
8.6
12.2
16.1
19.4
20.5
20.5
20.5
20.5
20.5
SOLUTION
50.0
50.0
50.0
"
"
n
it
62.8
80.1
90.0
90.0

Removal
Next, the question of estimating the price that the decision-
making unit in reach seven would be willing to pay for upstream
BOD removal is examined.  It might be conjectured that he would
be willing to pay any amount  less  than his own cost for upstream BOD
removal.  Unfortunately, there is not a one to one (or even a
trivial) correspondence between BOD removal at reach seven and
at any other upstream reach due to the complex instream processes
that occur.  Thus, it is necessary to describe how the economic
value of the product (waste treatment) varies according to the
location of the facility.
                                9-26

-------
Recall that In Section 7 the various states of the regional system
were identified by examining the shadow price with respect to BOD
removal, ir^C^), and the shadow price with respect to the DO standard,
•^(4).  Table 9-9 shows these prices for the original set of water
quality standards with only primary treatment required.
                         TABLE 9-9

SHADOW PRICES FOR BOD REMOVAL AND WATER QUALITY STANDARD IN EACH REACH

                (PRIMARY TREATMENT REQUIRED)

Shadow                               Reach
Price          1       2        34        5       6       7


1r1(2):$/#BOD   10.87   7.90    11.36    11.17    13.61   13.93    14.44


                   00        0        0        00    18.58
Examination of Table 9-9 indicates that competition exists at the
treatment facility in reach seven.  This is indicated by non-zero
shadow prices for BOD removal in all contributing reaches and a
positive shadow price for the water quality standard only in reach
seven.  It is also seen from Table 9-9 that the BOD shadow price
decreases in the upstream direction because of the diminishing
effectiveness of upstream waste treatment.

The general recursive relationship, developed in Section 7, is now
used to determine the rate at which upstream BOD removal can be
substituted for removal at reach seven:
                                                          < 9i22]
where A^ « set of all contributing reaches above reach  i.
For  this river system, 0^. can be calculated as follows:
                                  9-27

-------
Reach 6 relative  to  reach  7
    p7(2, 3)^(2)) .  [p7(2,3)E6(2)  + p6(2,3)£

                                                      [Eq.  9.23]

Reach 4 relative to reach  7
    ^(2,3)^(2)) .  [P7(2,3)(   n   e
                              H , j , b

    p (2,3)( n e.(2))   (3) + p  (2,3)   <2)(  n  £  (3))
            4,5 J      '       J       ^    6,7 j
      P4(2'3) (         (3))] Tr4<2>      ......    [Eq.  9.24]
Reach 3 relative to reach 7

    p (2,3) (  (2)) =  [p <2,3)(  n   e  <2)} + p  <2,3)(  „   e.(2)
     '        '                j»J»o  J        o      3,5   J      '
                                                      [Eq.  9.25]

      2 relative to reach 7
    p    '(  E   e.) e (3) + p (2,3)( n          n
     6      2,3,5  J                       '   J      '
                                                    [Eq. 9.26]
                               9-28

-------
Reach 1 relative to reach 7
                                                [Eq. 9.27]
Knowing the BOD shadow prices for all contributing reaches and
consequently the 0. , it is now possible to describe this regional
system in a market context.  The BOD shadow prices represent the
marginal value of upstream waste treatment to reach seven under
optimal conditions.

For the hypothetical region, the vector of 0..,  are shown in
Table 9-10.                                 1J 8
                          TABLE 9-10
 RATE OF SUBSTITUTION OF UPSTREAM WASTE TREATMENT FOR TREATMENT
                       AT REACH SEVEN
Item                             Reach
	12346	7

 0JJ             -752    .546   .785   .771   .965       1.00


If, for example, the marginal cost of BOD removal at reach seven is
$10/pound, then he would be willing to pay reach one up to $7.52/pound,
reach two up to $5.46/pound, etc. for  upstream BOD removal.
                               9-29

-------
9.4 Post-Optimal Analysis  to Determine  Regional  Flow Augmentation
    Benefits
This section describes how the more  productive sources  of  augmented
flow might be identified under the assumption that  the  activity
coefficients are independent of  flow.   The  flow  dependency of  the
activity coefficients will be analyzed  later.

The augmented flow may come from reservoirs located at  any of  the
headwater reaches' •(one,- two- or four  in  this case).   The assumed
upper bounds on the availability of  augmented' flow  are  twice the
base flow at reaches' one' and two', and- four- times  the- base  flow in
reach four.  The" relative'  effectiveness of  augmented flow  depends
on its quality characteristics and the  reaches in which it is  of
use in reducing waste treatment  costs.  For example,  a  unit release
of augmented flow in reach one would be of  potential value to
reaches one, three', five,  six, and seven.

9.4.1 Assigned _SouTces' of Augmented Flow
A point of departure for the analysis might  be to determine where
one additional unit of water could be most  effectively  employed.
But this information is already  known from  inspecting the  solution
to the dual problem.  The  shadow price with respect  to  the water
is 3Z*/3S^(1) = ir^d).  The shadow price vector for  the original
run is shown in Table 9-11.  As might be expected the value of
the unit of water is higher in the upper reaches.  Reach two is
seen to be the most desirable reach to introduce an  additional
unit of water.
                         TABLE 9-11

         SHADOW PRICE FOR WATER SUPPLY IN EACH REACH

                (PRIMARY TREATMENT REQUIRED)

Item          Marginal Value of Water in Indicated Reach; $/MG
            1      2	3	4	5	6	7_

          1045    1189    936     654     515     295      136
                               9-30

-------
Because of the fixed costs involved in constructing storage
facilities, it is likely that only a single source of augmented
flow would be used if a capital expansion is required.   However,
if there are existing reservoirs on reaches one,  two, and four,
then it is possible that the desired augmented flow could be
obtained from a combination of reservoir releases.  Benefit
functions are developed below for both these cases.

9.4.1.1 Selection of Most Effective Single Source
The selection of the single most effective source of augmented
flow will be determined in this section using parametric
programming.  The procedure is as follows:

1.  Obtain an optimal solution with no flow augmentation.

2.  Using parametric programming find 3 Z*/^.S^^  over a range
from the base flow, S d) f to the maximum flow, 5.'!).

3.  Do this analysis for augmented flow at reach one, reach two,
and lastly at reach four.

4.  Plot the benefit functions for comparative purposes.

The results of this analysis are shown in Figure 9-3.  Reach two
is the most desirable reach for flow augmentation.  Reach one is the
second choice; reach four is the last choice.  The most significant
difference in the slope of the benefit function occurs at smaller
levels of augmented flow.  This difference is partially attributable
to the differential value of water in the headwater reaches and the
fact that augmentation in reach four does not help reach three.
The diminishing marginal benefits result from the fact that higher
levels of augmented flow substitute for the less costly waste treatment.

A description of the impact of augmented flow at reach two is
presented below to assist the interpretation of the results.  With
no augmented flow, reach two is treating 69% of its waste.  At
125 MG of augmentation (the first breakpoint in Figure 9-3), the
required treatment at reach two has been reduced to less than
60% so that the unit costs are lower.  The amount of waste treat-r
ment has also been reduced in downstream reaches.  At the second
breakpoint  (268 MG of flow in reach two), the treatment at reach
two has been reduced to 50%.  Next, the treatment at reach four
was reduced to less than 90% BOD removal.  Reach four has been
                               9-31

-------
    10001—
           FIGURE  9-3
   FLOW AUGMENTATION  BENEFITS:
RELEASES IN EITHER REACH ONE,TWO,
            OR FOUR
vo
1
CJ
                                      REACH 2

                                      REACH I

                                      REACH 4
                       3   « 4

                       AUGMENTED
             789

            INDICATED  REACH :
 tO   II

MG X I02

-------
overtreating to assist a downstream waste discharger.  The third
breakpoint (271 MG) occurs when reach four has reduced its treat-
ment to the point at which it is just satisfying its own standard.
The fourth breakpoint (311 MG) occurs when waste treatment is
reduced from 50% to 35% at reach three.  The fifth breakpoint
(780 MG) occurs when waste treatment at reach six is reduced
from 90.0% to 85.0%.  Finally, for flows from 780 MG to the
prespecified maximum augmentation (1325 MG) waste treatment at
reach six is reduced from 85.0% to 79.2%.

The parameterization shows how flow augmentation substitutes
for the most costly waste treatment which is being used at a
given stage in the analysis.  Discontinuities result from the
original assumption of a separable piecewise linear convex
cost function.  If desired, it is possible to modify the original
selection of these segments and obtain a more suitable approximation.

Naturallyjthe selection of the most effective headwater reach is
also dependent on the relative cost of impounding water for flow
augmentation.  The analysis presented here does not deal with
these cost differentials.

9.4.1.2 Selection of Most Effective Combination of Sources
Next the case where potential sources of augmented flow are
available from reaches one, two, and four will be analyzed.
It is desired to determine the optimal release sequence from
these three sources.  This water is assumed costless so that we
are indifferent, from a cost standpoint, as to which source the
water comes from.  The selected procedure for this analysis is
outlined below.

lf  Obtain an optimal solution with no flow augmentation.  Let
[Q*]Q be the vector of the optimal activity levels and [ir.(l)]0
be the vector of shadow prices with respect to low flow augmen-
tation.  Let  [H^] be the set of headwater reaches.

2.  Find, Maximum [w^1^.
                              9-35

-------
3.  Augment the flow in this headwater reach until a basis change
occurs.  For the next optimal basis,  [Q  ]±,

     End, Maximum [ir
4.  Augment flow in this headwater reach.

5.  Continue this process up to a  specified maximum augmentation
or the flow at which  [TT.^1)] =[],the null  vector, tirhich indicates
that further augmentation is valueless.

Figure 9-4 shows the  results of this analysis.  Up to an augmented
flow of 781 MG, reach two is the most effective source of augmented
flow.  At this point, only reaches four and seven are exactly
meeting the water quality standard.  Thus augmented flow from
either reach one or two benefits only reach seven whereas augmen-
tation at reach four  benefits both reaches  four and seven.  Reach
four remains the most effective source of augmented flow from
781 MG to 905 MG because low flow augmentation is reducing the
required treatment at reach four in the 85-90% BOD removal range -
the most costly range.  Above a flow of 905 MG the optimal
strategy dictates using water from reach two until a flow of
1825 MG.  Then augmentation is most effective from reach four.

9.4.2 Effect of Variation in Quality of Augmented Flow
An important consideration in evaluating the benefits of flow
augmentation is the quality of the augmented water.  It is well
established that the  quality of the water in deeper reservoirs
is not homogeneous.  During summer months reservoirs usually
stratify into a warmer upper layer (epilimnion) which overlies
a cooler bottom layer (hypolimnion) .  The dissolved oxygen in
these lower layers is often quite low.  Because of the differing
quality of water that would be delivered as a function of the
portion of the reservoir from which it is removed, it is necessary
to evaluate the effect of such changes on the optimal solution.
The effect of releasing warmer water was described in Section
8.  The related case where the DO of the augmented flow is zero,
and where the augmented flow has a high BOD concentration, will
be discussed below.  The discussion will be restricted to
augmentation from a single source.  The multiple source case
can be developed as a direct extension of the this analysis.
                              9-36

-------
vr>
i
         lOOOl—
                                         FIGURE 9-4

                                 RELEASE SEQUENCE  WHICH

                          MAXIMIZES FLOW AUGMENTATION BENEFITS
                     3          6           9          12         15          is
                           AUGMENTED  FLOW AT  INDICATED  REACH:  MG X  10*
21

-------
9.4.2.1 Single Source With Zero DO
The flow in reach two was increased from its original level to
twice that level with the augmented flow containing zero DO.   The
results from this analysis are interesting.  Figure 9-5 shows
the regional treatment cost as a function of the augmentation
at reach two.  It is seen that a cost reduction (positive benefit)
results for smaller levels of flow augmentation.  However, a net
increase in regional costs results if the augmentation exceeds
about 435 MG.  The minimum regional cost occurs when the augmented
flow is approximately 133 MG.

The shape of the cost function can be explained by examining the
operation of the regional system under the assumed conditions.
Table 9-12 shows the percentage treatment for selected levels of
augmented flow.  The initial impact of the augmented flow is to
reduce the required treatment at reaches two and four.  The reason
why treatment could be reduced at reaches two and four was that
they were overtreating to assist reach seven.  As augmentation
continues, reductions in treatment are realized at reaches three,
                        TABLE 9-12

          TREATMENT REQUIRED WHEN AUGMENTED FLOW
          ENTERING AT REACH TWO HAS ZERO DO

Augmented Flow                % BOD Removal at Each Reach
At Reach Two:MG
0
133
266
400
533
666
680
67
67
67
67
67
67
67
1
.0
.0
.0
.0
.0
.0
.0
2
68.7
61.8
68.6
75.4
82.3
89.0
90.0
3
50.
50.
35.
35.
35.
35.
35.

0
0
0
0
0
0
0
4
90
89.
89.
88.
88.
88.
88.


9
8
6
6
6
6
6
90.

0
90.0
88.
86.
84.
82.
81.
3
3
2
1
8
7
50.
50.
50.
50.
50.
50.
50.

0
0
0
0
0
0
0
                               9-39

-------
                                     FIGURE  9—5

                              REGIONAL WASTE TREATMENT COST

                     AUGMENTED FLOW WITH  ZERO  DO AT REACH TWO
        3.5
       x

       0,3.4
       to
       o
       o
vo
I
,33
       LJ
       oc
         3.2
       S3.1
        3.0
                  FLOW  AUGMENTATION  BENEFIT
                           I
                              I
                           3456

                             AUGMENTED   FLOW
                                         7     8    9     10

                                       IN  REACH TWO:  MG  X
        12
13
14
I01

-------
four, and six.  However, the augmented flow with zero DO utilizes
the available excess oxygen in reach two and consequently more
treatment is required.  In fact an infeasible solution to the
problem results if the augmentation exceeds 680 MG because the treat-
ment plant at reach two is using its entire capacity.

For this hypothetical river system, augmented flow with zero DO
has a positive benefit over a restricted flow range.  However, it is
impossible to generalize from these results regarding the benefit
of this type of flow augmentation since it clearly depends on the
particular regional system- under study.

9.4.2.2 Single Source With High BOD
The next task is to examine the effect of augmented water with a
high BOD entering reach two.  In this case, the BOD concentration
of the augmented; flow was much higher than the BOD concentration
of the base flow.  The results of this analysis showed that the
increased BOD loading reduced the effectiveness of the augmented
flow to the system.  Figure 9-6 shows the regional cost function for
augmented flow at the original BOD, twice the original BOD, and
five times the original BOD in the augmented flow.  The added BOD
load has a relatively minor effect on the regional cost function.
Even raising the BOD concentration to five times the base level
decreased benefits by only about 15%.  Here again, the total
impact depends on the specific regional configuration.

9.4.2.3 Varying Activity Coefficients Using Single Source
Section 7 discussed a technique for estimating low flow augmentation
benefits which accounts for the changing coefficients in the
activity matrix.  This approach will be utilized here to determine
the flow augmentation benefits for the limiting conditions described
in Section 7.  The two limiting cases for augmentation in reach
two are as follows:
1.  use activity coefficients for S-j, the base flow;  and

2.  use activity coefficients for Sj^ ^, the upper bound on
    the flow .

Figure 9-7 shows the regional benefit function for these two
conditions.  The regional benefits are seen to be larger if the
                               9-43

-------
Ui
      - 500
      x
      CO
      Ul
      2

      £400
      z
      o
        300
      5:
      o
        200
        100
                                        FIGURE 9—6

                         EFFECT  OF BOD IN AUGMENTED FLOW ON REGIONAL
                          BENEFIT  FUNCTION-AUGMENTATION AT REACH TWO
I X BOD CONCENTRATION-
                                 2 X BOD CONTRATION
                                                           5 X BOD CONCENTRATION
                          34     56    78    9    10

                          AUGMENTED   FLOW AT REACH TWO:  MG X IOZ
                            12
13
14

-------
coefficients for the base flow are used.  This result was expected.
These two curves provide the analyst with the limiting cases of
the influence of changing coefficients on the optimal solution.
For this hypothetical river system the actual curve would lie
between these two curves as shown in Figure 9-7.  From the results
of the parameterization, the limiting conditions for the flow
augmentation benefit function can be derived as outlined in
Section 7.  Improved results can be obtained by adding more break-
points to the original approximation of the cost function.  It
is necessary to revise only those cost functions which are affected
by the parameterization'.  The' ones which are in this- category are
known.  For example, in the curve with base flow coefficients,
flow augmentation in excess of 306 MG simply reduces the waste
treatment at reach six from 90% on down to-about 79%.  Consequently,
a better approximation can be obtained by increasing the number of
breakpoints, in this treatment range, only for the reach six
cost function.

9.5 Conclusions
Application of the optimization model to a hypothetical region
has been presented.  In the first part of the section, the
important linkage between theory and application is provided
by illustrating how the model is structured and operated.  The
implementation, shown in the latter part of the section, demonstrates
the value of the model for quantifying the benefits of low flow
augmentation, via post-optimal analysis  for various assumed
conditions.

The flexibility of the model is demonstrated for the deterministic
case.  However, its structure should permit formulation of the
stochastic case using chance-constrained programming or a related
method.  Also, the scope of the analysis was restricted to finding
the gross benefits of low flow augmentation.  The net benefit
                             9-47

-------
         500 —
                                             FIGURE  9-7
                            EFFECT  OF VARIABLE  ACTIVITY  COEFFICIENTS ON
                       REGIONAL BENEFIT FUNCTION AUGMENTATION AT REACH  TWO
UD
I
-P-
V£>
O

X

t*


to
t
ul
Ul
z
LU
CO
         400
               BENEFITS  USING ACTIVITY COEFFICIENTS  FOR
               MINIMUM AUGMENTED  FLOW
ESTIMATED  BENEFITS USING ACTUAL
ACTIVITY COEFFICIENTS
  300
       UJ
       2
       o
         200
       3:
       O
       _l
       U-
       z
       o
       o
       LJ
         100
                             .BENEFITS USING ACTIVITY  COEFFICIENTS
                              MAXIMUM AUGMENTED FLOW
                                                                            FOR
                             3456789     10    II
                                AUGMENTED  FLOW  AT REACH TWO:   MG X I02
                                                                           12
                                                                            14

-------
function could be determined if the work is extended to include
a comprehensive derivation of the flow augmentation cost function.
This derivation should include not only direct costs, e.g., reservoir
construction, but also imputed costs which reflect the value of
water in alternative uses.  These imputed costs may be important
because of the relatively intensive demands for the water that could
be expected during low flow conditions.
                               9-51

-------
                          REFERENCES
                          SECTION 9

1.  Loucks, D.P., Revelle, C.S., and Lynn, W.R., "Linear Programming
Models for Water  Pollution Control," Management Science, Vol. 14,
No. 4, 1967.

2.  Leopold, L.B. and Haddock, T., Jr., The Hydraulic Geometry of
Stream Channels and Some Physiographic Implications, Geological
Survey Professional Paper 252, Washington, B.C., 1953.

3.  Langbein, W.B., and Durum, W.H., The Aeration Capacity of Streams
Geological Survey Circular No. 542, U.S.G.S., Washington, D.C.,
1967.
                             9-52

-------
                         SECTION  10

                      ACKNOWLEDGEMENT S
The three-year study reported upon herein has been a cooperative
project involving the inputs of many individuals, both from within
and without the University of Florida.

Major contributions to the development  of the hydrologic simulation
model were made by Dr. John C. Schaake, Jr.  during the period
when he was an assistant professor at this institution (1966-1968).
Another former faculty member, Dr. David H.  Moreau (1966-1968),
provided valuable insights concerning the performance of sensitivity
analyses.  We are appreciative, too, of the extensive programming
vary capably handled by Research Associates E. J. Weiner and R.
Aleman.  Drafting of illustrations, key punching and general
engineering calculations were the responsibility of Research
Assistants R. A. Jandrucko and John Moore.

Two doctoral dissertations were closely tied to the project:  A
Methodology for Selecting Among Water Quality Alternatives, by
Gilbert S. Nicolson (Ph.D. 1969), and A Water Quality Simulation
Model, by G. R. Grantham  (Ph.D. 1969),  the latter of which served
as a basis for Sections 6 and 8 of the present report.  Two M.S.E.
theses, Cost Curves of Sewage Treatment for Low Flow Augmentation,
by R. David G. Pyne (1967), and An Investigation of Parameters
Affecting the Cost of Impounding Water for Low Flow Augmentation,
by A. I. Perez  (1968) were modified by Messrs. Pyne and Perez to
form Sections 5.3 and 5.4, respectively, of the present report.

We are grateful to our colleague, Dr. Kenneth C. Gibbs, Assistant
Professor of Environmental Engineering and Assistant Professor
of Agricultural Economics, for his careful review of major portions
of the report - especially, Section 5,  "Economic Analysis." And
to Mrs. Kathy Weller and Miss Jackie Rimes, secretaries, we offer
our thanks for typing and clerical assistance.

During the course of the  project, various outside consultants
of national stature were  utilized.  We acknowledge important
contributions by:  Dr. M. B. Fiering, Harvard University; Dr.
Paul Bock, University of  Connecticut; Dr. Robert V. Thomann,
Manhattan College; Dr. Kenneth Kerri, Sacramento State College;
Dr. Walter R. Lynn, Cornell University; Dr. Charles E. Renn,
Johns Hopkins University; and, Dr. Daniel P. Loucks, Cornell
University.  The authors  alone, however, are responsible for the
contents of this report.
                                10-1

-------
The application of  the methodology  to  a  specific  river  basin -
the Farmington' River Basin  in  Connecticut  and Massachusetts  -
was greatly facilitated" through  the interest and  help of  local
organizations.  We1  drew heavily upon" the1 published- report of the
Travelers Research'Center;  Inc., Hartford,  Connecticut, entitled
Water Resources Planning'Study of the  Farmington  Valley.   The
data contained in that report  were  extended and updated by making
personal contact with Mr. Harold Peters, Executive  Secretary of
the Farmington Rlvier" Watershed Association, Messrs'. Gilbert  U.
Gustafson and' Michael' Long-  of  the" Metropolitan' District Commission
of Hartford County,'Mr. Robert Taylor  of the' Connecticut  State
Water Resources Commission', Mr'.  Robert Tolles' of-  the Stanley
Company, Mr."George Sarandis of  the New England Division,  Corps
of Engineers and', finally, Messrs.  John Horton and  Edward L.
Burke of the Hartford District Office, U.  S. Geological Survey.

The authors also would express their appreciation to Mr.  E.  P.
Lomasney of the Atlanta office of FWPCA, who has  served as
Project Officer and who has made many  helpful suggestions.
                              10-2

-------
                        APPENDIX Al
                     DEFINITION OF  TERMS
                     USED  IN  EACH SECTION
Section
KT
         deoxygenation  velocity  constant
         regeneration velocity constant
         rate factor, loss  of BOD in reservoir
Section 5
Y        total annual waste treatment costs
a,b      coefficients
Q        design capacity of treatment plant, MGD
QMAX     maximum average monthly streamflow, MGD /square mile
QMIN     minimum average monthly streamflow, MGD/ square mile
CMAX     maximum average monthly coefficient of variation of atreamflows
CMIN     minimum average monthly coefficient of variation of streamf lows
SMAX     maximum average monthly coefficient of serial correlation of
         streamflows
SMIN     minimum average monthly coefficients of serial correlation of
         streamflows
DMAX     maximum monthly demand rate, MGD/aquare
0MIN     minimum monthly demand rate, MGD/square mile
DLAG     time period elapsed between the largest flow and tfhe,
         largest demand, months
PROB     probability that the reservoir will not become empty
         in any given year
v        required storage volume per square mile of drainage area
         of the watershed, acre  feet/square mile
         total storage volume in acre feet
         number of square miles in the drainage area
         represents DMAX, cubic feet per second
         represents DMIN, cubic feet per second
         represents QltIN, cubic feet per second
         represents Q1IAX, cubic feet per second
         unit cost equation for region B
         total capital cost of the reservoir
V
A
c
C
 Section  6
 Q
 A
 V
R
S
w
         rate of flow, cubic feet per second
         area, sq. ft.
         velocity, feet per second
         Manning's friction factor
         hydraulic radius, feet
         slope of hydraulic grade line
         width of channel, ft.
                                 Al-1

-------
d        mean  depth  of  flow,  ft.
a        constant, width-discharge  equation
b        constant, width-discharge  equation
c        constant, depth-discharge  equation
f        constant, depth-discharge  equation
K        constant, velocity-discharge equation
m        constant, velocity-discharge equation
y        mean
a        standard deviation
r        random variable
x        data  point
p        serial correlation coefficient
e        standard normal deviate
Y        skewness
£        random component, gamma distributed
n        standard normal random deviate
e        natural logarithm base
t        dummy variable
a    '    constant, transformation equations
n        constant exponent
n        sample size
T        temperature
R        random number  (0,1)
L        week  index
t        time..
K2       reoxygenation velocity constant
C        dissolved oxygen concentration
KI       deoxygenation velocity constant
u        mean velocity
h        depth
g        gravitational constant
L        BOD concentration
Y        deoxygenation error term
D        dissolved oxygen concentration
K^       deoxygenation velocity constant
s        reoxygenation error term
Lo       initial BOD concentration
D0       initial DO concentration
X        data value
3        regression constant
x        data value,  residual
r        correlation coefficient
S        covariance matrix
X        root of correlation matrix
                               Al-2

-------
B        regression constant, generation eqn.
C        variance coefficient* generation eqn.
A        deterministic component, generation eqn.
r        week of the year
n        number of basis gages
QO       flow at point 0
DAO      drainage area at point 0
a        weight coefficient
QS       flow at gage point
DAS      drainage area at gage point
s        transformed variable, laplace transforms
p        reoxygenation error term
La       initial BOD concentration
Da       initial DO concentration
tc       critical time
BODin    BOD at upstream point in reach
BODOUT   BOD at downstream point in reach
BODW     BOD of waste
Qy       flow rate of waste
QIN      flow into reservoir
QREG     regulated flow
QOUT     flow out of reservoir
RREL     reservoir release rate
DIV      diversion rate
y        BOD concentration in reservoir
V        volume of water in reservoir
Yin      BOD cone, incoming to reservoir
K3       rate factor, loss of BOD in reservoir
QVAP     evaporation loss in reservoir
YQ       BOD concentration in reservoir, beginning of time interval
C0       DO concentration in reservoir, beginning of time interval
W        equals QOUT/V
Z        equals QIN/V
A        equals K^ + W + K3
B        equals K£ + W
C        average DO cone, in reservoir
y        average BOD cone,  in reservoir
Cin      DO cone, incoming to reservoir
Si/       sensitivity function
a..      overall transfer function,
A.J.      constant, transfer function regression equation, BOD
r.j      flow transfer factor
Bij      regression coefficient, transfer function reg. eqn. BOD
C^  '    regression coefficient, transfer function reg. eqn. DO
DJLJ      constant, transfer function regression equation, DO
d^      DO transfer coefficient
aA      BOD transfer coefficient
                                   Al-3

-------
B
e
A
B
N
   (k)
Pl(k!k>

Cib
Qib
   (kT)
Qib(kT)
Z
n
P
q
K
K

B
B
D
M
 transformed  flow value
 ith  statistical moment about zero
 ith  statistical moment about mean
 skewness parameter
 kurtosis parameter
 angular constant
 Fourier constant
 Fourier constant
 number of years of data
Section 7
set of all contributing reaches above reach i
set of all contributing reaches immediately above reach i
set of all recipient reaches downstream from reach i
set of all treatment plants in region (q elements)
flow of commodity k into treatment plant in reach i
new supply of commodity k entering reach i
flow of commodity k from treatment plant to reach i
flow of commodity k at beginning of reach i
flow of commodity k at end of reach i
attenuation or amplication of commodity k in transit
through reach i
change in flow of commodity k1 through reach i per unit of
flow of commodity k through reach i
cost of transporting a unit of commodity k along treatment
branch b in ith reach
flow of commodity k along treatment branch b in ith reach
upper nound on Qib'  ^
lower bound on Q-JK  "^
minimum allowable flow of commodity k in reach i
value of the objective function
number of treatment branches
number of reaches
number of treatment plants
rate constant for deoxygenation, day"-"-
reaeration rate constant, day~l
rate constant for sedimentation and adsorption, day~^
BOD concentration, ///11G
BOD concentration at time 0, #/MG
BOD concentration time t, #/MG
rate of BOD addition due to runoff and scour, #/MG/day
DO deficit, #/MG
DO deficit at time 0, #/MG
DO deficit at time t, #/MG
oxygen production (M>0) or reduction (M<0) due to plants
                                 Al-4

-------
[A1-3'!
   l2
         saturation DO quantity at the beginning of the reach, Ibs
         saturation DO quantity at the end of the reach, Ibs
k" (3,1)  saturation DO concentration, #/MG
         (p+q)x(p+q) matrix of water continuity coefficients
         (p+q)x(p+q) matrix of BOD continuity coefficients
         (p+q)x(p+q) matrix of DO continuity coefficients
[p(l,2)] (p+q)x(p+q) matrix of water-BOD interdependency coefficients
[p(2,3)] (p+q)x(p+q) matrix of BOD-DO interdependency coefficients
[p(l,3)] (p+q)x(p+q) matrix of water-DO interdependency coefficients
[D^1'3)] (p)x(p+q) matrix of water-DO quality coefficients
[D(2»3)] (p)x(p+q) matrix of BOD-DO quality coefficients
[D(3, 3)] (p)x(p-fq) matrix of DO quality coefficients
[T(2)]   (p+q)x(nxq) matrix of BOD treatment alternatives
[I]      (nxq)x(nxq) identity matrix of upper bounds on BOD removal
[ir^1)]   vector of dual variables associated with [s(l)]
[ir(2}j   vector of dual variables associated with [s(2)]
fnr(3)]   vector of dual variables associated with [s(3)j
[TT™)]   vector of dual variables associated with [^^)]
[Tr(5)j   vector of dual variables associated with   [Q(2T)]
0.jj      rate of substitution of upstream BOD removal at reach j
         relative to BOD removal at reach 1
         BOD removal shadow price for upstream reach j
         marginal cost of BOD removal at reath i
         water quality shadow price for upstream reach j
         shadow price with respect to flow at reach i

Section 8
E        evaporation rate, inches per week
L        week of year
D        diversion rate, million cubic feet per week
K-]_       deoxygenation velocity constant
K£       reaeration velocity constant
K3       rate factor, loss of BOD in reservoir
c        constant
f        constant
h        constant
m        constant
T        temperature
w        width of channel, ft.
d        mean depth of flow, ft.
v        velocity, ft. per second
Q        rate of flow, cubic feet per second
q        transformed flow values
PJ       ith statistical moment about mean
Sf (k)    sensitivity function
 k
                             Al-5

-------
Section  9
S^W         base  (unagumented) flow, MGD
3.j(l)         maximum flow, MGD
T             flow  time through reach r, days
QW            wastewater inflow, MGD
QT            tributary inflow, MGD
CS            saturation DO concentration, mg/1
B             maximum allowable DO deficit, mg/1
D             minimum allowable DO concentration, mg/1
CW            wastewater DO concentration, mg/1
CT            tributary DO concentration, mg/1
BW            wastewater BOD concentration to treatment facility, mg/1
BT            tributary BOD concentration, mg/1
K!   " '        deoxygenation rate constant, day"1
&2            reaeration rate constant, day-1
K-j            sedimentation and adsorption rate constant, day~l
M             oxygen production (M>0) or reduction (M<0) due to plants
              and benthal deposits, nig/I/day
P             % BOD removal 1980 load with existing wastewater
              treatment facility
R             BOD addition rate due to runoff and scour, mg/l/day
Q            'discharge
w             water surface width
d             mean depth
v             mean velocity
a,c,f,k,l,m,  numerical constants
A             cross-sectional area of the stream
L             length of the reach
[c(2T)]        unit cost matrix for transporting a unit of commodity
              2 (BOD) along treatment branch b in the plant in reach i
[Q^2T)j        matrix for the amount of BOD removed at the corresponding
              branches
              cost vector for branch b in the treatment facility in
              the ith reach
              BOD commodity vector for the treatment  facility in the
              ith reach
              flow of commodity 1
              flow of commodity 2
              flow of commodity 3
              amount of BOD removed at the corresponding branches in
              the plant
              additional amount of commodity 1 entering system
              additional amount of commodity 2 entering system
              additional amount of commodity 3 entering system
              minimum allowable flow of commodity 3
                            Al-6

-------
[fi(2T)]      upper bound on
A^k)         matrix of continuity coefficients for the three commodities
pk  ,k        matrix of interdependency coefficients
             matrix of coefficients for water quality DO standard
             matrix of BOD treatment alternatives
g            sum vector with n components
n            number of linear segments representing percent treatment
             at a facility
I            identity matrix of upper bounds on BOD removal
IT .(2)        marginal cost of BOD removal at reach i
IT . (4)        water quality shadow price at reach i
A^           set of all contributing reaches above reach i
0. .           rate of substitution of upstream BOD removal at reach j
             relative to BOD removal at reach i
 j(l)        shadow price with respect to flow at reach i
H.           set of headwater reaches
                              Al-7

-------
                        APPENDIX A-2
                  CURVE FITTING TECHNIQUES
The mathematical formulation of relationships often requires that
a mathematical equation be fitted to a set of data.  In general,
data are in periodic form or in a form that can be fitted by a
polynomial or an exponential formula.  Fitting curves to data
points is a time-consuming process and one that is readily
programmed to the computer.  This section contains coding and
documentation for two programs, FITCRV and CRVFIT which can be
used to place data points in mathematical form.

The program FITCRV is designed   to fit data having a primary
period of one year.  The basic assumption is that the data are
represented by the form:
                   Y = f(x+2ff) = f(x) ....... [Eq. A2.1]

where x represents an angle in radians.   This can be represented
by a trigonometric series:

           Y = Ym + C± cos (x-^ ) + C2 cos (2x-*2) +  . . .


               Cn cos (nx-$n) + ....  ....... [Eq. A2.2]


where Ym is the mean Y for the period, C^ are the amplitudes of
the ith harmonic and $]_ are the phases of the ith harmonic (1) .

The computation is carried out using the forms:

                   Ym = 1  nj1   (Yj)   ......  [Eq. A2.3]
               ak = -  "z1  Yi cos k xi
                    n
                       i-0
                    k - 1, ... N
                              A2-1

-------
                                 Y.  sin x±
                                  [Eq. A2.5]
                         n   1=0

                     k = 1,  ... N
                          (a, 2 + bv2)1/2    	[Eq. A2.6]
                     k = 1,  ... N
$k = tan'1 bk
                                                       [Eq. A2.7]
                     k = 1,  ... N

N is the number of harmonics desired.

In a set of data, the values (Y., X..^) are known and may be substituted
into Equations [A2.4], through  [A2.7] to obtain Ck and 4>,.  The
program is set up for maximum N = 6.  The program furnishes values
of Ck and $k for all values of k < N for all harmonics 1,2...,N.
This latter feature allows the use of fewer than N harmonics, with-
out recomputing, if it is found that the Ck and 4>k for the higher
harmonics have little effect on the result.

The program CRVFIT utilizes the "least squares" criterion for fitting
a polynomial of degree 1 to 7, f(x) = AxB or f(x) = AeBx, depending
upon the control variable selected.  The routine to fit the polynomial
starts with degree 1, sets up and solves the normal equations, re-
generates the data using the polynomial and compares the original
and renerated data.  If the comparison is not within the limits
specified, the degree is augmented by one and the procedure is
repeated.  The maximum degree that can be used in this program
                              A2-2

-------
is 7»  The normal equations are solved using the method of Gaussian
elimination, wherein the matrix of coefficients is triangularized
and the variables solved for by starting at the bottom row and
moving upward.

For the exponential forms, two normal equations are formed and
solved for the "best fit" values of A and B.

The program coding for both programs follows:
 (1) Mackey, Charles., Graphical Solutions, John Wiley and Sons,
New York, 2nd ed., 1944, p. 142.
                              A2-3

-------
            JOB  ( 1143f47 ,009,05, LCOC ), "nEINGR               ',MSGLE
                                                            VEL=1
//          EXEC  F4GOX    FORTRAN G, COMPILE,  PUMCH  USJ.  DECK, EXE
                                                            CUTE
//FGRT.SYSIN  CC  *
      01 KEN SICK  Y{520),THETM52),TH£TAC(52),A{6),B(6),C(6),TAU{6)
                                                            t
     1           YEST(52) ,YHCLC(6}
     2           ,ALPHA(20)
   16 READ ( 5 • -13, ENO=17) ALPHA
   L8 FORMAT ( 2CA4)
      READ{5,l)KNAXiNlM,NPERC,NPERI,(Y(I),I=LiNIM)
    1 FORMAT! I3,3I't,/( 10F8.21 }
      WRITE (6, IS JALPHA
   19 FCR^ATf Lhl,20AA///)
      VjRITE(6,3 JKMAX.NINrNPERI ,NPERC, < Y < I ) , I = 1 , ,N IN )
    3 FORMAT (1H  ,' NUMBER  CF HARMON I CS= ' , I 3  ,/
     1' Nljf'DEH CF  RECORDS  TC BE READ  IK  = ' , I 'f , /
     2' NU/'BE^ CF  INPUT RECCRDS PER PER I 00= ' , I 4 , /
     31 NUMDER CF  ULTPUT  RECGRCS PER  PER I(JD= • I A , 11 /
     51HO, 'ORIGINAL  INPUT  C AT A • t / ( I X , 1QF 12 . 2 } )
C     CONVERT  WCEKS  TO  RADIANS
      XF=(2*3.1416)/NPERI
      XW=(2*3.1416)/NPr:RC
C     CALCULATE  Tht T AS~C ALCULATE Yf^EAN
      YSUM=0
      CC 2  I=1,MN
    2
      CO  13  I = 1, (\PcRI
   13 THETAl I }=Xf>*I
      Y^eAi\ = YSL^/iMK'
      ^RITE (6, 2OYMEAN
   20 FORMATUH  ,'MEAN  CF  INPUT CAT A
C     CALCULATE  M K ) , B ( K) , C ( K ) , TAU ( K )
C     FOR  EACH CF  K.KAX  1-ARfCNICS
      CO  6 K=l,KiVAX
      AIK)^0
      BIKJ-G
      C(K)=C
      J = 0
      CO  7 1 = 1, NIN
      J^J+1
      ARG = K*THETA( J )
      A(K)=A(K)+Y( I J»CQS( ARC)
      B(K) = [i(K)+Y( I )*SIM ARC)
    7 IF( J.EQ.NPERI ) J = 0
      A(K) = A(K)M2./MiM)
      B(K)aG(KJ«(2./MN)
      BB=8(K )


                                A2-5

-------
   TAU(K)=ATAi\2COO,AA)
 6VvRITE{6,9)K,A{K),PJ(K},C(K),TAU(K)
 9 FCRMATt IHOt 'HARMCNIC' » 13,/'  A(K ) = • ,F14.4,/

  2       /' TAU(K)  =  ' ,FU.^)
   hRITc(6> 1'3 )ALPHA
   ^RIT£<6, 1C)
10 FOR.vAT(lh ,'FOURIER  APPROXIMATIONS TC ORIGINAL  DATA  FCR EAC
                                                         H  OF K
  IHARMCMCS't/LX,'   I',11X,'K=1',11X,M; = 2',UX,'K = 31,11X,»K=4
                                                         ' t
  211X, »K = 5» i 11X , »K = 6 » )
   CALCULATE  VEST
   CO 12 I=i,NPERO
   T H E T A C ( I ) = X f M * I
12 YEST( I )=Y^EA,\I  .
   CO 15 I=1,NPERO
   CC 8 K=l,KKAX
   ARG = K*ThETAC( I J-TAUIK )
   YEST(I)=YEST(I)+C(KJ «CCS(ARG)
 8 YhCLC(K)=YEST ( I)
   V>RIT£(6, 1 1)1, (YHOLCIK) ,K=l,Kf AX)
11 FORMAT! Ih  , I3,6F14.4 }
15 CONTINUE
   GO TC 16
17 STGP
   END
                             A2-7

-------
//CRVFIT   JOB  ( 1K3, 47,005,06, CCCC) , 'ALEMAN              ', CLASS
                                                           = S
/*FASSUORC      liLOFLOJCQ
// EXEC F4GCXS      FCRT  G  COMPILE  (NODECK),  EXECUTE, CLASS S
//FCRT.SYSIN fiC  «
      NSP=1
      CALL CRVFIT(NSP)
      CALL EXIT
      END
      SUBROUTINE SI FUL ( N i A , D , C )
C     THIS SUBROUTINE  SOLVES  A  SET OF  SIMULTANEOUS EGUATI CNS ( L I .ME
                                                           AR)
C     USING GAUSS'S  METHOD.
C     N=.I\C. OF  EQUATIONS.
C     A^ARRAY CF COEFFICIENTS  OF  THE  EQUATIONS.
C     B=VECTCM  CF CONSTANT TERVS  FCR  THESE EQUATIONS.
C     C=VECTGR  CF SCLUTlChS  FOR  THESE  EQUATIONS.
                                                           « « » * « t» ft
      CIMENSIC.X  A(2Ct2Q)rB(20)tC(2C)
      NNl=N-l
      CO 60 K=1,NN1
      KP1=K+1
      L = K
C     NOW ALL THE RCWS  ARE  ARRANGEC SO THAT  AtK.K) IS NOT ZERC.
C     AND ALL CIAGONAL  TERivS  ARE LARGEST IN ABSOLUTE VALUE.
      CO 20 I=KPl,M
      IF( AUS( A( I,K) )-ABS(A(L,K) )) 20,20, 21
   21 L=I
   20 CO.vTIKUE
      IF(L-K)50t 50t25
   25 CG 30 J=K,N
      TT=A(K, J)
      A(K,J)=A(L,J)
   30 A(L,J)=TT
      TTT=3(K)
      B(K)=E{ L )
      BJD'TTT
C     *«««««»«***#*««#«»»#******#«#«#*»*#*»»#****#«•****«*********
                                                           -*«*««**
C     PROCEED UITh  GAUSS'S  ELIMINATION.
   50 CO 60 I=KP1,N
      FX=.A( I,K)/A(K,K)
      A( I ,K)=0 .0
      CQ 56 J=KF1,N
   56 A( I, J)=A( I ,J)-FX*A(K, J)
   60 B( I)=E( I )-FX*6(K)
C     MATRIX  A   IS  NOW  A  TRIANGULAR  MATRIX.
C     BACK  SCLUTICJ  METHOD  PROCEEDS.
C     aa««B«£*«4««fta«»x«vc«««««it&tt&£tt*«*tt«**tt*ft8&ttftfi«ft*&*«»tt«*«*ft
                                                           ***«•«»*
                                 A2-9

-------
      C(N)-E(.\ )/A(M,N)
      I=MP1
   61 IP1=I+1
      s = o.o
      CO  7C  J=IPlr'J
   70 S=S+A( I , J)«C( J )
      C( I J = (Cf I J-5) /A( I , I )
      1=1-1
      IF{ I )6C, 30,61
   80 RETURN
      ENC
      FUiNCTILN  F(N,X,C)
      CINENSlUsCm)
      TERM=C.O
      CO  1  I = l,,\
      J=N-I+1
       IF(J.EQ.l)  GO TC 2
    1  CONTINUE
    2  F=TERN
         TURN
       ENC
       SUDRCLTIISE  CRVFIT(KSF)
C      CURVE-FITTING ROUTINE USING ThE METHOD  OF  LEAST  SQUARES.
C      NSP=1  CCRRESPCNCS TC A POLYNOMIAL FIT.
C      i\SP = 2  CCRRESPCNDS TO AN EXPONENTIAL  FIT.
C      NSP=3  CCRRESPCNDS TC A NATLRAL EXPUNENTIAL  FIT.
       CINE.NSIL\  X(2CO)rY(2:C)tXK2CO)iYl(2CO)iA(ll,ll)iB(ll)fC(ll
                                                            )
       CI^ENSICN  P(2C),X11(2C1,X22(2C),CC(11),XX(20)
       CATA X11/2C*1H-/,X22/2C*1H-/
C      N$=  MNBER  UF DATA PCINTS.
       READ (5,1)  M
    1  FORMAKI5)
       REAC{5,2 ) (XU J iYJ I ) , 1 = 1, N$)
    2  FCRfAl ( 1CF8.0)
       GC TC  ( 1CC,20C,3CO) ,NSP
  ICO  C C 199  I* = 1 i 7
       N'X2 = N'«2
C      l^ = CEGREt  CF PCLY.MCMIAL.
C      FCR  SINGLE  APRCX I v AT ICN MAKE STATEMENT  100  OF  THE  TYPE  M = NU
                                                            f'BER.
C      POWERS  CF  X ARE  NOV.  FCRMED.
       CO 13  1 = 1, VX2
       P( I )=0.0
       CO 13  J=1,N$
   13  p(u = p( i i + xm«*i
C      N= KC.  CF  ECUATIOiNS.
C      A=ARRAY  CF  COEFFICIENTS.
C      D=VEC1GR  CF CCNSTANT TERNS.
                                  A2-11

-------
      N = ,V+1
      CO 30  I = l,,\
      CU 30  J=l, v
      K=I+J-2
      IF(K)  29,29,23
   26 At I,J)=P(K)
      GO TC  3G
   29 A( 1, l)=i\t
   30 CONTINUE
      B { L ) = C . C
      CO 31  J=l ,N$
   31 B( 1)=B{1)+Y(J )
      CC 32  1 = 2, N
      3( I )=O.C
      C G 32  J =1 ,N 5
   32 B(I)=B(I)+Y(J)«X(J)*»(I-l)
C     TC SOLVE  THE  SIMULTANEOUS EQUATIONS HE CALL CN SIPUL.
      CALL SIMUN,A,3,C)
C     feE P3IM  RESULTS  [l\  CESIRED FORM.
   80 CO 85  1=1 ,N
      IF(C( I).LT.C.O)  GO  TC 82

      GO TC  33
   82 XX( I )=X22U)
   83 CC( I )=ACS(C(I ) )
   er> CONTINUE

   86 FORMAK ' 1 ' ,/////!37, ' I1 ,TrJ2, '2' ,T67, '3' ,T82, '^t',T97, «5' ,T11

     lT127,f7l,/T6,'F(X)-',A2,F10.6,A2,F11.6,'Xl,6(A2,Fl.?.6,«X1))
C     LETS CHECK  FOR  90   ACCURACY.
      DC 90  1 = 1,Mi
      XI ( I )=X( I )
      X$ = X( I)
      Yl( I )=F(\,X$,C)
   90 CONTINUE

      CO 93  1=1,N$
      IF(AES(Y( I)-Yl(I) ).LE.1.E-0^)  GU TO 95
      GO TC  98
   95 N fv.=. \ \ + 1
      IF(i\i\.LE. (C.1*N$) }  GC TO 93
      \* R I T E ( 6 , 9 6 )
   96 FCRMATf1H3,TIC,'THIS  POLYNOMIAL FIT CUES NOT CONVERGE  TC  TH
                                                            E  DESIR
   .  1ED ACCURACY1 )
      NE-0
      GC TC  99
   98 CONTINUE
      kRITE(6,1C9)
  1C9 FORMATJ'C',T10,'ThIS  POLYNOMIAL FIT SATISFIES ERROR  CRITERI
                               A2-13

-------
                                                         A1 t/TIO
   liMT IS CCRRcCT TC FCLR  DECIMAL  PLACES  F03 90  OF DATA.1)
          NE = 1
    GO TC 55
 59 CALL XYPLCnXiYiNf)
    CALL XYPLCT(XI,Y1,N$)
    IF(NE.EC.l) RETURN
159 CONT IMiE
    DC 17C J=l,3
    kRITE(6, 185)
109 FCRKAT ( ' «*«*a««*****-»POLYNCMIAL  FIT  FAILEC TC NtET ERROR CR
                                                         ITERIA*
   l***-»fl-B**«* ' }
    'wRlTE(6, 189)
    WRITE(6, 18'*)
170 URITc(6, 18S)
    tfETLRIS
2CO T=iC.O
    s=.c.o
    ST=C.C
    ss=o.c
    TT=C.C
    CC 202 I=I,Ni
    THE SlfS NECCESSARY  FCR  EXPONENTIAL  FIT ARE NCk FORKED1
    T=T+LCG(X{I)J
    TT=TT+LCG(Y(I))
    SS = SS-KLCGU( I )) )«*2
2C2 ST = STi(LCG(X( I ))*LCG(Y(I ) ) )
    NE = 0
    Atlt1)=rtt
    A{1,2)=T
    G( 1) = TT
    A(2t 1 ) = T
    A(?t2)=SS
2C8 3(2)=ST
    CALL SIML(2,A,B,C)
    BEXP=C(2)
    A1 = EXP(C( 1) )
    IF(NE .EC. 1 ) GC TO 35C
    hRlTe(6i25C)3EXPtAl
250 FCRNAT('1I,/////T22,F6.^,/T6,'F(X)=«,F10.^,'X')
    CO 26C 1=1,Nt
    Xll I )=X( I J
260 Yl(I)=A1«(X(I)«*BEXP)
280 CALL XYPLCT(X,Y,N E)
    CALL XYPLCT(XL,Y1,N$)
    RETURN
3CO S=O.C
    T = O.C
    ST=O.C
    SXC=0.0

                             A2-15

-------
      DC 31C  1 = 1 ,N$
      T=T+X(1)
      S=S+LCG(Y(I))
      ST = ST-» (XII) «LQG( Y( I ) ) )
  310 SXG = SXQ+X( I}*X(I)
      AC 1,1)=N$
      A{ 1,2J = T
      A(2r 1 )=T
      M2,2)=SXC
      em = s
      NE=1
      GO TC  208
  350 WRITE(6,360)OEXP,/M
  360 FORfJ'AT(ll',/////T22,F6.4,lXl,/T&,lFW=1fFlC.4,lE1)
      CG 37:  I=1,N*
      Xl( I )=X( I)
      Yl(£ ) = A1«(EXP{X( I )«BGXP) )
  370 CONTINUE
      GC TC  23C
11111 STGP
      ENC
      SUBROUTINE  XYPUOT(XtY,NN)
      REAL  LChX,  LQV.Y,  KI.\E,  MINUS
      DATA  7. ERO, ON E,TirtO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE/
     1      I0I»I1I,I2I,I3',14'|15I,'6',I7',IBII"3«   /
      CATA  CLANK .VDASH.f'INLS, CENTER, V A XIS.H AXIS/
     1      '  ' , '  ' , '-' , «Q» , ' I ' , '  • /
      DATA  PLUS,  ASTRIX/'^ ','*'/
      CIN EN SIGN CHAR(31,31)
      GIVEN SIGN X('N!N),  YdNN)
      hIGhX  = X(l)
      h 1G H Y  = Y ( 1 )
      LCWX  =  X(1)
      LCwY  =  Y(1)
      CO 1  I  =  l,f\;\l
      IF(XII) .GT. HIGHX)  HIGHX  = XU)
     . IF(Y(I) .GT. HIGHY)  FIGHY  = Y(I)
      IF(X( I) .LT. LCWX)  LGUX  =  X( I )
    1 IF(YU) .LT. LOWY)  LCUY  =  Yd)
      IF( AtiS(hIGFX)-ABS(LO'AX) )  2,3,3
    2 CIVX  =  AeS(LOWX)
      GC TG  
-------
    CO ICC IX =  1,81
    CG ICC IY =  1,51
ICO CHARtIX,IY)  =  BLANK
    ChAR(IX,I) = PINUS
    ChAR( IX,26)  =  HAX IS
101 CHARUX,  51)  =  NIN'JS
    CQ 102 IX =  1,81,3
    CHAR(IX,I) = PLUS
    CMR( IX,26)  =  PLUS
102 ChAR( IX,51 )  =  PLUS
    DO 103 IY =  1,51
    ChARC 1 , IY) = VCASH
    OAR(41,IY)  =  VAXIS
103 ChAR(81,IY )  =  VCASH
    CO 104 IY =  1,51,5
    CHAR(ltlY) = PLUS
    ChA«(4l,IY)  = 'PLUS
104 OAR{Si,IY)  =  PLUS
    CHAR(41,2fc)  =  CENTER
    CO 2CC JJ =  liNN
    I  =  ( XI JJ )/CIVX)*40.C  +  41.5
    J  =  (-Y(  JJJ/lHVY) »25.C  *  26.5
    IF(CHA3U,J) .EQ.PLUS)  GO  TO  200
    CHARllrj) =  ASTRIX
2CO CONTINUE
    N  = C
    CO 201 JJ =  1,.\N
    I  =  (X(JJ)/CIVX)*40.C  +  41.5
    J  =  (-Y(JJJ/DIVY)*25.C  +  26.5
                                  TO 2C1
IF
IF
IF
IF
IF
IF
IF
IF
IF
IF
IF
N
tci-
(l\
(.N
( N
(r\
(N
(N
(IS
( l\
(N
(X
A
*
•
•
•
•
.
.
.
.
.
= M
R(
EC
EC
EC
EG
EG
E<,'
EG
EG
EG
E£
1
It J
.0)
.1)
.2)
.3)
.4)
.5)
.6)
.7)
.a j
.9)


C
C
C
C
C
C
C
C
C
C

• NE.
HARl
FAR (
K". R (
FAR{
t- AR (
F A R (
t-AR(
HAR(
FAR<
HAR (


r
I
I
I
I
I
I
I
1
r

AS
f J
t J
,J
tJ
,J
rJ
»J
^J
|J
fJ

T
)
)
)
)
)
)
)
)
)
)

RI
=
=
=
=
•=
=
=
=
=
=

X) GU
ZERO
ONE
TV,0
THREE
FOUR
FIVE
SIX
SEVEN
EIGHT
NINE

    IF(K  .EC. 1C) GO  TO  2C2
2C1 CONTINUE
202 CONTINUE
    WRITEI6,3CC )
300 FORNATl ' 1 ' )
    WRITE(6,301) HIGHX|HIGHY,LOWX,LOHY
301 FORMATC  KAXINUM  X VALUE  ='  G15.7,T40,' r'AXIPU.v Y VALUE  ='
   1 G15.7,/1 MINIMUM X  VALUE =  '  G15.7,T4C, ' MINIMUM Y VALUE

   2G15.7,/ )


                             A2-19

-------
    hRITE(6,303)  SIZEX,SIZEY
303 FCRl'AK   '  X  SCALE'/G15
   I/1  Y SCALE*/G 15. 7r'  PER
    WRITEJ6, 3C2 ) ( (CHAIU I ,J) T
3C2 FCRMAT(LX.8LA1)
    RETURN
    ENC
7,' P£R MAJOR HGRIZCiUAL  DIVISICN1
KAJCR VERTICAL DIVISICN  •/  )
1=1,31), J = l,51)
                             A2-21

-------
                           APPENDIX A3
                   FASIHNGTON RIVER BASIN DATA
This Appendix contains the basic data for the Farmington River Basin,
Connecticut and Massachusetts, which were gathered for application
of the water quality simulation model to that basin.   The data are
compiled in their basic form.  The preparation of these data for use
in the simulation model is described in Section 8.2  of this report.

A3.1  Maps and Geographical Data
The naps used to obtain basic watershed data were U.  S. Geological
Survey quadrangle maps covering 7 1/2 minutes of longitude and latitude
at a scale of 1:24000 (1 inch = 2000 feet).  These maps were available
for the entire Farmington River watershed and were purchased through
the Map Information Office, Geological Survey, Washington, D. C.
20242.  The cost is $ 0.50 per sheet.

The quadrangle maps are too large to include in the report.  Twenty-
one quadrangles are required to cover the watershed and each map is
IT'' x 22".  The coverage of the watershed by the quadrangles is indicated
on Figure A3-1.

The quadrangle maps were used to determine the watershed boundaries
and the ridge lines within the watershed.  This made it possible to
measure the area of the watershed and its component parts, as needed
to generate synthetic flow data.  Gages were located on the maps and
the areas tributary to the gage points were measured.

The various reaches of the watershed were determined partly from a
study of the maps, partly from reconnaissance of the watershed and
partly from the location of reservoirs, waste loads and other features
which require a change in reach designation.  Upstream areas from
reach points were determined by measurement on the quadrangle maps.
The length and average slope of the reaches were also determined from
the maps.

A tabulation of reach numbers descriptions, lengths and tributary areas
is contained in Table A3-1.

The gage locations in the watershed and their upstream areas are
tabulated in Table A3-2.
                             A3--1

-------
CO
I
N3
     Reach
     Number
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
                 Reach Description
          Upper End            Lower End
                                     TABLE A3-1
                                REACH INFORMATION

                                   Length     Area Upstream*
                                    Feet      of Upper End
Rainbow Dam
Rainbow Reservoir
Spoonville Br.
Tariffville
Simsbury
Avon
Pequabuck R.
Unionville
Burlington Brk.
Nepaug R.
East Branch
Riverton
Goodwin Dam
Colebrook Dam
Colebrook Res.
Roosterville
Otis
Source
Gage 1895
Source
Gage 1890
Connecticut R.
Rainbow Dam
Rainbow Res.
Spoonville Br.
Tariffville
Simsbury
Avon
Pequabuck R.
Unionville
Burlington Brk
Nepaug R.
East Branch
Riverton
Goodwin Dam
Colebrook Dam
Colebrook Res.
Roosterville
Otis
Tariffville
Gage 1895
Pequabuck R.
                                           Area in*   Area*
                                            Reach   Tributary at
                                                    Upper End
39,200
Res.
6,700
11,000
27,400
25,100
36,900
22,400
15,900
,18,400
20,000
44,200
12,500
Res.
Res.
14,100
32,900
37,200
17,200
17,000
32,400
583.35
578.65
576.00
574.32
486.35
470.38
452.32
389.83
374.33
358.27
306.37
217.89
123.56
117.07
93.86
90.52
47.67
0
33.57
0
45.61
19.69
4.70
2.65
1.68
21.23
15.97
18.06
4.85
8.09
6.85
5.16
21.43
3.52
6.49
23.21
3.34
13.76
29.21
33.17
33.57
12.03
0
0
0
66.74
0
0
57.64
7.41
9.21
46.74
67.05
90.81
0
0
0
29.09
13.76
0
0
0
0
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Main Stem
Salmon Brk.
Salmon Brk.
Pequabuck R.

-------
                                       FIGURE  A3-
                                 QUADRANGLE  MAPS COVERING
                                    FARMINGTON WATERSHE
  EAST LEE
M  S   A
 MONTEREY
                         BLANDFORD
              TOLLAND    WEST
                                     SOUTHWICK
              CENT      GRANVILLE
SANDISF1ELD
                            NEW
                          HARTFORD
                                                   A/INDSOR
                                                        )
                                                    LOCKS
            */!NSTED
TAR1FFVILLE
NORFOLK
                                                  HARTFORD

                                                    NORTH
                         COLLINSVILLE    AVON
           TORRINGTON
                                      NEW
                                        /
                                        BRITAIN
                           3RISTOL
           THOMASTON
                               A3-3

-------
                                 TABLE A3-1 (Continued)
i
.p-
23
24
25
26
27
23
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
       Source
       Gage 1880
       Source
       Gage 1878
       Source
       Source
       Compens. Dani
       Barkhamsted Dam
       Barkhamsted Res.
       Source
       Source
       Sandy Brk.
       ¥insted
       Mad River Dam
       Highland Lake
       Sucker Brk.
       Source
       Source
       Mad R. Res.
       Source
       Otis Res.
       Source
Gage 1890
Burlington
Gage 1880
Nepaug R.
Gage 1878
Gage 1878
East Branch
Comp. Dam
Barkham. Dam
Barkham.Res.
Barkham. R.es.
Riverton
Sandy Brk.
Winsted
Mad R. Dam
Highland Lake
Sucker Brk.
Highland Lake
Mad R. Dam
Mad R. Res.
Otis
Otis Res.
22,000
15,100
12,000
Res.
25,000
5,000
5,000
Res.
Res.
20,000
12,000
7,400
23,000
8,600
Res.
Res.
6,000
5,000
Res
15,000
Res.
15,000
0
4.
0
23.
0
0
63.
53.
27.
0
0
89.
43.
7.
3.
3.
0
0
19.
0
17.
0

09

62


35
32
94


33
40
14
40
20


52

75

45.
5.
4.
22.
23.
0.
3.
10.
25.
20.
7.
1.
0.
6.
0.
0.
3.
3.
0.
19.
0.
17.
61
12
09
54
62
58
35
03
38
65
29
48
13
49
14
20
20
60
08
52
91
75
0
0
0
0
0
0
0
0
27
0
0
39
10
19
3
0
0
0
0
0
0
0



.58




.29


.80
.17
.60
.60







 Pequabuck R.
 Burlington Eric.
'Burlington Brk.
 Nepaug  R.
 Nepaug  R.
 Nepaug  R.
 East  Branch
 East  Branch
 East  Branch
 Hubbard R.
 Valley  Brk.
 Still R.
 Still R.
 Mad R.
 Highland Lake
 S.  Brk. Res.
 Sucker  Brk.
 Taylor  Brk.
 Mad R.  Res.
 Mad River
 Otis  Res.
 Big Pond
*Areas in square miles

-------
                   TABLE  A3-2
               GAGE LOCATION AND AREA
Gage NO.**     Reach No.        Area Upstream*      Gage Location

  1855           16                90.52      Main Stem, Roosterville
  I860           13               127.08      Main Ste,. Riverton
  1861           35                19.52      Mad River, Winsted
  1865           33                89.61      Still River, Riverton
  1873           31                20.40      Hubbard River
  1874           32                 7.18      Valley Brk.
  1878           26                23.62      Nepaug River
  1878.5         27                 0.58      Collins Brk.
  1880           24                 4.09      Burlington Brk.
  1890           22                45.61      Pequabuck R.
  1895           20                33.57      Salmon Brk.
  1900            1               585.47      Main Stem, Windsor

 *Areas in square miles
**U.  S. Geological Survey designation.

A3.2  Gages and Gage Data
The basic historical streamflow data for the  thirteen Farmington
River watershed gaging stations were made available on  9  track
magnetic  tape by the U. S. Geological Survey, Water Resources
Division, Washington, D. C.  The gage numbers, locations  and
periods of record are listed in Table A3-3.

It  is noted  that the flows at  gage  1855 are  regulated by  the
releases  at  Otis Reservoir, flows at gage 1860 are regulated
by  releases  from Otis and Goodwin Reservoirs, flows at  gage
1861  are  regulated by Mad River Dam, flows at gage 1865 are
regulated by releases from Mad River and Highland Lake, flows
at  gage 1890 are regulated by  the Whigville  and  Copper  Mine
Brook Reservoirs and flows at  gage  1900 are  regulated by  all
releases  made  in the watershed.

Data for  use in computation of the  constants in  equations [5.6],
 [5.7] and [5.8] were supplied  by  the U. S. Geological  Survey,
Water Resources Division, District  Office, Hartford, Connecticut.
These data  consist  of measurements  of width, area, mean velocity,
 gage height  and discharge at gage locations. The measurements
were made at various' times of  the year.  Data were  provided
 for gages 1-1860,  1-1878, 1-1890  and  1-1895  in  the  Farmington
 Basin.  The data  are tabulated in Table A3-4.
                            A3-5

-------
                              TABLE A3-3
                  GAGE LOCATION AND PERIOD OF RECORD
Gage Number
           Gage Location
                       Period of Record  'years of Record
01-1855  W. Br. Farmington R., New Boston
01-1860  W. Br. Farmington R., Riverton
01-1861  Mad River, Winsted,  Conn.
01-1865  Still River, Riverton, Conn.
01-1870  W. Br. Farmington R., Riverton
01-1873  Hubbard R., W. Hartland, Conn.

01-1874  Valley Brk, W. Hartland, Conn.
01-1878  Nepaug R., Nepaug, Conn.

01-1878.5 Clear Brk., Collinsville
01-1880  Burlington Brk., Burlington
01-1890  PequabuckR., Forestville
01-1895  Salmon Brk., Granby, Conn.
01-1900  Main Stem, Farmington R., Windsor
June
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
Oct.
1913-Sept.
1955-Sept.
1956-Sept.
1948-Sept.
1929-Sept.
1938-Oct.
1956-Sept.
1940-Sept.
1921-Oct.
1957-Sept.
1921-Sept.
1931-Sept.
1941-Sept.
1946-Sept.
1939-Sept.
1963
1963
1963
1963
1955
1955
1963
1963
1955
1963
1963
1963
1963
1963
1963
                                                          50
                                                           8
                                                           7
                                                          15
                                                          26
                                                          26
                                                          24*
                                                          23

                                                          40*
                                                          42
                                                          32
                                                          22
                                                          17
                                                          24
*Record not consecutive
Source:  Water Resources Division, U. S. Geological Survey, Hartford, Conn

A3.3 Evaporation and Temperature Data
Evaporation data were obtained from the files of Metropolitan District
Commission, Hartford, Connecticut.  The data, listed in Table A3-5,  are
those used by MDC for predicting evaporation from the Nepaug and
Barkhamsted Reservoirs.
Date
Width
 ft.
         Table A3-4
     Cross Section Data

 Area       Mean Vel.
            ft./sec.
For Gage 1-1860, W. Farmington, Riverton
 7/16/65
ll/ 4/65
117 9/65
127 3/65
 1/21/66
 5/26/66
 7/14/66
 8/11/66
 9/15/66
  19
 122
 130
 128
 128
 134
  40
  42
  81
  1.74
 64.1
152
114
127
195
 48.9
 47.9
 98.5
0.80
0.33
0.97
0.82
1.09
0.91
0.40
0.22
0.38
               Gage Height
                   ft.
2.68
2.77
3.52
3.52
3.87
3.60
2.77
2.67
2.89
                                                                  Discharge
                                                                     cfs.
 14.0
 21.2
147
 93.4
138
177
 19.4
 10.4
 37.3
                                   A3-6

-------
                     TABLE A3-4  (Continued)
10/ 4/66
III 4/66
12/ 8/66
11 9/67
2/10/67
3/21/67
4/13/67
5/17/67
6/29/67
10/11/67
12/ 6/67
12/27/67
21 8/68
3/ 8/68
3/28/68
4/ 9/68
51 9/68
6/ 5/68
7/29/68
9/16/68
10/21/68
11/19/68
12/13/68
I/ 7/69
2/ 7/69
3/ 6/69
4/ 9/69
5/16/69
135
130
97
100
98
130
134
133
96
130
130
129
121
125
146
100
128
135
103
100
100
135
130
130
100
125
130
135
241
364
195
229
158
169
264
247
146
179
232
206
119
76.1
491
129
127
278
92
81
100
295
209
125
94.5
159
163
452
For Gage 1-1878, Nepaug, Conn.
                                1.00
                                1.93
                                1.18
                                1.05
                                0.96
                                   22
                                   44
                                   35
                                 0.76
                                 1.11
                                 1.11
                                   04
                                   69
                                   13
                                   40
1.
1.
1.
2.
                                 0.85
                                 1,
                                 1,
  13
  56
                                 0.56
                                 0.50
                                 0.44
                                 1.59
                                 1,16
                                 1.11
                                 1.97
                                 0.90
                                 1.10
                                 1.58
8/23/65
ll/ 5/65
12/ 7/65
12/16/65
4/27/66
6/16/66
7/15/66
8/17/66
9/20/66
9/22/66
10/11/66
ll/ 7/66
12/12/66
1/11/67
1/12/67
2/27/67
32
33
13.5
30
33
32
13.2
32
32
34
28
35
32.2
33.5
33
32.2
17.6
21.0
9.98
30.7
33.6
28.0
7.55
22.6
15.6
57.8
17.1
44.3
31.1
42.4
37.4
28.4
0,13
0.26
1.11
0.76
0.82
0.80
0.29
0.48
0.27
1.83
0.40
1.37
0.88
0.84
1.04
0.81
3.95
5.23
3.88
4.21
3.96
3.75
4.37
4.25
3.33
3.80
4.10
3.96
4.56
4.05
5.98
3.29
3,42
4.52
2.98
2.90
2.88
4.62
3.95
4.02
4.37
3.73
3.65
4.61
341
704
230
241
151
207
381
333
111
198
257
240
201
86
1,177
110
143
435
52.2
40.3
32.5
468
243
139
186
143
179
452
                                                  0.10
                                                  0.17
                                                  0.26
                                                  0.50
                                                  0.56
                                                  0.48
                                                  0.11
                                                  0.28
                                                  0.16
                                                  1.42
                                                  0.22
                                                  0.93
                                                  0.55
                                                  0.80
                                                  0.69
                                                  0.46
                                    26
                                    40
                                 11.1
                                 23.2
                                 27.4
                                 22.3
                                  2.2
                                 10.8
                                  4.2
                                106
                                  6.8
                                 60,
                                 27.
                                 35,
                                 38,8
                                 38.8
,6
,4
,5
                                   A3-7

-------
TABLE A3-4(Continued)
3/23/67
4/19/67
4/ 8/67
6/28/67
2/ 9/68
2/28/68
3/ 8/68
5/ 8/68
6/17/68
8/ 1/68
9/17/68
10/ 3/68
11/21/68
For Gage
9/14/65
ll/ 9/65
11/19/65
12/ 7/65
12/16/65
1/24/66
ft/27/66
6/ 8/66
8/15/66
10/17/66
11/21/66
1/11/67
2/14/67
3/10/67
4/11/67
5/10/67
6/ 8/67
8/29/67
10/16/67
12/13/67
2/ 5/68
4/ 8/68
6/19/68
8/ 2/68
10/14/68
ll/ 6/68
1/20/69
3/14/69
6/ 9/69
6/ 9/69
33
35.5
29
32
31
32
30
30
34
31.5
29
14
30.5
1-1890,
58
55
51.5
54
54
52
58
58
57
56
57
65
57
57
58
58
58
56
55
60
60
57
58
56
55
55
56
56
58
58
38.5
71.2
41.6
28.6
42.2
28.3
27.5
29.6
44.2
22.1
22.4
11.0
38.6
Pequabuck
27.4
25.0
22.8
22.8
27.9
29.0
29.0
28.2
41.1
26.0
28.0
48.5
30.5
42.2
59.0
59.1
36.0
28.6
24.3
82.0
63.0
46.8
49.6
32.6
27.8
24.5
35.8
34.0
35.3
34.7
1.12
2.04
2.93
0.75
1.07
0.58
0.71
0.81
1.12
0.38
0.34
0.44
0.99'
River, Forestville,
0.63
0.78
0.99
0.78
1.10
1.04
1.04
0.96
1.63
0.96
1.02
0.76
1.04
1.21
2.10
1.96
1.18
1.07
0.86
2.93
1.98
1.40
1.86
1.13
1.06
0.89
1.33
1.32
1.25
1.21
0.74
1.71
1.45
0.49
0.75
0.39
0.44
0.51
0.84
0.23
0.24
0.17
0.69
Conn.
0.88
0.90
0.90
0.88
0.09
0.98
0.98
0.96
1.22
0.95
0.98
1.08
1.03
1.20
1.51
1.49
1.11
1.01
0.91
1.96
1.55
1.27
1.38
1.09
0.98
0.92
1.15
1.14
1.16
1.14
                                       22.9
                                       32.0
                                      145
                                       21.4
                                       45.2
                                       16.3
                                       19.5
                                       24.0
                                       49.6
                                         8.5
                                         7.5
                                         4.9
                                       38.2
                                        17.3
                                        19.5
                                        22.6
                                        17.9
                                        30.8
                                        20.0
                                        30.2
                                        27.2
                                        67.1
                                        24.9
                                        28.5
                                        36.9
                                        31.7
                                        50.9
                                       124
                                       116
                                        42.6
                                        30.7
                                        20.8
                                       240
                                       250
                                        65.7
                                        92.5
                                        37.0
                                        29.4
                                        21.9
                                        27.5
                                        45.0
                                        44.1
                                        42.1
       A3-8

-------
                      TABLE  A3-4 (Continued)
For Gage No. 1-1895 Salmon Brook, Granby, Conn.
9/ 9/59
12/16/59
II 1/60
2/19/60
2/19/60
3/ 3/60
4/ 5/60
5/16/60
6/ 8/60
7/18/60
8/29/60
9/21/60
9/26/60
11/16/60
12.27.60
21 7/61
2/17/61
2/26/61
3/ 9/61
4/14/61
4/28/61
5/15/61
5/23/61
7/27/61
8/24/61
10/ 9/61
11/16/61
1/17/62
2/14/62
3/ 6/62
4/17/62
5/31/62
6/20/62
7/11/62
8/24/62
10/12/62
I/ 9/03
2/21/63
2/26/63
4/ 2/63
4/16/63
5/ 8/63
6/ 4/63
7/2/63
8/13/63
9/10/63
10/ 8/63
10/21/63
Source:
50
56.
54
52
52
57.
Ill
58
61
60
62
77
62
61
61
32
34
62
44
48
40
39
39
31
44
40
37
72
32
34
41
33
48
50
47
39
41
45
43
79
59
57
58
48
40
20
42
26
Water
49.6
5 101
69.0
99.7
100
5 73.2
542
59.1
80.6
58.3
49.8
121
69.7
77.2
72.3
36.2
37.3
296
96.2
107
65.2
92.1
69.6
20.8
51.2
41.4
50.9
95.0
42.0
32.5
60.0
32.0
47.5
59.8
64.0
67.4
58.1
46.6
43.4
154
78.3
66.0
60.4
51.6
32.9
11.2
24.8
14.7
Resources
0.38
1.66
1.40
3.30
3.26
1.49
3.14
1.69
1.68
1.15
0.86
2.10
1.38
1.28
1.21
1.96
2.16
3.58
3.34
3.30
3.16
2.39
2.02
1.62
0.90
0.68
0.90
1.84
0.98
1.65
2.87
1.30
0.67
0.52
0.33
0.78
0.90
1.57
1.32
2.75
1.45
1.24
0.90
0.69
0.88
1.28
0.83
1.05
Division, U. S
2.41
3.43
2.76
3.90
3.95
2.88
7.55
2.96
3.16
2.73
2.66
3.96
3.10
3.06
2.94
3.40
2.80
6.46
4.08
4.06
3.50
3.53
2.12
2.22
2.41
2.16
2.37
3.14
2.21
2.30
3.16
2.21
2.06
2.37
2.47
2.56
2.42
2.46
2.33
4.18
2.85
2.60
2.52
2.61
1.69
3.70
1.75
3.82
al Survey »
19.0
168
96.8
329
326
109
1,700
99.9
135
67.4
42.7
254
96.5
99.0
87.5
70.9
80.7
1.060
322
342
206
222
141
33.7
46.0
28.3
46.0
175
41.1
53.5
172
41.5
31.6
31.2
21.3
52.4
52.2
73.0
57.3
424
113
82.0
54.6
35.8
29.1
14.4
20.5
15.5
Hartford, Conn
                                    A3-9

-------
                            TABLE A3-5
                          EVAPORATION DATA
         Month

         January
         February
         March
         April
         May
         June
         July
         August
         September
         October
         November
         December
Average Evaporation, inches
         0.96
         1,
         1,
         2.
05
70
97
         4.46
                                         Total
         5.54
         5.98
         5.50
         4.12
         3.16
         2.25
         1.51
        39.20
Source:  MDC, Hartford, Connecticut.

                           TABLE A3-6
                        TEMPERATURE DATA
                                         Mean, Monthly  3.27
Week of
Year
1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Mean of
Source:
Mean Temperature °C
1966
1.07
0.92

1.31
1.94
0.46
0.02
0.36
0.85
0.74
0.69
1.00
1.11
4.16
4.34
5.86
7.14
8.68
13.07
9.73
15.13
16.91
17.67
21.54
22.73
19.94
21.86
the weekly means - 11.86°C
Mr. David Bennett, Cheshire,
Week of
Year
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

Connecticut.
Mean Temperature, °c
1966 1967


23.28
24.28
20.76
18.85
16.38
14.70
13.86
12.73
11.24
10.73
9.35
8.21

5.05
6.30
2.75
3.66
1.45
1.05


21.99
O / f* .•
24. 01
23.55
24.10
24.08
22.98
23.09
20.60
20.79
21.01
18.61
19.43
17.00
16.71
13.97
13.64
9Q/
• — J 1

4.
.43
3.33






                                     A3-10

-------
Temperature data were obtained from Mr.  David Bennett,  who established
a continuous temperature recorder in the Farmington River at Farmington,
Connecticut to measure the river temperature.  The data provided by
Mr. Bennett were contained in his M.S.  Thesis, 1968, University of
Connecticut,.  The data are tabulated in Table A3-6.

A3.4 Reservoir Data

A3.4.1 Otis Reservoir
Otis Reservoir is located in Berkshire and Tolland Counties;' Massachusetts.
The present ownership is the State of Massachusetts, although it was
formerly owned by The Collins Company,  Collinsville, Connecticut.  It
was used to augment low flow for the Collins Mill from 1865, when it was
built, until 1966.  The reservoir is now used primarily for recreation, but
the level is drawn down in the fall to afford a~measure of flood control
protection in the early spring.  Otis Reservoir is a Type II reservoir
according to the classification set In Appendix A4.5.

The reservoir capacity-gage height data for Otis Reservoir were obtained
from the U. S. Geological Survey, Hartford, Connecticut.  These data are
listed in Table A3-7.  No data exist relating the depth and surface area
of Otis Reservoir.  The area data, contained in Table A3-7 were computed
by equating the area to the volume'between adjacent depth readings.  The
method of computation is approximate but for the reservoir full or nearly
full, as it would be in the summer when the evaporation constant is high,
the approximation is very close.  The planimetered area for a full reservoir
was 46.68 x 10^ square feet, compared to the calculated area of 46 x 106
square feet.

The operation of Otis Reservoir is simply to:  only discharge overflow
between April 1 and October 1, draw the level down to 17.0 feet during
the month of October and discharge the overflow at 17.0 feet between
November 1 and March 31c

A3.4.2 Colebrook Reservoir
Colebrook Reservoir  is located on  the upper main stem of the West Branch
of the Farmington River in Litchfield County, Connecticut.  The dam and
reservoir were built by the Corps  of Engineers with completion of
construction occurring in early 1969.  Approximately one-third of the
cost of the project was financed by the Metropolitan District Commission

                                 A3-11

-------
                            TABLE A3-7
              CAPACITY-AREA-DEPTH DATA-OTIS RESERVOIR
Gage Height
   feet

     0
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
Total Capacity
106 cubic feet

       0
       8
      17
      27
      38
      51
      66
      83
     102
     122
     144
     167
     192
     220
     250
     282
     316
     352
     389
     428
     468
     510
     553
     597
     642
     688
     780
Surface Area
106 square feet
     0
     8
     9
    10
    11
    13
    15
    17
    19
    20
    22
    23
    25
    28
    30
    32
    34
    36
    37
    39
    40
    42
    43
    44
    45
    46
    46
- Winter level
  Spillway  level
Source:  Water Resources Division, U. S. Geological Survey,  Hartford,
Connecticut.

which controls a water supply and replacement pool of 41,700 acre-feet
capacity.

Colebrook Reservoir is a multipurpose project.  The various  pools are:
Dead Storage and Sedimentation
Replacement Water Supply, Goodwin Res,
Water Supply
Fishery, for brown trout
Joint, Fishery and Flood Control
Flood Control
                                        Total
                          1,000
                         11,000
                         30,700
                          5,000
                          5,000
                         45.000
                         98,500
     Acre-
     Acre-
     Acre-
     Acre-
     Acre-
     _Acre-
     Acre-
   feet
   feet
   feet
   •feet
   •feet
   •feet
   •feet
                                A3-12

-------
Colebrook Reservoir is a Type I reservoir.   The spillway is an
uncontrolled chute having a crest width of  205 feet.

The reservoir capacity-depth and area-depth data were obtained
from curves furnished by the New England Division,  Corps of
Engineers, Waltham, Massachusetts.  Data read from the curves are
tabulated in Table A3-8.

The operation of Colebrook Reservoir is described as follows:

(1) The flood control capacity will be kept empty for storage of
floods and will be emptied as rapidly as possible after flood
control operations.
(2) The water supply storage will be used in part to provide a
minimum release of  50 cfs for downstream riparian owners and in
part (future) for diversion into the Metropolitan District
Commission  (MDC) system for water supply.
(3) The 11,000 acre-feet replacement pool is also controlled by
MDC, for flow augmentation, being volume that was originally
in the Goodwin Reservoir.
(4) The fishery pool of 5,000 acre-feet is for release in late
April and May for enhancement of the spring shad fishery.  The
release will be prior to the hurricane season when this volume
is needed for flood control.
(5) The fishery pool of 5,000 acre-feet for enhancement of the sea-
run brown trout fishery will contain water stored in the spring
for release in August, September and October.  This pool also
provides additional water for summer recreation activities.

A3.4.3 Barkhamsted Reservoir.
Barkhamsted Reservoir is located on the East Branch of the Farmington
River in Litchfield and Hartford counties, Connecticut.  It was
built by the MDS, Hartford and is owned and operated by this body
for water supply purposes only.  Water is diverted to the MDS
distribution system, which lies outside the Farmington watershed.
Excess water is released downstream to the Farmington.  The
reservoir is Type  IV.

The reservoir capacity-area-depth information, as well as data
on diversions, was provided by the MDS.  The data are listed in
Tables A3-9 and A3-10.

The operation of the  Barkhamsted  Reservoir is  to provide the
demands for diversion out of storage and inflow, and to release
any spillway overflow to the Farmington.

A3.A.4 Sucker Brook Reservoir.
The Sucker  Brook project is  a Corps of Engineers flood  control
project now under  construction.   The dam and  reservoir  are  located
                              A3-13

-------
adjacent to Highland Lake in the Town of Winchester, Connecticut,
The discharge from the reservoir is through an ungated 30 inch
diameter conduit. When the flows exceed the capacity of this
outlet, the excess is stored in the reservoir.  An overflow
spillway is provided.  There is no permanent or recreation pool.

Reservoir capacity-area-depth data, in the form of curves were
obtained from the Corps of Engimeers, New England Division.
The outlet rating curve was also furnished by The Corps.  These
data are listed in Tables A3-11 and A3-12.

                             TABLE A3-8
            CAPACITY-AREA-DEPTH DATA-COLEBROOK RESERVOIR
Pool Elevation,     Depth
Feet above MSL       feet

     567              0
     580             13
     590             23
     600             33
     610             A3
     620             53
     630             63
     6AO             73
     650             83
     660             93
     670            103
     680            113
     690            123
     700            133
     710            143
     720            153
     730            163
     740            173
     750            183
     760            193
     761            194
Capacity
10^ cubic feet

   0
  12.3
  21.9
  52.3
 117.6
                 Area
                   1.
                   2.
                   5.
                     square feet
   32
   83
   14
 200
 309
 448
,4
,3
,7
 618.6
 801,
1006,
1237,
1524.6
1812,
2130,
2474,
2866,
3275,
3733,
4238.4
4290.7
.1
.1
.2
.2
.7
.1
 8.02
10.32
12.68
15.25
17.95
20.39
22.87
25.57
28.01
30.71
33.24
36.11
39.60
43.34
47.13
51.84
52.71
Source:  New England Division, Corps of Engineers, Waltham,
Massachusetts.
                        - Spillway Elev.
                             A3-14

-------
                             TABLE A3-9
            CAPACITY-AREA-DEPTH DATA-BARKHAMSTED RESERVOIR
                  (Data  are  for top 24 feet only*.)

Pool  Elevation    Depth, feet       Capacity         Area
Feet  above MSL    above el.  506     106 cubic ft.    106 sq. ft.

      506                 0              2015
      507                 1              2085             70
      508                 2              2158             72
      509                 3              2231             73
      510                 4              2305             74
      511                 5              2381             76
      512                 6              2458             77
      513                 7              2536             78
      514                 8              2616             80
      515                 8              2696             80
      516                10              2778             82
      517                11              2862             84
      518                12              2946             84
      519                13              3032             86
      520                14              3118             86
      521                15              3207             89
      522                16              3296             89
      523                17              3387             91
      534                18              3479             92
      525                19              3572             93
      526                20              3666             94
      527                21              3762             96
      528                22              3858             96
      529                23              3956             98
      530                24              4054             98 - Spillway Level

Source:  MDC,  Hartford,  Connecticut

*  Data are available for the entire range of the depth in the
reservoir  but  are  not used because the operating range is included
within the depths  tabulated.
                               A3-15

-------
Week
                             TABLE A3-10
                DIVERSION DATA-BARKHAMSTED RESERVOIR
              (Data  are weekly  diverted volumes computed
                 from daily  data furnished by MDC).
Weekly Diverted Volume
      cubic feet
         Week
Weekly Diverted Volume
      cubic feet
        1963
        1964
1967
1963
Source:  MDC, Hartford, Connecticut
1964
1967
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
31.0
28.2
23.1
22.5
21.7
21.5
19.5
18.7
18.7
15.0
14.0
10.4
2.3
0
0
0.4
8.6
12.2
21.4
23.5
28.1
25.9
25.1
27.5
25.4
27.8
16.8
15.0
13.6
14.0
14.0
14.0
14.0
14.0
14.0
9.2
4.7
4.8
4.7
4.7
4.7
4.7
4.7
5.1
10.3
17.0
34.2
33.6
28.7
23.0
19.0
28.5
33.7
25.5
20:7
25.8
16.3
20.6
20.6
20.6
17.6
5.6
0.9
1.9
3.6
3.5
3.7
3.7
3.7
3.2
3.7
3.7
3.7
3.7
3.1
25.3
40.0
36.4
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
19.5
16.8
19.1
19.4
24.1
18.3
18.7
17.5
19.4
25.8
25.8
22.3
19.7
19.7
28.7
33.6
34.4
37.2
34.9
35.4
36.5
35.6
37.2
23.8
18.7
17.8
28.6
21.5
23.3
24.3
25.8
17.1
17.6
20.3
18.7
23.0
26.9
27.1
27.1
25.3
23.4
23.4
21.4
23.4
23.0
27.5
28.2
32.8
6.8
28.6
32.8
32.8
27.4
23.8
19.5
20.5
19.9
20.2
23.4
27.5
42.1
42.5
39.6
42.1
34.6
33.3
33.6
34.0
33.8
35.4
36.1
35.8
35.8
35.7
28.7
24.2
28.5
28.5
                            A3-16

-------
                            TABLE A3-11
          CAPACITY-AREA-DEPTH DATA-SUCKER BROOK RESERVOIR
   Pool Elev.        Depth
 Ft. Above MSL        ft.

     881              0
     885              4
     890              9
     895             14
     900             19
     905             24
     910             29
     915             34
     920             39
     925             44
     930             49
     935             54
    Capacity
  103 cubic ft.

       0
     174
    1437
    1574
    8930
   13939
   19863
   26572
   34979
   43996
   53797
   64556
    Area
103 square ft,
    510
    784
    923
   1076
   1342
   1564
   1777
   1978
   2161
   2330
Spillway crest is at Elev.  926 feet

Source:  New England Division, Corps of Engineers,  Waltham, Mass.

                            TABLE A3-12
                         OUTLET RATING DATA
                       SUCKER BROOK RESERVOIR
  Pool Elev.
Ft. above MSL

     881
     885
     890
     895
     900
     905
     910
     915
     920
     925
     930
     935
Depth
 ft.

  0
  4
  9
 14
 19
 24
 29
 34
 39
 44
 49
 54
Discharge
   cfs
    0
   32
   48
   58.
   67.
   76
   83.
   90
   97
  103
  108.
  115
Source:  New England Division,  Corps of Engineers,  Waltham, Mass.
                              A3-17

-------
 A3.4.5  Rainbow Reservoir.
 Rainbow Reservoir  is  an impoundment  used  to  store water for hydro-
 electric power generation.   The  generating plant is used to provide
 peaking capacity and  thus the  use  of water and  consequent releases
 are  intermittant.   The  storage capacity is relatively small and for
 the  time averaging  interval  of one "week" used  in this work, the
 plant  may be  considered "run of  the  river."  Rainbow Reservoir is
 classified  type  V.

 The  reservoir is owned  and operated  by the Farmington River Power
 Company.  Data were furnished  through the courtesy of Mr. Robert
 Tolles,  The Stanley Works, New Britain, Connecticut.

 There  is no complete  information which allows the direct computation
 of capacity-depth and area-depth equations.  The information supplied
 is:

 maximum depth                                   50       feet
 average depth                                   18.6     feet
 surface area  at  spillway crest elevation        235       acres
 volume at spillway  crest elevation             4370       acre feet
 spillway crest elevation                        132.6

 Data were furnished from which the capacity-depth relationship can
 be determined  in the  range from  9  feet below to 3 feet above the
 crest.   Because  the operating  range  is within these limits, a
 capacity-depth equation can  be developed.  The  area-depth relation-
 ship has been approximated using volume-incremental depth information
 within the  above-mentioned range.  The data, which are approximate
 but the best available, are  contained in Table A3-13.

 A3.4.6 Goodwin Reservoir.
 Goodwin Reservoir is  also called the West Branch Reservoir or Hogback
 Reservoir.  This reservoir was built and is operated by the MDC.   it
 is located  on the main stem  one mile downstream of Colebrook Dam and
 about  2  1/2 miles upstream of  the  confluence of the Still River and
 the West Branch  of the Farmington.   The newer Colebrook Dam was
 built  in the pool of  Goodwin Reservoir as noted in A3.4.2,  above.

 The Goodwin project was built  to provide low flow augmentation for
 riparian owners  downstream and is  required by law to discharge a
minimum of  150 cfs.   The plan  is to build an aqueduct  from Goodwin
 to Barkhamsted to divert water  from the West Branch into the MDC
 system  in the future.   Much of the function of Goodwin has  been
 expanded by the  larger storage available in The Colebrook Reservoir
                                 A3-18

-------
                            TABLE A3-13
             CAPACITY-AREA-DEPTH DATA-RAINBOW RESERVOIR
  Pool Elev.
Ft. above MSJ,
       ,6
       .6
 82,
123,
124.6
125.6
126.6
127.6
128.6
129.6
130.6
131.6
132.6
133.6
134.6
135.6
Depth
Dam, ft,

  0
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
                           Storage Available
                                KWH*
  7,500
 15,500
 24,100
 33,000
 42,100
 51,500
 61,200
 71,200
 81.500
 92,100
103,100
114,600
126,600
                  Capacity
                 106 cubic ft.
                                                    125
                                                    132
                                                    140
                                                    148
                                                    156
                                                    164
                                                    172
                                                    181
                                                    190
                                                    200
                                                    210
                                                    220
106 sq. ft,

   0

 7.4
 7.7
 8.0
 8,2
 8.5
 8.8
 9.1
 9.4
 9.7
10.1
lp.4
10.7
* 1 KWH = 6400 gallons
Source:  Farmington River Power Company thrpugh Mr. R. C. Sprong,
Manager, Utilities and Services, The Stanley Company, New Britain,
Connecticut.

Goodwin is classified type IV.

The  capacity-area-depth data were provided by the MDC in the  form  that
allowed separation of the volume into that included and that  not
included in  the Colebrook Reservoir.  The data shown in Table A3-14
are  for the  portion not included in Colebrook.  Facilities  for  diversion
are  not completely constructed at the present time.

A3.4.7 Nepaug  Reservoir.
Nepaug Reservoir  is the first of the Farmington River Basin reservoirs
built by MDC for  its water supply.  The project was completed ip
1916.  The reservoir is on the Nepaug River a short distance  upsjtream
of its  confluence with the Farmington River near Collinsville,
Connecticut.   The capacity-area-depth and diversion data needed in
th^s work were supplied by the MDC.
                                 A3-19

-------
Nepaug Reservoir is operated in the same manner as Barkhamsted
Reservoir; that is, water is diverted into the MDC water supply
system according to demand and any excess after the reservoir is full
is released downstream at the dam.  The reservoir is used for
water supply only and no recreation is allowed.  Nepaug Reservoir
is classified type IV.

Capacity-area-depth data and diversion data are tabulated in Tables
A3-15 and A3-16, respectively.

A3.4.8 Compensating Reservoir.
Compensating Reservoir was originally built by MDC for the benefit
of downstream riparian owners as compensation for the right to
divert water out of the Farmington Basin.  Later, when Barkhamsted
Reservoir was built immediately upstream, the volume of water
available for compensating was no longer sufficient.  The construction
of Goodwin Reservoir relieved Compensating Reservoir of this use.
Compensating Reservoir is now used for reserve storage and recreation.
It is classified as a type V reservoir with no scheduled diversion.

The capacity-area-depth data for Compensating Reservoir were furnished
by MDC and are tabulated in Table A3-17.

                            TABLE A3-14
             CAPACITY-AREA-DEPTH DATA-GOODWIN RESERVOIR
  Pool Elev.       Depth
ft. above MSL        ft.

    540              0
    560             20
    565             25
    570             30
    575             35
    580             40
    585             45
    590             50
    595             55
    600             60
    605             65
    610             70
    615             75
    620             80
    625             85
    630             90
    635             95
    640            100
 Capacity
106 cubic ft.

   0
   9.64
  14.46
  23.41
  33.05
  45.44
  63.34
  85.37
 110.16
 134.95
 162.49
 190.03
 220.32
 249.24
 279.53
 313.96
 347.01
 388.32
  Area
106 sq.  ft.

    0
    0.39
    0.48
    0.96
    1.79
    1.93
    2.48
    3.58
    4.41
    4,
    4,
    5,
    5,
    5,
    6,
    6,
    6.
96
96
52
50
78
06
60
90
    8.26 - Spillway Crest
Source:  MDC, Hartford, Connecticut

                                 A3-20

-------
                       TABLE A3-15
             CAPACITY-AREA-DEPTH DATA-NEPAUG RESERVOIR
                  (For top 24 feet in Reservoir)

  Pool Elev.       Depth above     Capacity            Area
ft. above MSL      EL 458        106 cubic ft.      106 sq, ft.

    458                0           ,497               25
    459                1            523               26
    460                2            549               26
    461                3            576               27
    462                4            604               28
    463                5            632               28
    464                6            660               28
    465                7            690               29
    466                8            719               30
    467                9            749               30
    468               10            780               30
    469               11            810               31
    470               12            842               31
    471               13            873               32
    472               14            905               32
    473               15            938               33
    474               16            971               33
    475               17           1004               33
    476               18           1038               34
    477               19           1072               34
    478               20           1107               35
    479               21           1142               35
    480               22           1178               36
    481               23           1214               36
    482               24           ,1251               37 - Spillway Crest

Source:  MDC, Hartford, Connecticut
                               A3-21

-------
                            TABLE A3-16
                       DIVERSION DATA-NEPAUG RESERVOIR
            (Weekly averages computed from daily values)
Week    Average Weekly Diversion
           10° cubic feet
        1963     1964       1967
 Average Weekly Diversion
   10^ cubic feet
1963      1964        1967
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
8.6
13.0
16.3
19.5
21.9
22.9
22.1
20.4
20.4
14.3
17.8
21.7
23.4
24.7
36.6
39.4
36.1
32.5
28.7
21.9
17.2
16.8
17.2
18.7
17.8
27.9
19.0
26.7
28.1
15.0
14.0
14.0'
18.7
25.3
25.9
28.7
19.4
26.9
31.0
31.8
31.8
31.6
29.5
35.8
34.5
39.1
11.8
15.8
25.4
26.9
23.1
28.1
7.5
16.7
22.3
18.7
26.9
21.1
21.7
23.4
26.5
37.7
34.1
29.0
52.5
40.6
43.9
36.8
38.6
46.9
48.7
47.6
43.7
40.8
49.6
34.1
23.3
41.6
27
28
29
30
31
32
33
34
35
36
37
38
39
40'
41
42
43
44
45
46
47
48
49
50
51
52
27.4
31.3
31.7
28.2
23.0
30.3
24.9
30.9
29.5
27.9
27.8
27.9
27.9
28.3
17.8
13.4
11.6
7.2
7.5
8.3
5.2
0
0
13.8
20.1
18.7
28.1
30.5
30.5
28.1
29.1
29.1
28.1
28.1
32.5
28.7
27.4
29.1
28.6
25.7
23.4
29.5
30.2
30.6
31.0
36.4
24.6
13.9
27.4
22.2
14.0
15.0
30.3
36.1
38.1
39.3
38.9
35.6
32.8
32.6
18.7
18.7
18.7
21.1
20.6
19.7
19.7
19.7
19.7
19.7
19.7
19.7
19.7
14.4
15.8
12.2
14.6
25.3
 Source:  MDC, Hartford, Connecticut.
                                    A3-22

-------
                            TABLE A3-17
          CAPACITY-AREA-DEPTH DATA-COMPENSATING RESERVOIR
                   (For top 24 feet in Reservoir)

  Pool Elev.       Depth above        Capacity            Area
ft. above MSL       EL. 396         106 cubic ft.       106 sq.  ft,

     396                0              91.18
     397                1              98.67              7.49
     398                2             106.43              7.76
     399                3             114.71              8.28
     400                4             123.27              8.56
     401                5             132.10              8.83
     402                6             141.19              9.09
     403                7             150.81              9.62
     404                8             161.11             10.30
     405                9             171.80             10.69
     406               10             182.90             11.10
     407               11             194.67             1JL.77
     408               12             206.83             12.16
     409               13             219.97             12.44
     410               14             231.97             12.70
     411               15             245.07             13.10
     412               16             258.31             13.24
     413               17             272.88             14.57
     414               18             287.59             14.71
     415               19             302.70             15.11
     416               20             318.21             15.51
     417               21             333.98             15.77
     418               22             350.29             16.31
     419               23             367.14             16.85
     420*              24             383.99             16.85

* Spillway Crest is at Elev. 420.5

Source:  MDC, Hartford, Connecticut
                                A3-23

-------
A3.4.9 Highland Lake.
The following information relative to Highland Lake was furnished by the
Corps of Engineers, New England Division, Waltham, Mass.

Highland Lake is used primarily for recreational purposes with year-
around residences and cottages distributed all around the periphery.
An industry, Union Pin Company, located near the outlet end of the
lake, has water rights and controls the discharges made, excepting
the spillway overflow.  The industry uses the water for power and
processing with the used water being discharged into the outlet
stream.  No rating curve exists for the sluice gate control device.

The agreement whereby Union Pin Company regulates the level of the
lake is unwritten.  For many years, water has been stored in the
spring so that the water surface is at or near the spillway crest
at elevation 882.5 MSL  by  June 1.  The level is lowered not to
exceed one foot per month during July, August and September.  After
October 1, the level is lowered to 877.5, five feet below the spill-
way crest.  This fall drawdown provides a limited flood protection
while the higher summer level contributes to the recreational
benefit to 'the owners around the lake.  Highland Lake is classified
type II in this work.

The capacity-depth data for Highland Lake were furnished by the
U. S. Geological Survey, Water Resources Division, Hartford.  The
data are tabulated in Table A3-18.  No area-depth are available
excepting that the area at spillway crest elevation is 444 acres
and at the level at 6.5 feet below crest elevation the area is
planimetered as 350 acres.  It is assumed the area-depth relation-
ship is linear between these two levels and may be extrapolated
to the level of the outlet structure.

A3.4.10 Mad River Reservoir
Mad River Reservoir is, like the Sucker'Brook Reservoir, a single
purpose flood control project with an ungated outlet structure.
The reservoir is owned and operated by the Corps of Engineers.
The Mad River project was completed in 1962.  Although the project
is for flood control only, there is a small pool below the level
of the outlet structure which is used for recreation.

The ungated structure is a circular conduit having a diameter
of 45 inches.  The outlet discharge rate is given by a rating curve
furnished by the Corps of Engineers.   Data read from the rating
curve are listed in Table A3-19.  Capacity-area-depth data, also
obtained from Corps-furnished curves,  are tabulated in Table A3-20.
                            A3-24

-------
                            TABLE  A3-18
                 CAPACITY-DEPTH DATA-HIGHLAND LAKE
  Pool Elev.                  Depth,  ft.                  Capacity
ft. above MSL               above 873.5                106 cubic feet

    873.5                        0                        233
    874.5                        1                        247
    875.5                        2                        262
    876.5                        3                        277
    877.5                        4                        292
    878.5                        5                        309
    879,5                        6                        325
    880.5                        7                        343
    881.5                        8                        361
    882.5                        9                        380

Source:  Water Resources Division, U.  S.  Geological Survey, Hartford
Connecticut
A3.5 Population and Waste Load Projections.
The following data have been taken from a Report, Water Resources
Planning Study of the Farmington Valley, made in 1965 by The
Travelers Research Center, Inc. to the Water Resources Commission,
State of Connecticut.

The, projected populations for the various Towns in the watershed
are listed in Table A3-21.  The figures are corrected to reflect
only the population in the Farmington Watershed for those towns
which do not lie wholly within the watershed.

The projected waste discharge rates, municipal and industrial,
are listed by Towns in Table A3-22.

A3.6  Irrigation Requirements
The Farmington Valley tobacco growers plant 3000 acres to tobacco
in an average year.  This crop in grown in the river lowlands
between Farmington and Simsbury (reaches  5,6 and 7).  Water for
irrigation is pumped from the river.  The normal irrigation demand
is 4 to 6 inches per year.  Assuming the use is 6 inches over a
2-month period,  (9 weeks) for 3000 acres, the average weekly demand is:
                             A3-25

-------
                   6   x 3000 x 43560 x !_
                   12                   9
       7.26 x 10° cubic feet
or,
                   7.26 x 1.52 = 11.04 cubic feet per second
                               =  3.68 cubic feet per second from
                                       each of three reaches.

                            TABLE A3-19
             OUTLET DISCHARGE DATA-MAD RIVER RESERVOIR
  Pool Elev.       Depth
ft. above MSL        ft.

    855              0
    860              5
    865             10
    870             15
    874             19
    880             25
    890             35
    900             45
    910             55
    920             65
    930             75
    940             85
    950             95
    960            105
    970            115
    980            125
    983            128
            Discharge
Weir Gate open   Weir Gate closed
     cfs               cfs
      0
     75
    112
    136
    150
    197
    232
    263
    289
    312
    335
    356
    375
    394
    412
    430
    435
  0
  0
  0
  0
  0
197
232
263
289
312
335
356
375
394
412
430
435
Source:  New England Division, Corps of Engineers,  Waltham,  Mass.
                                     A3-26

-------
                          TABLE  A3-20
          CAPACITY-AREA-DEPTH DATA-MAD RIVER RESERVOIR

  Pool Elev.     Depth          Capacity             Area
ft. above MSL     ft.         106 cubic ft.        103 sq. ft.

     825           0                0                 0
     840          15                0.44             44
     850          25                2.18            166
     860          35                3.92            261
     870          45                6.97            392
     872          47                7.84            418 - Recreation
     880          55               12.20            653   Pool Level
     890          65               19.17           1198
     900          75               32.23           1721
     910          85               53.50           2483
     920          95               80.15           3027
     930         105              113.26           3681
     940         115              153.31           4400
     950         125              203.86           5205
     960         135              259.18           6142
     970         145              322.78           6926
     980         155              397.27           7928
     983         158              424.71           8233 - Spillway Level

Source:  New England Division, Corps of Engineers, Waltham, Mass.

In addition, two golf courses in the Farmington area use irrigation
water pumped from the river.  The rate of usage is not known.

Assume the total use is as shown in Table A3-23.

A3.7 Existing Sewage Treatment Plants.
Waste treatment plants having significant size are located at
Plainville, Collinsville, Farmington, Bristol, Plymouth, Windsor
Locks (2 plants), Tariffville and Winsted.  Plant size, treatment
type and available effluent BOD values are listed below.  Data
were furnished by the Water Resources Commission, State of
Connecticut.  The locations of these treatment plants are shown
in Figure A3-2.

(1) Plainville.  Municipal plant, secondary treatment, 1.4 mgd
capacity, on line in late 1967.  Effluent BOD 11/15/67 was
47 tng/1.

(2) Collinsville.  Municipal plant, secondary treatment, 0.4 mgd
capacity, on line late 1967.  Effluent BOD 3/12/68, 110 mg/1;
7/2/68, 27 mg/1.

                               A3-27

-------
                 FIGURE  A3-2


             LOCATION   OF


             TREATMENT  PL,
           TARIFFVILLE
T^COLLIMSVILLEj
                                   I



                               *      IDSOfi  LOCK3 (2)

                                        II
                                    .    /
            PLAINVILLE
1  '   •  J  4

          )


  '- 'V L E IN


  MILES

-------
                           TABLE A3-21
             PROJECTED POPULATION-FARMINGTON WATERSHED

Town             1970       1980      1990       2000    2015
Connecticut
Windsor         4,088      5,400     6,800      5,880   4,950
Windsor Locks   1,838      2,700     3,553      4,520   6,368
Bloomfield      4,840      5,760     5,880      5,200   3,250
East Granby     4,500      7,500    11,100     16,000  24,500
Granby          8,200     14,000    23,500     35,000  50,000
Simsbury       12,819     15,819    19,419     23,869  30,069
Avon            6,886      9,186    11,936     15,336  20,136
Farmington     15,406     19,406    22,906     25,406  27,906
Plainville      5,363      7,000     8,813     10,800  14,025
Bristol        55,000     65,000    74,400     84,300  97,000
Plymouth        7,685      8,190     8,683      9,150   9,350
Burlington      3,290      3,890     4,590      5,390   6,890
New Hartford    3,533      4,132     4,832      5,632   7.11/
Canton          5,892      7,242     8,992     11,142  16,142
Barkhatnsted     1,870      2,370     2,870      3,870   5,370
Winchester     11,800     13,600    16,200     18,800  21,000
Hartland        1,340      1,640     2,140      2,640   3,650
Colebrook         990      1,190     1,490      1,790   2,290
Massachusetts
Granville       1,070      1,270     1,570      1,870   2,370
Tolland           150        200       280        350     450
Sandisfield       690        840     1,040      1,240   1,740
Otis              620        770       970      1,170   1,670
Becket            970      1,170     1,470      1,770   2,270
Total        158 ,840    198,275   243,434    291,125 358,513

Source:  Water Resources Planning Study of the Farmington River
Valley, The Travelers Research Center, Hartford, Connecticut, 1965
                             A3-29

-------
                             TABLE A3-22
           PROJECTED  WASTE  DISCHARGES-FAEMINGTON WATERSHED
                   (Data  in million gallons daily)
Town
Connecticut

Windsor
Windsor Lake
Bloomfield
East Granby
Granby
Simsbury
Avon
Farmington
Plainville
Bristol
Plymouth
Burlington
New Hartford
Canton
Barkhamsted
Winchester
Hartland
Colebrook

Massachusetts
Granville
To11and
Sandisfield
Otis
Becket

Munic .
0.33
0.15
0.39
0.29
0.53
1.03
0.55
1.23
0.43
4.40
0.62
0.21
0.28
0.47
0.12
1.24
0.09
0.06
1970
Indust.
0.95
0.93
0.08


0.08
0.04
1.18
o;io
4.60
0.20




0.50



Total
1.28
1.08
0.47
0:29
0.53
1.11
0.59
2.41
0.53
9.00
0.82
0.21
0.28
0.47
0.12
1.74
0.09
0.06

Munic .
0.49
0.24
0.52
0.56
1.05
1.42
0.83
1.75
0.63
5.85
0.74
0.29
0.37
0.65
0.18
1.50
0.12
0.09
1980
Indust.
1.15
0.24
0.09


0.10
0.05
1.28
0.11
5.00
0;22




0.60



Total
1.64
1.12
0.61
0.56
1.05
1.52

3.03
0.74
10.85
0.96
0.29
0.37
0.65
0.18
2.10
0.12
0.09
 0.07
 0.01
 0.04
 0.04
 0.06
           0.07
           0.01
           0.04
           0.04
           0.06
 0.10
 0.02
 0.06
 0.06
 0.09
         0.10
         0.02
         0.06
         0.06
         0.09
Sub Total
Total
12.64
8.66
                      21.30
17.61
9.72
                                                                     27.33
Source:  Water Resources Planning Study of the Farmington River Valley
The Travelers Research Center, Hartford, Connecticut, 1965.
                                A3-30

-------
                            TABLE A3-22
                              (Cont.)
          PROJECTED WASTE DISCHARGE-FARMINGTON WATERSHED
                  (Data in million gallons daily)
          1990                       2000
                                                      2015
Munic,
Indust.    Total   Munic.
Indust.    Total   Munic,
Indust.   Total
0.65
0.34
0.56
0.95
2.00
1.85
1.13
2.18
0.84
7.06
0.83
0.39
0.46
0.85
0.24
1.86
0.18
0.13
0.13
0.02
0.09
0.08
0.13
22.95
1.35
1.30
0.10


0.13
0.06
1.39
0.12
5.50
0.24




0.70







10.89
2.00
1.64
0,66
0.95
2.00
1.98
1.19
3.57
0.96
12.56
1.07
0.39
0.46
0.85
0.24
2.56
0.18
0.13
0.13
0.02
0.09
0.08
0.13

0.59
0.45
0.52
1.52
3.32
2.39
1.53
2.54
1.08
8.43
0,92
0,51
0.56
1.11
0.37
2.16
0.25
0.17
0,18
0.03
0.12
0.11
0.17
29.03
1.50
1.50
0.10


0.15
0.07
1.50
0.13
6.00
0.26




0.80







12.01
2.09
1.95
0.62
1.52
3.32
2.54
1.60
4.04
0.21
14.43
1.18
0.51
0.56
1.11
0.37
2.96
0.25
0.17
0.18
0.03
0.12
0.11
0.17

0.52
0.67
0.34
2.45
5.00
3.16
2.11
2.93
1.47
10.17
0.98
0.69
0.75
1.69
0.54
2.42
0.37
0.23
0.24
0.05
0.17
0.17
0.23
37.35
1.60
1.60
0.10


0.18
0.08
1.60
1.14
6.50
0.28




0.90







12.98
2.12
2.27
0.44
2.45
5.00
3.34
2.19
4.53
1.61
16.67
1.26
0.69
0.75
1.69
0.54
3.32
0.37
0.23
0.24
0.05
0.17
0.17
0.23

                   33.84
                                    41.04
Source:  Water Resources Planning Study of the Farmington Valley,
The Travelers Research Center, Hartford, Connecticut, 1965.
                                   50.33
                              A3-31

-------
 (3) Farmington.   Municipal plant,  secondary treatment,  1.20 mgd capacity,
 built in  1962 .   Effluent BOD data:

 1/20/64                15 mg/1           1/31/67               26 mg/1
 1/26/65                44 rag/1          10/19/67               37 mg/1
12/13/65                30/mg/l           5/ 1/68               47/mg/l

 (4) Bristol.   Municipal plant, recently increased in size to   10  mgd
 capacity.  Effluent BOD data:

 3/19/64                50 mg/1           1/30/67               40 mg/1
ll/ 9/64                68 mg/1          12/ 5/67               65 mg/1
 9/20/65                35 mg/1           11 1/68               25 mg/1

 (5) Plymouth.  Municipal plant, secondary treatment, 1.7 mgd capacity.
 No BOD data.

 (6) Windsor Locks (Bradley Field)  - two plants, both afford secondary
 treatment.  Plant No. 1 has 2.0 mgd capacity and Plant No. 2 has
 0.5 mgd capacity.  Effluent BOD data are:

 Plant No. 1     5/11/64    30 mg/1      8/8/67      16 mg/1
                 4/20/66    18/mg/l      4/4/68      20 mg/1
 Plant No. 2     6/17/68    85 mg/1

 (7) Tariffville.   Municipal plant, 0.2 mgd capacity, primary treatment.
 Effluent BOD data:

 9/16/64                190 mg/1          3/15/67              91 mg/1

 (8) Winsted.   Municipal plant, secondary treatment, 1.0 mgd capacity.
 Effluent BOD data:

 8/22/66                55 mg/1           5/1/67              40 mg/1
 7/31/67                31 mg/1           4/2/68              54 mg/1

 A 1.25 mgd plant at Windsor for the Combustion Engineering Corporation
 also discharges into the Farmington River below Rainbow Dam (near the
 mouth of the River).  The present loading is 0.2 mgd.  The plant
 affords secondary treatment.  The effluent BOD in a sample taken
 4/27/66 was 17 mg/1.

 Four industrial plants in the Simsbury-Avon area discharge a total
 of 50,000 gallons daily.  Their effect is neglected.  Also the
 Simsbury Sewer Association plant of 85,000 gallons daily capacity
 is neglected.
                              A3-32

-------
              Fl GURE  A3-3
           LOCATION  OF STREAM
           SAMPLING   POINTS
                            /
                           SCALE IU
                            MILES
A3-3 3

-------
A3_.j8_Strearn jQuality _D_ata_._
The Water Resources Commission, State of Connecticut, has established
six sampling locations in the Farmington Basin and it samples the
river at these locations at infrequent intervals to obtain water
quality data,  The location of each station is described belox-7 and
is shown in Figure A3-3.  The data, with dates of sampling, are
tabulated in Table A3-24.

Station CFS-1, Still River between the Winsted Sewage Treatment
Plant and the confluence of Still River and Sandy Brook.

Station CFS-2 Main'stem; Farmington River at Collinsville.

Station CFS-3 Main stem, Farmington River at the Highway US-44
bridge at Avon.

Station CFS-4 Main stem, Farmington River at the Rainbow Dam.

Station CFS-5 Main stem, Farmington River at Mill Brook, about
2 1/2 miles above  the confluence of the Farmington and  Connecticut
Rivers.

Station CFS-6 Pequabuck River a short distance upstream of  its
confluence with the Farmington River, near Farmington,  Connecticut.

A3.9 MDC Water Demand.
The daily demand  for water  from  the  Barkharnsted  and  Kepaug  Reservoirs
was 51.5 million  gallons  in 1967,  52.5. million gallons in 1968 and-
54 million gallons  in  1968.   It  is expected  that the 82 million
gallons per day firm capacity will supply MDC  until  1978.   The plan
then is to augment  this  supply by  diversion  from the Colebrook-
Goodxvin system, estimated to meet  the demands  until  the year 2000.
                              A3-34

-------
                           TABLE A3-23
                    Assumed Irrigation Demand
                    (in cubic feet  per second)
Week

 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
Reach 5

   0
   0
 3.7
 3.7
 3.7
 3.7
 3.7
 3.7
 3.7
 3.7
 3.7
   0
   0
   0
   0
Reach 6

  0
  0
3.7
3.7
3.7
3.7
3.7
3.7
3.7
3.7
3.7
  0
  0
  0
  0
                           TABLE A3-24
                        Water Quality Data
Station
CFS-1


CFS-2


CFS-3


CFS-4


CFS-5


CFS-6


Date
8/ 9/67
10/ 4/67
6/10/68
8 9/67
10/ 4/67
5/27/68
8/17/67
10/ 2/67
5/27/68
8/16/67
9/20/67
6/17/68
8/16/67
9/20/67
6/17/68
8/ 9/67
10/ 4/67
5/27/68
BOD, mgt
5.8
2.05
3.0
2.5
0.7
1.0
2.8
2.1
1.6
3.7
1.6
1.0
1.15
1.0
1.2
9.7
4.05
5.0
                                         DO, mg/1

                                           4.25
                                           4.45
                                           6.4
                                           8.6
                                           9.1
                                           9.3
                                           8.1
                                           7.6
                                           8.3
                                          12.7
                                          13.0
                                           8.4
                                           7.9
                                           8.2
                                           8.0
                                           1.9
                                           1.8
                                           4.5
                                                            Reach  7
  0
  0
  0
  0
  0
  0
  0
  0
  0
  0
  0
1.3
1.3
1.0
1.0
                                         Temp.°C

                                           24.8
                                           18.5
                                           19.0
                                           23
                                           17.8
                                           15.5
                                           25
                                           15.5
                                           15.3
                                           28
                                           22.3
                                           19
                                           24.5
                                           20.8
                                           18.5
                                           23.3
                                           18.3
                                           14.3
 Source:  Water Resources Commission, State of Connecticut,
 Hartford,  Connecticut.
                               A3-35

-------
                          APPENDIX AA
                      USER'S INSTRUCTIONS
The material contained in this Appendix is intended to be used by
those making the detailed preparations for use of the water quality
simulation model and the optimization model.  This Appendix has been
prepared in sufficient detail to allow its removal from the report
to serve as a manual for guidance in the preparation of program
inputs and control statements.  Output content and format are also
described in detail.  The information is separated into program
components and each component is described in the following pages.
Figure A4-1 is an overview of the various programs showing the
relationship between them.

A4.1 CHKDATA  Streamflow Data Edit Program

A4.1.1 Purpose.
The CHKDATA program is designed to read daily raw streamflow dat;n
of the type available from the U. S. Geological Survey (USGS) for
their stream gaging stations and to prepare these data for use in
a synthetic streamflow data generator.  The program reads the raw
data either from punched cards or from magnetic tape, checking as
it does so to assure that the data being read are in the proper
sequence, for the proper station and for the years of record desired.

When all desired raw data have been read in the proper order, the
program searches for missing data.  If more than one month of
consecutive data are missing, the program calls exit and the oper^to*
must reschedule the data sequence to remove that period from use.
If fewer than one month of data are missing-, the program fills the
missing data so that the output is a complete set of daily stream-
flow records.

 Missing data are filled by noting the day .of the year of the miss'n
data item and its station number.  Then a search is made of all
other years for the data item corresponding to the one which is IUXKS
The mean and standard deviation are computed from these data items
and the missing item i's computed according to the formula:

                         Qi = Wi + °1 ri	[Eq. A4.1]

where:
Q. = the computed missing data item.
y^ = the mean of all data available corresponding to the day.
a  = the standard deviation of all data available corresponding
 1   to the day and station of the missing data item.
r. = a standard normal random deviate.


                             A4-1

-------
Having read, edited and  filled the data traces, the program then:
(1) outputs daily flow data,  (2) computes and outputs the mean flow
for a weekly Interval, or  (3) computes and outputs the mean flow
for a monthly interval,  depending upon the value given the control
variable, ITIME.

A4.1.2 Program Components
The CHKDATA program consists  of the subroutines, listed with their
lengths in bytes, as follows:

               CHKDATA MAIN-  93510             AVM - 706
               INPUT       -  1288             AVW -1418
               INCARD      -  1640             RAN - 832
               FILL        -  1332           RANDU - 448

The program length for functions is 19,776 bytes.  The total program
length is 122,750 bytes.

A4.1.2.1 CHKDATA MAIN
This program component reads  in the program controlling information,
coordinates the work of  the other subroutines, makes certain checks
and outputs the edited data.  The program controlling information
is supplied on two cards (see A4.1.3, Program Input and Output,
which follows).  The controlling information establishes the number
of stations and each station number, the years in which the data
for each station begin and end, the averaging interval and the
mode of input and output.

After indexing the stations,  the subroutines INPUT and INCARD are
called.  These subroutines read the data one month at a time, perform
certain checks described below, and return for one month to CHKDATA
MAIN.  Checks for the station number and beginning and ending years
then are made on the month's data just read.  Thus, the data are
checked for proper order by station, week, month and year.  Notice
of deviation from proper order is printed or the program is exited.

When the reading of data is completed, the subroutine FILL is called
to fill in missing data.  FILL is described below.

Finally, depending upon the controlling information supplied, CHKDATA
MAIN outputs the edited streamflow data.  The data are supplied in
printed form, on punched cards or on magnetic tape.  Daily flows
are outputed without further change.  Weekly flows are outputed as
the average of the daily flows for the given week and monthly flows
are the average of the daily flows for one month.
                              A4-2

-------
                     FIGURE A4-I
                PROGRAM  RELATIONSHIP

                   RAW  GAGE DATA
NORMAL*
     I   (46,672)
 TRANSFORM
 SELECTION
                   CHKDATA1
                             (122,750)
                    EDITED HISTORICAL
                    GAGE  DATA,
                    WEEKLY AVERAGE
                                   «**
                               , **•
                      FLASH
                          |  (321,248)
                       SYNTHETIC
                       WEEKLY GAGE
                       DATA
WATERSHED  DATA
RESERVOIR DATA
WA,STH DATA
QUALITY  PARAMETERS
       .**
WASP
     (104,888)
                   TFLOV\T
                        |{I4I,024)
                     GAGE
                     SELECTION
                    REGULATED FLOW
                    BOD  AND DO AT
                    EACH REACH EACH
                    WEEK.

                    QUALITY VIOLATIONS
                                     4. PROGRAMS USED IN
                                       FOR SIMULATION

                                    ** SIMULATION PROGRAMS

                                       "tOSRAM UEH3TM, BYTES
                       A4-3

-------
Normally, USGS data are in units of cubic feet per second and if
this unit is used, the output will be in cubic feet per second
units for average flow rate for the day, week or month, which-
ever is appropriate.

A4.1.2.2 Subroutine INPUT
This subroutine transmits the call to read data from CHKDATA MAIN
to subroutine INCARD and the data read back to CHKDATA MAIN.  Before
the data are sent to CHKDATA MAIN, this subroutine checks to determine
that the data read are of the proper station, month and year.  The
data are transmitted in a 1 dimensional array, one month's data at
a time.

A4.1.2.3 Subroutine INCARD
INCARD actually reads the supplied raw historical data.   The subroutine
checks to determine if the cards (or tape data) are in the proper
weekly sequence.  Data for one month at a time are read, checked,
and transmitted to subroutine INPUT.

A4.1.2.4 Subroutine FILL
After the data are all read and checked, subroutine FILL is called
to determine if there are any missing data points.  If 30 or more
consecutive daily data points are missing for any station, exit is
called and the operator must make an adjustment in the data years
used.  If scattered data points are missing, the subroutine fills
the missing points one at a time, as described above.

A4.1.2.5 Subroutines RAN and RANDU
These subroutines generate standard normal deviates  (mean » 0 and
variance = 1) for use in subroutine FILL.

A4.1.2.6 Subroutines AVW and AVM
Subroutines AVW and AVM compute the weekly average and monthly average
flows from the edited and filled daily data, according to the control
number entered for the variable ITIME.

A4.1.3 Program Input
Input is required as follows:

A4.1.3.1 For CHKDATA MAIN
Card # 1 (915)*    IYRI(I)    =  The starting year for station (I).
                   IYR2(I)    =  The ending year for station (I).
                   NNSTA      =  The number of stations.
                   ITAPE      =  4 for data input on tape.
                              =  5 for data input on cards.
                   ISTART     =  A starting random number.
                   ITIME      =  1 for daily flow output.
*Data fields on card.
                              A4-4

-------
                   IPRINT

                   IPUNCH.

                   NTAPE
2 for average weekly flow output.
3 for average monthly flow output.
0 if output is not to be printed,
1 if output is to be printed.
0 if output is not to be punched.
1 if output is to be punched.
0 if output is not to be taped.
1 if output is to be taped.
Card # 2 (1018) (ISTA(I), 1=1, NNSTA) indicates the set of station
numbers for the stations for which data are to be read.   These
station numbers must correspond to the station numbers of the raw
data set.  The number of stations, NNSTA, may be fewer than the
number of stations contained in the raw data but the order in which
stations are read must be the same as in the raw data set.

A4.1.3.2 For Subroutine INCARD
A set of input streamflow data cards or card images on a 7-trace
tape is required.  The data card format is:

                     (18, 14, 12, II, 8F6.2)
where,                18 = the station number.
                      14 = the calendar year.
                      12 = an index, 1, 2, 3, or
                           4, which identifies the
                           number of the card in the
                           month.
                    8F6.2= The daily streamflow values for 8
                           consecutive days.  The first card
                           contains flow data for the first
                           8 days, the second for the 9th
                           through the 16th days, the third
                           for the 17th through the 24th days
                           and the fourth for the 25th day through
                           the last day of the month, 28, 29, 30
                           or 31, as appropriate.

 A4.1.4 Program Output
All output is produced by CHKDATA MAIN and is described as follows:
 (1) Data output may be printed and/or punched on cards,  depending
upon the control information furnished.  The format of the output
depends upon the control information supplied for variable ITIME.
For daily streamflow data - a set of 4 cards or lines per month
is produced and the format is the same as the input data format.
For average weekly streamflow data - one card or line is produced


                                A4-5

-------
 for each month.  The format is:
                            (IB, 14,  12, 4F8.2)
 where,                      18 = the fetation number.
                             14 = the calendar year.
                             12 - the month.
                           4F8.2= four average weekly flows for
                                  the month.
 For monthly streamflow data - a set of 2 cards or lines for each
 year is produced.  The format is:
                            fI8, 14, 6F8.2/12X, 6F8.2)
 where,                      18 - the station number.
                             14 - the calendar year.
                           6F8.2- the six monthly average flows.
 (2) Data output may be written on  magnetic tape, depending upon
 the control information furnished  as variable ITAPE.  The format
 of the output depends upon the control information supplied for
 variable ITIME.  For daily streamflow data - the format will be
 the same as that of the raw data tape,  as described previously
 (A4.1.3.2).   For average weekly streamflow data  - a binary tape
 is written for each station.   Each record contains ISTA,  IYR1
 1YR2,  (AV(I,J), I - 1,  48), J  - 1,  NYR)  where:                '

 ISTA =• the station number.
 IYR1 = the beginning calendar  year of data.
 IYR2 = the ending calendar year of data.
 AV(I,J)  »  the weekly average flow  for week I and year J.
 NYR - number of years  of data  - IYR2-IYR1+1.

 For monthly  streamflow  data - a binary  tape  is written for  each
 year at  each station.   Each record  contains  ISTA,  IYR,  (AV(I)
 I  - 1,  12) where:

 ISTA - the station  number.
 IYR - the calendar year.
AV(I)« the monthly  average flow for month  I,

 A4.1.5  Definition  of Program Variables
Following is  a  list  of variables used in CHKDATA and a brief
definition of each:

AV(I,J)       Average flow during Ith week of Jth yesr.
AV2(I,J)      Average flow during Ith month of Jth year.
FN            Number of data items.
ICARD(I)      Card  sequence number.
ICOUNT        Convenience Index.
                             A4-6

-------
IDAY
IISTA
IIYR1
IIYR2
IPUNCH

ISTART
ISTA(I)
ITAPE

ITIME
IWEEK
IWEEK2
IYEAR
IYR2(I)
JPREV
JYR
KMO(I)
KSTA(I)
KYR(I)
L
LMO
MONTH
ND(I)
NEVEN
NMO
NNSTA
NNYR
WODD
NSTA
NTAPE
QMEAN
QNEW
QSTD
Rl
R2
RN(I)
Control variable-input,

Control variable-input.
        K)
Day counting variable.
Convenience station number, for checking.
Convenience starting year, for checking.
Convenience final year, for checking.
Control variable-output, = 0 for no data punched.
                         = 1 for data to be punched.
Starting random number.
Identifying number, Ith station.
                         = 5 data on cards.
                         = 4 data on tape.
                         = 1 for daily flows.
                         = 2 for weekly average flows.
                         = 3 for monthly average flows,
Week counting variable.
Month counting variable.
Year counting variable.
Starting year for data,Ith station.
Final year for data, Ith station.
Convenience station number, for checking.
Convenience number of years for checking.
Identifying number, Ith month.
Equals ISTA (I).
Equals IYR (I).
Week index.
Number of months of data, computed.
The current month.
Number of days in month I.
Convenience number, random number generator.
Number of months of data counted.
The number of stations.
Number of years of data.
Convenience number, random number generator.
Current station number.
Control variable-output, = 0 for no data on tape.
                         = 1 for data output on tape.
Gage flow Ith month, Jth day, Kth year.
Mean flow.
Computed flow to fill missing data point.
Standard deviation of flow.
Convenience variable, random number generator.
Convenience variable, random number generator.
Random number, Ith time frame.
                                A4-7

-------
SUM        Sum of second term.
S(I,J)     Flow for Jth day of  Ith week, current month.
YFL        Convenience number,  random number generator.
Z(I)       Temporary storage, flow on Ith day in current month.
Z(L)       Temporary linear storage for one month's flow.

A4.1.6 Program Logic
Figure A4--2 is a diagram showing program logic for CHKDATA.

A4.1.7 Program Coding
The program coding for CHKDATA follows.
                           A4-8

-------
                        FIGURE  AA-2
                 PROGRAM LOGIC  -  CHKDATA
        CHKDATA MAIN
        Read control statements
          Call RAN
  -^•develop random
     numbers for FILL
          Call INPUT
  -•-Call INCARD
Return after
reading and
checking one
month's data.
Until all data
are read.
  •read data for one
   month and check
   for correct card
   sequence
     Check data read
     for station, year
     and month
    	I
          Check data for
          beginning and
          ending year
          Call FILL
     Check for missing data
     and compute filling data.

     — If more than 30 consecutive
       data points are missing
                                     call exit
Output edited
and filled daily
flows, printed,
on cards or on tape.
    Call AVW

Compute average
weekly flows and
output, printed,
on cards or on
tape  ^,	

Check to determine if
all data called for have
been read
   Call AVM

Compute average
monthly flows and
output, printed, on
cards or on tape
                               END
                               A4- o

-------
//CHKCATA  JOB  I 114 3 , 47 , 009 ,09 , 9S99 ) , ' ALEMA.N               'tCLASS
                                                            -V
If EXEC F4GCXf      FORT  G CCMPILE (NODECK), EXECUTE, CLASS M
//FOiU.SYSIK CC  *
C  •   NIDI I )=NUM6ER  OF  DAYS IN MONTH I
C  '   C( I,J,K) = FLCW  IN ITh NCNTH, JTH DAY, KTH YEAR
C     ISTM I )=ICENT IFYING NUMBER OF ITh STATION
C     K I)=TEWPGRAKY  STORAGE FOR FLOW CK  ITH DAY OF  A  GIVEN MONTH
                                                             CF
C          INPUTTED  CATA
C     AVI I, J)=AVERAGE  FLCl* CURING ITH V.EEK OF JTH  YEAR
C     AV2( I i J )=AVERAGE FLGV-, DURING ITH i^OMTH OF JTH  YEAR
C     IYR1( I )=STARTING YEAR OF DATA FOR ITH STATION
C     IYR2{ I ) = F INAL  YEAR  OF CATA FOR ITH  STATION
C     NNSTA = NUf'3ER  UF  STATICNS
C     ITAPE=TAPE NUMBER  FOR INPUT DATA
C          =5 IF CATA  ARE PUNCHED GN CARDS
C          =4 IF CATA  ARE CM TAPE
C     ISTART = STARTKJG  RANCCf NUMBER
C     ITIKE  INDICATES  WHETHER DAILY,HEEKLY OR MONTHLY  FLOWS ARE
C            DESIRED
C          =1 IF CAILY FLOVvS ARE DESIRED
C          =2 IF WEEKLY  FLCfcS ARE DESIRED
C          =3 IF MONTHLY  FLCWS ARE DESIRED
C     IPRINT=0  IF CHECKED CATA ARE NOT TO BE PRINTED
C            =1  IF CHECKED CATA ARE TO BE.PRINTED
C     IPUNCH=0  IF CHECKED CATA ARE NOT TO BE PUNCHED
C            =1  IF CHECKED CATA ARE TO BE  PUNCHED
C     NTAPE=0 IF NO  OUTPUT DATA TAPE IS DESIRED
C          =1 IF AM  OUTPUT CATA TAPE IS DESIRED
      DIfENSICN  ND(12),C(12,32,5-0) , ISTAl ICQ), 2(32)
     -1--         ,AVI 48,50) ,AV2<1?,50),IYR1{100),IYR2(LOO)
      DIMENSION  I 1STA(ICO)
      ICOUNT=C
      ND(1)=31
      KD(2)=26
      ND(3)=31
      ND(4 }=3C
      ND15)=31
      ND(6)=30
      ND(7)=31
      ND(8)=31
      ND(9)=30
      ND(101=31
      ND(11)=30
      ND(121=31
      READ(5,6CC1)NNSTA, ITAPE,ISTART,ITIME,IPRIPIT,IPLNCH.NTAPE
      IF  (NTAPE.NE.O)NTAPE=1
      IF{ITAPE.NE.5)ITAPE=4
      IF( ITAPE .EC.4)REWIND 4
      CO  1 1=1,10


                              A4-10

-------
      CALL RAMISTART,32,Z )
    1 CONTINUE
 5CC1 FORMATI7I5)
      READ (5,*C02)  CISTA( I ) ,I=1,NNSTA)
 5002 FORMAT  ( 1CI8)
      READ<5,5CC3) ( IY*1( I ) ,IYR2(I) ,1=1,NNSTA)
 5C03 FORMATU6I5)
      WRITE(6,6CC1)  NMSTA, ITAPE.NTAPE, ( I, ISTA( I ) ,IYR1( I) , IYR2(I ) ,.
                                                            1=1,
     1NNSTA)
 6001 FCRMATt II-1,'STREAKFLCW  DATA EDIT PROGRAM * / I 3 , «  STATIONS'/
     1        •  INPUT  CATA  CN  TAPE ' ,
     2        I2/1  OtTPUT CATA CN TAPE ',12/7
     3        ('  STATIC,M{ ' , 12, • )  = SIS,1    STARTING  YEAR=  ',14,
     4        '     F INAL  YEAR=, ' , 14) }
      ISTART  =  ISTART  +  3
C
C  READ CATA  FCR  CNE  VuKTH
C
    5 CALL INPUT  ( NST-' , KYR , NONTH , Z , I TAPE )
    6 IF (NSTA)  1COO,10CC,1C
   10 I =  1
   11 IFCNSTA.NE.ISTAt I ) )GO  TO 2CO
      ICCUNT=ICCUNT+1
      IISTA(ICCUNT) = ISTA( I )
      NNYR=IYR2( I )-IYRH I J + l
      LMO  =  12»NNYR
      I IYR1 = IYR1( I)
      I IYR2=IYR2( I )
      GC TC  20
  2CO IF(I.GE.NNSTA)GC  10  5
      l-I + l
      GO TC  11
   20 JPREV  = NSTA
      NMO = 0
      GO TO  32
   21 JYR=NYR-IIYR1-H
   25 DO 30  1=1,32
   30 C(MONTH,I,JYR )  =  Z( I )
   31 CALL INPUTINSTA,NYR,NONTH,Z,ITAPE)
      IF (NSTA  -  JPREV)  4C,32,'iO
   32 IF(NYR-I IYR1) 31, 33,.33
   33 IF(NYR-I IYR213A, 3A,.31
   34 NMO  =  NKC  +  1
      GO TC  21
 10CO IF( ITAPE.EG.4 )R£oiINC A
      IF(NTAPE.E(,.0 JRETURN
      END  FILE  1
      REWINC  1
      RETURN

C                                A4-11

-------
C  CHECK  FCR  MISSING DATA
C
   40  IF(Nf'G-L,wt)41,45,45
   41  URITE  (6,S041) NMO ,.LPC » J PREV
 6041  FORMAT  ('  GNLY',I4,-» OUT  OF', 14,'  MONTHS OF DATA ARE  PRESEN
                                                            T  FOR  S
     ITATICIS',19)
   45  CALL  FILL  ( N.MYR , ND ,.Q , I START , J PREV )
C
C  PU'NCH  DATA CARDS FOR STATION JPREV
C
       GC  TC  (60,61,62),ITINE
   60  WRITE(6,8C02)
 8C02  FQRNATl1HC,'DAILY FLOPS')
       DO  50  I=1,NNYR
       NYR= I IYR1+I-1
       CO  50 J=l,12
       L =.  1
       M =.  8
       CO  51 K=l ,4
       IF( I PP. INT.EC.C.AiMC. I PUMCH . EQ . C .AND. NT APE . EQ . 0 ) GO TO 300
       IF( IPRIM.EC.OJGO TO 52
   54  WRITE(6,6C51)JPREV»NYR,J,K,(C(J,N,I),N=L»M)
 6051  FCRNAT  ( I G , 14 , IP, I 1,8F8.2J
   52  IF{ IPUi-lCI-.EG.O)GO TO 53
       WRITL  (7,6C51) JPREV , NYR, J ,.K , ( Q ( J ,N , I ) , N = L , M )
   53  IF(NTAPt)201t300,301
  301  URI TE (NTAPE ,6051) JPR£V,.NYR,.J,K, (Q ( J,N, I ) ,N=L, N)
  300  L=L+8
   51  M = M +  8
   50  CONTINUE
       GO  TC 110
C      CCMPUTE  WEEKLY AVERAGES
   61  CALL AVUC,NNYR,AV)
       WRITE(6,8C01)
 8C01  FGRMAHIhO,'WEEKLY FLCWS')
       IF( I PRINT .EG.O.ANC. I PLNCH . EQ . C . AND.NTAPE . EC]. 0 ) GO TO 110
       DO  400  J = l, N.MYR
       IWEEK=1
       IWEEK2=4
       NYR=IIYRHI-1
       DC  400  J=l,12
       IF( IPRINT.EG.O)GO TO 4C1
       VJRITE(6,6052)JPREV,.NYR,J,(AV(II,I),II = IWEEK,I
 6052  FCRf-'.ATI II-  , I 8 , 14 , I 2 , 4F8 . 2 )
  401  IF(IPUNCH.EQ.OJGO TO 402
       WRITE(7,6C53) JPREV, NYR.J, (AV ( I I , I) , I 1 = 1 WEEK , I
 6053  FORNATt13, 14, I2,4F8.2)
  402  !WEEK=lHEEK+4
  400  IWEEK2=r^lEEK2 + 4
       NYR=IIYR2-IIYR1-H
                              A4-12

-------
  62

8000
6054
 501

6C55
 502

 SCO
 110
 ICO
 9CO

 903


 901

 101
IF(NTAPE.EC.O)GO  1C  110
WRITE(NTAPE)JPREV,IIYR1.IIYR2,I
-------
 6033 FORMAT (' INSUFFICIENT  DATA  FOR  STATI ON1 , I 9, •   MONTH1,13,•
                                                           DAY' ,
     1       13)
   34 FN = N
      CMEAN = CVEA^/FN
      USTD = SQRTUUSTD- FN*GME AN»*2 ) / { FN-1. ) )
      CALL RAN  ( ISTART,2,RN)
    7 FORMATdH ,«RN(1)= ',F10.4/
     11H ,«CWEAN= ',F14.2,'    QSTD=  «,F14.2)
      GNEW =     QMEAN + RNdJsQSFD
      WRITE (6,6020) QNIEW, J , K , I , NSTA , Q ( J , K , I )
 6020 FORMATH  NEK  FLOW  (*,F8.2,')  GENERATED FOR ' , 12?«/ ' , 12 , •/'
                                                           ,12,' F
     10R STATION',I 9,' IN  PLACE  OF  ORIGINAL  VALUE (SFB.Z,*)1)
      WRITE(6,7)RM1),UNEAN,QSTD
      Q(J,K,I)  = QNEW
   20 CONTINUE
      RETURN
      END
      SUBROUTINE IrJPLT ( NSTA , NYR , MGNTH , I, I TAPE )
      OIMEKSILN  Z(32),KSTA(4) ,KYR(4),KMG(4) ,I CARD(4 ) ,X(4,8)
C
C  READ DAILY STREAMFLOW DATA  FOR  CNE  MONTH
C
   34 CALL INCARD(KSTA,KYR,KMO, ICARD.X,ITAPE)
   10 00 11 1=1,4
   12 IF (KYR(I) -  KYR(l))  23,13,23
   13 IF (KI'Q(I) -  KM,0(D)  24,14,24
   14 IF (KSTA(I) - KSTA(l))  21,11,21
   21 WRITE (6,6021 )
      GO TO 25
   23 fcRITE (6,6023)
      GO TO 25
   24 MUTE (6,6024)
   25 DO 26 K=l,4
   26 WRITE(6,6C26) KSTA(K ) ,KYR(K) ,KMO(K),ICARD(K) ,(X
-------
      RETURN
      END
      SUBRCUTINE  RAN(IXiNtRN)
      CIKENSILN KN12COO)

      NODD =(M/2)*2
      IFU-NCCCHOO, 101,IOC
100   NEVEN=nEVEN+l
101   IF(NEVEN-20CO) 102,102,103
103   NEVEN=2CCC
102   DO 1C4  1=1,NFVEN
        CALL  RA.NCUl IX, IYrYFL)
104   R.NU)=YFL
      DO 105  I=1,NEVEN,2
      R1 = RM I )

      RNU)=SC/RT  U-2. J*ALCG(R1) )*COS (6.28*R2)
105   RN(I+1)=SCRT  ((-2.0)«ALOG(R1))*SIN (6.28»R2)
C     FUR TRIAL PURPOSES

      RETURN
      END
      SUDRCUTIKE  RANUUtIX, IY,YFL)
      IY=IX*65r>3S
      IF( IY)5,6,6
    6 YFL=IY
      YFL=YFL*.^656613E-9
      IX=IY
      RETURN
      END
      SUBRCUTIME  irJCARD(KSTAtKYR,KKG,ICARD,X,ITAPEJ
      DIMENSIC.N KSFA(A) , KYR ( 4 ) , KKO ( 4 ) , ICARD { A ) , X ( A , 8 )
      DO 1 1 = 1,A
      READ(ITAPE,5002)  KSTA(I) , KYR( I ),KNO(I) , ICARD(I),(X(I,J),J=l
                                                           • 8)
 5C02 FORMAT( 18, I'M 12,I1,8F8.2 )
      IF( ICARClI )-I )3,1,3
    3 WRITE(6,6022)
 6022 FCRKAT (' CARD  SEQUENCE  MOT CORRECT')
      WRITE(6,6COO) 1,KS1A( I),KYR(I ) ,KMO( I),ICARDtI) , (X( I ,J),J=l,8

 6CCO FORKATdh ,'!=  ' , I 5/ IX , I 
-------
    9 CONTINUE
      READt ITAPE,5002)KSTA( II ) ,KYR< II ) ,HMO(II),ICARD(II ) , (XIII.J)
                                                           t J=li 8)
      IF{ ICARC{ r I )-I 1)6, 5, ft
    6 WRITE (6, ACCO) I I ,KSTA( I I ) ,KYR( I I ) , KMO( I I ) ,
     1ICARC( I I ) , (X{ I If J) , J = l,8)
      GO TO 1
    5 CONTINUE
      GO TC 7
    1- CONTINUE
    7 RETURN
      END
      SUBROUTINE  AVU(Q,NYRStAV)
C     NCAY = NUM3ER OF  DAYS IN  A  GIVEN  N'ONTH
C     NYRS=NUMBEK OF  YEARS  OF  DATA TO  BE READ IN
C     ICOUNT  CCUNTS  A3  WEEKS  IN  A YEAR
      DIMENSION  AVI 48,5C) ,Q( 12,32,50) , NO ( 12)
      ND( 1)=31
      N0(2)=28
      ND<3)=31
      NO(A)=30
      NC(5 )=31
      ND(6)=30
      N0(7)=31
      ND(8)=31
      ND19J =30
      ND( 10)=31
      ND( 11 ) = 3C
      ND( 12) = 31
      CO 1  IYEAR=1,NYRS
      ICOUNT=0
      CO 1 POMH = iil2
      NDAY=^D(f CNTH)
   20 IF(NCAY-30)2B,30, 31
C     IT IS FEBRUARY
   28 L=C
      00 13 I^EEK = 1 ,4
      ICCUi\T=ICOL'NT-H
      SUM = 0
      DO U ICAY=1,7
      L = L-H
   H SUy=SUM+G (MONTH, L, IYEAR)
   13 AV< ICCUNTi IYEAR)=SUM/7.
      GO TO 1
C     IT IS A  THIRTY  DAY  KCNTH
   30 L = 0
      DO 15 IV*EEK=1»2
      ICOUNT=ICCUNT41
      CO  16  ICAV=1,8
      L-.L + l
                                A4-16

-------
   16 SUM = SUM-K, (MONTH, L, I YEAR)
   15 AVUCCUNT, IYEAR) = SUM/8.
      DO 17  H,EEK=1 ,2
      lCCUkT=ICULNT+l
      DC 18  ICAY=1,7
      L = L-H
   18 SUM=SUM+C (MONTH, L, IYEAR)
   17 AV( ICOUNT, IYEAR)=SUM/7.
      GO TO  1
   31 L = 0
      DC 19  U,EEK=1,3
      ICOUMT=ICOUNT+1
      DO 5C  ICAY=1,8
   50 SUM = SUM + C (MCmiJiL , I YEAR)
   19 AV( ICOUNT, IYFAR)
      SUM = 0
      CO 21  IIJAY=1,7
   21 SUM = SUfUQ(MOiJTh,L, I YEAR)
      AVI 1C CUNT, IYEAR)=SUM/7.
    1 CONTINUE:
      RETURN
          END
      SUBROUTINE  AV^ (Q , NYR S , AV )
C     NDAY=NUM8ER  OF  DAYS  IN  A GIVEN MONTH
C     NYRS=NUMEER  OF  YEARS OF DATA TO BE READ  IN
C     ICOUNT CCUNTS  12 f'ONTHS I M. A YEAR
      DIN ENS I ON  AVI 12,50 ) i C( 12, 32 i 50)
     1           ,NO(12)
      ND( 1)=31
      N0(2 )=28
      ND(3)=31
      ND(4)=30
      NC(5)=31
      ND{6)=3C
      ND{7 )=3i
      ND(8)=31
      ND(9)=30
      ND( 10)=31
      ND( 11 ) = 30
      ND( 12)=31
      DO 1  IYEAR=1,NYRS
      CO  1  fONTH=l, 12
      NDAY = ND(.VQMTH)
      ICOUNT  =ICCUNT<-1
                                A4-17

-------
  20 DO 13 ICAY=1,NDAY
  13 SU,V = SUK + C (MGnTH, ICAY, IYEAR)
     AV( [COUNT, IYCAR)=SUM/.\'DAY
   1 CONTINUE
     RETURN
         END
     SUBROUTINE QUT2
     DIMENSION  NL(8)
     DATA NL/C,1,2,2,4,5,6,77
     VvRITE(6,6C04)NL
6004 FORMAT!'1',30X,'CORRELATION  COEFFICIENTS OF TRANSFORMED  HIS
                                                           TCRICAL
    1 FLOWS*///1X, 'SITES 3X, «fCNTh«,8(7X, 'LAG' ,12), 3X,'SITE'/)
     RETURN
     END
     SUBROUTINE GUT 3(T 11,T 12,T22, I , 11, J )
     DII^ENSICK  Tll(4) ,T12(7) ,T22(4)
     V»R I TE( 6,6005) I, J ,122, 11
     hRlTE(6,fiC05)I,J,TllfII
     WRITE £6,6COG) I , J,T12, II
6CO'j FORKAT( I4,I7,2X,4G12.5,4SX,I6)
6006 FCRiVAK 14, 17, 14X,7G12.5, 16)
     RETURN
     END
     SUBROUTINE CUT6{NSITES,GAV,GSD,GSKEH,GCURT)
     DIfENSlCN  GAV(4,B,12),GSDt4,8,12),
    1           GSKCW(4,8,12),GCURT(4,8,12) ,ML(6),M(7) , Tl(4),T2(
                                                           7)
     DATA M'./ 1,2,3,4,3,2, I/
     DATA NL/C,1,2,3,4,5,6,7/
     '« RII C. ( 6 , 6 C 14 )
6014 FORMAT!'1',27X,'STATISTICS OF  GENERATED  FLOWS')
     WRITE(6,6C15)
6015 FORMAT (///I OX, 'SITE1 ,3X, 'MGNTHS3X, 'WEEKS6X, 'fEAN' , 5X ,
    1       'SID  DEVS4X, 'SKEWNESSS4X,'KURTOSIS'/)
     DO 1C I=1,NSITES
     DO 1C J=l,12
     DO 10 L=l,4
  10 riRITE(6,60i6)I,JlLlGAV(L,I,J}|GSD(L,I,J),GSKEh(L,I,J),
    1               GCURT(L,I,J)
6016 FORTATlI 12,17, I8,4F12.5)
     RETURN
     END
     SUBROUTINE CUT 1(NSITES,NTRAN,XQAV,XQSO,XSKEW,XCURT,QAV,QSD,
    1                      SKEVi.CURT)
     ClfEh.SlLN  ATr^AN( 3 ) , XCA V { 4 . 12 , 8 ) , XGSD (4 , 1 2 , 8 ) ,XSKtW(4, 12,8) ,
    1           XCURT (4, 12, 8) ,QAV(4,12,8) ,QSD (<,-', 1 2 , 8 ) .SKEW (4, 12,
                                                           8),
    2           CURT(4,12,E)
     DA1A ATRAi\/4H   NO,AH  LCG,4HSCRT/
     WRITE:{6,6COO)

                              A4-18

-------
 60CO FURNAK'I',26X,'STATISTICS OF HISTORICAL  FLOWS')
      WRITE(6.6C01)
 6C01 FGRNAT(///10X,'SI]ES',3X, 'MONTH',3X,'WEEK't6X,»MEAN•,5X,•ST
                                                            D DEV ,
     1         4X, •SKEWNLSS1 , 4X,'KURTGSIS1/)
      DO 10  1=1,\SITES
      DO 10  J=l,12
      CC 10  L=l,4
   10 WRITE (6, 6C02) 1,J,L,XCAV{L,J, I ) ,XC!SD ( L , J t I ) t XSKEW (L , J , I ) ,
     1               XCUKT{L,J,I)
      WRITC (6,6CC2)  ATRAN( MRAi\)
 6002 FORNAT(I13iI7,I8,4G12.5)
 6003 I:GRMAT( • I1 ,33X,A4, «  TRANSFORMATION'//
     1        2?.X,'STATISTICS OF TRANSFORMED  HISTORICAL  FLOWS')
      WRITE16,6C01)
      CC 15  I=1,NSITES
      CO 15  J=l,12
      HC 15  l.= l,4
   15 WRITE16, 6C02) I,J,L,CAV(L,JiI ) iQSD(L,J, I) ,SKEW(L,JtI) iCURKL
                                                            ,J,1 )
      RETUUN
      END
/*
//GCJ.FT01F001  CC UN I T= 18 1, VCLUME = SER = X XX , LABEL= ( , BLP ) , DI SP= { , P ASS
                                                            )
//GC.FTO'tFOOl  CC DM I T= 1 60 i L ABEL= ( i BLP ) , C I SP = NE'^I,
                                                                  X
//             VCLUME=SER=VYY,
                                                                  X
//             DCti- ( RECFM=Ut BLKSIZE = BOOi OEN=lf TRTCH = ETJ
/*ECF
                               AA-19

-------
A4.2 Normal

A4.2.1 Purpose
The NORMAL program is designed to test the frequency distribution
of the historical gage data to determine if the data are normally
distributed in the statistical sense.  The program then makes six
transformations to change the scale of these data and it tests
the resulting frequency distributions to determine if the trans-
formed variable has a normal, or Gaussian distribution.  This
program is intended to be used in preparation to generate
synthetic gage data by FLASH and to simulate stream flows and
water quality by WASP.  The result of NORMAL should be used to
determine the transformation to be selected for subroutine TRANS
in the program FLASH.

Many natural random functions have values which are symmetrically
distributed about their mean value.  Hydrologic functions are
natural and random but in almost every case, their frequency
distributions are not normal, but, rather, are skewed right.
This type of distribution has a preponderance of-values less
than the mean, but the larger values extend well to the right
of the mean.  Because many statistical procedures are available
for analysis of normal-data, advantage is gained if these
skewed hydrologic data are converted to a normal distribution.
This is possible by making a non-linear transformation of the
data.  Most hydrologic data can be normalized by considering
the logs of the ordinate values, flows or rainfalls, instead
of the direct values.

The objective is to maintain the statistical appearance of the
historical data in generating the synthetic data.  Because the
data usually have a skewed distribution, it will be necessary
                          A4-20

-------
to use a model which preserves the mean, standard deviation and
skewness of the historical data, as well as the serial correlation.
If the historical data were normal distributed, it would be
possible to eliminate the skewness parameter from consideration because
the mean and standard deviation completely describe the statistical
properties of a normally distributed population.  Thus, using data
made normal by transformation eliminates the need of a skewness
term in the generating equation.

More importantly, in considering the multivariate process there
is no general multivariate gamma distribution available (the
skewed data approximate a gamma distribution).  On the other hand,
information readily available about multivariate distributions is
based upon the assumption of multivariate normality.  This is due
to the fact that marginal and conditional distributions derived
from multivariate distributions also are normal, as are linear
combinations of normal variates.  These properties are utilized
in the multiple-lag model which is the basis of the flow generator.
It is necessary to transform the historical data to render their
distribution normal to reduce the error that would otherwise result.

NORMAL reads edited and filled historical data and, then, in a
"do loop" taking each station in order, transforms the data,
computes the mean, standard deviation and skewness of the trans-
formed data, prepares a histogram to show the distribution of
the transformed data, computes the cumulative frequency of the
transformed data and compares the cumulative frequency, cell by
cell, with the cumulative frequency of a normal distribution.
The comparison is made by determining the difference between the
cumulative frequency of the transformed historical data and the
cumulative frequency of a normal distribution having the same
cell bounds.

The test for normality is made using these differences in
cumulative frequency values and the Kolmogorov-Smirnov test for
goodness of fit.  The Kolmogorov-Smirnov test is a non-parametric
or distribution free test similar to, but reportedly more restric-
tive than, the Chi-Square test.  The difference in cumulative
frequency between the transformed historical data and data obtained
from the normal distribution must be less than the tabulated
                               A4-21

-------
"critical" value.  The "critical" values have been tabulated by Massey
(9).      For a sample size greater than 35 and a level of significance
of ct   » 0.05, the "critical" value is given by 1.36/N1/Z where N is
the sample size.  If any cell difference exceeds the "critical" value,
the hypothesis that the distribution of the historical data is normal
is rejected.

As an example, suppose the maximum cell difference of 0.0487 i£L
obtained for a sample of 480.  The critical value is 1.36/480 ' •»
0.062.  The hypothesis that the distribution tested is normal can
be accepted since 0.0487  < 0.062.  This indicates that in 5 percent
of the samples of size 480, the maximum relative deviation between
the sample cumulative distribution and the normal cumulative
distribution will be at least 0.062.

Note that if the difference in any cell is greater than the
critical value,  the hypothesis is rejected and the data must be
considered non-normal.

The transformations used  in the program are of two general forms:

                  - (1)  q - Qb
                   (2)  q - log (Q+a)
where q is the transformed value, Q is the untransformed value, b and
 a    are constants.  In  the program coding (see A4.2.7), values
for b are:  +0.25, +0.50 and +0.75; and values for  a  are 0 (log-
normal transform), +0.25  y and 0.50 y , where y  is the mean value
of Q.  Note that b^l.OO results in no transformation.  If one wishes
to make a transformation  of a different form, it is an easy matter
to change the program coding.

The program is designed to provide the differences in cumulative frequency
for a complete set of station data and for a week by week consideration
of the data; that is, all data points for week L of the year are
considered separately.  This allows testing of the complete set of
each weekly set  of data.   If one wishes to bypass the weekly
computations and consider  only the complete data set, statement
number 19 of NORMAL  - MAIN must be "GO TO 51".
                                A4-22

-------
The program computes the cumulative frequency, for each cell limit,
for each station and transformation and computes the difference between
that cumulative frequency and the norrnal cumulative Crtqutncy.  The
maximum of these differences is then checked against the critical
value.  If the maximum difference is less than the critical value,
"good fit" is written, and if it is greater than the critical value,
"not a good fit" is written.  The maximum difference and the critical
value also are written.

In general, one or more of the transformations included in the program
will convert the historical data into a normal distribution.  If more
than one transformation is successful, the assumption is made that
the one giving the least maximum cell difference should be selected.
On the other hand, data for which a normalizing transform has not been
found should not be used to generate gage flow data in FLASH.

A4.2.2 Program Components
The program NORMAL is made up of the subroutines listed below with
their lengths in bytes.


        NORMAL MAIN   23,428        Function length - 20,208
        DIFCHK           796        Total Program length - 46,672
        TRFM             658
        HISTGM         1,210

A4.2.2.1 Subroutine NORMAL - MAIN
Subroutine NORMAL - MAIN is the controlling subroutine which reads
in all data, computes the statistical data, calls the supporting
subroutines and writes output array headings.

A4.2.2.2 Subroutine DIFCHK
This subroutine computes the cumulative distribution of the trans-
formed data, performs the comparison with the normal cumulative
distribution and writes out array containing both cumulative
distribution and the absolute value of their difference.

A4.2.2.3 Subroutine TRFM
TRFM sets up the transformation constants, determines the trans-
formation called for and transforms the data.

A4.2.2.4 Subroutine HISTGM
Subroutine HISTGM arranges the transformed data in order of increasing
magnitude, computes the mean, standard deviation and skewness of
the transformed data, normalizes the transformed data and classifies
the data into 17 cells, according to magnitude.  These data are the
                                A4-23

-------
cell counts which make up the histogram and are the basis for com-
putation of the cumulative distribution of the transformed data.

A4.2.3 Program Input
All program input enters through NORMAL MAIN.
Card # 1 (12) NNSTA = the number of gaging stations for which data are
to be read.
Card # 2 (10I8)NSTA(I) = the identifying number of the gaging stations,
maximum of ten.
Card # 3 (1615) IYR1 (I) • the beginning year of data for station I.
                IYR2 (I) » the ending year of data for station I.
Data Cards (18, 14, 12, 4F8.2)
                NSTA     • identifying station number, field is 18.
                  N2     - the year identifying the data on the card
                           field is 14.
                  N3     • the month identifying the data on the card
                           field is 12.                               '
              WK(K,L,J)  - four weekly average  flows for the month,
                            year and station identified therewith
                            4-F8.2 fields.

A4.2.4 Program Output
Program output is written by NORMAL-MAIN and DIFCHK.  The output is
in four parts described as follows:
(1) The number of stations and the identifying station number with
starting and ending years of data are written out once at the
beginning of the output package.
(2) For each station, the mean, standard deviation and skewness
for the untransformed data are written.  When weekly data are called
for, this output is in an array of 48 rows and 4 columns.  The rows
are one for each "week" of the year.  The column headings are week,
mean, standard deviation, and skewness.  When the complete set of
data are considered at one time, the output is printed in three
lines, one each for the mean, standard deviation and skewness.
(3) For each station and transformation, the following information
is written.  First, the identifying transformation number is written.
This is followed by a horizontal array in which the first three
numbers are the mean, standard deviation and skewness of the trans-
formed data, followed by 17 numbers representing the number of the
data items which fall iato the 17 cells of the histogram.
(4) For each station and transformation, an array is written to
output the cumulative frequency distribution for the data, the
cumulative frequency distribution for the normal curve and the
absolute value of the difference between the two.  The array is
17 rows by four columns, one row for each cell of the distribution


                              A4-24

-------
and one column each for the station number,  the cumulative  frequency
for the data3 the cumulative frequency for the normal curve and the
difference.  The maximum difference and critical value of the test
statistics are written and if the maximum difference is less than
critical, "good fit" is written; otherwise,  "not a good fit" is
written.

A4.2.5 Dictionary of Variables
Following is a list of the variables used in NORMAL and a brief
definition of each:

AVER          Average.
BOUND  (I)     Cell limit (for normalized data), Ith cell.
C (I)         Coefficient, Ith transform.
COMPAR        Cumulative frequency.
Dl            Coefficient, standard deviation formula.
D2            Coefficient, skewness formula.
D3            Coefficient, skewness formula.
DAVE          Mean, double precision.
DEV           Deviation, equals data value minus mean.
DIF           Difference, cum. dist. of data and normal.
DSD           Standard deviation, double precision.
DSKEW         Skewness, double precision.
FIRST         Mean of data, first moments.
FIT           Test statistic, Kolmogorov-Smirnov critical value.
FN            Number of data points.
IFREQ  (I)     Number of data points in cell I.
INT  (I)       Same as IFREQ. (I).
IT            Number identifying transform.
IYR1 (I)      Beginning year of data, station I.
IYR2 (I)      Ending year of data, station I.
KOUNT  (I)     Cell count for Ith cell.
N2            Year.
N3            Week.
NNSTA         Number of gage stations.
NSTA (I)      Identifying number, gage station I.
NYR           Number of years of data.
SD            Standard deviation.
SECOND        Standard deviation of data, second moment.
SKEW          Skewness, relative number.
SUMFRQ        Sum of IFREQ  (I), cumulative frequency of data.
TEMP          Dummy variable, flow.
THIRD         Skewness of data, third moment.
                               A4-25

-------
X (IYR)         Dummy variable, flow data.
X (J)           Flow data.
XBAR            Mean x
XMDIF           Maximum difference.
XNORM  (I)       Cumulative frequency, normal distribution, Ith cell,

AA.2.6 Program Logic
Figure AA-3 is a diagram of "program logic for NORMAL.

A4.2.7 Program Coding
The program coding for NORMAL follows.
                            A4-26

-------
        FIGURE A4-3
  PROGRAM LOGIC  - NORMAL

      NORMAL - MAIN
Read in gage station data,
years of data, and historical
gage data. ,
Initialize variables
Compute mean, standard deviation
skewness and kurtosis of
untransformed data
       Call TRFM
•Make transformation
 of data i
Return
each tr
i
Call 1
for
ansformation
Call D
1
transformed data.
Normalize transformed data.
Catagorize data according
to magnitude into 17 cells
and count number of data
points in each cell.
f \

frequency of transformed
data and compare with
normal cumulative frequency
data to find maximum
difference. Compute test
statistic and test for
normality. Write out result
of test. -
.4 	 1
          END
          AA-27

-------
//NCRMAL   JOB  ( 1 143 , 47 , 02C , 10 , COCC ) , • ALEMAN               ', CLASS
                                                            = S
// CXEC F4CCXS      FORT  G  COMPILE  (NCJDECK), EXECUTE, CLASS S
//FCRT.SYSIN 01  *
      CIKENSICN  WK( 50,4, 12)fX(2<*CO), TITLE! 18), IFREQ117) ,XNCRM( 17)

     1NSTAI 15) i IYRK 15),IYR2(15)
      READ15,5CC)NNSTA, TITLE
  5 CO FORM ATI I 2/18A4)
      REAC(5,.5C2) (NSTAI I ) , 1=1, NNSTA)
  502 FCRPATdOIS)
      RE AD I 5 ,503) ( I YRK I ) , IYR2I I ) , I =1 , NNSTA)
  503 FORMATl 1615)
      WRITE(6,5C4);MNSTA, ( I , NSTAI I) , IYRK I ) , I YR2 ( I ) , 1 = 1, NNSTA)
  504 FORMAT! ' 1 ' I///T20, 'DATA  DISTRIBUTION CHECK'/IS,1  STATIONS',
                                                            //,8(T5
     A,'STATICM'
     1, 12, • )*' ,18, '  STARTING  YEAR=«,I4,'     FINAL YEAR=»,M/J)
      RE AC (5, 501) (XNCRMt I ), 1=1 ,17)
  501 FORMAT(8F10.A)
      DO 9CO   1=1, NNSTA
      NYR=IYR2( I )-!YRl { I )+l
      CO 12  K=1,NYR
      DO 1?  J=l,12
   12 h5EAD(5,bC5)NSTA( I)tN2,N3,(WK(K,L,J),L = l,A)
  505 FORK ATI 18, 14, I2.AF8.2)
      GO TO 51
99999 WRITE(6,6CO)  TITLE
  600 FORM AT ( 1H1,///1HO,10X, 18AA/1 1 X , « hEEK ' , 8X , 'MEAN • , 2X , 1 STAND AR
                                                            D DEVIA
     1TION' ,AX, 'SKEWNESS1 )
 1111 CO 25 Jf'C = l,12
      DO 25 LV»K=ltA
      AVER=0
      SD = 0
      DC 15  IYR=1,NYR
   15 AVER=AVtR+WK( IYR,LWK,JMO)
      DC 20  IYR=1,NYR
      SD = S C + ( KK ( I YR , LK'K , JKC ) - A V ER ) * *2
      SKEV;=SKEtot (KK( I YR , LUK , JMO J-AVER ) « *3
      SD=S^RT(SC/(NYR) )
      SKEW^SKEWUYR)
   25 hRITt:(6l6Cl)JKO,LtiK,AVER,SD,SKEW
  601 FORMAT{2X,I4t7X,I2,F12.
-------
    D U 40  I Y :-* = 1 , M Y R
 40 X( IYR J = WK ( IYRt LVJK, JMC)
    CALL  TRFK(X, I T,NYR, AVER, SD)
    CALL  HIS , Gf-'(X , NYR ,F I kST , StCOND , TH IRD , IFREU)
    fcRITE(6, 2CO)
2 CO FORMAT (IhC i 60X ,' FREQUENCY DI SIR I BUT I ON ' / 1HO , 10X , ' WEEK ' , 8X, '
                                                          MEAN1,
   1  2X, «STC.  CEVN. ' ,4X,
   2  «SKEV;NESS« ^X.'l'.SX.^SSXi'S'fSXT'A'.BXf'S'.SX,
   2  «6' ,3X, '7' ,3X, '8' ,3X,«9',2X, '10' ,2X,' il' ,2X,U2' ,2X,« 13 « ,
                                                          o y
   EEK^',l4)
 50 CALL  CIFChK(Xi\QRri,MYR, IFREQt IT, ISTAT)
 51 AVER-0
    SC = 0
    SKEVi = C
    DC 125  IYR=1,NYR
    CO 125  Jf^C=l, 1 2
    CO 125  LWK=1,4
125 AVER^-AVER + ViK( I YR , LVvK , JMO)
    AVER = AVER/i\UEEKS
    DO 120  IYR=1,NYR
    DO 120  JNC=1, 12
    DO 12C  Llr.K=l,A
    DEV=UK( I YR,LV.K, JMO )-AVER
    SD=SD+(DEV)<-*2
120 SKFW = SKEh1+(CEV)»*3
  •  SD=.SCRT(SC/MvEEKS)
    WRITE (6,620)NSTA( I }, AVER,NSTA( I ) ,SD,NSTA{J ) , SKEW
620 FGRNATt 1HC, 'MEAN CF CATA FOR  STATI ON ' f I 9 , • IS',F14.4/
   1        11-0, 'STANDARD CEVIATICN  OF  DATA  FOR STA T I UN ' , I 9 , f  IS
                                                           ' ,F14.4
   2      /1HO, 'SKEWNESS CF DATA  FOR  STAT I ON ' , 1 9 , ' IS',F14.4)
    00 890  IT=1,3
    V.RITE (6, 205)
205 FORMAT( 1HC,60X, 'FREQLENCY DI STRI BUT I ON ' / 1HO , 8X , ' ME AN1 ,
   1  2X, 'STC.  CEVN. ' ,4X,
   2  tSKrv(KESSl,4X,ll«,4X,'2',4X,l3',4X,«4',/iX,'5',4X,
   2  •6t,AXf«7'l/»Xf1E',ziXf«9',3X,'lCl,3X,tllif3Xf«12l»3X,113It
                                                           3X,
   A  ' 14', 3X, '15', 3X, '16S3X, '17' )
    J=l
    DO 901  IVR=1,NYR
    DO 901  J 1^0=1, 12
    DO 901  LWK=1,4

                             AA-29

-------
     X{ J)=WK( IYR.LWK, JKCJ)
901  J=J-»1
     CALL  TKF,v{X,ITtNWEEKSfAVER,SD)
     CALL  USTSMIX, NWfitKSiFUSTrSECQMDi THIRD, IFREQ)
  .   WRITE (6, 211)FIRST,SECCNDtTHIRD, IFREQ
211  FORMAK1H  , 3F 1 ?. 2 , 1 7 ( I X , I A ) )
     CALL  DIFd-K(XNORM,NWEEKS, IFREQ, IT, I)
890  CONTINUE
900  CONTINUE
     STOP
     END
     SUBROUTINE  D I F ChK { X.NCRM , N, I FREg , I T , I STAT )
     DIME'NSILN  IFREQl 17 ) , XNORM( 17 )
     XMDIF=0.0
     SUNFKOO
     XN = N
     WRITE(6,6CO) IT
600  FORMAT ( 1HO, ' TRAN SFORNAT I GN ' , 14)
     WRITE(6,603)
603  FGRMATdhOt 'STATION1 f'iX, 'CUMULATIVE DIST.  FOR  CATA',4X,
   1        'CUMULATIVE  DIST.  FCR NORMAL ', 4X, « DI FFERENCE •)
     OU 100  1=1,17
     SUKFKG = SUf-!FRQ+ IFREQ ( I )
     CCMPAR=SUNFRQ/XN
     DIF=CCMPAR-XNORM( 1 )
     OIF = AES( C IF)
     I Ft XMC I F.I. E.I) IF)  XMDIF = DIF
100  WRI FE(6i6C2 ) I S TAT , COM PAR , XNORM ( I ) ,OIF
602  FORMATdH  , I 7 , 16X , F 1 3 . A , 19X , F 12 . A , 2X , F 12 ./i )
     FIT=1.36/SGRT(XM»
     WRITG(6f6U6J  XMDIF.FIT
606  FORMAT ( 1 1- , 'MAXIMUM  DIFFERENCES ' , F 1 ? . 4 T4X , • F I T  COEFF.=  ',F1
                                                          2.4)
     IF(Xf'CIF.LE.FIT)  GO TC  1C5
604 FORMATdf-0, 'NOT  A  GOOD FIT1//)
    GO TO  110
105 WRIT.; (6, 605)
605 FORMAT! IhO, 'GOOD FIT'//)
110 RETURN!
    END
    SUBROUTINE  TRFM(X, I ,N,XBAR,SC >
    CIPF.NSIUN X(24CO),C(7)
    DATA  C/0. 30,0 .05,-. 1C/
    IFd-3) 49,50,100
 49 DO 25  J=1,N
 25 X( J) = X{ J)**C( I)
    GO TO  100
 50 DO 51  J=1,N
    X( J)=X( J )^C( I )«XBAR
    IF(XU).Ll.O)  X(J) = 1.

                              A4-30

-------
   5L X( J)=ALCG1C(X ( J) )
  ICO RETURN
      END
      SUBROUTINE  HI S TGK ( X , \ , AVE , SO , SKE /, , I F REQ )
      Cir'ENSIC.V  X(l ) ,1NT( 17) , IFREQ( 17 ) ,BOUND( 16)
      CINENSICN  KCUNT(20)
      CATA  BDUKD/-3.75|-3.25|-2.75,-2.25»  - 1.75 ,-1 . 25i-0 .75 ,-0. 25

     1      C. 25,0. 75, 1.25 ,1.75, 2. 25, 2. 75,3.25,3.757
C  ARRANGE  CATA  IN  ORDER OF INCREASING  MAGNITUDE
C  COMPUTE  NiiAN,  STANDARD fiEV I AT ION , AND  SKEWNESS
      XN = N
      DOUBLE  PRECISION  CAV E , DSO ,DSKEh » TEf-'P , DXN , [)3 , 02 ,D1
      CXN = rJ
      Dl = l
      CAVE^O.O
      osn=o.o
      CSKEW=0.0
      DC 60 1 = 1 ,N
      HAVE=CAVE+TEMP
      DSD=DSC+Tt.vP«TFMP
   60  OSKEU=DSKfK+TEMP* TEMP* TEMP
      AVE=CAVE
      SD={DSD-CXN*DAVE«CAVE)/(DXN-D1 )
      SO=SGRT< SO
      SKEW- (DSKtW-D3*DAVE*i:SD + D2*DXf\l*DAVE*DAVE*DAVE J/DXN
   NORMALIZE CATA
      DC 65 1=1, N
   65  X( I J = (X( I )-AVE)/SC
      CO 79 I--1 , 17
   79  KOUNTt I  )=C
      CO 90 1=1 ,N
      IF(X( I )  .LE. BOUND! 1 ) )  GO TO 86
      IF(X( I )  .GT . BOUND ( 16) )  GO TO 67
      DO 85 J = 2 , 16
      IF(X( I )  .LE.BOLNDt J) J  GC TO 82
      GO TG 85
   82  K = J
      GO TO 89
   85  CONTINUE
   86  K=l   .
      GO TO 89
   87  K=17
   89  KOUNTtK) =KCUNT(K)+1
   90  CONTINUE
      DO 95 1 = 1, 17
                                A4-31

-------
      1NT( I)=KCUNT( I )
   95 IFRECH I ) = INT{ I)
      RETURN
      END
/*ELF
                              A4-32

-------
A4.3 TFLOW, Gage Data Transformation Program

A4.3.1 Purpose
The TFLOW program converts the synthetic gage data generated in
FLASH to unregulated stream flows at all reach points in the
watershed.  The program receives data indicating the reach
configuration of the watershed, develops and indexes a computation
sequence to fit the watershed configuration and computes the
elements of a transformation matrix which transforms gage station
data throughout the watershed into stream flow data at all
reach points in the watershed.

TFLOW serves two purposes.  Primarily, it is an important link
in the simulation of streamflow data and secondarily, it can
be used as an aid in determining which gaging stations in the
watershed  will be best to use as basis gages in the simulation.
A basis gage is one the historical data of which are used to
develop the parameters for generating synthetic gage data.  The
secondary use allows the selection of the best set' of gaging
stations to be used when more than ten gaging stations are
available in a watershed or when, in the interest of saving
machine time or machine storage, fewer gaging stations can be
used.   Essentially,' this secondary  purpose entails the selection
of certain gages as basis gages, using their data to -compute
the corresponding gage data at other gages, designated "estimate"
gages.  Then the correlation coefficients between the computed
and actual data at the "estimate" gages are computed.  A high
correlation coefficient at a given "estimate gage" indicates
that,  for the set of basis gages used, it is possible with small
loss in overall accuracy to eliminate that particular "estimate"
gage in the final selection of basis gages.
                          A4-33

-------
 In the remaining paragraphs of this section, only the secondary
 use will be described.  The primary use is an integral part  of
 WASP, the simulation program, and is described as a portion  of that
 program (see section A4.5).

 A4.3.2 Program Components
 The following subroutines and functions are components of  TFLOW.
 The program lengths, in bytes, are indicated.

 TFLOW-MAIN           109,506          Functions     18,312
 WEEKLY                   596          Common         5,412
 IRAN                   2,852
 TGEN                   2,772          Total Length 141,024
 UPGAGE                 1,162
 IREACH                   412

 A4.3.2.1 TFLOW-MAIN
 Program component  TFLOW-MAIN serves as the controlling subroutine
 to call the various other subroutines and  after the reach  indexing,
 computation sequence and transformation matrix are completed by
 other components,  it computes the data necessary to perform  the
 secondary analysis  described in A4.3.1.

 Initially,  TFLOW-MAIN reads in the number  of years of  data,  the
 total number of gages and the gage number  for  each gage.   Then
 subroutine  WEEKLY  is called to read in historical  data for all  gages
 Following this,  subroutines TGEN,  TRAM and UPGAGE  are  called to
 develop the indexing, computing sequence and transformation matrix.
 Then  TFLOW-MAIN reads information which designates gages as  "estimate"
 gages,  the  number  of "estimate" gages NFE;  the gage numbers of  the
 "estimate"  gages,  LG(I),  and the  reach numbers of  the  "estimate"
 gages,  LR(1).   If  flow simulation  is  the objective,  set NFE • 0
 and do  not  enter values  for LG (I)  and LR  (I).

A4.3.2.2  Subroutine  WEEKLY
 Subroutine  WEEKLY reads  in  the  historical  flow data  from magnetic
 tape  or punched  cards.   The cards  have previously  been edited
and checked by CHKDATA.   The data  input  must be  for an equal
number  of years  for  each station.

A4.3.2.3  Subroutine  TGEN
TGEN  sets up the reach and  gage indexing and the computational  sequenc
and    provides   the  data needed for each reach.  For a discusaion
of reaches  and procedures for establishing  reaches  in a watershed
see Section 6.3.1.   The  subroutine  employs a search  technique which
sets up the watershed configuration for  indexing of reaches and
establishes  the order  In which  subsequent computations (flow,
                               A4-34

-------
regulation, quality, etc.) are to be made.  It is not necessary
that reaches be numbered in any particular order, so long as
each reach has its individual number, because the subroutine
sorts out the reaches in the proper order for computation
and assigns each reach an internal index which governs the
order of computation.  However, for other reasons, a reach
numbering scheme is recommended in Section 6.3.1.  This internal
index, JR (I), is set up for each reach so that no reach in
the sequence is upstream from one having a lower index.  Com-
putation begins at the upstream reach and progresses downstream.

A4.3.2.4 Subroutine TRAN
Subroutine TRAN makes the necessary computations to develop the
transformation matrix to convert gage data into flow data at
any reach point in the watershed.  The subroutine is supplied,
through TGEN, with the reach location and upstream drainage area
for each gage and the upstream drainage area for each reach point.
The elements of the transformation matrix are computed as the
weights, w^j ,   which are coefficients in the equation:

                       Qi B  N£G  wi»jfj-.. • • • •    Eq. A4.2

where, Q^ • the computed flow at reach point, i, i-1.  . .NR
          «= the weighting coefficient for the ith reach and the
            jth gage.
      xj  * the jth gage flow.
      NG  • the number of gages being used.
      NR  = the number of reaches in the  system.
Thus, the flow at any reach point is a linear combination of the
appropriate weights and gage flows.

The weights are determined as a proportion of areas upstream from
the gages and reach points in accordance with the procedures described
below for various combinations of relative gage-reach locations.

In the development below, the reach at which streamflow is to be
computed is called  the object site and the gaging stations, where
flows are known, are called source sites.  QO is the unknown object
flow, DAO  is  the area upstream of the object site, QS(I) is the
flow at the source  site I and DAS (I) is  the area upstream from
the source site I.  The source-object configurations are divided
                             A4-35

-------
into five categegories described as follows.

Case I.  The object site is located between two source sites, with
no branches having source sites entering between the two given
source sites.
                 DAS(2)           DAO          DAS(l)
                  QS(2)            QO           QS(1)
                   S(2)     _       0
The streamflow per unit area at the object site, QO/DAO, is
computed as the weighted sum of the streamflows per unit area
at the source sites, the weights being determined by linear
interpolation between flows per unit area for the source sites.

              QO    = a  QS(1)  +  a  QS(2)
             DAO       ± DAS(l)       DAS(2)	[Eq. A4.3]

where:

                    „. = DAO - DAS2
                         DAS(l) - DAS(2)  	[Eq. A4.4]
                    a2 = DAS(l) - DAO
                         DAS(l) - DAS(2)	  [Eq. A4.5]
Then,
     WT(.,1) =30	  =  ai DAO    = DAO    DAO-DAS(2)
               QS (1)       DAS(l)   DAS(l) DAS(l)-DAS(2)[Eq. A4.6]


     WT(.,2) = (JO	  =  q2 DAO    = DAO    DAS(l)  - DAO
               QS(2)        DAS(2)   DAS(2) DAS(l)  - DAS(2)  . [Eq.  A4.7]

All other weighting coefficients relating this object site to other
source sites are zero.

Case II.  The object site is upstream of the source site and there
are no other source sites upstream of the source site.
                            A4-36

-------
                        DAO
                        QO
DAS
QS
The streamflow per unit area at the object site,  QO/DAO,  is
computed as the weighted sum of the streamflows per unit  area
at the source sites, the weights being determined by linear
interpolation between flows per unit area for the source  sites.

The object site may be located'on either the main stem of the
river or on a branch tributary.  The flow rate at the object
site is in direct proportion to the flow rate at the source
site.  That is:
                         30 = QS
                        DAO   DAS
            [Eq. A4.8]
or:
and:
                         QO = DAO
                         QS   DAS
                      WT(. ,1) = DAO
            [Eq. A4.9]
                                DAS	[Eq. A4.10]

The weighting coefficients for all other source sites located
downstream of the source site used here are zero.

Case III.  The object site is located upstream of source site (1)
on BRI and there is another source site (2) located on another
upstream branch, BR2.
          BRI
                DAO

                                                  DAS1
                               A4-37

-------
Either BR1 or BR2 may be the main stem.

In this case, it is necessary to compute the flow at the confluence
of BR1 and BR2, which will be called QC, and the upstream area
which will be called DAG.  The flow rate at the confluence QC/DAC
is computed by applying Case I, so that:

        QC = QS(l)x(WT(c,l» + QS(2) x  (WT(c,2)) . . [Eq. A4.ll]

By case II,
or:
                          QO    (£	
                          DAO - DAC
                       QC = (QO) (DAC)
                               DAO
    [Eq. A4.12]
    [Eq. A4.13]
and by substitution and clearing:
            QO = DAO (QS(1) WT(c,l) + QS(2) WT(c,2)) [Eq. A4.14]
                 DAC

The weighting coefficients for source sites upstream of source
site (2) and downstream from source site (1) are all zero.

Case IV.  The object site is located upstream of a source site
(1) and downstream of more than one source site, each of which is
located on a tributary to the object site location as shown.
                                QS(2)
                                DAS (2)
                                     DAO
                                      QO
DAS(l)
QS(1)
                            A4-38

-------
The first step is to calculate the total gaged flow, QG, and total
gaged upstream areas, DAG, for the source gages upstream of the
object site:

                  QG - QS(2) -I- QS(3) + QS(4)	[Eq, A4.15]

                 DAG = DAS(2) + DAS(3) + DAS(4) .... [Eq. A4.16]

The summations in these' equations extend to other comparable source
sites if they exist.  The flow at the object site is computed
as the weighted average1 of the sum of the upstream source site
flows and the downstream source site flow.  This case is then converted
to Case 1, and:

                   _2p_ =  a  QS(1)  + ot2 QG
                   DAO     1 DAS(l)      DAG   	[Eq, A4.17]

and:

                    a, - DAO - DAG
then:
                         DAS(l) - DAG	[Eq. A4.18]

                    a  » DAS(l) - DAO
                         DAS(l) - DAG   	[Eq. A4.19]
             QO « SAO   (DAO-DAG   ,          DAO(DAS(1) - DA0)
             *    DAS(irDAS(l)-DAG' QbU' +  DAG^DASU) - DAG'QG
                                                         [Eq. A4.20]

from which:
           WT(  1) - S9-    = DAO     /DAO - DAG   v
                     QS(1)   DAS(l)  1DAS(1) -DAG;.  .  .  [Eq. A4.21]
and:
           WT(  D - 52- -  DAO /pAS(l) - DAO>
             V''J/   QG    DAG VDAG(1) - DAG;	[Eq. A4.22]
                            A4-39

-------
The weighting coefficients of any source sites downstream of  source
site 1 and upstream of source sites 2, 3 and 4 on the same tributaries
are zero.

Case V.  The object site is located downstream of all source  sites.
The general case would be where the object site is a downstream
point having a number of gages upstream, each of which is on  a
tributary as shown.
          DAS(l)
             QS(1)
                                          DAO
                                          QO
                                           0
     DAS(3)
     QS(3)
         S(3)
                S(2)
As in Case IV, compute QG and DAG, the sums of flows and areas for
those gages which are upstream of the object site,  using only the
gage on any single tributary which is nearest the object site.  In
the example shown:

                         QG = QS(1) + QS(2)	[Eq. A4.23]

                        DAG = DAS(l) + DAS(2)	[Eq. A4.24]

The problem then reverts to that of Case II, excepting the object
site is downstream.  Equating the flow rates per unit area at the
object and source sites gives:
                               gq - QG
                               DAO  DAG
[Eq.  A4.25]
and:
                                       it
[Eq.  A4.26]
In all cases, do not use source sites which are upstream of source
sites adjacent to the object site.
                            A4-40

-------
Any combination of stream gages and an object site can be classified
under one of the five cases described above.   It is important that
the sequence of reaches begin with the downstream reach in the water-
shed and proceed upstream.  It then can be assumed that, as the
computation progresses upstream, all downstream flows are known.
This is necessary because the subroutine uses the computed flow in
the next downstream reach as a source site for the object reach.
The source sites upstream of the object site are considered explicit

A4.3.2.5 UPGAGE
Subroutine UPGAGE is called by subroutine THAN when, in the progress
of computing the transform elements, it is necessary to search out
and identify upstream gage sites.  Subroutine UPGAGE searches the
reaches upstream from the object site for gage locations and, in any
upstream branch, the search is discontinued when the first gage is
found in the current branch being searched.  The gage number is
returned to subroutine IRAN which associates its location and up-
stream drainage area from data read in by subroutine TGEN and computes
the desired weighting coefficient.

A4.3.2.6 IREACH
Function IREACH is used by subroutines TGEN, TRAN and UPGAGE.  In
the search for upstream reaches, function IREACH is used to determine
the upstream reach index number.

A4.3.3 Program Input
The input to TFLOW, when  it is used in selecting basis  gages, is
entered in TFLOW-MAIN and subroutines WEEKLY and TGEN.  The input
is described as follows:
 (1) For TFLOW-MAIN
Card # 1  (215) NYR - Number of years of data to be read.
               NGT = Number of gages for which data are to be read.
Card # 2  (10I8)IGT = The  gage numbers of the gages which are to be
                     read I « 1  .  .  . NGT with a maximum of eight
                     gages.
Card # 3  (15)  NFE = The  number  of  flow estimates  to be made; i.e.,
                     the  number  of  estimate gages.  NFE=NGT - number
                     of basis gages.
Card # 4  (18,15) LG(I) »  gage numbers for the estimate  gages 1=1,
                      .  .  ., NFE.
               LR(I)= reach numbers  corresponding  to the location
                     of gage numbers LG(I).  1=1,  .  .  ., NFE.
                              A4-41

-------
(2) For subroutine WEEKLY - The data to be read are edited and
checked historical gage data on magnetic tape or punched cards.
It is necessary that the length of record for each gage be the
same; i.e., NYR years.   Data must be "weekly" average flows,
Q(I,K,L,J) where I = 1, NGT for a maximum of eight; K = 1,...
NYR for a maximum of 50 years; L = 1, 2, 3, A, the weekly
index; and J=1...12, the monthly index.

(3) For subroutine TGEN
Card # 1 (215) NR = number of reaches (maximum of 50).
               NG = number of gages in the watershed  (maximum of 10)
Card # 2 (415, 6F5.0)  There are NR cards with the following on
                    each card, each card representing one reach:
            NOR(I)= external number of reach (I).  I is the
                    assigned reach number, the external index
                    number and the order the data are read into
                    the the computer.
          NUR(I,J)= external number of the Jth reach upstream
                    from NOR(I).
                J = 1,  2 or 3 depending upon the number of branches
                    at reach NOR (I).  J cannot exceed 3.
          DAU(I,J)= the drainage area upstream from reach NOR
                    (I) in the direction of branch J, in square
                    miles.
             FL(I)= the length of the reach NOR(I), in feet.
         SLOPE(I) « the slope of the hydraulic gradient in reach
                    NOR (I).
         ROUGH(I) = the value of Manning's "n" for reach NOR(I).
NOR(I) takes one 15 field, NUR (I,J) takes one to three 15 fields,
depending upon watershed configuration, DAU(I,J) uses one to
three F5.0 fields, while FL(I), SLOPE(I) and ROUGH(I) each use
an F5.0 field.  If the velocity of flow in each reach is to be
computed by empirical formula, such as described in Section 6.2,
it will not be necessary to provide SLOPE(I) and ROUGH(I) data.
Card # 3 (215, F5.0) There are NG cards, each containing the
following data for the gages:
         NGAGE(I) = the external number for gage (I).
         NGR(I)   = the external reach number in which NGAGE(I)
                    is located.
         DAG(I)   = the drainage area upstream from NGAGE(I),  in
                    square miles.
                            A4-A2

-------
A4.3.4 Program Output
The output from TFLOW Is in the form of four arrays.  The first  array
has the following column headings:
(1) External Reach Number
(2) Upstream Reaches 1
(3) Upstream Reaches 2
(4) Upstream Reaches 3
(5) Upstream Drainage Areas 1
(6) Upstream Drainage Areas 2
(7) Upstream Drainage Areas 3
(8) Downstream Reach Internal Index
(9) Downstream Reach External Number
(10) Total Upstream Area
(11) External Index
(12) Reach Computation Sequence External Number
There will be NR rows in this array, one for each reach.

The external reach number is the reach number assigned by the operator
to the various reaches of- the watershed.  Input data are entered in
this order but output data are printed in the order of the internal
index.  The watershed' reach numbers should be assigned in accordance
with the scheme recommended in Section 6.2.  Although the only
restriction in numbering the" reaches are that no two reaches can
have the same number and the'maximum number of reaches is 50«
experience has shown that numbering as suggested above will result
in an indexing scheme that is easy to use.

The upstream reaches 1, 2 and 3 refer to the external reach numbers
upstream from the current reach (I).  For instance, if the current
reach is 15 and there is a main stream reach, 16, upstream, then
"Upstream Reaches 1" is 16.  If there is also a branch (say reach
27) at the upstream end of reach 15, then "Upstream Reaches 2" is
27.  If there is a second branch upstream of reach 15, then "Upstream
Reaches 3" will be the number of that second branch.  Similarly,
upstream drainage areas 1, 2 and 3 refer to the total area, in
square miles, above the current reach, 1 corresponding to the up-
stream main stem, 2 corresponding to the first upstream branch and
3 corresponding to the second upstream branch.

Downstream reach, internal and external, are the internal and
external reach numbers downstream from the current reach.  These
downstream reach indices are determined by the program.  Total
upstream area is the total area upstream of the current reach.
This column is also determined by the program.  The external index
                             A4-43

-------
is printed again for ease in reference to the current reach.  The
reach computational sequence is the order, in external reach
numbers, of the sequence of computation used in TFLOW and in the
simulation programs which follow.

The second array has four columns with headings as follows:
(1) Basic Gage Number
(2) Reach Containing Gage
(3) Area Upstream of Gage
(4) Internal Index

There will be one row for each basis eage.  The first column lists
the gage numbers.  The second column lists the external reach
number which locates the gage> while the third column lists the
drainage area upstream of the gage.  The fourth column is an
internal index of gages.

The third array is the output of subroutine THAN.  The elements
of the array are the weights used in equation [A4.2] to compute
streamflows at reach points.  The array will have a number of
columns equal to the number of basis gages; each column heading
is one of the basis eage numbers.  The rows correspond to reaches.
The flow at the upstream end of reach i is the sum of the products
of ith row of weights multiplied by the corresponding gage flows.
The array lists the rows according to the external index.

The fourth array contains the results of the comparison of flows
generated for estimate gage (I) and the flows of that same gage
(I) considered as a basis gage.  The output lists the external
basis gage numbers and for each estimate gage, a row of data
containing:
(1) The estimate gage number
(2) Estimated mean flow
(3) Observed mean flow
(4) Estimated standard deviation
(5) Observed standard deviation
(6) Correlation coefficient
(7) Weight coefficients, one for each basis gage
The key in selection of the basis gages is the value of the
correlation coefficient.  A high value (maximum value possible
is 1.00) indicates that the basis gages can be used to generate
the flows at the estimate gage site with acceptable accuracy and
                             A4-44

-------
thus eliminate the need to use that gage as a basis gage in the
simulation of flows.   The elimination of one basis gage in the
simulation decreases  the order of the correlation matrix by four
and results in saving' in' computation' time throughout the simulation.

A4.3.5 Dictionary of  Variables
Following is a list of the variables used in TFLOW and a brief
definition of each:
DAG (J)
DAU (I,J)

FN
GDA
IGT (I)
IYR1
JGU
KGB (I)
KGC (I)

KR (I)
LG (I)
NFE
NG
NGAGA  (I)
NCR (JJ)
NGT
NGU
NOR (I)
NR
NUR (I,J)

NYR
QEST
QWEEK  (I, J,

TDA (I)
WT (I, J)
X (I)
X2 (I)
XY (I)
Y (I)
Y2(I)
ZY
   Drainage area upstream of gage J.
   Drainage area upstream of reach I in direction of
   branch J.
   Number of weeks of data.
   Sum of drainage areas.
   Identifying number of gage I.
   Beginning year of data.
   Gage number of upstream gage.
   Internal data set index for basis gage I.
   Internal data set index for object gage I at
   reach LR(I).
   Internal reach index for object gage I.
   Gage number of object gage I.
   Number of object gages.
   Number of gages.
   Identifying number of gage I in basis.
   Number of reach containing gage JJ.
   Total number of gages.
   Number of gages upstream.
   Number of upstream reach I.
   Number of reaches.
   Number of reach upstream of reach I in direction
   of branch J.
   Number of years of data.
   Estimated flows.
K) Weekly average flow for week K, year J and gage
   I.
   Total drainage area upstream of reach I.
   Weight coefficient for reach I, gage J.
   Sum of flow estimates for station I.
   Sum of squares of flow estimates for station I.
   Sum of cross products, flow data x estimated data.
   Sum of flow data for station I.
   Sum of squares of flow for station I.
   Dummy variable.
                             A4-45

-------
A4.3.6 Program Logic
Figure A4-4 is a diagram of program logic for TFLOW.

A4.3.7 Program Coding
The program coding for TFLOW follows.
                          A4-46

-------
               FIGURE A4-4
           PROGRAM LOGIC TFLOW
 TFLOW - MAIN
 Read gage data cards
 Initialize variables
 Call WEEKLY - »-Read in all historical gage data
                               '
 Call  TGEN - ^-Read  reach data and set  up sequence
                      of reach numbers for computation.
                      Read  gage location and area data
                _ I
 Call  IRAN	^-Calculate weight  coefficients
                      for  transformation of gage data
                      to streamflow data
                       	I
 Output reach,  area
 and reach index data
 Output weight  coefficients
 Compute flow for estimate
 gage using weight coefficients
 Compute means and  standard
 deviations for estimate gage
 data and correlate computed
 estimate gage data with historical
estimate gage data.
Output statistics and correlation
coefficients for estimate gages
     fr
   END
                      A4-',7

-------
//TFLUV,    JCC  (1143,47,005,06,1GCC),'ALfcMAN               'i CLASS
                                                            = p
// EXEC F4GCXN      FCRT  G CCXPILE (NODECK), EXECUTE,  CLASS M
//FORT.SYS IN CC *
C  NGT = TCTAL MjivDER  CF  GAGES
C  NG=NUKBEK CF GAGES  IN  BASIS
C  NFE=NUfBER CF  FLCW  ESTIMATES
C  (LGtl),I=l,NFE)=GAGE  NUMBERS FOR GAGES TO CHECK  FLOW  ESTIMATES
C  (LR(I ), I = 1,NFE) = REACH  NUMBERS OF REACHES AT  V.HICH  FLCW  ESTIMAT
                                                            ES  ARE
C  TU BE MACE
C  (IGT( I), I = 1,NGT)=GAGE  NUMBER FOR DATA SET I
C  gWEEK(I,J?K)=WEEKLY  FLGU FOR V.EEK K CURING YEAR  J  FOR GACE I
C  GEST= WEEKLY FLOW ESTIMATE
C  KR( I) = INTERNAL  REACH  INDEX FUR ESTIMATE  I
c  KGG( i ) = INTH:J^AL  CATA  SET INCEX FOR BASIS GAGK  i  ,I=I,NG
C  KGC( I ) = IME3i\AL  CATA  SET INDEX FOR CHECKING  ESTIMATE  I  AT REAC
                                                            H LR(I)
C  NOR(I)=REACH NUMBER  FOR REACH I
C  NGAGE(I )=NUf3ER  CF  GAGE I  IN BASIS
C  STREAtfFLCW   EXTrtAP/I ,\TER  RULTINE (SEIR)
      CIMENSICN IGT(10),GhEEK(10,50,12,A),0(50,^8),
     1            LG(10) ,LR( 10) ,DALG(10),KGB( 10) ,KR{ 10),
     1            KGC(10),.X( 10) ,X2( 10) ,Y( 10) ,Y2tlO) , XY ( 1 0 ) , W (10 )
      CGfMCN/FLC'rtL/NR,NG,NCR(50),NLR(5C,3),CAUt50,3),
     1       TCA(SC) ,NGAGE( 10),NGR( 10),OAG(10),I OR(50)
      COMMON/F L CW 3/JR(50),hi(50,10)
C  READ STREAf'FLCW  CATA
      READ(5,5CC1)  NYR,NGT
 5001 FOKMAKZIf))
      READ (^,5C02)  (IGT( I ) ,I = 1,NG1 )
 5C02 FORMAT!1CI8)
      DC ?8  I=1,NGT
      CO 98  K=1,NYR
      [JO 98  J=l, 12
      DO S8  L=l,4
   98 GWCEK(I ,K, J,L )=O.C
      CALL WEEKLYINYR.NGT, GV^EEK)
C  COMPUTE TRANFCRMATION  MATRIX
   30 CALL TGEN
      CALL TRAN
      WRITE(6,6 1C 3)  
-------
      REALMS,5CC3)  NFE
 5C03 FORfATdS)
      READ(5.5C04)  (LG(I ) ,LR(I ) ,I = 11NFE)
 5C04 FGRMAT(5( IS,15 ) }
C     SET-UP ARP.AY  OF  INTERNAL  REACH
C   .  INDICItS  CORRESPONDING
C     TO THE FLChi  ESTIMATES
      CO 15  1=1, NFE
      M=0
    11 M=K+1
      IF(LIU I ) .EC.NCR(M) )GC  TC  15
      I F ( M . LT . :\l« )  GD TO  11
      WRITE(6.6CCO)  LR(I)
 6CCO FORrATt'  REACH NUMBER  KISSING',18)
      CALL EXIT
    15 KRlIJ=M
C   SET-UP  INTERNAL  INDICIES  FOR  GAGES  TO
C   CHECK FLCW  ESTIMATES
      DC 25  1 = 1,NFE
      N' = 0
    21 M = M-H
      IFtLGl I ) .F.C.IGT(M) )  GC  TC  25
      IF(K.LT.\GT)GO TO  21
      WRITE(6,6C01)  LG(I)
 6CC1 FOi^ATC  GAGE  NUMBER N1 ISS I KG ' , I 8 )
      CALL EXIT
    25 KGC(I)=K
C   SET-UP  INTERNAL  INClClES  FOR  BASIS  GAGES
      DO 35  I=1,NG
      K = 0
    32 N=iX + l
      If(NGAGE( I ) .EQ.IGT(M))  GO  TO  35
      IF(M.LT.NGT)  GC TO  32
      WRITE(6,6C01)  NGAGE(I)
      CALL EXIT
    35 KGB I I )=M
C   INTIALIZE STATISTICS
      WRITE(6,620C)  (I,I-1,NG)
 6200 FCR^ATt///I2X,'EXTERNAL',3X,' INTERNAL',3X,«VERIF I CAT I ON' ,3X

     1 • INT FRNAU/3X, 'FLOW ,7X, 'REACH' ,6X, 'REACH' ,8X, 'GAGE' , 9X, ' GA
                                                           GE«,
     14X, 'DASIC GAGE NUr'BERS ' / IX , 'ESTIMATE' , AX , ' NtPBER ' ,6X i ' INDEX
                                                           1 ,7X,
     PNUMIJER' ,7X, ' INDEX' , 1017 )
      WRITE(6,6?01)
 6201 FORMAT(IX)
      CO 36  1 = 1, NFE
    36 WRITE (6,6202) I ,NOR(KR( I,) ),KR( I ) , IGT(KGC( I ) ) ,KGC( I ) , { IGTtKGB
                                                           ( J)) ,
     1J=1,NG)

                                  A4-49

-------
 6202  F CM AT 116, 111, 111, 112, 112, 2X, 1017)
      CG  50  l=L,NFli
      X( I)=0.
      Y( I)=C.
      X2( I )=0.
      Y2( I )=0.
   50  XY( I )=0.
;   COMPUTE  ^EANS,  STCS, ANC  CORR.  COEF.
      DO  ICC  IYR=l,NYR
      CO  100  J=l,12
      DO  1QO  L=l,4
      DO  IOC  I=1,NFE
      CEST-'C.
      ZY=.GVifEK tKGCt I ), IYR, J,L )
      Ym=YU )J-7Y
      Y2(I )=Y2l I )+ZY**2
      DO  11C  K=1,NG  •
  1 10  QEST = GEST + UT( K,7 ( I ) rK 1*QWF.EK< KGB(K) , IYR, J,L)
      XYU ) =XY( I ) + ZY->QEST
      xi n=xi i HCEST
  ICO  X2( I ) = X2( 1 )+QEST**2
      00-150 I=1,KFE
      X( I)=X( I ) /FN
      X2(I ) = SC;RTIX2{ I)/FN-X( I )**2J
      Y( I J=Y( I )/F/\
      Y2 ( I ) = SG,"5T ( Y2 ( I ) /f-\'~Y( I J **2)
      XY 11 ) = IXY( I )/FM-X( I)«Yt I) )/tX2( I )*Y2( I ) )
      WRITE (6, 6010) INGAGEU) » J=-1,NG)
 6010  FORr AT ( 1 J- 1 , 35X, • EVALUATION  OF  STREAMFLOW INTERPOLATION/
     1EXTRAPOLATICN ROUTINE1 ///30X ,' DAS IS GAGES= ' , 10 17 )
      WRITE (6, 6011) (MGAGE ( J ) , J=.1,NG)
 6011  FORMAT (////16X,»EST» 5 7X , ' GBS ' , 7X , ' EST ' , 7X , ' DBS ' , 15X , • COEFFl
                                                            CIENTS
     IFOR  GAGE»/7X, 'GAGE' ,4<, '.MEAN' , 6X , 'MEAN1 , 7X, ' STD* , 7X, • STO1 »5
                                                            X,
     1'CCRR' ,2X, 1017)
  150  V.RITi:{6,6C02) IGT ( KGC ( I ) ) , X U ) , Y I I ) ,X2 I I ) , Y2 ( I ) , XY U > , I WT { KR
                                                            { I ), J»t
     1J=1,NG)
 6C02  FORf'ATOX, I 7 , AF 10 . 2 , F9 . ^ , IOF 7 . 3 )
      WRITE-(6,6CC3)
 6C03  FDRNAT(IX)
      END
      SUBRCUTIiNE V.EEKLY  (NYR.NGT.Q)
      C1KENS1LN Ct 1C.50, 12,^) , IGT( 1C)
      DO 10  1=1, NGT
      DO 10  K=1,NYR
      CO 10  J=l,12
   10  REAC(5,200)  I GT ( I ) ,. I YR 1 , J , (Q ( I , K , J , L ) , L= 1 , ^ )
  2CO  FORMAT(I8,l
-------
     RETURN
     END
     SUBRCITIKE IRAN
     CONfCN/fLGM/NRiNG,NCR(50),NLR(50, 3) , CAU(50,3 ) ,
    1      IDA (50) ,I\GAGE( 10) ,NGR( 10) , DAG( 10) , IDR(50)
     COHKCrs/FLCW2/FLC5G),RGUGH(50),SLQP£(50)
     COfMCN/FLCV\3/JR(5C)iVT(5C,10J
     GIPENSlLiN JGU( 10 ) , NIK 50 ) , NIC (50 )
  ***£#** *•»#*«•£#*** **•»***•!;*
  COMPUTE FLOW IN  LAST  RE/>CH  DOWNSTREAM
  #«*««#»«•!!«**«•*«•»«•«•»**«••»**
     I  = JR(NR)
  IS THERE A GAGE  IN  THIS  REACH
     J  - Q
     DO 5 JJ=1 ,NG
     IF (NGR(JJJ -  NCM I ) )  5,6,5
   6 J  = JJ
   5 CONTINUE
     IF {J)  10,10,15
  THESE IS A GAGE  - CASE  1
  15 DO 16 JJ=1,NG
  16 W T( I > J J )  = 0.
     KTlI»J) = TCA{I)/CAG(J)
     GC TG ICO
  THERE IS NO  GAGE  -  CASE  2
  10 CALL UPGAGE (I,NGU,JGU)
     IF (NGU)  21,21,22
  21 WRITE (6,60003
6CCO FORMAT  (ICX.'KO  GAGES')
     STOP
  22 DO 23 JJ=1,NG
  23. VN T ( 1 i J J )  = 0 •
     GCA = 0.
     DO 25 JJ=1,NGU
  25 GDA = GCA + CAG( JGUUJn
     CO 24 JJ=lfNGU
     J  = JGU(JJ)
  24 WT( I tJ) = TCA(11/CCA
  *»#********«******«#•*******###
  CONTINUE UPSTREAN
  *****«»*•*****«***«»******»*«**
 100 IU = I
     IB = 1
     N I D { I E ) = I U
  IS THERE A REACH UPSTREAM
 1C5 NU = NURl IUf 1 )
     IF (NU) 110,110,115
  THERE IS NO  REACH UPSTREAM
 110 IB = IB - 1
  HAVE  ALL REACHES  BEEN COMPLETED
     IF (ID) 2CO,200,120
                             A4-51

-------
= I REACH(NU)
= IU
     135,135,140
     BRANCH
 TRANSFORM IS COMPLETE
200 RETURN
 CONTINUE CALCULATIONS
120 IU = MU( iD )
    ID = MC( IB)
    GC TC 150
 THERE IS AN UPSTREAM REACH -  IS
115 IF (NUR(IUiZ)) 125,125,130
 THERE IS NC BRANCH
125 NU = NUR(lUi1)
    1C = IU
    IU = IREACH(NU)
    GO TC 15C
 THERE IS A BRANCH - ARE THERE  TV.Q
130 IB = IB + 1
    NU = NUR{IU,1)
    NIUl IC-L)
    MD( ID-1 )
    IF (MUR( IU,3J )
 THERE IS ONLY CNE
135 NU = NUR( IU,2 )
    ID = IU
    IU = IREACH(NU)
    GO TO 15C
 THERE IS ANCTHER  BRANCH
140 NU = KUR( IUt2)
    IB = IB 4 1
    NlU( IB-1) = IREACH(NU)
    NIDI ID-1) = IU
    NU = KUR{10,3)
    ID = IU
    IU = IREACH(NU)
 IS THERE A GAGE  IN
150 J = 0
    CO 151 JJ=1,NG
    IF (NGR(JJ)-NCR{ IUJJ
152 J = JJ
151 CONTINUE
    IF (J) UC,16C,165
 THERE IS A GAGE  IN  THIS
165 DO 166 JJ=1,NG
166 UT ( IU,JJ) = 0.
    kTHU, J) = TDA(IU)/DAG( J)
    GC TO 105
 THERE IS NC GAGE  IN THIS  REACH
160 CALL UPGAGE (IU,NGU,JGU)
    IF (ivIGUJ 180,180,161
161 GDA = 0.
    DO 170 JJ = 1,NGL'
    J = JGU(JJ)
170 GDA = GCA + DAG(J)
                   THERE A BRAN
      THIS REACH
           151,152,151
           REACH
                            A4-52

-------
     CG  171  JJ=1,NG
  171 WT( IUi JJ)  =  0.
     Al  =  (TCA(IC)  - TDA( lUn/lTDAUD)  -  GDA)
     DC  172  JJ=1,NGL
     J =  JGU( JJ)
  172 WTUU.JJ  = A1*TDA( IU)/GCA
     Al  =  (TCAIIU)  - GCA)/(TCA( ID) -  GOA)/TCA(ID)
     CO  173  J=1,NG
  173 MUU,J)  = VvTUU,J) + A1#UT( IDt J )*TDA( IU)
     GO  TO  105
  THERE  IS  NC  GAGE  UPSTREAM - CASE 2
  180 Al  =  TDA( IU)/TDA( 1C)
     CC  181  J=l,NG
  181 WT ( IUi J)  = A1*WT( ID, J)
     GO  1C  1C5
     END
     SUBRCUTI.NE TGE\
     CCN:I-'CN./FLCU1/NR,MG,NOK(5C) ,NUR(50,3) ,OAU( 50,3) ,
    1       TCA(50) ,NGAGE( 1C) , NGR{ 1 0 ) , CAG ( 10 ) , I OR ( 50 )
     CGPKCK/FLH-.2/FLI 5C } , RCUGH ( 50 ) , SLCPE { 50 )
            ILN  Ift(5C)
      CINErvSlCiN  NNOR(50)
      READ  (5.5C01) NR,KG
 5C01  FCRi^AT  (215)
      DO  1  1 = 1, NR
      NNORC I )=C
    1  IORC I )  = C
      CO  5  I = 1,,\R
    5  READ  (5,5C02) NOR { I J , { NUR ( I i J ) , J= 1 , 3 ) ,
    1      (UAU{ l,J),J=U3),FL( I.), SLOP El I ), ROUGH ( I
 5002  F.ORKAT  (AI5,6F5.0)
      CO  6  I = l,i\G
    6  READ  (5,5CC3) NGAGE ( I ) , NGR ( I ) , DAG ( I )
 5C03  FORfATl I3,I5,F5.0)
;  CET6RM«\E  SECUENCE OF REACH  NUMBERS
      CG  15  1=1, NR
   15  IR( I )  =  0
      CO  20  f\i=l,NR
      I =  1
   23  IF  ( IR( I)  ) 21,21, 22
   22  I =  I  +  1
      IFl I.GT.NR) GC TO 2C
      GO  TC  23
   21  K =  0
      CO  25  J=l,3
      IF  (MJR(I,J» 25,25,26
   26  NUP  =  NUR  ( I , J )
      L =  IREACKNUP)
      IF  UR(L)  ) 27,27,25
   27  K =  1
                               A4-53

-------
   25 CONTINUE
     IF  (K)  30,30,22
   30 JR(N)  =  I
     IR(I)  =  1
     DO  36  K=l,3
     IF  (NUR(I,KM  36,36,37
   37 NC  = NUR(I,K)
     ID  = IREACH(MD)
     IDR(IC)  =  I
   36 CONTINUE
   20 CONTINUE
     DC  45  1=1,MR
     TCAlI)  =  0.
     CO  45J = 1,3
   45 TCA{I)  =  TDA(I)  +  CAU(I,J)
;   «**»»**«*******«#
     WRITE(6i6CCO)  •
6000 FCJRiVAT( ' 1 EXTERNAL' , 4<3X , 'DOhNSTREAN REACH' ,6X, 'TOTAL' , 15X ,
     1'RfEACH  COMPUTATION  SEQUENCE1/
     13X,'REACH1,4X,'UPSTREAM  REACHES',3X,'UPSTREAM DRAINAGE  AREA
                                                           S',
     1        3X, 'INTERNAL   EXTERNAL ' ,3X,'UPSTREAM',3X,'INTERNAL't
                                                           7X,
     1 'INTERNAL   EXTERNAL'/2X,'NUMBER' ,7X,' 1 « ,4X,'2 ' ,4X,'3'8X, ' 1 '
     1'2',7X, '3I,6X,'1NCEX',7X, 'NUMBER',5X,lAREA'f7X,1INDEX' ,8X,»
                                                           INDEX',
     17X, 'NUMBER'/)
      DO  8CC  1=1,NR
      IF( IOR( I ) .NE.O)NNGR( ICR( I ) )=NOR( IDR{ I ) )
  8CO  CCNTINUE
      DO  46  1=1,NR
   46  WRITE(6i6C01)NCR{ 1 ) , (NUR( I,J),J = 1,3),(CAU(I,J),J=1,3),IDR(I

     INNORt IUR( I) ) ,TDA( I ) , I,JR( I) ,NOR(JR(I) )
 6001  FORMAT(16,110,15,I 5,F11.1,F8.1,FB.1,I8,I11,F12.1,I10,6X,I8,
                                                           111)
      hRITG(6,6CO?)
 6002  FORMAT(///43X,«BASIC',7X,'REACH',7X,'AREA'/
     143X,'GAGE',5X,'CONTAINING',3X,'UPSTREAM',3X,'INTERNAL'/
     142X,'NUMBER',7X,'GAGE',7X,'OF  GAGE',5X,'INDEX'/)
      DO  47  I=1,NG
   47  KRITE(6|6CQ3)  NGAGE( I ) ,NCR(I ) 1DAG(I),I
 6(103  FORMAT(39X,I8,I12,F13.lfI10)

      RETURN
      ENC
      SUBROUTINE  UPGAGE  (I,NGU,JGU)
      COMMC\/FLCWl/NR,NG,NCR(50),NLTU 50,3),DAU(50,3),
     1      TCA(50),NGAGE(1C),NGR(10),DAG(10),IDR{50)
      COMMON/FLCW2/FLI50),ROUGH(50),SLOPE (50)


                               A4-54

-------
      COI"MCK/FLGU3/JR( 5C) ,hT<50, 10 )
      01 KEN 5 I UN JGIH 10) ,NIL(50)
C  DETERMINE THE NUMBER AND IDENTITY OF GAGES  UPSTREAM
C  OF THIS REACH. DISCOUNT FURTHER  SEARCH  WHEN A  GAGE
C  IS ENCOUNTERED.  I  IS CURRENT REACH, NGU  IS  NUMBER OF
C  GAGES UPSTREAM AND JGU ARE  INDICIES OF  THESE GAGES
      NGU = 0
      IB = 1
      IU = I
C  IS THERE A  REACH UPSTREAM
    5 NU = NUR( IU, 1 }
      IF (NU)  10,10,15
C  THERE IS NO REACH UPSTREAM
   10 IB = IB  - 1
C  IS THE SEARCH COMPLETE
      IF ( IE )  ICO, ICQ, 2C
C  SEARCH CCMPLETE
  ICO RETURN
C  CONTINUE SEARCH
   20 IU = MUl IB)
      GC TO 24
C  THERE IS AN UPSTREAM REACH  - IS  THERE A  BRANCH
   15 IF (NURl IU,2) ) 25,25,30
C  THERE IS NO ERANCH
   25 IU = IREACMNU)
C  IS THERE A  GAGE
   24 J = 0
      DO 26 JJ=1 ,NG
      IF ('NGR(JJ) - NOR(IU)) 26,27,26
   27 J = JJ
   26 CONTINUE
      IF (J) 3 5 t 3 5 1 4 0
C  THERE IS NO GAGE IN
   35 GO TO 5
C  THERE IS A GAGE
   40 NGU = NGU + 1
      JGU (NGU) = J
C  CONTINUE SEARCHING
      GO TO 10
C  THERE IS A BRANCH
   30 IB = IB + 1
      NU = NUR( IUil)
      NIU( 1C - 1) = IREACH(NU)
C ' IS THERE A SECOND BRANCH
      IF (i\UR< 11.3)) 45,45,50
C  THERE IS NO SECOND BRANCH
   45 NU .= NUR{ IU,2)
      GO TO 25
C  THERE IS A SECOND BRANCH
   50 IB = IB + 1
      NU = NUR( IU,2)
    THIS REACH
IN THIS REACH
            A4-55

-------
  NIU( IH-1 ) = .IREACHM)
  NU = KUR(IU,3 )
  GO TC 25
  ENC
  FUK'CTICK  1REACH  (NU)
  COf'KOK/FLOl/NR,NG,,NCR( 50 ) ,NUR ( 5C , 3 ) , DAU { 50, 3) f
 1      TCA (50) ,N'GAGE( 10) ,NGR( 1C) TCAG( 10) , IDR(50)
  COMMGN/FLCW2/FU 5C),ROUGH(50),SLOPE(50)
  CGM*CN/FLCW3/JR(50),WT(50,10)
 '11=1
3 IF  (NCR(II) -  NU)  li2,1
111=11+1
  IF  ( I I.EG.NR)  GO  TO  2
  GO TO 3
2 IREACh =  II
  RETURN
  END
                             A4-56

-------
A4.4 FLASH - Synthetic Gage Data Generator Program

A4 . 4 . 1 Purpose
The FLASH program is designed to generate synthetic gage data that
are statistically indistinguishable from the available historical
data.   The program generates average weekly gage flow for one to
ten gage sites.  A detailed development of the methodology is
contained in Section 6.4.

The FLASH program generates a trace of data for each gage- site
selected.  It is preferable that gage sites' selected correspond
to the sites for which historical data are available for input.
However, it is possible to utilize parameters developed tjy FLASH
from historical data to generate data for another site, provided
proper modifications are made.  When parameters developed for a
given site are used for another site, lesser confidence can be
placed in the result.

The synthetic data are developed according to the model:
                                                   [Eq. A4.27]

where:   Qt  ^ =  the generated flow for the current week, t, for
site  i.  Ai(r)=  a deterministic component developed fron analysis
                 of historical data for that week,  t , of the year
                 corresponding to the current week,  t, site i.
       BT_J ^ =  a correlation coefficient developed from historical
                 data which relates the current  flow to the previous
                 four generated flows for all stations.
       Qt_.  . =  the generated flows for the four previous weeks
         ~J'     for all n sites, j = 1,2,3,4.
             n =  number of sites; program maximum is ten sites.
       CT_.,  t =  a parameter related to the variance of the
                 generated flows such that a sequence of generated
                 flows has the same variance as  the historical  data.
                         A4-57

-------
     a_ = the standard deviation of weekly historical data, week
          T, station ir
     Rt = a standard normal random deviate; different for each t.
     T  = a week of the year corresponding to the week, t:
          T = 1,...48.

Thus, the generated flow data-point is made up of a deterministic
component plus a factor which correlates the current flow to
previously generated flows for the site being computed as well
as for all other sites, plus a random component which preserves
the variance of the historical data.  The deterministic component
is the "least squares" best fit mean value of the historical flow
for the week, Ty of the year corresponding to the data point being
generated.  The correlation component preserves the dependence
between flows spanning a short time period, one month in this case,
and flows from gage sites close enough spatially to be influenced
by the same hydrometerological conditions.  The A, B and C parameter
values are developed in FLASH from edited historical data supplied
as input.  The development of these parameters is described in
detail in Section 6.

The data generated are to be used as a replacement for observed
gage data to extend the amount of data available for analysis and
simulation.   The gage data generated are subsequently transformed
into streamflow values at other points in the river system,
appropriately routed through controlling structures, to simulate
the stream flow throughout the system.  This transformation is
carried out in the program TFLOW, a description of which is contained
in A4.3.

A4.4.2 Program Components
The program components of FLASH and their lengths are:

FLASH MAIN         244,080         ITRAN         896
GEN                  1,324         RAN           460
COREL                3,120         RRN           396
TRANS                2,520         STA2         1506
FCOEF                1,140         STA3          904
STA1                 1,458         STA4         1152
OUT3                   612         OUT1         1596
E1GEN               22,652         OUT2          424
WFLOW                  888         OUT4          864
OUT5                   738         OUT6         1076
OUTP                 1,048         MEAN          938
INP                  1,036         S            9612
FUNCTIONS           20,792
Total program length = 321,248 bytes
                             A4-58

-------
A4.4.2.1 FLASH MAIN
This program reads in the program controlling information and
serves as the coordinating program to call the numerous subroutines
which perform the operations,  compute statistics and write out
information.

The program controlling information is supplied on one card.  The
details are contained in A4.4.3, Program Input, and A4.4.4,
Program Output, which follow.   The controlling information indicates:
(1) whether the flow generator parameters are to be developed from
historical data supplied with the current "run", or previously developed
parameters are to be used, (2) the number of years of data that are
to be generated, (3) the number of sites for which data are to be
generated,  (4) if the historical data to be used are to be transformed
for use or not, and (5) other miscellaneous instructions for handling
the transfer and output of data.

Although the program is a complete package which utilizes a set of
edited and  filled historical data to generate any number of years of
synthetic data, it also is set up to generate synthetic flows from
parameters  previously developed.  If more than one generating "run"
is to be made from a given set of historical data, the parameters
developed in the first "run" on that set of data can be used for
all subsequent "runs".  This eliminates the need for developing
the same parameters for each "run" and results in a saving of machine
time.  This can be used only when successive "runs" are to be
based on a  given set of historical data and the numbers and locations
of the gages for which data are to be generated are not changed.

When the flow generating parameters are to be developed from
historical  data, FLASH MAIN calls subroutine WFLOW which reads
and stores  all the historical data that are used as a basis of
the generating process.  Then subroutine TRANS is called, which
in turn calls subroutine MEAN, FCOEF and OUT1 before' returning to
FLASH MAIN.  Subroutine TRANS calls MEAN to compute the mean, standard
deviation,  skewness and kurtosis of the untransformed historical
data.  This done, TRANS performs the required transformation of the
data.  The  data may be (1) used without transformation,  (2) given
a square root transformation or (3) £iven a logarithmic transformation.
If, through the use of NORMAL, it appears that a transform other than
these two is better, the program should be changed to incorporate
the best transformation.  These transformations are used to make
the historical data normally distributed and to render the means
                              A4-59

-------
and variances more independent.  After the data are transformed,
MEAN is again called to determine the mean, standard deviation,
skewness and kurtosis of the transformed data.  These statistical
parameters are printed out for reference and for later comparison
with the same parameters computed from the generated data.

The subroutine FCOEF utilizes the transformed historical data to
develop the parameters and constants needed to compute the
deterministic component of the generated data.  This subroutine
is described in more detail below.

Continuing, FLASH MAIN calls COREL, S and EIGEN which are used
to develop the correlation matrices and perform the necessary
operations on them to compute the B and C parameters of equation
[A4.27].  Subroutine OUT 5 prints out these parameters and sub-
routine OUTP is called if it is desired to record these parameters
on magnetic tape for future use.

If the synthetic flow generator is to use previously computed
parameters B and C, subroutine INP is called to read in these
parameters.  Subroutine STA 1 utilizes the statistics.  Sub-
routine RAN generates the standard normal random numbers, sub-
routine S is called again to provide starting values for Qt_i ^
and subroutine GEN is called to compute the Qfc ^ values of tne
generating flow trace.

All operations subsequent to subroutine TRANS have been performed
on transformed data.  Now, subroutine ITRAN is called to perform
the inverse transformations to convert back to the original units.
Following t^his, subroutines STA 4 and OUT 6 are called to compute the
statistics on the generated data and to print them.

A4.4.2.2 WFLOW
The subroutine WFLOW reads in the edited and checked historical
data for selected gages and for all of the historical data which
are to be used as a statistical basis for generating the synthetic
data.  The program is set up to utilize historical data for up to
ten gages or stations and for up to 50 years of data for each
station.  It is necessary that the same number of years of historical
data be used for each of the stations and the beginning and ending
years for the historical data must be the same for all gages used,

WFLOW reads either a magnetic data tape or cards, depending upon
the control information initially placed into FLASH MAIN as
variable IHIST.  If IHIST equals 0, the subroutine reads from
                             A4-60

-------
tape and if IHIST equals 1,  cards are to be read.   The formats are
detailed in A4.4,3.   All data are read into storage because
subsequent processes require several returns to these data during
the course of computing the  generator parameters and making the
necessary statistical checks.

A4.4.2.3 TRANS
The subroutine TRANS is a multiple purpose subroutine in that it
in turn calls subroutines MEAN,  FCOEF and OUT 1 before returning
to FLASH MAIN.  TRANS calls  MEAN to compute the first four
statistical moments  of the historical data prior to the trans-
formation of the data.  Following this-, TRANS performs the desired
transformation of the historical data depending- upon the control
information initially established- in FLASH'MAIN for the variable
ITRAN.  If ITRAN equals 1, no transformation is made; if ITRAN
equals 2,,$he log transformation is made and if ITRAN equals 3,
the square root transformation is made.

Following the transformation, subroutine MEAN again is called to
compute the first four statistical moments of the transformed
data.

TRANS then calls subroutine FCOEF which computes the Fourier
coefficients which,  along with the data mean, are the constants
in the periodic formula which is a "least squares best fit"
approximation of the historical data.  This periodic formula
provides the deterministic components, A(T), in equation [A4.27].
More detail about FCOEF is contained below.

Subroutine FCOEF returns the computed Fourier coefficients, as
well as the computed deterministic components A (T) for each
gaging site, back to TRANS.

Next, subroutine TRANS determines the difference between the
computed deterministic component, A(T), and the corresponding
historical data points for "week"  T and, to normalize, divides
this difference by the standard deviation of the historical flows
for  that week.  These normalized deviations, one for each data
point in the set of historical data, then are returned to
FLASH MAIN for transfer to subroutine COREL, which is described
in detail below.
                               A4-61

-------
Finally, subroutine IRAN calls OUT 1, which prints out the first
four statistical moments for the transformed and  untransformed
historical data.

A4.4.2.4 MEAN
Subroutine MEAN computes the first, second, third and fourth
statistical moments of the data supplied to it.  The moments are
first computed about origin zero according to the formulas:
EX(I)
N . . .
EX(I)2
N . . .
EX(I)3
N . . .
EX(I)4
N . . .
[Eq.

. . FEq.

. . .[Eq.

. . .[Eq.
A4.28]

M.291

A4.30]

A4.311
where X(I) are the data values, N is the number of data values
summed and u^ are the moments.

The usual form for the second, third and fourth moments is for
these moments to be taken about the data mean as the origin.
In this case:
                                                   [Eq. A4.32]
                                  N

                                   - Uj)2
                                           .... [Eq. A4.33]
                                  N
                                  N        .... [Eq. A4.34]
                                           .... [Eq. A4.35]
where y. = the ith moment about the mean, u1 = the data mean,
X(I) and N are as above.
                           A4-62

-------
The subroutine directly computes the values for \*2> P
UA from the values of u^ by the formulas:

                      Vi« = U2 -  u-j^	[Eq. A4.36]

                      y3 °* U3 ~ 3ul U2 + 2ul3 *  tEq- A4.37]

               y,  « u, - 4 u, u-j + 6 Ui2 U2 - 3 u-j_4

                                                 [Eq. A4.38]

The second moment about the mean is the variance, which is  a
measure of the "spread11 of the' data points- about- the- mean-.- •
The square root of the second' moment about the mean  is defined
as the standard deviation, which is also a measure of the  "spread"
in the units of the data.

The third moment about the mean,' called "skewness",  is a measure
of distortion from symmetry.  Normally (Gaussian)' distributed
data are symmetrical about their mean.  A right  skewness indicates
that more of the data items are- less than the mean while left
skewness indicates that the majority of data items' is greater than
the mean.  The fourth moment about the mean is  called kurtosis.
It is a measure of the magnitude of the peak of  the  distribution
in relation to the peak of- normally distributed  data.  Both
skewness and kurtosis are  expressed as numerical parameters,  the
magnitude of which is indicative of the shape of the distribution.
The  parameter for skewness is given by:
                             3/2
                                          .  .  .  .[Eq. A4.39]
 If   a3 -  0,  the data are normally distributed.  The  parameter
 for  kurtosis is given by:

                    S2 " VA_ - UA
                         7J7  at	[Eq.  A4.40]

 Values of B2 equal  to 3 indicate normally  distributed data,  values
 greater than 3 indicate data having  a more- peaked distribution
 than normal  data, while values of S2 leas  than  3  indicate a
 distribution having a maximum leas than  the normal.
                            A4-63

-------
The program prints out the computed moments of the untransformed
historical data, the transformed historical data and the generated
synthetic data.  The program uses the mean  (1st moment) and
variance  (2nd moment about the mean) in the computation of those
parameters which are used in generating the synthetic data.  The
third and fourth moments are useful only in the comparison of the
statistical properties of the historical, transformed historical
and generated data.

A4.4.2.5 Subroutine FCOEF
It is well known that weather varies in a cyclic fashion with a
primary period of one year.  Runoff and gaged data also follow
a periodic pattern with an annual frequency.  Subroutine FCOEF
uses the historical data, transformed or not, as the case may
be, to develop a periodic formula which represents the "best
fit" of the data.  The formula provides the deterministic
component, A(T), in equation [A4.27], which serves as a basis
for generating synthetic data.

The form of the periodic function is:

         A(T) = f (T) = AQ + A-L (T)cos6+ A2(i)cos 26+ ...

                A  (T)COS n6+ B  (x)sin  64- B(i)sin 26
                + --- + B (i)sin n  6, ....... [Eq. A4.41]

where  T is the weekly index; that is,  T = 1 is the 1st "week"
of the year,  T = 2 is the 2nd "week" of the year,  T = 1,2 ..... 48.
 6 iSojjjje angular value of T; that is, for an annual period (360°),
 6 = (I Ag)T = 7.5x is the angular measure of one "week".  For
example"  for  T= 20, the twentieth "week" of the vear,  6= 7.5
x 20 = 150°.  Equation [A4.41] is an infinite series and typically,
the more terms used to describe the function, that is, the higher
the value of n, the more accurate is the approximation to the
true function.  In this subroutine, provision is made to compute
up to six harmonics (up to n=6) which provides an adequate
approximation.

The function f(f) is not known at the outset and subroutine FCOEF
develops the function from the historical data.  If y are the
data points, then y(f ) are the data points for week, T, of the


                            A4-64

-------
year.  Let N be the number of years of data available.  The
coefficients A^^ and B± in equation [A4.41] are given by:
                           N   48                 Tr,    .. /01
                 A  = 1	  E    Z  yn i	[Eq. A4.42]
                  °   48N n"1  i"l    '

or A  - i i't! ;ir't:h; o.Ll.c ncari of all data points.

        A,,(T ) = 2  J  yn  (T )cos k  (7.5t)  ....  [Eq. A4.43]

                 I; n-1


                           ( T )sin k  (7.5 T)  .  .  .  .  [Eq. A4.44]
where:  y  (T  ) are N data points,  all  data  points  for the "week"
 T in  the Record  of N years,  k  is the harmonic number.

Thus,  subroutine  FCOEF  computes  the constants  Ao,  .. A^ and
BI» •• B^.  which are needed  to compute  A(T ),  the estimated or
expected value of the flow.  Following this,  the subroutine
then  computes A(T ), the estimated flow for each of the 48
"weeks."   This is done  for  each  gage site.

 In subroutine FCOEF, the historical flow data are converted to
normalized deviations from  the  estimated flow data using the
 relation:

                     x- (Q-A(i))/cQ  ....    [Eq. A4.45]

 These normalized  deviations are used in all subroutines until
 they are transformed back in subroutine ITRAN which is near the
 end of the program.

 A4.4.2.6 OUT 1
 Subroutine OUT 1  prints the statistics of the historical  flows,
 the first four statistical moments of the untransformed data and,
 if required, ol   the trnnsi:nmeu data.  Values are  provided
 for ench «'f  the  A8 "veeVs': of the. year and for  each gaging  site.

 A4.4.2.7 r:;V.%.Jv-
 Subroutine (y)lv L utilizes the. normalized deviations  of the
 historical flows (or transformed  flows) from  the  corresponding
 estimated flows, A(t ), to compute  the various  correlation
 coefficients needed ultimately  to develop  the B and  C coefficients
 in equation  [A4.27].   This subroutine is called from FLASH  MAIN.
                             A4-65

-------
In the course of its operation, it calls subroutines S and OUT 3.

Correlation is a measure of the degree to which variables vary
together or a measure of the intensity of association (1).
The simple linear correlation coefficient is generally defined as:

                     Z(X - x)(Y - y)/(n - 1)
                     7 (X - x)2/n - 1/Y - y)2/n - 1 . [Eq. A4.46]

or, since the values  (X - x) amd (Y - y) have already been computed
by TRANS, the equivalent form is:
                           y2   	[Eq. A4.47]
where x and y are deviations from the mean.  The correlation
coefficient  is a pure number, independent of units, which equals
its maximum value of unity, when x and y vary identically, and
its minimum value of negative one and when the two variables
always vary in an opposite manner.

The rationale for the procedure used to develop the required
correlation coefficients and correlation matrices was established
in Section 6.5.  The computational methods needed to obtain the
necessary correlation coefficients and to set them up in matrix
form are described below.  Briefly, the purpose is to establish
the correlation between historical flow values at the various gaging
stations in the river basin and the correlation between historical
flow values for "week" L and "weeks" L-l, L-2,..., L-7, for all
gaging stations.  Thus there are:  (1) autocorrelations between flows
at the same station for different time frames (a temporal correlation)•
(2) correlations between flows at different stations in the water-
shed for the same time frame (a spatial correlation); and (3)
correlations between flows at different stations and different
time frames (a temporal and spatial correlation).  The problem is,
therefore, multivariate.

The temporal correlations are made over the period from the current
time frame under consideration backwards in time for seven time
frames for a total eight correlations, one with no time lag and
seven with time lags of from 1 to 7 time frames.  This is done
                          A4-66

-------
so that the flows being generated will exhibit correlation with
the previously generated flows,  in agreement with the assumption
that natural river flo\;c autocorrelate with the flows observed
in the previous four week period.  Recall from Section 6.4 that
to correlate temporally for one month in multivariate analysis,
it was neccsr.nry to obtain the submatrlx $22> which was made up
of correlations in the previous month, and submatrix 8^2 which
was made up of correlations between the two'months.  The spatial
correlations are re rule because, in a given basin, the hydrometero-
logical conditions which cause' the flow at' one' station- also cause
a corresponding'flow at' a nearby station.'  By considering both
spatial and temporal correlation multiple traces of streamflow
data, one for each station, that will be not unlike those
observed in a record of flows for a river basin, are provided.

The correlations are computed for' all historical flow records
that are being used as a basis for the generated flows.  The
correlation coefficients arc computed and then are placed in a
matrix array upon which mathematical operations' are performed
to produce the desired coefficients.  In actuality, four
matrices are set
matrix:
up, each of which is a sub-matrix of the correlation
                              Sll  S12

                              _S21  S22.

The procedure is illustrated using a three-station example.

The array Sni is shown in Figure AA-5.  For the column  and row
headings, note the two digits separated by a hyphen.  The first
digit  is the station number and the second digit  is  the number
of time frames lagging the current time frame.  For  instance,
1-0 indicates station 1 at the current time frame while 1-2
indicates station 1 at the time frame two weeks lagging.  The
a.jj are correlation' coefficients which' correspond to- their
appropriate station-lag'relationships.  For' instance',• a^y is
the coefficient which indicates the correlation between station
1 - current time frame, and station'2 - lag of  2 weeks.  The
value  of a-j^ will be the same as a,, .  Accordingly,  the value
of any a^ will be unity.
                           AA-67

-------
A modification of the computational procedure is made to produce
less variability in correlation coefficients representing the
same time difference.  The values of a^2> a23> an<^ a34 are
computed, averaged and then  the average value is used in each of
these positions.  The coefficient a-^ represents a one-lag time
difference as does a.2% and a^/p so the average one-lag coefficient
is used.  Similarly, &21.> au  a43 are averaSe^ from these one-lag
coefficients.  Further, aj_3 and a24 are averages of the two-lag
coefficients, as are 33^ and
The same procedure is used in computing" the elements representing
correlations between two stations.  Thus, a-^  a?.  337 and
a/tg are all identical, representing the average of 'the different
station-no lag correlations.  Correspondingly, a^, a^  373
and agA have the same value, which is the same as for a^cj, and
so on.  The computer programming computes the coefficients and
sets up the array as shown.

The array 822 is shown in Figure A4-6.  This array is set up in
the same manner as array S-Q, excepting that lag-four through
lag-seven coefficients are computed.  Thus, array 827 contains
correlation coefficients for the four through seven  weeks"
following the current time frame.  For example, the element
^23 represents the correlation between station 1 - lag 6 and
station 1 - lag 5.  Again, b]2> t>23 and b3^ represent  the
average of the one-lag coefficient for these four through seven
"weeks" before the current time frame.

The array 8^2 is shown in Figure A4-7.  This array contains the
correlations between the lag-zero through lag-three values and
the lag-four through lag-seven values.  The array is developed
in the same manner as for S-Q an<3 822-  Array 821 is merely
the transpose of array
Subroutine COREL calls subroutine S which makes the transposition.
Subroutine OUT3 is called, if desired for reference, to write
out the correlation coefficients that have been computed for the
current time frame.  .This subroutine can be removed, if desired,
without loss of program continuity.

A4.4.2.8 S
Subroutine S is a utility program developed for the program
library of the Department of Environmental Engineering, University
                           A4-68

-------
    Station 1
•p-
I
Ox
vO
    Station 2
                       Station 1



                    1-0  1-1  1-2  1-3



               1-0  au  a12  a13  a14



               1-1  a21  a22  a23  a24


               1-2  a31  a32



               1-3  a41  a42




               2-0  ag^  a^2  • • •



               2-1  a61  a62  ...



               2-2  a?1  a72  a73

                     •    •    *

               2-3  a31   .    .
Station 3
                   3—0
                   3-2
                        a101-
                                                       Figure A4-5

                                                 Array S^ Correlation Sub-Matrix

                                                    (Three station example)
      Station 2


2-0  2-1  2-2  2-3



a!5  a!6  a!7  a!8


a25  a26  a2?  ...
                                                                                     Station 3


                                                                                  3-0  3-1  3-2  3-3



                                                                                                 aH2
                   3~3  a!21' ' '

-------
^j
o
                                                        Figure A4-6
                                                Array S22 Correlation Sub-Matrix
                                                      (Three station example)
                          n
                       Station  1

                    1-4  1-5  1-6  1-7

               1-4  b:

               1-5

Station 1      1-6

               1-7  b41  b42  b43  b44


               2-4    .'    !

               2-5

Station 2      2-6

               2-7


               3-4

               3-5

Station 3      3-6
                                                     Station 2

                                                   2-4  2-5  2-6  2-7
     Station 3

3-4  3-5  3-6  3-7

          ...  b112
                   3-7  b
                         121
                                                                                           ... b
                                                                                                1212

-------
Station 1
                       Station 1

                    1-4  1-5  1-6  1-7

               1-0  cn  c12  c13  c14

               1-1  c    c    c

               1-2  c

               1-3  c
           22  c23

          c32  c33
                                     Figure A4-7
                            Array Si2 Correlation Sub-Matrix
                                   (Three station example)
                                 Station 2

                              2-4  2-5  2-6  2-7
                                                                                 Station 3

                                                                             3-4  3-5  3-6  3-7
Station 2
2-0

2-1

2-2

2-3
Station 3
3-0

3-1

3-2
3-3  c
      121 ••*
                                                                                            -1212

-------
of Florida.  This program is included in its entirety in the coding
which follows.  The subroutine S performs common matrix operations,
matrix inversion and a determinant evaluation as tabulated below.

Operation                     Operation                Operation
  Name                          Number

ADD                               1                     A = B+C
SUBTRACT                          2                     A = B-C
MULTIPLY                          3                     A = BxC
INVERT                            4                     A = B-l
DETERMINANT                       5                     |A|- N
TRANSPOSE                         6                     A = AT
EQUAL                             7                     A = B
CLEAR                             8                A,B,C  = 0 (clear
                                                       matrix space)
INPUT                             9                     A (read in matrix A)
OUTPUT                           10                     A (write matrix A)
SCALAR MULT                      11                     A = ctB

The operations in the S subroutine used in the flow generating program,
FLASH MAIN, and its subroutines are:  2, substract; 3, multiply; 4,
invert and 6, transpose.  The subroutine calls S, operation 6 to
make the transposition of matrix 8^2 to ^21 an<* does 8O without
destroying 8^2 •  FLASH MAIN calls S, operation 4 to invert matrix
822 and in so doing replaces 822 with S22-1«  Then S is called to
multiply 812 anc* S22""-'- and places the product in array B(1,1,J).
Following this, a matrix multiplication of 821:and the array
B(1,1,J) is made and the result is placed in 822'-  The last matrix
manipulation subtracts 822" from Sn and places the result in C(l,l,j).
The reason for making these matrix operations is described in Section  6.5.

The matrix operation of subroutine S, excepting for operation 4,
invert, and operation 5, determinant evaluation, are simple and
straightforward.  Matrix inversion and determinant evaluation involve
considerably more computation, especially when the order is greater
than 4 or 5.

The problem of matrix inversion is one of finding a square matrix
.A~l such that:

                        A""1 A " A A"1 = I	[Eq- A4.48]


                             A4-72

-------
where .A is a square matrix of order n:
                       A - (a±j)
                                        a12
                                            ... a
                                                 2n
                                         n2
                                                 nn
                                                      .  .  .  .  [Eq. A4.49]
and _!_ is the identity matrix.  Finding the inverse, A~
same as solving the system of linear equations:
                                                          is  the
                    allxl
                            a!2x2

                    a21xl + a22x2
                                        + aln xn " fl

                                              «n " f 2
                                                          .  .  [Eq.  AA.50]
                    ax
                     nlxl + an2x2
                                          ann
The matrix has one, and only one, inverse and the system has one,
and only one, solution if, and only if, A is non-singular; that  is,
if the determinant of A is non-zero.

The system of linear equations can be written in the form:

                            Ax-f   ............ [Eq. A4.51]

and then:

                            x. " A'1 f_ ............ [Eq. A4.52]

                                                              [Eq. A4.53]
If s
                            A'1 -  (ci;j)
then, by components:
                         i' A
                                                              [Eq.  A7.54]
                            A4-73

-------
    1,2,... n.  This relationship allows computation of the values
                                                          j.  Thus,
of c.j4 after the above system of equations is solved for
matrix inversion is equivalent to solving a system of linear equations.
The best known method for solving this problem is that of Gauss,
often called "Gaussian Elimination."  The method uses one equation
to eliminate one variable in all other equations and successively
uses the remaining equations to eliminate the remaining variables,
until the last equation has only one variable remaining.  The
result is a upper triangular matrix, A_(
0

0
                         .0
                                                             - A4.55]
                  n
                  0
After finding
                      the value of XR can be found by:
                      nn
                        (n)
                                 fn	[Eq. A4.56]
Then, by successively computing the X.L and substituting, all values
of x  can be found and the system is solved.  Having the values of
xif the inverse, A"1, can be found component by component.

The classical method for finding the inverse is through the use
of the relation:
                        ,-1
                             (det A)
                                                         [Eq. A4.56a]
where A+ is the adjoint of A, defined as the transpose of the matrix
of cofactors of A_.  If A_ is of order 2, computation of the inverse
is trivial, and as the order increases to more than 4, the computation
becomes laborious.  For this reason, the systematic method of Gauss,
with later variations, is usually selected for machine computation.

One of the variations of the Gauss method, the so-called Crout
reduction method, has an advantage that, although the number of
computation operations is the same, there is a reduction in the
                           A4-74

-------
number of intermediate values that must be stored.  For this reason,
the method of Grout,  modified by making row interchanges for increased
accuracy, is used in subroutine S for matrix inversion and determinant
evaluation (2).

Determinant evaluation is performed in a part of the operation
required to invert.  Referring to the triangular matrix obtained by
Gaussian elimination, the value of the determinant of A, (det A),
is obtained by:
                                       (3)
            (det A) - an(1) a22^ a33 • • • ^n^ •  IE<1' A4.56b]
i.e., the product of the main diagonal elements of the triangularized
matrix.

A4.A.2.9 EIGEN
Subroutine EIGEN computes the eigenvalues and eigenvectors of the
correlation matrix developed by subroutine COREL and the successive
matrix operations of subroutine S.  The reason for making these
computations is developed in Section 6.5.

The fact that the correlation matrix is symmetric' with real elements
considerably simplifies the computation of eigenvalues and eigenvectors.
A symmetric matrix has the properties that:  (1) the eigenvalues
are real, (2) the eigenvectors corresponding to different' eigenvalues
are orthogonal, and <3) the correlation' matrix- can- be- dlagonalized
by a similarity transformation.  The transforming matrix has as its
columns the' orthonormal set of eigenvectors for the correlation
matrix and, furthermore-, the- resulting- diagonal -matrix- has as its
diagonal elements' the eigenvalues' of the- correlation matrix.  The
symmetric matrix is a special' type" of' Hermltlan matrix, one having
no complex components, and the computational advantages which are
manifest in Hermitian matrices apply also to  the correlation matrix.

The classical method for determining eigenvalues for a real symmetric
matrix is that of Jacob! (1846) in which the transformation is made
by a sequence of two-dimensional  rotations (3) .  The process is
iterative because an element which is reduced to zero by rotation
In one plane is made nonzero by another rotation in a different
plane.  Theoretically, an infinite number of rotations would be
required but in practice the process is stopped when the value of
                              A4-75

-------
the off-diagonal elements is zero (to working accuracy).
The method for determining the eigenvalues used in EIGEN is that
of Givens (1954) which is similar to the Jacobi method except that
a less complete reduction is attempted.  In Given 's method, a real
symmetric tri-diagonal matrix is produced by orthogonal similarity
transformations (3).  The method is not iterative and thus a
considerable savings in computation results.  Given' s method also
is based upon plane rotations.  The first row off-diagonal elements
are reduced to zero.  These zero elements are not affected by the
next set of rotations, which generate  zero  in off-diagonal
elements of the second row.  This method is continued successively
for all rows until the tri-diagonal matrix is formed.

There are approximately 4n3/3 multiplications to be made using
Given' s method compared with 2n^ multiplications needed for one
iteration in the complete reduction method of Jacobi. where n is
the order (3) .  Although the tridiagonal matrix which results in
Given 's method usually is not close, numerically, to the completely
reduced matrix, the eigenvalues and eigenvectors resulting from
both methods are very nearly the same, within working accuracy.

The remainder of the problem is to solve the symmetric tridiagonal
matrix for the eigenvalues.  The method used is again that of
Givens (3).  There- are (2n-l) independent elements in the tri-
diagonal matrix and the solution for its eigenvalues is much
simpler than the original matrix.

The tridiagonal matrix generally has non-zero superdiagonal elements.
Although roots of multiplicity k will  give (k-1) zero super-
diagonal elements, the occurrence of zero superdiagonal elements
does not necessarily imply that there  are any multiple roots.
The matrix will be of the form:
                 C =
J»  0*2  ^3*  •  •  •  0

 0  33  a3  64.  .  .0

 .  .   64  014.  .  .0
                          0 .
                                                       [Eq. A4.57]
                               A4-76

-------
If the leading principal minor of  order r of (£ - XI)  is Pr (X) ,
and if PQ (X)  is defined to be 1,  then:

                   P-L (X) = a± - X	[Eq. A4.57a]

and for successive minors of C:

      Pt (X) = (Qi - X)  P^ (X) - Bj2 P±_2 (X) . .[Eq. A4.58]

      i - 2	n.

The zeros of Pr (X) are  the eigenvalues.

If the P. (X)  are evaluated for a given value X - y then, by the
Sturm sequence property, the number of agreements in sign of
consecutive numbers of this sequence is'the number of eigenvalues
which are greater than y in values (4).  This property is used
to locate the individual eigenvalues by magnitude.  If for two
values of n, aQ and bQ,  b0 > aQ, then:

                        S(a0) ;» K	[Eq. A4.59]

and:

                        S(b0) < K	[Eq. A4.60]

then, X, lies between a0 and bQ.  By successively reducing the
interval, bo - aQ, the eigenvalues can be separated.  After
separation, further reduction increases the precision of the value.
Suitable starting values for aQ and bQ are ± \\C\\   , the maximum
value of the norm of matrix C.

After an eigenvalue is isolated by reducing the interval (usually
done by successive bisections), it is possible to switch to an
iterative technique for faster convergence to the value having
the desired working accuracy.  EIGEN computes the n eigenvalues by
this method.

A4.4.2.10 OUT 4
Subroutine OUT 4 writes out the parameter estimates of weekly
flows which have been computed by subroutine FCQEF.  These are
values of A^  (T ) in equation[A4.27Jdeveloped from analysis of
the historical data.  Subroutine OUT 4 also writes the monthly
standard deviations for each month of the year for each station.
These data also are obtained through analysis of the historical
data and are used also in equation [A4.27].
                             A4-77

-------
A4.4.2.11 OUT 5
Subroutine OUT 5 writes out the parameters B and C developed from
the correlation matrix of the historical data.  These are the
B and C parameters of equation [A4.27].  The matrix write-out
operation in subroutine S is used to write out these parameters.

A4.4.2.12 OUTP
Subroutine OUTP records the parameters B and C on magnetic tape
for future use.  If one wishes to make several synthetic data
generating runs based upon a given set of historical data from
a given set of gaging stations, the output of these parameters on
tape and their subsequent use in subroutine INP allows the by-
passing of all of the FLASH program previous to this point.  If
any change is made in the historical data used, however, a new
set of parameters is needed.

A4.4.2.13 INP
Subroutine INP provides the necessary statements to handle and
read the parameter data supplied on magnetic tape.

A4.4.2.14 STA 1
Subroutine STA 1 is called to initialize all the variables used in
the computation of the statistics of the generated flow data.

A4.4.2.15 GEN
Subroutine GEN computes the probabilistic components of the
genereted flow; that is, that portion of equation!A4.27]which
is added to the deterministic component A^ (T) to obtain the
generated flow data.

A4.4.2.16 ITRAN
Subroutine ITRAN performs two transformations, or more accurately
described, re-transformations.  In subroutine FCOEF, the data
were converted to normalized deviations and in subroutine THAN
the data were given a normalizing' transformation, depending upon
the information fed by one of the control cards.  Subroutine
ITRAN returns the normalized deviations to transformed flow
data by the equation:

                          Q - x (OQ) + QEST . . . . [Eq. A4.61]

where Q is the transformed generated flow, x is the normalized
deviation, OQ is the standard deviation of the transformed flows
and QEST is the mean of the transformed flows.  Following this,
                           A4-78

-------
the inverse transform,  corresponding to the transform used in
subroutine IRAN,  is used to return the flow data back to the
original form,   Subroutine ITRAN also calls subroutine STA3.

A4.4.2.17 STA 3
Subroutine STA 3 makes  the summations necessary to compute the
first, second,  third and fourth statistical moments about zero.
These sums are transferred to subroutine STA A.

A4.4.2.18 STA 4
Subroutine STA 4 receives the summation needed to compute the
mean, standard deviation, skewness and kurtosis from subroutine
STA 3 and computes these statistical parameters for the generated
flows.

Finally, FLASH-MAIN can, depending upon the control statements
provided, write out the generated flow data or it can place the
generated data on magnetic tape for subsequent use.  It would
be an easy matter to change the output to punched cards if cards
are more suitable than the magnetic tape.  Also, it is possible
to include other main programs; i.e., TFLOW and WASP in an
overall ' Vio loop'  to generate gage data, compute unregulated
stream f]ov/s, compute regulated stream flows and simulate water
quality for all for a given time frame before proceeding to the next
tine  frame.  The total program length of these combined programs is
in excess of 426,000 bytes.

A4.4.3 Program Input
The program input for FLASH is as follows:
(1) For FLASH-MAIN:
Card  // 1  (915) NYR - Number of years of historical weekly data
                     to be used.  When parameters are used, NYR=0,
              NYRG » Number of years of data to be generated.
             NSITES= Number of gage sites  from which historical
                     data  are  to be used and for which  data are
                     to be generated;  the  number of basis gages.
             NTRAN - The transformation option code = 1, for no
                     transformation of historical data.
                     »  2 for log  transformation.
                     »  3 for square-root transform.
               IRAN   •  Initial random  number;  5 digits.
               ISAVE  •  1,  if generated data are to be written  on
                        magnetic tape.
                          A4-79

-------
                 = 0, otherwise.
          IPARAM = 1, if generator parameters are to be written
                   on magnetic tape, for future use as input.
                 = 0, otherwise.
          NPRINT = The number of years of generated data to be
                   printed as program output.
          IHIST  = 1, if historical data are to be read from
                   punched data cards.
                 = 0, if historical data are to be read from
                   an  edited and filled data tape.
(2) For subroutine WFLOW:  Historical data are read.  For input
on magnetic tape, data should be placed on the tape according
to the format:  Nl, N2, N3, Q(K,L,J,I), L = 1,4, J = 1,12,
K = 1, NYR
where:       Nl  = The gaging station number, I.
             N2  = The year, K.
             N3  = The month, J.
       Q(K,L,J,I)= Four weekly flows.

For input on punched cards, the format should be Q(K,L,J,I)
L = 1,4,4F8.2 to be read in nested "do loops" for J months,
K years and I stations.
(3) For subroutine INP:  When the parameters needed for generating
synthetic data have been developed previously and are stored on
tape for repeated use, the parameters are read in by subroutine
INP.  See the output from subroutine OUTP.  The tape will contain:
(a) QEST (L,J,I), L = 1,4, J = 1,12, 1=1, NSITES.
(b) QVAR (J,I), J = 1,12 1=1, NSITES.
(c) B(J,K,I), J = 1,N, K = 1,N, I = 1,12.
(d) C (J, K.I) J = 1,N, K = 1,N I = 1,12.

The format and data are established by OUTP, provided the control
card for FLASH-MAIN  (card #1) contains IPARAM = 1.

A4.4.4 Program Output
The program output for FLASH follows.
(1) From subrotuine OUT1.  The output from subroutine OUT1 is
the result of the computation, by subroutine TRAN, of the statistical
parameters for the historical gage flow data.  Two sets are printed
out; the first set is for the edited and filled data without trans-
formation and the second set is for the edited and filled data,
but computed using the transformed data.

                           A4-80

-------
The output contains the mean, standard deviation,  skewness  and  kurtosis
computed for each gaging site for each week of  the year.  The sums
used in computing the statistical moments are taken  for week i  over
the number of years of historical data used; i.e., if  30 years  of
historical data are used, the mean is computed  by  taking one-thirtieth
of the sum of the 30 data values for the ith week.

These two sets of statistical parameters allow  the comparison of
the parameters' af the-transformed and -untransformed  data- and, further,
allow comparing- these--parameters" with-.those- of'  the- generatedvdata
which are printed- out by subroutine OUT6-. • The-output  amounts "to
48N lines for- eachr set, where Nl is the number1 of- gage  sites.
(2) From subroutine1 OUT3';'' The- output- 'from- subroutine-  OUT3  is the
set of correlation coefficients- computed- by; subroutine COREL.   These
coefficients are the elements that make up the  arrays  S;Q,  8^2
and 822 described- in section A4.4.2;7.

Referring to Figure' A4-7A5 the correlations in any row  are between
the site listed on the left and the site listed  on the right.   If
the site numbers are the same, the correlation  is  serial in time,
as shown in the first three lines.  The lag 0 serial correlation
is 1.000, as shown.  The value 0.0352, indicated by  (1) in  the
figure, is the average correlation in month 1 between  the flow
at site 1 in current frame and the flow at site  1 which occurred
three time frames previously.  Similarly, the value  -  0.0527,
indicated by (2), is the average correlation in  the  previous month,
(actually the'12th" month'in the case shown), between the flow at
site 1 and the1 flow at site 1 which occurred three weeks previously.
That is, row two shows the correlation coefficients  corresponding
to those of row one,' excepting they are- for the month  just  passed.

The third rox? shows average correlation coefficients between the
flow in the current time frame and the flows which occurred one
to seven weeks previously.

The data shown in'rows 4 through' 6 in Figure A4-7Aare  average
correlation coefficients between flows at site  1 and site 2 for
the current month,  the previous month and for the seven lag periods,
respectively.  In this case, and elsewhere, where the  site  numbers
are different,  the coefficients are a combination of serial
(time)  correlation and spatial correlation.
                             A4-81

-------
  Figure A4-7A
Sample of Output
Subroutine OUT3







-C-
[
oo
N5
SITE
1
1
1
1
1
1

MONTH LAG 0
1 1,000 0
1 1,000 0
1
1 .9100
1 .9141
1

LAG 1
.4379
.3036
.3489
.4093
.3896
.0720

LAG 2
.0872
.0318
.0357
.0588
.0491
.0680
etc
LAG 3 LAG 4
.0352(1)
-.0527(2)
.3007 -.0114
-.1918
.1043
-.0949 -.1141

LAG 5


-.1633


-.0844

                       LAG 6
LAG 7
                      -.1432   -.5543
                      -.0778   -.5656
SITE

  1

  1

  1

  2

  2

  2

-------
This output amounts to 36N2 lines, where N is the number of gaging sites
used.

(3)  From subroutine OUT4.  The output from subroutine OUT4 is the result
of the computations made in subroutine FCOEF.  The output consists of
two sets of data; first, the estimated average weekly flow for each site
for each week of the year and secondly, the weekly standard deviation
for each site for each month.  These data were developed by fitting a
Fourier series of six harmonics to the historical data and represent the
"best fit" for each week based upon the N years of historical data used.
The estimated average weekly flow corresponds to the A^T) and the weekly
standard deviation corresponds to the o^ in equation [A4.27].

The number of lines of output for subroutine OUT4 is 24N, where N is the
number of sites used.

(4)  From subroutine OUTS.  The output from subroutine OUTS also is two
sets of data.  The first set consists of the values of the parameter B
and the second set lists the values of parameter C.  Both are used in
equation [A7.27].  These parameters are the coefficients which result
from the multivariate correlation techniques described in Section 6.4.

The output is in the form of a 4N x 4N matrix (N is the number of sites
being used) for each of the two parameters.  Because only seven columns
can b« spaced on a printout sheet, it is necessary to print the matrix
in a folded format with the number of folds equal to the next larger
integral value of p - 4N/7 if 4N is not exactly divisible by seven.

The total lines of output for each of the two sets is given by 48Np' where
p1 is the integer next greater than p.

(5)  From FLASH-MAIN.  FLASH-MAIN prints out the generated data or places
the generated data on magnetic tape, depending upon the value given ISAVE
on data card number 1.  If ISAVE - 1 the generated data will be placed
on tape, if ISAVE - 0 the output will be printed.  It would be an easy
modification to have the output In the form of punched cards.

The format of the data on tapes will have the generated flows for the
first week for all sites spread across the tape; the second week data
will appear in the next row and so on through the months and years.  The
format of the printed data is such that the columns correspond to the
months of the year, with the first four rows in the first column giving
the generated flows for site 1 for the first month, the first four rows
in the second month, and so on.  The data for site 2 follow in the 5th
through 8th rows, for site 3 in the 9th through 12th rows, and so on.
The year number is printed and the data for each year are separated.
                              A4-83

-------
 (6)   From aibroutine OUT6.   Subroutine OUT6 prints out the data computed
 by subroutine  STA4; namely,  the  statistics of generated flow data.
 These data  correspond  to and are in  the same format as the output from
 subroutine  OUT1  for untransformed historical data, so that comparison of
 the statistical  parameters  is facilitated.  OUT6 prints the statistical
 parameters, mean, standard  deviation, skewness and kurtosis for the
 generated data for each site for each month of the year with sums taken
 over  the number  of years of  data generated.  The number of lines of out-
 put is 48N, where N is the  number of sites.

 A4.4.5  Dictionary of Variables.
 Following is a list of the  variables used in FLASH and a brief definition
 of each.
AO
ASI(J)

AV
B
BCO(J)

C
CURT
DEV
GAV
GCURT
GQ(J,L.I)

GSD
GSKEW
IHIST
IPARAM
NPRINT
IRAN
ISAVE
Nl
N2
N3
NFREQ
NSITES
NSP
NTRAN
NYR
NYRG
Q(K,L,J,I)

QAV
Fourier constant, flow estimate equation.
Fourier constant, flow estimate equation, COEFF.
Jth harmonic.
Mean.
Generating parameter - regression coefficient.
Fourier constant, flow estimate equation, COEFF.
Jth harmonic.
Generating parameter - variance coefficient.
Kurtosis, gage flows, transformed data.
Deviation, equals Q-QEST.
Mean, generated flows.
Kurtosis, generated flows.
Generated flow, Jth month, Lth week, 1th station,
deviation.
Standard deviation, generated flows.
Skewness, generated flows.
Control variable - historical data source.
Control variable - parameters on tape.
Control variable - years of output.
Initial random number.
Control variable - records B & C parameters.
Year number, data.
Month number, data.
Week number, data.
Number of harmonics, estimating equation.
Number of basis gages to be used.
Number of data points.
Control variable - selects transform.
Number of years of historical gage data to be read.
Number of years of synthetic gage data to be generated.
Gage flow, Kth year, week, L, month J, station I,
transformed.
Mean gage flow, transformed data.
                              A4-84

-------
QEST
QPR(K)
QSD
QVAR
R(D
S12(L,I,LL,II)

S22(L,I,LL,II)
S3
S4
SKEW
SL12(M)
SLL12(M)
SUML1CM)
SUMLLi(M)
SUML2(M)
SUMLL2 (M)
Tll(M)
T12 (M)
T22(M)
XCURT
XQAV
XQSD
XSKEW
Expected value of flow, = A(T).
Flow for Kth previous time frame.
Standard deviation, gage flows,  transformed data.
Variance of computed flow estimates.
Random number, Ith number generated•
Correlation matrix, current month, weeks L & LL,
sites I & II.
Correlation matrix, lag month, week L this mo.
week LL last.
Correlation matrix, previous month.
Skewness.
Kurtosis.
Skewness, gage flows, transformed data.
Summing variable.
Summing variable.
Summing variable.
Summing variable.
Summing variable.
Summing variable.
Element of correlation matrix, lag 0 through 3, week M.
Element of correlation matrix, cross.
Element of correlation matrix, lag 4 through 7, week M.
Kurtosis, gage flows, untransformed data.
Mean gage flow, untransformed data.
Standard deviation of gage flow, untransformed data.
Skewness, gage flows, untransformed data.
A4.4.6  Program Logic.
Figure A4-8 is a diagram of program logic for FLASH.

A4.4.7  Program Coding.
The program coding for  FLASH follows.
                             A4-85

-------
                       FIGURE A4-8
                 PROGRAM LOGIC - FLASH
Call INPUT-
•yes
Read In generating
equation parameters
FLASH - MAIN

Read Control Variables

-If  generating  equation
parameters  are to be  used
       t no
  Call  WFLOW	*— Read  edited  and  filled
                   historical data
           	I
                         Call TRANS
                          -a-Call MEAN
                               •compute statistics
                                of untransformed
                                data   .
                                      Transform historical
                                      data     I
                                          Call MEAN-
                                Return
                                for each
                                basis gage
                                    f    Call FCOEF-
                                        •compute statistics
                                         of transformed
                                         data
                                        •compute deter-
                                         ministic component
                                         of generator
                                         equation
                                        	I
                                      Convert to residuals
                                               I
                         Call CORREL.
                             •compute elements and
                             set up correlation matrix
                             	I
                         Call S
                             operate on correlation
                             matrix to obtain regression
                             constants for generating
                             equation and prepare  for
                             EIGEN.
                            A4-86

-------
UctiX
1
Call
obtain variance coefficient
for generating equation

equation parameters
	 	 '
Return
for each
year of
data to be
generated
Call STA1-
      ^—
                                         •initialize  statistics
                                         	I
                         Call RAN.
                         Call  S
                         random numbers
                 for generating equation
            •compute initial
            flow values for
            generating equation
                         Call GEN-
               •j^-generate gage flow data
               	I
                         Call ITBAN     »• perform inverse trans-
                                          formation on generated
                                          data
                     Write out generated
                     flows for one year
                         Call STA4 ---compute statistics of
                                     generated data
                                              I
                         Call OUT6 -sprint statistics of
                                     generated data
                            END
                             A4-87

-------
//FLASH    JOB  (1143,47,020, 18, CCOG), «ALEMAN               •, CLASS

// EXEC FCRTRA*
//SOURCE   CC *
C  -FLCRIDA SYNTHETIC  HYDRCLOGY  HOC EL ( FLASH )
      C I PENS I CM C ( 50,4,1 2, 8),XQAVU, 12,8),
     1          XCSDU,12, e),XSKEVU4,12,8),XCURT<4,12,8) ,QAVU*12
                                                            • 8) ,
     •2
                                                           »   »
     3          BCO<6,8UQEST(4,.12,a),         QVAR ( 1 2 , 8 ) , SI 1 ( 32, 3

     4-         S 12(32, 32), 521(22,32 1,522(32,32), 8(32, 32, 12),'
     5         C( 32 ,32, 12) tSVAL(32),QPR{32),GCU,6,12),GAVl4,8,i2

     6          GSO(4, 3, 12) ,GSKEW(A,8,12),GCLRT(4,S,12)
  2CO REAO(5t5CCO)^YR,NYRG,NSITES,NTRA.Nf IRAN.ISAVE.IPARAM.MPRINT,

 5000 FGRMAT(9I5)                                           HIST
      IFtNYR.EC.GJGC TO  50
      CALL WFLOw(NYR,NSITES,3, IHIST)
      N=4»l\SITcS
      CALL TRA,\S(NYRfMSITES,NTRANtC,XQAV,XGSC,XSKEW.XCURT,CAV,CSD
                                                           t S K £ •! »
     1           CURT,AC,-ASI,BCC,QEST,      QVAR)
      CALL CUT2
      CG 1C J=l,12
      CALL COR=LJNYR?NSITE£,C,CVAR,SllfS12,S2l,S22,J)
      CALL S(32,4,S22iS22,0,N,\,OtTAG)
      CALL S(32»3,Bllf l,J)fS12.S22tN,M,N,0)
      CALL S (32, 3, S 22, 3 (l.l.JJ , S21 , N,N ,N,0)
      CALL S(32,2,Ct 1, UJ) , S1L ,S22,,N ,.'M ,i\ f 0)
      CALL EIGEN(32,C( lil, JJ.EVALiNtN)
      DO 10 I=l,\
      XL=0.
      IF(EVAL( I l.LE.O. )GG  TC  11
      XL=SGRT(tVAL( I ) )
   11 DO 1C 11 = 1, N
   10 C( II, UJ )=Cl I 1,1 , J )*XL
      CALL CUTA(,NSITES,CEST,CVAR)
      CALL CUT5(NSITES,E,C)
      IF( IPARAy.GT.OJCALL CUTP ( NSI TES, QEST, QVAR ,B ,C )
      GO TC ICC
   50 CALL lNP«,\SITES,OESTfCVAR,B,C)
  100 IFdNYRG.LE.OJRETURN
      IFIISAVE.GT.OIREWIND  9
      CALL STAl(NSITES,GAVfGSD,GSKEU,GCLRT)
      N=4»NSITES
      CALL RAN (IRAN,N,S1L)
                    ,,
      CALL S{32,3,QPR,C(l,lt12)tSll,?JtNfl-,0)
      CALL S(32, 10, CPH,C,0,N, 1,6,0) '
                             A4-88

-------
     DO 101 K=i,NYRG
     CALL GEN ( IRAN , .\S I TES , CPR » B tC , GQ, i\PRINT )
     CALL I IRAN (NSITES,NT*A,VJ,GU,QVAR,GEST,GAV,GSQ,GSKEW,GCURT)
     IF(NPRINT.LE.O)GO TG  160
     WRITE (6,6C01) K, ( ((GC{J,L*I ) , 1 = 1, 12),J = 1,4) ,L=1,NSITES)
6C01 FORMAT (//1X,"GENERATED  FLQViS  FOR YEAR' ,I3/(1X,12G10.3 ) )
 160 IF{ ISAVE.LE.O)GC  TO  101
     WRITE(9)(((GO(LtJ,I)fJ=liNSITES)fL=lf4),!=lf12)
 101 CONTINUE
     CALL STA4(.\SITES,GAV,GSD,GSKEk,GCtRT,;NYRG)
     CALL CUT6(NSITES,GAV,GSO,GSKEW,GCURT)
     IF ( ISAVE.LE.O)  CALL  EXIT
     END  FILE 9
     REWIND 9
     CALL EXIT
     END
     SUBROUTINE GEN( IR AN , ,N S I TES ,-CPR , B ,C ,GC , NPR I NT )
     DINENSILN GPR(32),GQ(32,12),B(32,32,12),C{32»32»12),R(32),
    IGQK32.12)
     N=4«NSITES
     XN=N
     CALL S(32,io,CPR,C,C,\,1,6,0>
     DO 10 J=l,12
     CALL RAM IRAN,N,R)
     DO 21 K=l,i\
     GQ(K,J)=0.
     GQ1(K,J)=C.O
     co 2C K=I.N
     GQ(K,J)=GC(K,J)+C(K,V,J)**(M)
  20 GQl(K,J)=GGllKfJ)+B(K,M,JJ*QpR{M)
  21 GQ(K,JJ=GG(K,J)+GC1(K,J)/XM
    - EG 10 K=lt.\
  10 GPR(K)=GG{K,J)
     RETURN
     END
     SUBROUTINE COREL(KYR,NSITES»G,GVAR,SI 1,S12i5211522 , J)
     DIMENSIU'M Q(50,4, 12, £), 511(4,8, 4,8), 512 (4,8,4,3), 521(4, 8,4,
                                                           8),
    1          522(4,8,4,8) ..T11K) iT22(4) ,T12(7) ,CV4R( 12,8) tNM(7
                                                           )
     L          ,SL12(7) ,SLL12(7),SUNL1(4),SU,VLLU4) , SUVL2(4),SUML
                                                           L2(4)
     DATA NM/1,2,3,4,3,2,I/
     N=4»NSITES
     JJ=J-1
     IF(J.EQ.l)JJ=12
     DO 1C  I=1,NSITES
     DO 10  II=1,NSITES
     DO 5 P=l,7

     SLL12(M)=C


                               A4-89

-------
 5 T12(M)=C.
   CO 6 P=l,.
   T11(M=0.
   SUMLL1(M)=0
   SUML2(M)=C
   SU.VLL2(K)=0
 6 T22(M=0.
   CO 20 L=l,4
   00 20 LL=1,L
   MaL-LL+1
   DO 2C K=1,NYR
   Tll(M) = Tll(MUQ(K,LiJ,n*t;(K,LL,J,II}
   SUMLl(M)=3UMLi(M)+Q(KiLf Jf I )**2
   SUMLLim = SUfiLLl{M + C(KtLLfJ»II)«*2
   KK = K
   IF(JJ.LT.12)GC TO  21
   KK=K-1
   IF(KK.LT. 1 )KK=NYR
21 T22(P)=T22{M)«-C(KKtLiJJiI)»Q(KKiLL»JJ.II)
   SUML2(^)=SUN'L2(M)+G(KK,L,JJ, I )**2
20 SUMLL2(H)=SUMLL2 (M)+C(KK,LL,JJ,II)»«2
   DO 25 L=l,4
   DO 25 LL=li4
   N = L-LL<-A
   DO 25 K=l,.\YR
   KK=K
   IF( JJ.LT. 12JGG TO  2A
   KK=K-1
   IF(KK.LT . DKK = iNYK
2A T12{r)=T12(M)+Q(K,L, J, I )»C(KK,LLt JJ.II J
   SL12(M)=SL12(M)+Q(K,L,J,I)**2
25 SLL12(M)=5LL121M)+G{KK,LL,JJ,II)**2
   DO 30 M=lr4
30 T22(M)=T22(M) / SORT ( SUVL2 ( M ) *SLMLL2 ( M ) )
   CO 35 M=l,7
35 T12(M) = T12(H) /SORT ( SL 12 ( M J»SLL12 ( M J )
   CALL CUT3( Til, T12, I, II, J)
   DO 40 L=lt4
   CC 40 LL=L,L
   M=L-LL+1
   S1KL, I,LL, II )=Tll(K)
   Sll(LLiIfL,II)=Tll(M)
   S22(Lt IiLLi II )=T22(M)
40 S221LL, I ,L, II )=T22tM)
   00 10 L=l,4
   DO 10 LL=1»4
   P=L-LL+4
10 S12(Lt I,LL, II 3=T12(M)
   CALL S(32f6,S2lfS12tCfNfNfOtO)-
                           A4-90

-------
   RETIRIS
   END
   SUBROUTINE TR ANS { NYR , NS I TES, NTRAN , Q , XQA V, XQSD ,XSKEW , XCURT,
  1                    QAV,QSD, SKEW, CURT, AC, ASI ,BCC,QEST      ,
                                                        QVAR)
   DIPEi\SICi\ (*(5C,4, 12,8) ,.XQAV(4, 12,8), XQSD(4, 12,3 J ,X SKEW (A, 12
                                                        t8),
  1          A0( 8), AS I (6, 8) , BCD (6, 3) ,QVAR( 12,8) , XCURT14, 12,3) ,
  2          QAV(4,12,8 ),QSD(4,12,8),SKEW(4,12,S),CURT(4,12,8)

  3          GEST(4,12,9)
   DO 1Q I=1,NSITES
   CO 5 J=l,12
   00 5 L = li4
   CALL ^EA\(Q(1, L, J, I ) , NYR , XGAV ( L , J , I ) , XQSD ( L , J , I ) , XSKEV, ( L , J ,
                                                        I),
  1          XCURKLt Jt I))
   IF(NTRAj\-2)4,20,3C
20 CO 25 K=1,NYR
25 C(K,L, J, I )=ALOG(QCK,L, J, I ) )
   GO TC A
30 CO 35 K=1,NYR
35 G(K,LfJf I) = SQRT(Q(K,L,J, I) )
 4 CALL MEAN(U(1,L,J, I) , NYR , QAV ( L , J , I ) , QSDl L , J , I ) , SKE W ( L , J , I ) ,
  1           CURT(L,J,I))
 5 CONTINUE
   CALL FCGEF(CAV(1, 1,1 ) , AS , 6 , AC ( I ) , A SI ( 1 , I ) , BCO ( 1 , 1 J ,QEST(l,l
                                                        t I))
   CO 40 J=l, 12
   DEV=0.
   CO 45 L=l,4
   DO 45 K=1,NYR
   X=Q(K,L,J,I )-CEST(L, J,I)
   DEV=DEV-i-X**2
45 Q(K,L,J, I )=X
   GVAR{ J, I )=SQRT(DE\//FN)
   DO 40 L=l,4
   CO 40 K=1,NYR
40 G(K,L, J, I )=Q(K,L, J, I )/GVAR( J, I )
10 CONTINUE
   CALL CUTKNSITESiNTRAN.XCAV.XCSD.XSKEWtXCLRT.CAVtCSD.SKEWfC
                                                        URT)
   RETURN
   END
   SUBRCUTINE HFLOW  ( NYR , NS I TES , G » I H I ST )
   DlfEr.SIUN G(50»4, 12, S)
   IF( IHIST )4,4, 14
 4 10=12
   GO TC 15
14 10=5


                           A4-91

-------
  L5 CO 2C I=liNSITES
     00 20 K=1,NYR
     DO 20 J=l,12
  20 REACl ICi^CCO) ( Q ( K i L t J , I ) » L = l , 41
5000 FORMAT ( 14X ,4F 8. 2 )
     RETURN
     END
     SUBROUTINE ITRAN ( NS I T6S , NTRAN ,GQ i GVAR ,GE ST, GAV ,GSD, GSKEW , GC
                                                          URT)
     DIMENSION GQ(4f8,12),CVAim2i8)tv,'ESTU,12,a) , GAV (A, 8, 12) ,
    L          GSD(4,8,12),GSKEW(4,3,12),GCURT(4,a,12)
     DO 1C I=1,NSITES
     DO 1C J=I,12
     DO 10 L=L,4
     GQILt It J )=GO( Lt I , J J»CVAR( J,I )+QEST(L, J, I )
     IF(NTRAN-2) 10,20, 3C
  20 GQ(L,I , J)=EXP (GQtL, I , J) )
     GO TO 10
  30 GQILt I, J)=GQ( L, I, J)**2
  10 CONTINUE
     CALL STA3 ( NS I TES , GG , GAV , GSD , GSKEU , GCURT )
     RETURN
     END
     SUBROUTINE RAN(IX,N,R)
     DIMENSION Rtl)
     DO 10 I=I,i\
     R( I J=0.
     DO 20 J=l,12
     R( I )=R( I ) + RRN ( IX )
  20 CONTINUE
  10 R( I )=R( I )-6.
     RETURN
     END
     FUNCTION  RRN( IX)
     IX=IX*63539
     IF( 1X15,6,6
    5 IX=IX-t-214748
    6 RRN=IX
     RETURN
     END
     SUBROUTINE  STA 1 ( NS I TES , GAV , GSD , GSKEW , GClRT )
     DIMENSION GAVU,3,12),GSO(
-------
   RETURN
   END
   SUBROUTINE STA3 ( NS I TE S , GQ , G AV ,GSC ,GSKE'ri , GCURT )
   DIMENSION GAV(4,8,12),GSD(4fa,12) .'JSKEWK, 8, 1 2 ) , GCURT (4 , 3, 1
                                                        2)
   Clf ENSILN GCI 4,8, 12)
   CO 20 J=l,12
   CO 20 I=l,NSITES
   DO 20 L=l,4
  ' X=GQ( L, I , J)
   GAVlL.I , J)=GAV(L, I, J )+X
   X=X*GG(L, I, J)
   GSD(L, I, J ) = GSC(Lt UJ )+X
   X=X*GG( L, I , J)
   GSKEV, (L, I , J ) = GSKEML, I , J )+X
   X=X*GQ(L, I, J)
20 GCURTIL, I , J J = GCURT(L, I, J )+X
   RETURN
   END
   SUBROUTINE ST AA ( MS I TE S , GAV, GSC .GSKEW , GCbRT, N )
.   CIMENSIdN GAV (A, 3 ,12) ,GSD( A, 8f 12) ,GSKEV,l ^,3,12) ,GCURT(4,3,1
                                                        2)
   DO 30 J=l,12
   CO 30 I=1,NSITES
   00 30 L=1,A
   GAV(L» I , J) = GAV(Lt I. J J/.M
   GSDJLiI i J J=GSD(L, I t J ) /iM
   GSKEWIL, I,J ) = GSKEU (L,UJ)/N
   GCURT(L, I f J) = GCURT(Lf I, J ) /N
   GCURT(L, IfJ) = GCURT(L»IfJ)-A»GSKEV^(LtIrJ)*GAV(LtIf.J) +
  L                6«GSC(LfIfJ)*GAV(LiItJ)*»2-3*GAV(LfItJ)«»A
   GSKEW (L, IfJ) = GSK£W(Lt It J)-3*GSD(L ,I,J)*GAVIL,I,J)^
  1               2*GAV(L, I, J )»»3
   GSD(LiIiJ) = SCRT(AES
-------
      ENC
      SUBROUTINE IMP (NS I TESiQESTt-QVAR ,Q (C )
      DIMENSILX CEST(4,12,S),QVAR{12,3),6(32,32,12),C(32,32,12)
      N=4*NSI FES
      NTAPE=LO
      REWINC i\TAP£
      READ (NT APE }(((QEST(L,J,I),L=l,4)fJ=l,12),!=l,NSITES>
      REAC( NTAPE) { ( GVARU, I),J=l,12),I=l,NSITES)
      READ! \TAPE) ( ( (BIJ.K, I ) , J=1,N) ,K=1,N) ,1 = 1, 12)
      READ ( MAP E) ( ( ( C( J , K , I > , J= 1 , N ) ,K= 1 ,M ) , 1 = 1 , 12 )
      REWIND ,NTAPE
      RETURN
      END
      SUBROUTINE N!EAN(X,N,AV,SD,S3, 34}
      DIMENSION X(l)
      S3 = 0.
      S4=0.
      00 10 I-l.N
   10 S4
      AV=AV/N
      SD = SC/i4
      S3=S3/N
      S3 = S3 - 3*SC*AV  *  2*AV**3
      SO = SQRT( ( (SD-AV**2)*N)/IN-1)
      S3=S3/SC»*3
      RETUR^
      END
        SUBROUTINE  EIGEM I C I M , A , EVAL , N t M )
C
C     EIGENVALUES AND  EIGENVECTORS OF  A  REAL SYMMETRIC MATRIX
C
      DIFENSICN A{ I DIM, ID If) ,B(60,60) ,EVAL< I DI,V } , S ( 60 ) , C ( 6C ) ,
     1          0(601, lNC(6C)tU(60)
       CCUBLE  PRECISION  ANGRM, AMORM2, TAU ,P ,0 I AG < 60 ) ,VALU(6Q) ,VALL
                                                            (60) ,
     1  Tit T2, F, SURE RD( 60), 0(60) , OS I , DCO , BETA
C
C     CALCULATE NORM OF  MATRIX
C
       MAXIT=  5C*N*N
       IT = C
    3 ANOR^2 = 0.
    4 DO 6  1=1, N

                              A4-94

-------
c
c
c








c
c
c










5
6
7

9
10
12
20'
25
30
35
40

DO 6 J=l
ANORM2 =
ANORN" =C
GENERATE

IF
CO
DO
IF
B(
GO
B(




(
4

M)
0 I

i
=
40 J =

I
(
i
I-J
J )
)
=
S

G
1
1


N •
A NCR
CRT
I DEN

t
,
,
3
1

4
N
N
5
•

5,


,2

M2 + At I, J )*»2
( ANORM2 )
TITY MATRIX

10


5,35

TO 40
I
CON


,
T

J)
=

0
•


INUE


PERFORM

45
50
52
55
60
65
70
75

1910

IE
KM
IF
DO
II
DO
Tl
T2
I

X

I

T =





RCT

1





AT



ICNS TO REDUCE VATRIX TO JACOBI FORM
.

- N-2






F
(
L
=
1
=
=
(
N !\ )
60
I
6C
A(
A(
T2)
890
I
+
J
I
I

=

=
,
*
1
T^DSCRTt
cc=















c
c
c






90
95
ICO
105
110
115
120
125
128
130
135
140
150
160


CO
T2
At
At
DO
T2
A(
A(
IF
DO
T2
B(
81
S
I
Tl/
T
= T2/
105

K
K


J
I



K
K
=
,
,
1
=
,
+
(
1
=
,
,
CONT



MOVE

170
180
190
200
210

DO
CI


CO
J)
1 + 1
25
CO
K)
ItK
M)
5C
CO
J)
1 + 1
K


T
-
*
1
2
I
I
J
9
T


1
A
•»

I
+
)
,1
!\N

iN
1)

10,
1


?
(
**


N
K,
= CO *
)
K


=
*
=
1
A

,
(
= CO
)
1
K


3
—
*
=
C
1
r>
u

,
i
(
= CO
)

3

T2
N
1 +
*
T2
70,55





160, 191 C
2 +T2**2)



I+1)+SI «A(K,J)
A(K,J)-SI *A(K,H-1)


1 ,K) + SI *A( J,K)
A(J,K) - SI »A( I + 1,K)

160,130
N
K,
*
T2

1+1 ) + SI *DtK, J)
BlKt J) - SI *B(K, H-l)

IKUE



JACO

200

I

i

B

1
AG( I) =
VALU
VAL
00

L
2
(I)
( I)
30

I

,
A

E

N
(I

LEMENTS AND INITIALIZE EIGENVALUE BOUNDS


,1)
= ANORM
= -ANORM
I
=
2
,
N

A4-95

-------
  220 SUPERCtI-l) = At 1-1, I )
  230 Q(I-l) = (SUPERD( I-l ) )»»2
C
C     DETERMINE SIGNS OF PRINCIPAL  f
C
  255 TAU = 0.
  240 I = 1
  260 MATCH = C
        IT=IT+1
  270 T2 = C.
  275 TL = 1.
  277 DO 45C J=l,N
  280 P = CIAG(J) - TAU
  290 IF (T2) 300,330,3CC
  300 IF (TL) 310,370,310
  310 T = P*T1 - G(J-i)»T2
  320 GO TC 410
  330 IF (Tl) 335,350,350
  335 Tl = -1.
  340 T = -P
  345 GO TC 410
  350 Tl = 1.
  355 T = P
  360 GO TC 410
  370 IF (G(J-l)) 380,350,380
  380 IF (T2) 4CO,390,350
  390 T = -1.
  395 GO TC 410
  400 T = 1.
C
C    COUNT AGREEMENTS IN SIGN
C
  410 IF (Tl) 425,420,420
  420 IF (T) 44C,43C»43C
  425 IF IT) 43C,440,440
  430 MATCH = N'ATCH + 1
  440 T2 = Tl
  450 Tl = T
C
C     ESTABLISH  TIGHTER  BOUNDS  CN  EIGENVALUES
C
  460 DC 53C K=1,N
  465 IF (K - MATCH) 47G,,470,520
  470 IF (TAU -  VALL(K)) 530,530,480
  480 VALL(K) =  TAU
  490 GO TU 533
  520 IF (TAU -  VALU(K)) 525r530r530
  525 VALU(K) =  TAU
  530 CONTINUE
  540 IF (VALUI) - VALL(I)  -  5.0D-8)  570,570,550
  550 IF (VALLUM 560,580,560
                                A4-96

-------
  560 IFtDABS (VALL(I)/VALL(I) -  1.) -  5.0D-8)  570t570i580
  570 I = I + 1
        IT = C
  575 IF ( I - ,\!) 540,540,550
  580 TAU = (VALL(I)  + VALHIJJ/2.
        IF(IT-VAXIT)  260,260,581
  58 L  WRITE(6i6C01)IT,I,VALL(I)fVALLMI)
 6001  FORNAT(15h MAXIT  EXCEEDED,2 I 10,2E20.8}
       GO TO 570
c
C     JACCBI EIGENVECTORS BY  ROTATIONAL  TRI ANGULAR IZAT ICN
C
  590 IF IM) 593,890,593
  593 IEXIT = 2
  595 DO 610 1 = 1, N
  600 DC 610 J=1,N
  610 AC I i J) = C.
  615 DC 350 I=1,N
  620 IF (1-1) 625,625,621
  621 IF (VALUU-L) - VALU(l) -  5.CD-7)  730,730,622
  622 IF (VALU(I-l))  623,625,623
  623 IF(DABS 
-------
  840 PRODS = - PROCS*S( II )
  850 A( It I ) = PRODS
C
C     FORM MATRIX PRODUCT  OF  ROTATION M/TRIX WITH JACOBI  VECTOR  M
                                                            ATRIX
C
  855 CO 885 J=1,N
  860 DO 865 K=ltM
  665 UIK) = ACK,J)
  870 DO 885 1=1, N
  875 A( I t J ) = 0.
  880 DO 885 K=1,JM
  885 A(I,J) = 3(I,K)*U(K)  +  A(UJ)
  890 GO TC 941
  941     CO 945 1=1, N
  945  EVAL(I)=  VALU(I)
         RETURN
        END
      SUBROUTINE FCOEF ( X ,.N SP , NFREQ , AO , AS ,BC f XE ST }
      DIMENSION X(48),XEST{48),AS{6),BC(6)
      T=NSP
      W=2.»3.1416/T
      AO = 0.
      DO 5  1=1, NSP
    5 AO =  AC * X( I )
      AO =  AC/FLQAT(NSP)
      DO 10 M=l,NFREC
      AS(N) = 0.
      BC(M) = C.
      TA = C.
      TB=0.
      DO 15 1 = 1, NSP
      WT =  ^*FLCAT( I*M)
      AS(M)=AS(rM+X ( I )*STA
   15 BC(fM=BC(M)+X( I)*STS
      AS(M)=2.»AS(M)/T
   10 EC(M)=2.ȣC(M)/T
      X2 = 0.
      DO 20  1=1, NSP
      X2 = X2  t  X( I )**2
      XEST(I)  =  AO
      00 20  M=liNFREQ
      WT = W*FLCAT( I*M )
   20 XEST(I)  =  XESTII)  +  AS(M)«SIN(WTJ+BC(M)»CGS(V*T)
      RETURN
      END
      SUBROUTINE  S { KT , NN , A , B , C , I M , JK , KN , QET )
      DIMENSKi\  A(KT,KTUB(KT,KT),C(KTtKT),IN(100),Eyp(lOO)
      IMAX=IM
                               A4-98

-------
    JMAX=JM
    KMAX=KM
    GO TO(30,32,34,36,38,40,42,44,46,50,52),NN
 30 00311=1, !,VAX
    C031J=1,JMAX
 31 A( I,J)=6(I,J)+C(I,J)
    GO TC 805
 32 DQ33I=L,IMAX
    C033J=1,JNAX
 33 At[,J}=3( I,J)-C(I, J)
    GO TG 805
 34 D0101I=1,IMAX
    C035J=L,KMAX
     EMP{J)=0.
    C035K=1,JKAX
 35  EtfP(J)= EMP(J)+B(I,K)*C(K,J)
    COiOLK=l,KMAX  .
101 A(I,K)= EKP(K)
    GO TC 805
 36 00371 = 1, If-'AX
    C037J = 1, U'AX
 37 A(I,J)=B(I,J)
 59 IN(1)=0
    IMAXC=IKAX-1
    TEMP = A(1,1 J
    D070I=2tIFAX
    IF(ABS  (TEMPJ-A8S (A( 1, 1 )))71,70,70
 71 IN(1)=I
    TEMP=A(1,1)
 70 CONTINUE
    IF(IN(1) )73,72,73
 73 IS=IM 1 )
    COTAJ=1,IPAX
    TEMP=A(1,J)
    AlltJ)=AtIS.J)
 74 ACISiJ)=TEMP
 72 IF(A(1,1)J98,59,98
 98 00751=2,I^AX
 75 At I,1) = A( I.D/All.l)
    001001=2,IWAX
    IPO=I-H
    IMO=I-1
    D080L=1, It'Q
 80 At I, I)=A(ItI)-(A(L,I )*A(I,L) )
    TEMP=A(1,1)
    IFt I-IMAX)55,83,55
 55 IN(I)=0
    D081IS = IPC, IMAX
    C085L=1,IMU
 85A(IStI)=A(IS,IJ-A(L,I)»A(ISiL)
    IFIA3S  (TENP)-ABS (A{IS,I)))82,81,81


                               A4-99

-------
 82 TEMP=A( IS, I )
    IN( I) = IS
 81 CONTINUE
    ISS=IN(I)
    IF( ISS)84,83, 84
 84 D0886J=1, IMAX
    TEMP=A( I , J)
    A(I,J)=A( ISS, J)
886 A{ ISS, J J=TEMP
 83' IFIAl 1,1 ) 197,99,97
 97 IF( I-IMAX 154, LOO, 54
 54 D086IS=IPC,IMAX
 86 A( IS, I ) = A( IS, I )/Al I, I )
    0089JS=IPC, IMAX
    DQ89L=1, IMO
 89 A(I,JS)=A(I,JS)-(A(L,JS)«A(I,L})
100 CONTINUE
    D060CJP=1 , IMAX
    J=I(VAX+1-JP
    AUi J)=1-C/A( J,J)
    IF( J-D603, 700,603
603 D06COIP=2,J
    I=J+1-IP
    IPO=I+1
    TEMP=0.0
    D0602L=IPC, J
602 TEMP=TEHP-A( I ,L)*A(L,J)
600 A(I,J)=TEMP/A(I, I )
7CO 00151J=lf IMAXQ
    D0151I=JPC, IMAX
    TEMP=0.0
    IMC=I-1
    D0154L = J , IMC
    IF(L-J)152, 153,152
152 TEMP=TEMP-A(I,L)*A(Lt J)
    GO  T0154
153 TEMP=TEVP-A(I ,L)
154 CONTINUE
151 At I,J)=TENP
    D0901I=1, IMAX
    D09GCJ=L,IMAX
      EMP( J)=0.0
    D0899N=I , IMAX
    IF(N-J)899,897,898
898   EMP(J)=  EMP( J)+A(I,N)»AINiJ)
    GO  TC899
897   EMP(J)=  EMP( J)+A(I,NJ
899 CONTINUE
9CO CONTINUE
    D0901J=1, IMAX
                           A4-100

-------
901 A{ I,J ) = EKP( J )
    005001=2,IMAX
    M=IMAX+1-I
    IFllNlf))502i5C0.5C2
502 ISS = IMM)
    D0503L=1,IMAX
    TEMP=ML, ISS)
    A(L,ISS)=AU,M)
503 A(L,M=TEfP
SCO CONTINUE
    DET=0.
    GO TO 805
 99 ViRITE             (6,SC6 )
    CET=1.
606 FCRMAT(1::HO   SINGULAR  MATRIX)
805 RETURN
 38 00391=1,IKAX
    C039J = L, II^AX
 39 Al I, J)=E(I,J)
    N=INAX
    DET=1.
    11=1
  1 13=11
    SUf^AES (A( II, II) )
    0031=11,N
    IFtSUM-ABS (A( I,I 1)) )2,3,3
  2 13=1
    SUM=ABS (A( I, II) )
  3 CONTINUE
    IF(I3-I1)A,6,A
  4 D05J=1,N
    SOM=-A( I 1,J)
    A(II,J) = A( 13,J)
  5 At 13, J) = SUN<
  6 13=11+1
    D07I=I3,N
  7 Adi I1) = A( I,I1)/A( 11,11)
    J2=I1-1
    IF( J2)8,11,8
  8 009J=I3,N
    D09I=1,J2
  9 A(IliJJ=A(I1,J)-A(I1,I)»A{I,J)
 11 J2=I1
    Il=Il+i
    C012I=I1»N
    C012J=1,J2
 12 A(I,I1) = M I,I1)-A( I,J)*A{ J, ID
    IF( Il-NJ1,14, 1
 14 13=1
    J2=N/2
    IF(2*J2-N)15,16,15

                            A4-101

-------
 15 13=0
    DET=A(N,N)
 16 00171=1,J2
    J=N-I+I3
 17 DET = DET*MI,I)*A(J, J)
    GO TO 805
 40 IF( IMAX-JFAX)41,1C2, 1C2
 41 IP=IMAX
    GC TO 103
102- IP=JKAX
103 DG106K=1,IP
    C0104I=K,IMAX
104  EKP( I) = B(I,K )
    00105J = K, JN"AX
105 A(J,K )=u(K,J)
    C0106I=K, I.VAX
106 A{K,I)= EKP(I )
    GO TO 8C5
 42 C043I = 1 , If'^AX
    DC43J=1,JMAX
 43 A{ Ii J)=B( IfJ)
    GO TC 805
 44 C045I = 1, IMAX
    OC45J=1,JMAX
    Adf J)=0.
    B( ItJ ) = 0.
 45 C(IfJ )=C.
    GO TC 805
 46 ID=2
 20  READ (KN.AX,47)  INI 1 ) , INI 5) , EMP { 1 ) , IN( 2 ) , IN ( 6) ,EMPl 2 ) ,
   1   IN(3) , IN(7) ,EMP(3) , IN(4) ,.Ii\(8) ,EMP(4)
 47 FORMAT  (4( I 3, 13,E 12.8 ) )
    IF(IN(1))805,805,23
 23 GO 70(19,24),1C
 24 IJ/=IM1)
  •  JK=IM5)
    10=1
 19 00211=1,4
    I1=IM I )
    J1 = IN( 1 + 4 >
    IF( 11)21,21,18
 18 AUlf Jl>=  EMPt I)
 21 CONTINUE
    GO  TO 20
 50 DO  62 IP=1,JMAX,7
    JPO=IP+6
    IF(JPC-JMAX>61,61,60
 60 JPO=JKAX
 61 WRITE             (KMAX,63)(J,J=IP,JPO)
    DO  62 1 = 1,IMAX
    WRITE             (KKAX,64)I, ( A.{ I , J ) ,'j = I P , JPO )
                            AA-102

-------
  62 CONTINUE
     GO  TC 805
  63 FORMAT15HO  ROV<7( 8X ,41-COL . I 3 , 1 X ) )
  64 FORMAT(14,AX,7E16.9)
  52 00531=1,IfAX
     0053J=liJNAX
  53 At I,J)=B(I, J)»DET
     GO  TO 805
     END
     SUBROUTINE  OUT 1 (NS I TES,NTRANtXQAV,XQSD,XSKEW,XCURT,GAV,QSD,
    1                      SKEW,CURT)
     DIMENSION ATRAN(3 ) ,XGAV(4,12,8),XQSD(4,12,8),XSKEW(4,12,3),
    1            XCURTU,12,8) ,GAV(4,12,8),QSD(4,12,8),SKEW(4,12,
                                                          8),
    2          CURT(4,12,8)
     DATA ATRAK/4H  NO,AH  LOG,4HSCRT/
     WRITE(6,6CCG)  .
6000 FQRMAT{' 1«,26X,'STATISTICS OF  HISTORICAL FLOPS')
     WRITE(6,6C01)
6C01 FORMATI///10X,'SITES•,3X,•NONTH•,3X,'WEEK',6X,'MEAN',6X,»ST
                                                          D DEV ,
    1         AX,'SKEWNESS ' ,4X,'KURTOSIS'/)
     DO  1C I=i,,NSITES
     DO  10 J=l,12
     DO  10 L=1,A
  10 V4RITE(6,6002) I , J , L , XCAV ( L , J , I ) , XGSDt L , J , I ) , XSKEW ( L , J , I ) ,
    1               XCURTIL,J,IJ
     WRITE(6,6003)  ATRAN(NTRAN)
6002 FORNAT(I 13,17,I8.AG12.5)
6003 FORMATf•1«,33X,AA,' TRANSFORMATION'//
    1        22X,'STATISTICS OF  TRANSFORMED  HISTORICAL FLOWS')
     WRITE(6,6C01)
     DO  15 I=ltNSITES
     DO  15 J=l,12
     DO  15 L=l,4
  15 WRITE(6,6C02)I,J,L,Q/SV(L,J,I),QSC(L,J,I),SKEW(L,J,I),CURT(L
                                                          ,J,I)
     RETURN
     END
     SUBROUTINE CUT2
     DIMENSION NLI8)
     DATA NL/Oi1,2,3,4,5,6,7/
     WRITE(6,6C04)NL
6004 FORMAT(' 1',30X,'CORRELATION COEFFICIENTS OF TRANSFORMED HIS
                                                          TCRICAL
    1 FLO'wS1  ///1X,«SITE',3X, 'MONTH' ,8(7X,'LAG',I2),3X,'SITE'/)
     RETURN
     END
     SUBROUTINE CUT3(T11,T12,I , 11,J)
     DIKENSICN Til(4),T12(7)
     WRITE(6,6CC5)I,J,Til,II

                             A4-103

-------
     WRITE(6,6C06)I,J,112,11
6C05 FORMAT(I4,I7,2X,4G12.5,48X,. 16)
6006 FORMAT{I4,I7,14X,7G12.5,I6)
     RETURN
     END
     SUBROUTINE CUT4(NS ITES,QEST,CVAR)
     DIMENSION CEST(4,12,8),QVAR(12,8)
     WRITE(6,6C07)
6007 FORMATl'1',32X,'PARAMETER ESTIMATES - WEEKLY  MEAN'//
    1        17X,'SITE',5X,'PCNTH')
     WRITE(6,6C08)((I,J,(CEST(L,J,I),L=1,4),J=1,12),I=1,NSITES)
6008 FORMAT! 15X,I5,4X,I5,5X,4G12.5)
     WRITE(6,6C09)
6009 FORMAT!'I1|21X,«PARAMETER ESTIMATES - WEEKLY  STANDARD  DEVIA
                                                          TION1
    1      //30X,1 SITE1 ,5X, 'MONTH' )
     WRITE(6, 601C)( (I,J,QVAR{Jil),J = 1,12),1 = 1,NSITES)
6010 FORMAT(3CX,13,I9,6X,G12.5)
     RETURN
     END
     SUBROUTINE OUT5(NSI TES,B,C )
     DIMENSION D{32,32,12),0(32,32,12)
     N=4*NSITES
     WRITE(6,6011)
6C11 FCRMATl'I1,40X,"PARAMETER ESTIMATES - B')
     DO 30 J=l,12
     WRITE(6,6C12)J
6012 FORMAT(///48X,'MONTH',137)
     CALL S(32,10,BU,1,J),0,0,N,N,6,0)
  30 CONTINUE
     WRITE(6,6013)
6013 FORMATl ' 1' ,40X, 'PARAMETER ESTIMATES - C1)
     CO 35 J=l,12
     WR1TE(6,6C12)J
     CALL S(32,10,C(l,l,J)tO,0,N,N,6,0)
  35 CONTINUE
     RETURN
     END
     SUBROUTINE OUT 6 ( NS I TES , AUTOC , GAV , GSD , GSKEV;, GCLRT )
     DIFEINSILN AUTOC(4, 8,^,8,2,12) , GAV (A, 8, 12) ,GSD (4,8, 12) ,
    1          GSKEWU.8, 12) ,GCURT(4,8,12) ,NL ( 8) , MM C7 ) , Tl (A) , T2 (
                                                          7)
     DATA NM/1,2,3,4,3,2,I/
     DATA NL/0,1,2,3,A,5,6,7/
     WRITE(6,601A)
6014 FORMAT!'1',27X,'STATISTICS  OF GENERATED  FLOWS')
     WRITE(6,6015)
6015 FORMAT(///IOX,'SITE',3X,'MONTH«,3X,'WEEK',6X,'NEAN•,6X,
    1       'STD DEV',AX,'SKEVsNESS',AX,'KURTOSIS'/)
     DO 10 I=1,NSITES
     DO 10 J=l,12

                            AA-104

-------
      DO 10 L=l,4
   10 ViRITE(6,6C16)IfJ,L,GAV(L,JfI)iGSD{L,J,I),GSKEML,J,I),
     1           GCURKLfJi I)
 6016 FORMAT! 113, 17, 18, 4G12. 5)
      WRITE(6,6017)NL
 6017 FORMAK ' I1 ,29X , 'CORRELATION COEFFICIENTS  OF  GENERATED TRANS
                                                           FORMED
     1 FLOWS1///1 SITE1 ,3X, 'MONTH1, 8(7X, 'LAG1 iI2) t3X, 'SITE1/)
      DO 20 J=l, 12
     . DO 2C I=1,NSITES
      CO 20 II=1,NSITES
      DO 23 M=l,4
   23 T1(K)=0
      DO 24 M=l,7
   24 T2(M)=0
      DO 25 L=l,4
      DO 25 LL=L,4
      M=LL~L+1
   25 THM)=T1{M)+AUTQC(L,I,LL,II|1,J)
      DO 30 L=l,4
      DO 30 LL=1»4
      M=L-LL+5
   30 T2{M)=T2(y)+AUTOC(L,I,LLtII,2fJ)
      DO 35 M=l,4
      MM=5-N
   35 T1(M)=T1(M)/MM
      V
-------
A4.5  WASP - Watershed Simulation Program

A4.5.1  Purpose.
The basic requirement in the employment of simulation for watershed
analysis is a methodology or program logic which,  when given the
operating conditions and parameters, will adequately represent the real-
life interactions and print the results in usable form.  WASP is a com-
bination of a set of mathematical models which describe the primary
interactions of the factors and a program logic which links them all
together in a simulation of the river system.

In this study, the river flows and water quality are simulated.  Water
quality is dependent upon river flows and is, consequently, affected by
the results of the flow simulation.  Simulated flows are generated by
taking gage data generated by FLASH and transforming gage data into
unregulated stream flows at reach points in the stream.  Then, by appli-
cation of the operating rules for the devices and procedures which modi-
fy the flow in a stream, the regulated flows at each reach point in the
stream can be computed.  The waste loads are then applied and operated
upon by the river system to obtain the conditions of water quality at
reach points in the system.  The time series traces of regulated flows
and water quality parameter values for all points in the watershed are
the objectives of the simulation process subsequently described in detail.

The simulation program is controlled by WASP-MAIN which sets up the com-
mon blocks, reads control data and calls supporting subroutines.  The
program passes automatically from subroutine to subroutine to generate
simulated unregulated stream flows, regulated stream flows and water
quality  indicating values for each reach point.  This is done for any
number of years desired.  The program simulates the flow and quality for
the whole watershed for onex "weekr," prints out the results, then goes
to the next "week" and repeats the process, continuing "week" by "week1
until the number of years desired are traversed.

The first operation, to generate unregulated stream flows, makes use of
the program TFLOW which is described in A4.3.  The only modification in
TFLOW needed to adapt it for this use is to delete card #3 and card
#4 in the input for TFLOW-MAIN.  This deletes the requirement for esti-
mates and consequently no comparisons are computed.  The data input to
subroutine WEEKLY, for this use of TFLOW, must be the generated gage flows
from FLASH, the synthetic gage data generator.  The reader is referred
to A4.3 for the description of TFLOW and the basis for the computation
of the weighting factors which form the elements of the transformation
matrix which converts gage data to streamflow data at all reaches.

The values called QNAT, for natural flow, are generated by summing the
appropriate weight factors multiplied by their current week gage data:
                             A4-106

-------
                                 NG
                         QNAT.  -  I  w..  x.    	[Eq. A4.62]
                                 J-l   J   3
where:
        the generated flow at the upper end of reach i.
        the weight coefficient for the ith reach and j^ gage.
•X.*'   - the generated gage flow for jtn gage.
NG    ™ number of gages.
                                                              k
The program generates the weighting coefficients only once and they are
stored for use again for each week of simulation.  The weighting coeffi-
cients will remain unchanged as long as the configuration of gages used
is unchanged.  Additionally, the sequence of computation of the reaches
is set up once and used over and over again during the simulation.  It
takes a realignment or revision of reaches, and their numbering, to change
the sequence of computation.

The second operation in the simulation is the conversion of the unregu-
lated flows in each reach to regulated flows.  The subroutine REG and
its supporting subroutines superimpose the effect of any flow regulating
structures or operations on the unregulated flows to produce the desired
result - simulated streamflows.   REG accounts for the regulation of flow
by reservoirs and impoundments, the losses in reservoirs due to evapora-
tion, diversions made from the reservoir or river for water supply and/or
irrigation and discharges to the river bv waste producers.

The presence, of a dam and reservoir in a river system affects the flow
downstream, dc.pemHriR vinon ho'T the control facilities at the dam are
operated.  Control structures ar^ usn.il ly operated according to a fixed
scheme, called "reservoir operptinr riilos."  The onrrntivi? rules usually
are fixed for a riven rrnp.rvo.ir hut, because no two nre a] ike, anch
reservoir has its unique operating rules.  In this program, reservoirs
have been classified into five different types, according  to use, and
information needed to simulate operation is input to the program as a
series of parameters which are described in detail below.  It is not
intended that all reservoirs be forced into a five-type classification,
according to use, and more or different types can be added, if desired,
with only the proper attention to details.  The five types set forth
here will serve to indicate the manner in which the details are handled.

When regulated river flows are simulated, it is necessary  to- maintain
an inventory of volume  of water stored in each reservoir for each time
frame encompassed by the simulation period.  To do this, it is first
necessary to know the relationship between the volume of water in the
reservoir and the corresponding depth, and also the relationship between
                                A4-107

-------
the depth and area of water surface for all volumes from empty to full.
These can be developed by least squares fitting of actual reservoir data
and expressed in the form:

                          C • a + bD + eD2  ......... [Eq. A4.63]

and:

                          A - f + gD + hD2  ......... [Eq. A4.64]

where C and A are reservoir capacity and surface area, respectively; D
is the depth of water corresponding to C and A; and a, b, e, f, g and h
are constants.  Because the inventory is kept by volume, the equation
relating C and D is more useful in the form:
                         D = "b +             ........ [Eq. A4.65]


because C is the independent variable.  In this form:

                            m = b2 - 4ae    ......... [Eq. A4.66]

                              a " +4e   ........... [Eq. A4.67]

In maintaining the inventory, the new water volume, Ct+j_, is obtained by:

          ct+l = ct + QINt+l * EVAPt+l - RRELt+l - DIVt+l •  • [Eq. A4.68]

where QIN is the flow into the reservoir from upstream, EVAP is the evap-
oration correction, RREL is the volume released downstream and DIV is the
volume diverted elsewhere.  QIN is determined by simulation in the up-
stream reaches for time frame t+1, which is possible because the sequence
of computation is upstream to downstream.  Evaporation is computed by
substituting Ct into equation [A4.65] to get Dfc which is, in turn, used
to get At from equation [A4.64].  The evaporation losses are a function
of A  ana are described below.  Releases depend upon operating rules
whici are usually a function of Dt+1 or of (t+1) , while diversions are
independent demands which are expressed in time series relations .

Evaporation losses usually can be expressed as a sine function:

                       EVAP = a sin (L-b) + c   ....... [Eq. A4.69]

where E is in inches per square foot of reservoir surface area per week,
a is a constant, L is the current week in the year expressed as a time
angle, b is the lag constant and c is the mean annual evaporation.  If
weekly or monthly average evaporation data are available, a Fourier
                                A4-108

-------
series fit thereof having a single harmonic will suffice.   If pan data
are available for several years,  it would be more appropriate to include
a random term to account for the  variance in the data.   The formula then
would be:

                     E - a sin (L-b) + c + Rag    	[Eq. A4.70]

where R is a random number having mean a 0 and variance -1 and oe the
standard deviation of the evaporation data,

The volume lost to evaporation during the time frame is computed by the
relation:

                            QVAP  - C E A    	[Eq. A4.71]

where QVAP is in volume units for the time frame, C is a conversion fac-
tor to make units compatible, E is the evaporation rate in inches per
unit of time and A is in areal units.  If QVAP is in 10° cubic feet per
"week," E is in inches per "week" and A is in 10° square feet units, then
C - 1/12.

Diversions are volumes of water delivered out of the watershed or trans-
ported to a downstream reach not adjacent to the control structure.
Releases are discharges from the reservoir to the next downstream reach.

Diversions can be expressed in many different ways; i.e., they may be
constant with time or they may vary according to some determinable pat-
tern.  If historical data on diverted volumes are available, it is pos-
sible to approximate the pattern by harmonic analysis.  An auxiliary
program  is included in Appendix A2 which fits to the data a periodic
curve having up to six harmonics.  In any case, it is necessary either
to express the diversion mathematically, in terms of the "week" of the
year, or to provide a set of data cards, one for each week.  The coding
in this work is set up for the periodic curve of six harmonics.

Releases depend upon the volume of water in the reservoir, or the associ-
ated  depth, and any other additional .constraints imposed by watershed
management.  Releases are made according to operating rules which are,
in turn, dependent upon reservoir uses.

The five types of reservoirs, classified according to use, are  described
below.
           •

Type  I Reservoir.  The multiple purpose  reservoir is classed as Type  I.
The uses include, but are not limited  to,  flood  control, low flow aug-
mentation, recreation, diversions and  fisheries.  The generalized oper-


                               AA-109

-------
ating rules are:

(1)  All spillway overflows are released.
(2)  All storage In the flood control pool is released at a fixed rate
which will not damage any downstream property or facilities.
(3)  A minimum release rate shall be maintained.  Releases will be made
at this minimum release rate for all pool levels between the flood con-
trol pool and the minimum pool.  Store all net inflow in excess of this
minimum release rate when the water level is between the flood control
pool and the minimum pool.
(4)  When the water level is at or below the minimum, no releases or
diversions are made.
(5)  Diversions are made according to schedule, excepting when the water
level is at or below minimum.
                                              *-->A Spillway Level
         Flood Control Pool
         Diversion, Fisheries
         Recreation and Flow
         Augmentation Pool
                                                                Diversion
                                                                -—•——_
                                                                	
                                                                Release
Minimum Pool
Type II Reservoir.  The single purpose flood control and the dual purpose
flood  control  (primary use) and recreation (secondary use) projects are
classed as Type II. The generalized operating rules are:

(1)  All volume in excess of the minimum or recreation pool is released
according to formula rate or at net inflow rate, whichever is the lesser.
In many flood  control projects, the releases are made automatically through
open conduits  through the dam.  The conduits are sized to restrict the
flow.  The conduits act essentially as an orifice, releasing water as a
function of upstream depth, according to the relation:

                              Q » CHd   	[Eq. A4.72]

where Q is the discharge, H is the upstream head on the discharge conduit,
                                  A4-110

-------
C Is a constant depending  on conduit  size and  inlet configuration and
d is a constant usually having  a value of about 0.5.
(2)  All net inflow is held when the  reservoir level is below the auto-
matic outlet structure.
              Flood  Control  Pool
                                                          Type II
Type III Reservoir.   The Type III reservoir is the lake or impoundment,
having a controlled outlet, which is used primarily for recreation in
the summer, but in the winter the level is drawn down to protect the
shoreline facilities from winter ice damage and to afford some incidental
spring flood protection.  The operating rules are dependent upon the time
of the year.  The schedule set forth below is one that might be typical
in New England.  If the operating schedule is different for another
location, one has only to change the "week" indices to alter it as
desired.  The operating rules are:

(1)  Starting October 1, release all net inflow plus that volume in ex-
cess of the winter storage, the excess volume releases to be spread out
over the four week period between October 1 and November 1.
(2)  From November 1 to April 1, release all water in excess of the win-
ter storage volume.
(3)  From April 1 to October 1, hold all net inflow excepting that which
causes overflow of the summer storage level.
            Recreation Pool (Summer)
            Flood Control (Winter)
            Winter Pool
                                    A4-111

-------
 Type  IV Reservoir.   A Type  IV reservoir  is  a water  supply  reservoir where
 water is impounded  for diversion to  a  location  outside  the watershed or
 to  a  point  downstream which is not adjacent to  the  dam.  The  operating
 rules are:

 (1) Hold all  net  inflow excepting that which causes overflow  of  the
 spillway.
 (2) Divert  according to a demand schedule.
          Diversion Pool
                                                          Type IV


                                                              Diversion
Type V Reservoir.  The hydro-power, cooling water impoundment or flow
augmentation projects are classed as Type V reservoirs.  These impound
water for release to the adjacent downstream reach and subsequent flow
down the normal watercourse,  In this type, the operating rules are:

(1) Hold all net inflow excepting that which overflows the spillway.
(2) Release according to a demand schedule.
As the computation proceeds down the watershed according to the internal
sequence, the regulating effect of each reservoir, flow discharge or
withdrawal upstream is added algebraically to the unregulated flow to
determine the regulated flow:
                                   A4-112

-------
                                  NR        N
                QREG.,  =  QNAT., +  £   DQ^  +  E   IQk  .....  [Eq.  A4.73]
                                       J
        The regulated flow in reach i.
QNAT.£ • The unregulated flow in reach i.
DQj   - The regulating effect of reservoir j.
NR    = Number of reservoirs upstream of  reach i.
IQk   = The irrigation withdrawals or waste discharges, k.
N     = Number of irrigation withdrawals  or waste discharges upstream of
        reach i.

The third operation in the simulation is  to compute the water quality
data.  In this study, only the oxygen demand and dissolved oxygen  con-
centration parameters are considered.  The subroutines QUAL and RQUAL
make the necessary computations to simulate water quality in a reach
which does not contain a reservoir and one containing a reservoir,  res-
pectively.

The mathematical relationships used in the subroutines QUAL and RQUAL
are developed in Section 6.6 and the results are repeated here for ready
reference.  Modified Streeter-Phelps equations are used to compute BOD
and dissolved oxygen values at each reach point in the watershed.   The
BOD equation is :

                                 £ ] a"*!* +  .     ......  [Eq. A4.74]
where:

L.  =  the BOD  at the downstream end of reach  i.
L"  =  the BOD  at the upstream end of  reach  i.
r  =  the M-P  (Moreau-Pyatt) (5) BOD  error  term.
K£  =  the deoxygenation velocity constant,  days~^.
t  =  time,  days.
e  =  the natural  logarithm base.

The dissolved oxygen  deficit equation is:
          Dl -       [e-e] +     (l-a)  +         .  [E,. A4.75]
                2"~ 1                   2
 where :
 D  = the dissolved oxygen deficit at the downstream end of reach i.
 5"" = the dissolved oxygen deficit at the upstream end of reach i.
 KJ • the reoxygenation velocity constant.
 s  • the M-P reoxygenation error term, and
 other variables  are as defined above.
                                   AA-113

-------
Where K^ = I^,  the  BOD equation  is  unchanged, but:

                                                   ......  [Eq. AA.76]
where all variables are as defined above.

Where the reach is a reservoir,  the assumption is made  that there is
complete mixing in the reservoir.  Based upon the development in Section
6.6, the BOD and dissolved oxygen deficit equations are, respectively:
"
                                            ) + Z£i.j  '  '  '  '
and:
where:

A      - K-L + w + K3.
W      - Qout/volume of reservoir.
Z      - QIN/volume of reservoir.
K3     =• a velocity constant for settlement of organic solids.
B      • K2 + w.
L.  .   » BOD concentration leaving reservoir i, during the jth time
         frame.
L.  ._, - BOD concentration leaving reservoir i, during the (j-l)th
  '      time frame.
L^  ^   • BOD concentration in water entering reservoir i during time
         frame J.
°-i  1   " D0 concentration in water leaving reservoir i, during jth time
         frame.
D.  . , »DO concentration in water leaving reservoir i, during (j-l)th
         time frame.
DJ  j   «DO concentration in water entering reservoir i during ith time
  '      frame.
K-i     • deoxygenation velocity constant in reservoir.
Ko     • reoxygenation velocity constant in reservoir.
t      » time.
e      • natural logarithm base,
                                  A4-11A

-------
Mass balance principles are used in the computation of the BOD, DO deficit
and Ki of the water entering the reach or reservoir.  The equations are:
                          N


                         .A    ,.1 Qi,J + L*i ^i   ..... [Eq. A4.79]
                         =  Si,J*i,J + Dwi ^i
                                       : -     ......  [Eq,  A4.80]

       N
       *  Kli,j
KH - J"1  N -  .....  [Eq. AA.81]
                                        +Klwi
where:

LJ      « incoming BOD  concentration  in  reach i.
LJ  j    * BOD  concentration  in  lower  <^nd of  tributary, j  which flows into
"        the  upstream  end of reach i.
Q.  .    - flow entering reach i from  tributary j.
N      • number of  tributaries converging at the  upper  end of reach i.
    i    = BOD  concentration  in  waste  entering upper end  of reach i.
   *i    » flow rate  of  waste entering upper  end of reach i.
        - incoming   DO'v deficit in reach i.
Bi 1    = DO deficit in lower end of  tributary j which flows into the
   '      upstream end  of  reach i.
Kl i    * the  deoxygenation  velocity  constant in reach i.
Klji,j  = the  deoxygenation  velocity  constant in reach j which is tribu-
          tary to the upper  end of reach i.
        " the  deoxygenation  velocity  constant of the waste discharged at
          the  upper  end of reach i.             *
Q'ij    - corrected  flow (see below).

Note  that Q'^j B 0  if  K^ij  » 0 for  tributary j; i.e., additional flow
 does  not "dilute"  the  value of K^,  as  it does for BOD and DO deficit.

 An important  factor in water quality considerations is temperature.  As
 described in  Section 6.3,  temperature  variations  can be characterized by
                                                             (

                                  A4-115

-------
a sine curve having a single period of one year.  In general, records of
river water temperature at several points in a watershed often are not
available.  For  this reason, and because river systems which do not con-
tain large summer-stratified reservoirs have nearly constant temperatures
throughout their length, this simulation model assumes that temperature
is constant throughout the system length for any given time frame.
Temperature is varied from time-frame to time-frame according to a sine
curve:

                   T(L) - f + A sin (L+C) + R «TT	[Eq. A4.82]

where:

T(L) = the temperature during the Lth week of the year.
f    = the mean at all historical temperature observations.
A    -a constant.
L    = the week of the year; when used in the argument of the sine func-
       tion, L is expressed as a time angle.
C    = phase constant.
R    = standard normal random deviate N(0,l).
OT   ** standard deviation of historical temperature data.

The values of A and C are developed by a least squares fit of the his-
torical data to the sine curve.  The program is set up to receive data
items T, A, C and a-j"  The random numbers are generated internally.

In locations where temperature data are available and indicate that more
precision is possible by computing temperature variations by region or
reach, it is possible to modify the program as set forth here to make
use of the data available.

Another important factor in considerations of oxygen balance in a stream
is the reoxygenation velocity constant, I^.  The source of oxygen for
replenishing oxygen used in the water is from the air, at the air-water
interface.  The value of K£ depends upon the mechanism for transport of
this reoxygenated surface water into the depths.  The reoxygenation veloc-
ity constant is directly proportional to the velocity of water flow in
the river and inversely proportional to the depth.  The constant is also
temperature dependent.

If there is available a considerable fund of water quality data for a
stream, along with corresponding flow data, it is possible to develop
Ko-flow-temperature relationships.  One must be able to determine the
value of KI by other means.  It is suspected that in only a few of the
more thoroughly studied river systems has there been enough data obtained
to develop a relationship in which confidence may be placed.  The work
of Langbein and Durum (6) is an alternate source of this information.
They developed the empirical formula:
                              A4-116

-------
                                  •hi.
                                                              [Eq. A4.83]
where v is the mean velocity of flow in the stream and h is the mean
depth.  This formula gives the value of K2 at 20RC.  The program coding
is set up to compute the value of K2 at 20^0 using the Langbein and
Durum formula.

If the Langbein and Durum formula is used, there is the problem of
determining the values of V and; h to use.  Of course, measurements can
be made in each reach in sufficient number to be able to develop,, a flow-
velocity-depth relationship, or if cross sections, slopes and roughness
data are available, one of the open-channel hydraulic formulas can be
used.  Refer to Section 6.3.  Again, there are available empirical formulas
which relate the velocity and depth to the flow rate.  These were developed
by Leopold and Haddock (7) and are:

                              w » aQb    ...........  [Eq. A4.84]

                              h - cQf    ...........  [Eq. A4.85]

                              v - kQm    ...........  [Eq. A4.86]

where :

w • stream width, ft.
h " mean depth of water in the stream, ft.
v « mean velocity of flow, ft. /second,
Q - the flow rate in the stream, in cfs and a,b,c,f,k, and m are constants
    which must be determined.

Thus, even using these empirical relationships, it is necessary to make
at least a few measurements at cross sections in  order to evaluate the
constants.  The program coding is set up  to compute h and v from corre-
sponding values of Q for input values of  c,f,k, and m.

The temperature dependence of K2 is given by the  formula:

                       S " K22oe°'24(T~20)  ........  ^q. A4.87]

where :

K2_ " the reoxygenation velocity constant at temperature T.
K2?n» the reoxygenation velocity constant at 20°C.
T   • the temperature in °C.
e   " the natural logarithm base.

The value of  the deoxygenation velocity  constant  also is temperature
                                 A4-117

-------
 dependent as given by  a similar formula:

                                          20)   	  [«,. A4.88]

 The dissolved oxygen concentration at  a stream location  is  given by  the
 difference between the dissolved oxygen saturation  level, also  tempera-
 ture dependent,  and the dissolved oxygen  deficit  at that location.   The
 dissolved oxygen saturation concentration used in the  program is given
 by:

            DOSAT - 14.65 -  0.41T + 0.008T2 -  0.00008T3  .  .  .  [Eq. 4.89]

 which has been rounded off  from the formula set forth  by the ASCE Committee
 on Sanitary Engineering Research (8).   T  is the temperature  in  degrees
 centigrade.

 A4.5.2  Program  Components.
 The simulation program,  called  WASP, is made  up of  a controlling program,
 WASP-MAIN and several  subroutines,  each of which  contributes to the  over-
 all program.   A  list of the  subroutines and their length, in bytes,
 along with the lengths of functions and common blocks, follows.

 WASP  MAIN         906         TWASTE             522
 SIM                 1544         TGEN                2772
 REG                 3660         IRAN                2852
 QUAL                5004         IREACH             412
 RQUAL               1730         UPGAGE             1162
 RAN                 460         S                   8580
 RRN                 396         GTRAN               536
 STD                 490         GFLOW               456
 RDATA               1256         TRES                514
 DIVREL              1220
 Functions          20936
 Common             49480
 Total program length - 104,888  bytes.

 These lengths  are  based  on a program which reads  gage  flow data from a
 magnetic  tape  produced by FLASH.

 A4.5.2.1   WASP-MAIN.
 The  simulation program is controlled by WASP-MAIN.   This subroutine sets
 up  the ten common  blocks needed to  transfer variable values from subroutine
 to  subroutine, calls subroutines  in the required  order and reads input
 of  number  of years  to  be simulated  and  the  number of gages (with gage
 numbers)  to be used  in the simulation.  The gage  numbers used and their
weight coefficients  are  written.   Subroutines  TGEN  and TRAN are called
 to set up  the  reach  indices and computation sequence and to compute the


                                    A4-118

-------
 transformation matrix used to convert gage data to reach flow data.  Sub-
 routine RDATA is called to read in data needed to regulate the stream-
 flow  in the watershed.  The final subroutine called is SIM which carries
 out the simulation process.

 A4.5.2.2   SIM.
 Subroutine SIM reads in constants and data needed to compute the temper-
 ature and  waste parameter values, computes the deterministic component
 of  the temperature equation for each week of the year and, through  two
 "do loops" one nested in the other, performs the simulation by calling
 various subroutines.  The first of the "do loops'1 covers from the first
 year  of the simulation period to NYR, the number of years of simulation
 desired.   This "do loop" also calls RAN which generates the random
 deviates for the temperature equation and then calls GFLOW which reads
 in gage data for one year at a time.

 The second "do loop" covers from "week" one through 48 "weeks" of the
 year.  Inside this "do loop," subroutines QTRAN, REG and QUAL are called,
 successively, to convert gage flows to unregulated flows and to compute
 the regulated flows and the water quality values at reach point in  the
 stream.  These operations are described below in. more detail as individual
 subroutines.  Weekly values of the simulation results are written out
 within the "do loop."  When the simulation is complete, the computer is
 returned to WASP-MAIN for termination.

 A4.5.2.3   Subroutines RAN and RRN.
 Subroutines RAN and RRN are the same random number generating subroutines
 used  in programs CHKDATA and FLASH, which have been described previously.

 A4.5.2.4   Subroutine GFLOW.
 Subroutine GFLOW reads the generated (or historical, if desired) gage
 data.  GFLOW is called in the yearly "do loop" to read gage data for
 one year for each gage being used in the simulation.  The data read are
 transferred to COMMON/FLOW 7 for use by other subroutines.

 A4.5.2.5   Subroutine QTRAN.
 QTRAN  is a short subroutine which receives gage data through COMMON/FLOW
 7 and, using 'the transformation matrix developed by subroutine TRAN and
 the matrix multiplication operation of subroutine S, converts gage data
 to streamflow data.  The streamflow data are designated QNAT(I), to indi-
 cate  the natural or unregulated flow at the upper end of reach I.  These
 values of QNAT(I) are also entered in COMMON/FLOW 7 for use by other
 subroutines linked through this common block.

 A4.5.2.6  Subroutine S.
 S is  a general subroutine which performs various matrix operations.  It
was described in detail in A4.4.2.8.


                                A4-119

-------
A4.5.2.7  REG.  Subroutine REG is called each week during the simulation.
Each time it is called, it tests the reaches in the internal computation
sequence for reaches having reservoirs.  When REG finds a reservoir, it
calls subroutine TRES which checks through the list of reservoirs read
in through subroutine RDATA to determine that data for the reservoir are
available in storage.  Assured that reservoir data are available, REG
then computes the depth and area of water corresponding to the inventory
in this reservoir for the most recent time frame.  This allows correction
of the inventory for evaporation.  The storage inventory is then brought
up to date by adding in the flow and subtracting the evaporation loss.
Having the current inventory, the subroutine checks the appropriate
operating rule governing releases and diversions and, with data supplied
by subroutine DIVREL, it determines the rates of release and diversion.
Following this, the inventory computation is completed and the value is
stored for use in the next time frame.

Finally, REG computes the amount of regulation afforded by the reservoir;
that is, QREG-QNAT (regulated flow-natural flow).  All flows in reaches
are corrected by the sum of all upstream regulations.  For instance, if
the QNAT in reach 12 is 300 cfs and reservoir A, located upstream of reach
12, holds back 15 cfs while reservoir B, also upstream of reach 12, dig-
charges 30 cfs more than its net inflow, then the regulated flow in
reach 12 is QNAT(12) + (Regulations upstream) » 300 - 15 + 30 = 315 cfs »
QREG(12).  The values of QREG(I) are made available to other subroutines
through COMMON/FLOW 7.

A4.5.2.8  Subroutine TRES.
This subroutine checks that, when in the pass through the reaches in a
given time frame, a reservoir reach is found, operating data for that
reservoir are available in machine storage.  If not, TRES calls EXIT
and the program stops.

A4.5.2.9  Subroutine DIVREL.
Subroutine DIVREL determines the type of reservoir encountered, then
proceeds to compute the basic rates of release and/or diversion.  These
rates either are established by the use of the reservoir or are computed
by demand formulas developed through external analysis of historical or
projected data.  The basic rates of release and/or diversion are sent
to REG, which modifies them as necessary to correspond to the operating
rule, for use in computing reservoir inventory and regulated flows.

A4.5.2.10  Subroutine RDATA.
Although subroutine RDATA is not strictly a part of REG, it is used to
read in much of the data that are required by REG for its operation.
Consequently, the portions of RDATA that relate to regulation of flows
and reservoirs will be included here.
                                A4-120

-------
Subroutine RDATA reads in the data needed to operate the reservoir and
to maintain the reservoir inventory.   Data needed are:

(1)  number of reservoirs and their reach location.
(2)  the reservoir type and the capacity of the various pools.
(3)  constants for release equations.
(4)  constants for evaporation equation.
(5)  constants for the diversion equations.
(6)  irrigation demands by reach and time of year.

These data requirements are described in A4.5.1.

If the reservoirs are in existence, it is usually possible to obtain
the maps, soundings and/or area-depth capacity curves needed to prepare
the input data.  If a non-existent reservoir is placed in a reach to
simulate its effect on the watershed,  it will be necessary to make a
preliminary design sufficient in detail to obtain a suitable set of data
for use in REG.

A4.5.2.11  Subroutine QUAL.
After regulated flows in each reach are computed, subroutine QUAL is
called to compute the water quality values.  First, QUAL completes the
computation of the temperature for the time-frame.  It should be remem-
bered that QUAL is called in "do loop" operating on the "weekly" .-cycle
which is, in turn, a "do loop" for the number of years of simulation
desired.  QUAL sets up a third "do loop"  which cycles over the number
of reaches, NR.  Thus, for each "week," QUAL is called to compute the
quality values for each reach for one "week" before it returns to its
calling subroutine, SIM.  The computations are made, starting at the
upstream reaches, according to the sequence of 4omPUtation set up by
subroutine TGEN.

For each reach, QUAL initializes variables and proceeds to make the
computations necessary to evaluate the incoming BOD and DO concentra-
tions and the ^ velocity constant.  It then checks to determine if the
current reach is a reservoir, and, i|£ so, RQUAL is called.  If the
current reach is not a reservoir, QUAL computes the value of Kn, corrects
KI and K2 for temperature, computes the time of flow in the reach and,
finally, the BOD and DO concentrations in the water leaving the reach.
Note that if the computed values of K^ and K2 are equal, the program
switches to the special formula used in that situation.  QUAL then
checks to determine if the DO deficit has reached a maximum within the
reach, in which case the minimum DO concentration will have occurred
within the reach.  This is done by computing TCRJT, the critical time
of flow, and comparing it to the time of flow in the reach.   If
TCRIT < TIME, a minimum DO concentration has occurred in the  reach.
TCRIT is then substituted for TIME and the value of DEFOUT is computed


                                A4-121

-------
 and used in turn to compute the minimum DO concentration,  XMINDO,  in
 the current reach.   QUAL then writes out the water quality and related
 values in an array.

 A4.5.2.12  Subroutine RQUAL.
 Subroutine RQUAL is called by subroutine QUAL when a check of  reaches
 indicates the current reach is a reservoir.   Thus, RQUAL is operating
 in the same set  of  "do loops" as is  QUAL.   RQUAL immediately calls
 subroutine TRES  (see A4.5.2.8)  for a check of the reservoir data for
 the current reach.   RQUAL computes the  values of average BOD and DO
 deficit in the reservoir and  the BOD and DO  deficit in the water being
 released and/or  diverted from the reservoir.   The appropriate  quality
 values are transferred back to QUAL  which writes them in the same  array
 with the other values computed for the  stream,

 A4.5.2.13  Subroutine TGEN.
 Subroutine TGEN  is  called by  WASP-MAIN  to set up the reach indexing
 and the computing sequence.   TGEN is described  in Section  A4.3.

 A4.5.2.14  Subroutine TRAN.
 Subroutine TRAN  also is  called by WASP-MAIN  to  develop the transformation
 matrix which  is  used to  convert gage data to  stream flows  at reach
 points in the stream.   TRAN is  described in  detail in Section  A4.3.

 A4.5.2.15  Subroutine DIVREL.
 Subroutine DIVREL is auxiliary  to subroutine  REG and is  called by  REG
 to compute the reservoir releases and/or diversions.   Depending  upon
 the reservoir type,  the  release or diversion  is  computed and sent  to
 REG for use in computing regulated flows and  reservoir inventories.

 A4.5.2.16  Subroutine TWASTE.
 Subroutine TWASTE is a checking subroutine which does for  a reach
 having a waste load what subroutine  TRES does for a reach  that is  a
 reservoir.   TWASTE  checks  that  there is  a  set of waste load data corres-
 ponding to a  reach  number  where there is scheduled a waste discharge.
 If  the data are  not available  for the reach,  TWASTE calls  EXIT.

 A4.5.3  Program  Input.
 Data  are read into  the simulation program, WASP,  through subroutines
 WASP-MAIN,  SIM,  RDATA, GFLOW,  and TGEN  only.

 (1)   For WASP-MAIN:
 Card  //I (215)
 NYR »  the  number of years  of  simulation  to be carried out.
 NGT •  the  number of gages  for which  data are  used.

 Card  92  (1018)
 IGT(I)  •  the  gage numbers  used.
 I       -  1...NGT.
Maximum of  ten.

                                 A4-122

-------
(2)  For SIM:
Card #1 (3F8.0,  I5.5F8.0)
D      » constant in temperature equation.
C      = lag constant in temperature equation.
TMEAN  = mean annual temperature.
ISTART • initial number for random number generator.
XK     » constant in velocity equation.
XM     " constant in velocity equation.
CC     = constant in depth equation.
F      » constant in depth equation,
SIGMAT = standard deviation of the temperature data.

Card n (4F10.0.I1)
RLNTH(I)  » the length of reach (I), feet.
RCON(I)   = the Moreau-Pyatt dexoygenation error term, r, for reach I.
SCON(I)   = the Moreau-Pyatt reoxygenation error term, s, for reach I.
XK120W(I) - the deoxygenation constant Kl at 20°C for the waste which
            is introduced into reach I.
IWASTE(I) - 1 if there is a waste load introduced in reach I,
          - 0 for no waste load introduced in reach.I.

Card #3  There are 48 data cards, one for each "week," for each reach
where  a waste is introduced  (3F10.0).
QWASTE(I,J) = the rate of discharge of waste, in cfs for each I and week J.
BODWST(I,J) = the concentration, in mg/1, of BOD in the waste being dis-
              charged into reach I during week J.
DOWST(I,J)  = the concentration, in mg/1, of dissolved oxygen in  the waste
              being  discharged  into reach I during week J.

Card #4  There  is one card for  each reservoir in the system  (AF10.0).
XK220R(I) = the  value of  the reoxygenation velocity constant K2 at 20°C
            for  reservoir I.
XK3(I)   = the  value of  K3  for reservoir I.
BODSTO(I) » the  initial BOD, mg/1,  in reservoir I.
DEFSTO(I) » the  initial DO,  mg/1,  in reservoir I.

 (3)  For RDATA:
Card  #1 (15)
NRES • the  number  of reservoirs in the  system.

 Card  #2 There  is  one card  for  each 16  reaches.  The  reservoir  number
 is punched  in an 15  field in the  field  number  corresponding  to  the reach
 in which the  reservoir  occurs.   For example,  if  the first  reservoir,
 number 101,  is  in reach 12,  the reservoir number   is  punched as follows:
 1 in space  58,  0 in space 59,  and 1 in  space  60  of the first card.
                                  A4-123

-------
(16I5)IRES(I)
       the reservoir number, a convenient number for identifi-
       cation of the reservoir; may be up to 5 integers.
Card #3  There is one card for each reservoir in the system (2I5,4F10.2)
JRES(J)   = the reservoir number; same as IRES(I) above.
ITYPE(J)  = the type classification for reservoir J.
CAP(J)    = the capacity of reservoir J, volume in 106 cubic feet at
            spillway level.
SMIN(J)   = the volume, in 10s cubic feet, of the minimum pool, if
            applicable, for reservoir J.
TOPLEV(J) = the volume below the flood control pool, in 106 cubic feet,
            in a Type I reservoir, reservoir number J.

Card #4  One card contains the values of AGON and BCON for four reservoirs
in an 8F10.4 field.  The value of ACON for the first reservoir, 1-1, is
placed in the first 10 spaces, BCON for the first reservoir is placed in
the 11-20 space, ACON for the second reservoir, 1-2, is placed in the
21-30 space and so on.  If, for the particular reservoir, ACON and/or
BCON are zero, leave blank the space reserved for them.  It takes 1 card
for each 4 reservoirs (8F10.4).
ACON(I) - a constant used in computing the release from reservoir I.
BCON(I) - also a constant used in computing the release from reservoir I.
Card #5
YMEAN(L)

ACAP(L)
BCAP(L)
DCAP(L)
ADAP(L)
BDEP(L)
CDEP(L)
One card for each
» the mean annual
  sion formula.
= constant in the
= constant in the
- constant in the
« constant in the
= constant in the
• constant in the
reservoir in the system (8F10.2)
diverted flow, reservoir L, used in the diver-

depth-capacity equation for reservoir L.
depth-capacity equation for reservoir L.
depth-capacity equation for reservoir L.
depth-area equation for reservoir L.
depth-area equation for reservoir L.
depth-area equation for reservoir L.
Card #6 (3F10.0)
AVAP » constant in the evaporation equation.
BVAP • constant in the evaporation equation.
CVAP " constant in the evaporation equation.

Card #7  Two cards are required for each reservoir (6F10.0).
TAU(I.J)  » the lag constant for harmonic J in the diversion equation,
            for reservoir I.
CCON(I,J) » the coefficient for harmonic J in the diversion equation,
            for reservoir J.
TAU(1,1) is placed in spaces 1-10; CCON(1,1) is placed in spaces 11-20;
TAU(1,2) is placed in spaces 21-30; CCON(1,2) is placed in spaces 31-40,
and so on.
                                 A4-124

-------
Card #8 (15)
NADJST - the  number of data cards for flow adjustments.  The number
         equals the number of reaches where flow adjustment is
         required multiplied by the number of weeks of adjustment.

Card #9  NADJST cards, one for each reach for each week of adjustment.
(I5,I8,F14.4)L = the week of the year that flow adjustment is made.
NSTA           = the reach number where the flow adjustment is made.
XIRRIG(NSTA.L) = thj£? amount of flow adjustment in reach NSTA and for
                 week L.

(4)  For GFLOW:  The generated gage data (or historical gage data,  if
desired are read by GFLOW.  The format must be adjusted to the format
of  the data to be read.  Normally, the data will be on magnetic tape.
The program as set forth herein reads the data from magnetic tape as
QG(I,J), (I=1,NG)(J-1,48); i.e., it reads one year of data for each
station, within a 1, NYR "do loop."

(5)  For TGEN:
Card #1 (215)
NR  ** number of reaches.
NG  » number of gages.

Card #2  One  card for each reach (415, 6F5.0).
NOR(I)   • the reach number, reach I.
NUR(I.J) » the reach numbers J upstream of reach I; there may be  0, 1,
           2  or 3 J numbers depending upon the stream configuration
           above reach  I.
DAU(I,J) • the drainage area upstream of reach I;  one number  for  each
           J, equal to  the drainage  area of  tributary J upstream  of
           reach I.
FL(I)    « length  of  reach !.'<
SLOPE(I) = average slope, hydraulic  gradient, in reach I.
ROUGH(I) = Manning's  roughness,  n  for reach  I.

Card  #3  One  card  for each gage  (I8,I5,F5.0).
NGAGE(I) = identifying number  of gage I.
NGR(I)   = number  of  the  reach in  which  gage I  is  located.
DAG(I)   = the  drainage area upstream of  gage I.

A4.5.4  Program Output.
The program  output from WASP consists of  three  arrays from TGEN and TRAN,
which are printed  out once each run, and  five arrays  which are printed
out for each week  of  the  simulation.

The three arrays  from TGEN and TRAN are  identical  to the first three
arrays of output  for  TFLOW described in  A4.3.4  above.
                                A4-125

-------
The five arrays of output printed for each week of simulation are
described as follows:

(1)  Array 1:  The values of the unregulated flow, QNAT, in each reach,
are written in horizontal rows of ten numbers per row.  The array writes,
through subroutine QTRAN using a 10F8.0 FORMAT, the values of QNAT(I)
for the current week.  I is the reach number.  The QNAT values for the
first ten reaches are in the first row, for llth through 20th reaches
in the second row, and so on.  The number of lines printed will be NR/4
or the next larger integer.

(2)  Array 2:  The reservoir identifying number, the external index and
the weekly evaporation correction are written in the second array.  The
order of appearance in the array is the order in which the computation
took place,

(3)  Array 3:  This array is NR rows by two columns in which the external
reach numbers and corresponding regulated flows, QREG, for the current
week are written.  The order in the array is the order of computation.
The array has been folded for writing to decrease the number of lines of
output.  The number of folds can be arranged for each project to use a
minimum number of lines.

(A)  Array 4:  The reservoir inventory data are contained in Array 4.
The array consists of NRES rows, one for each reservoir, with rows headed
Reservoir, Storage, Release and Diversion.  "Reservoir" indicates the
reservoir identifying number, "Storage" indicates the volume (in 105
cubic feet) in the reservoir at the end of the current time frame,
"Release" indicates the average release rate (in cfs) during the time
frame and "Diversion" indicates the volume (in 106 cubic feet) diverted
during the current time frame.

(5)  Array 5:  The water quality data and results are contained in
Array 5.  The array is NR rows, one for each reach, by ten columns.
The columns are as listed below:

(a)  TIME - the average time of flow in the reach or, if the reach is
            a reservoir, the average detention time in the reservoir if
            the detention time is less than 30 days.  The value entered
            will be 30 days if the detention time is greater than 30
            days.

(b)  QWASTE - the quantity of waste discharged, in cfs.

(c)  DOWST - the dissolved oxygen concentration, in mg/1, in the waste
             discharge.

(d)  BODWST - the biochemical oxygen demand concentration, in mg/1, in
              the waste discharge.

                                 A4-126

-------
(e)  XK,  - the value of the deoxygenation velocity constant at T°C
           for the waste discharge,  in days"1.   T°C is the average water
           temperature in the current time frame.

(f)  XK,  - the value of the reoxygenation velocity constant in the
           corresponding reach,  at T°C where T°C is the temperature
           during the current time frame.

(g)  XMINDO - the value of the minimum dissolved oxygen concentration,
              in mg/1, in the corresponding reach during the current time
              frame.  XMINDO is  the  difference  between the DO deficit
              and the saturated  DO concentration,  both computed for
              current time frame.

(h)  BODOUT - the value of the BOD concentration in mg/1, at the down-
              stream end of the  corresponding reach.

(i)  DEFOUT - the value of the DO  concentration, in mg/1, at the down-
              stream end of the  corresponding reach.

(j)  REACH - the identifying external reach number.

The order of appearance of the data  in Array 5  is the. order in which the
data were computed and corresponds to the computation sequence set up
by the subroutine TGEN.

A4.5.5  Dictionary of Variables.
Following is a list of the variables used in WASP and a brief definition
of each:

A                   Intermediate constant.
ACAP(I)             Constant, reservoir depth-capacity equation, reser-
                    voir I.
ACON(I)             Release or diversion constant, reservoir I.
ADEP(I)             Constant, reservoir depth-area equation, reservoir I.
AREA(I)             Reservoir surface area, reservoir I,
AVAP                Evaporation formula constant.
AVGSTO              Average storage, current time and in previous time
                    frame.
AVW(I)              Average waste load, Ith reach (used for periodic
                    load function).
AW(I)               Amplitude of waste load (used for periodic load
                    function).
B                   Intermediate constant.
BCAP(I)             Constant, reservoir depth-capacity equation, reservoir
                    I.
BCON(I)             Release or diversion constant, Reservoir I.


                                 A4-127

-------
BDEP(I)
BODIN(I)
BODOUT  (I)
BODSTO(I)
BODWST(I)
BVAP
C
cc
CCAP(I)

CCON(I.J)

CDEP(I)
CN
CNI
CQREG(I)
CVAP
DAG(I)
DAU(I.J)

DCAP(I)

DEFIN(I)
DEFOUT(I)
DEFSTO(I)
DEP(I)
DIV(I)
DOS
DOWST(I.J)
DQ(D
EVAP
F
FL(I)
HOLD
IDR(I)
IGT(I)
IKD
IR
IRES(I)
IRRIG(I
ISTART
ITYPE(I)
IWASTE(I)
JR(D
JRES(J)
L
NADJST
J)
Constant, reservoir depth-area equation, reservoir I.
BOD concentration, upstream end reach I.
BOD concentration, leaving reach I.
BOD concentration in reservoir I.
BOD concentration in waste load, reach I, week J.
Evaporation formula constant.
Constant, temperature equation.
Constant, depth equation.
Constant reservoir depth-capacity equation, reser-
voir I.
Constant, periodic diversion formula, reservoir I,
harmonic J.
Constant, reservoir depth-area equation, reservoir I.
Correction value, flow in upstream reach.
Intermediate variable.
Corrected regulated flow, reach I.
Evaporation formula constant.
Drainage area upstream of gage I.
Drainage area upstream of tributary J upstream of
reach I.
Constant, reservoir depth-capacity equation, reservoir
I.
DO deficit concentration, upstream end of reach I.
DO deficit concentration, leaving reach I.
DO deficit concentration in reservoir I.
Reservoir water depth, reservoir I.
Diversion rate, reservoir I.
Dissolved oxygen saturation concentration.
DO deficit concentration in waste load, reach I,
week J.
Amount of flow regulation reach 1.
Evaporation rate.
Constant, depth equation.
Length of reach, reach I.
Reach index, auxiliary.
Index of reach downstream of reach NOR(I).
Gage identifying number, gage I.
Temporary index.
Reservoir index.
Reservoir number in reach I.
Irrigation withdrawal, from reach I, for week J.
Starting number, random number generator.
Type of reservoir, reservoir I.
Equals 1 for a waste load in reach I.
Downstream index.
Reservoir number in reach J.
Week index.
Number of flow adjustments.
                                AA-128

-------
NG
NGAGE(I)
NCR(I)
NGT(I)
NOR(I)
NR
NRES
NUR(I.J)
NWASTE
NYR
PMW(I)

PSTO(I)
OG(I,J)
Q1N
QINV
QNAT(I)
QREG(I.J)
QSUM

QSUM2
QWASTE(I.J)
R(D
RCON(I)
RLNTH(I)
ROUGH(I)
RREL(I)
RRELV

RRN(I)

RRV
RTEMP
SCON(I)
SDIF
SIGMAT
SLOPE(I)
SMIN(I)
SPRD1
SPRD2
SPRD3
STO(I)
T(L)
TAU(I.J)

TCRIT
IDA(I)
Number of gages.
Identifying number, gage I.
Number of reach containing gage I.
Total number of basis gages -
Number of reach I.
Number of reaches.
Number of reservoirs,
Number of reach J upstream of reach I.
Number of waste loads.
Number of years.
Peak waste load, reach, I  (used for periodic load
function).
Previous  storage volume, reservoir I.
Weekly generated flow, station I, week J.
Rate of flow into reservoir, CFS.
Volume of flow  into reservoir, in one time  frame.
Natural  (unregulated) flow, reach I.
Regulated flow, reach I, week J.
Sum of incoming flows, corrected-waste loaded
reaches only.
Sum of incoming flows, total.
Rate of waste discharge, reach I, week J.
Random number,  normal distribution, time frame  I.
Deoxygenation error constant, reach I.
Length of reach I.
Channel  roughness  factor,  reach  I.
Release  rate, reservoir I.
Volume of flow  released from reservoir in one  time
f rame.
Temporary variable, random number generator,  time
frame I.
Intermediate variable.
Intermediate variable.
Reoxygenation error constant,  reach I.
Intermediate variable.
Standard deviation,  temperature  data.
Mean  slope, hydraulic  grade line, reach  I.
Minimum  storage level,  reservoir I.
Summing  variable  - K-^  computation.
Summing  variable  - BOD computation.
Summing  variable  - DO  deficit  computation.
Current  storage volume,  reservoir I.
Temperature, week L.
Lag constant,  periodic diversion formula, reservoir 1,
harmonic J.
 Critical time  of  flow, time to critical  DO condition-
Drainage area  upstream of reach I.
                                   A4-129

-------
THETA               Argument angle,  diversion equation.
TIME                Time of flow in  reach.
TMEAN               Mean temperature.
TOPLEV(I)           Volume below flood control pool, Type I reservoir,
XT                  Temperature at current  time frame.
V                   Mean velocity of flow in reach.
W                   Intermediate constant,  reservoir oxygen balance equa-
                    tions .
WT(I,J)             Weight coefficient for  reach I,  gage J.
XH                  Mean depth of water in  reach.
XK                  Constant, depth  equation.
XK120(I)            Deoxygenation velocity  constant, reach I, at 20°C.
XK2                 Reoxygenation velocity  constant, ambient temperature,
XK220               Reoxygenation velocity  constant at 20°C.
XK220R(I)           Reoxygenation velocity  constant, 20°C, reservoir I.
XK3(I)              Sedimentation velocity constant, reservoir I.
XKK(I)              Dissolved oxygen concentration, violation condition.
XLRAD               Intermediate variable,  argument in evaporation
                    equation.
XM                  Constant, velocity equation.
XMINDO              Minimum dissolved oxygen concentration.
YMEAN(I)            Mean diversion,  reservoir I.
Z                   Constant, temperature equation.
Z                   Intermediate constant, reservoir oxygen balance
                    equation.

A4.5.6   Program Logic.
Figure A4-9 is a diagram of program logic for WASP.

AA.5.7   Program Coding.
The program coding  for WASP follows.
                                 A4-130

-------
                       FIGURE A4-S
                  PROGRAM LOGIC - WASP
WASP MAIN

Read Control Data
   Call TGEN
                         -Read reach data and
                          set up sequence of
                          reach numbers for
                          computation.   Read
                          gage location and area
                          data   |
      r
   Call TRAN
   CaJ
                         • Calculate weight coefficients
                          for transformation of gage
                          data to streamflow data

                             Call UPGAGE	*~ Search for up-
                                             stream gages
1 RDATA-
-Read  in reservoir ,
 and diversion data
                                                    evaporation
   Call SIM
                         -Initialize quality variables
                          Read waste load data
                          Compute temperature
                                   Call GFLOW
                                             "Read in generated
                                              gage data for year
      Return
      Each
      Year
                             Call QTRAN
               Reach
               Each
               Week
                    •Transform gage
                     data to  streamflow
                     data   I
                             Call REG
                    •Check for reservoir
                     in reach,  Operate
                     reservoir and compute
                     release,  diversion
                     and reservoir inventory.
                     Compute regulated
                     streamflow data
                            I
                           •'A4-131'

-------
     Return
     Each
     Year
Return
Each
Week
Return
Each
Reach

                                  Call QUAL—	s-Compute BOD, deficit
                                                   and K]_ into reach
Check for reservoir
in reach
     |      no
Compute K.2> BOD and
deficit out of reach
                                     Call RQUAL
                                    -Compute  BOD and
                                     deficit out of
                                     reservoir
                                     Compute minimum DO
                                     in reach, Write out
                                     quality date
                                     Ht
•:ND
                              A4-132

-------
//WASP1    JOB  (1143,47,035,30,2CCC ), 'ALEMAN               »,CLASS

// EXEC FORTRAN
//SCURCE   CC *
C WATER QUALITY  SIMULATION  PROGRAM (WASP)
      CONPUIWFLCVa/NR,NG,NCR(5G),NUR(5Ci3) ,CAU(50t3) t
     1      TCA(5C)iNGAGE(lC),NGR(10),CAGC1C),IDR(50)
      COfNCN/FLCK2/FL(5C ) ,RCUGH(50),SLCPc(SG)
      COMPCIWFLCW3/JR150)tWT(50,10)
      COPI«Gf\/FLCW5/NRESiIRES(5C),JRES{lC)fCAP(1.0),SMNllO)tSTO{10
                                                            )t
     1       CIV(10),RREL( 1C) ,PSTG( 10)
      CONNGN/FLCK6ANWASTE, IWASTE ( 5C ) , JVvASTE ( 50 ) , AVW < 50) , AW ( 50) ,PF
                                                            H(50)t
     1 FKl,UASTEfXFKl
      CCPf*CN/FLCV<7/C.G( 10,48 ) , Q-NAT ( 50) , \YR
      CONMGN/FLCW8/AVTEMPiATEMP,TPEAK,TEMP,DTEtfP
      Ca1vMU^/FLC^19/XIRRIG(5C,^0),CiV,ASTE(50,48) , A VAP , BVAP , CVAP , TAU
                                                            U0,6),
     1       YMEANt 10),ACGN(10)fBCCN{lC),CCCN(10,6),ITYPE(IO),
     2       TCPLEV(10),ACAP(10),3CAP( 10) ,CCAP( 10) ,CCAP(10),ADEPt
                                                            1C) ,
     3       BCEP(1C),CCEP(10)
      CONMCN/FLCWll/TU8},SIGMAT,ZtC,TMEANtRLNTH{5C),ISTART,XKfXM

     1      CC,FfXK120W(50)f30DV«ST(50,48),
     2       CCVISTt 50, A8),R( A8) ,RCON(5C) ,SCCN(50>
      COMMCN/FLCW12/XK220RI 10) ,XK3( 10),BOOSTO{1C),DEFSTC(10)
      COMNGN/FLCWl3/CREG(5C,50)tCEFlN(50,50},DEFCUT{50,50),BGDIN(
                                                            50,50)»
     1BQCCUT(00,5C) , XM I NQ ( -5 C , 30 ) ,LLX ( 5C , 30 ) ,XKK{5Q,5C)
      OIMENSICN  IGT(IO)
      READ{5,5C01)NYR,NGT
 5C01 FORKAT(2I5)
      REAC(5,5CC2)(IGT(I)tI=l,NGT)
 5002 FORNATUOI8)
      CALL TGEN
      CALL TRAiN
      WRITE(6,6103) (NGAGE( I ), I = 1,NG)
      WRITE(6,6105)
      CO 31 1=1,NR
   31 WRITE(6,6104T NOR(I),(WT(I,J),J=1,NG)
 6103 FQRNAT( •1•,9X,'EXTERNAL' /
     112X,'REACH',9X,'COEFFICIENT  CF  FLCW AT GAGE1/
     2iix, 'Nu.yatR1, loiio)
 6105 FURNAT1 IX )
 6104 FURNAT(I15f6X,10F 10.1)
      WRITE(6t6000)
 60CO FORMAT! 1H1)
      CALL RCATA

                            A4-133

-------
   CALL SI.V
   END
   SUBROUTINE SIM
$$$$*$ $$il£fl$$£$$S*$$lt$S$
   CQNPCK/FLC*a/l\R,NG,NCR(5C),,NLR(5C,3) , CAUl 50, 3) ,
  1      TCM50) ,NGAGE( 1C),NGR( ICJ.CAGl 10) , ICR(5C)
   COMMCN/FLGW2/FU 5G ) , ROUGH (50) ,SLCPE( 50)
   COMKON/FLCW3/JR( 5C),V«T(5C,10)
   COff'CN/FLCU4/ATIME( 5C ) tBTIME
 •  COMMCN/FLC'XS/NRESiIRESl 5C ) t J1cS( 1C ) , CAP (10) , SM IN { 10 ) , STO ( 10
                                                         )>
  1       ClV(10)tRREL(l-:),PSTO(lO)
   CO,VMGN/FLi:Vv6/N^ASTEi IUASTE ( 5G ) , JUASTE ( 50 J ,AVVi(50) ,AW(50) ,PM
                                                         W(50),
  1 FKlfWASTEtXFKl
   CQMf.CK/FLCV«7/GGt 10,43) f CON AT (50) f NYR
   COMMCN/FLGV*9/x'lRRIG(5Cf48),GKASTc{50,48} , AVAR tBVAP t CVAP , TAU
                                                         ( 10t6),
  1       YNEANl 1C) , AGON (1C) ,8CGN{ 1C ) tCCONt 10, 6 ) , I TYPE (1C),
  2       TCPLEVt 10) |ACAP( 1C) ,BCAP{ 1C) ,CCAP( 10) iDCAP(iO) ,ADEPC
                                                         1C),
  3       BCEP(10),CCEP( 10)
   COMMQN/FLCW11/T148) , SIGNAT , Z ,C , TKEAM, RLNTH{ 50 ) , I START , XK , XX

  1      CCtF, XK120W(5G) , 3QCHST ( 50, AS ) ,
  2       DCliST(5C,48),R<
-------
700 FORMAT(3F8.0, I5.5FB.C)
    READ(5,7C1) (RLNTH( I ) , RCUNf I ) t SCQNl I ) ,XK120W{ I ) f I WASTE ( I ) , 1 =
                                                         ItNR)
70L FORNATlAFlC.Qi II)
    00 1 1=1, NR
  1 IF t I WASTE (  I ).NE.O)REAC(5, 703) (CWASTEt It J) , BCOuSTt I , J) ,DOV«ST
                                                         ( I , J) ,
   lJ=li 46)
703 FCRMAT(DX,3F1C.O)
    READ(5i 702)1 XK220RI I ) , XK3 ( I ) , BOO STO ( I) , OE FSTC (I ) , 1 = 1 , NRES )
702 FORNAT14F1C.O)
    COMPUTE MEAU TEMPERATURE  FUR LTH  WEEK  OF  THE  YEAR
    CO 800 L=1|4S
    XL = L
    ARG=(7.5^XL+C)/57.3
    T( L)=Z*SIK(AKG)+TIJ|EAN
800 CCNTINUE
    CC li K=1,NYR
    CALL RA.\( ISTART.AB.R)
    CALL GFLCMK)
    DO LO L=l,4£
    CALL CTRAMD
    CALL REG(L,K)
    CALL GUAL(L)
 10 CONTINUE
    KOUNT=0
    ^RITE(6,ACC) K
400 FORMAT ( • 1 ' ilOXf1 SLfKARY  OF VIOLATIONS  FOR YEAR «,I2//)
    CO 6CO I = L,i\R
    CO 600 L=ii48
    IF(XKK( JR( I ) , D.EQ.O. ) GO TO 6CO
    WRITe(6|5CC) JR( I),L,XKK(JR( I),L)
500 FORPATt 'O1 , 'VIOLATION  IN REACH ',I2»*  DURING WEEK »,I2
   IbM CC =  ' ,F8.4//)
    KOUNT=KCLNT+1
6CO CONTINUE
601 IF(KGLNT.EQ.O)  WRITE(6,62C)
620 FORMATl 'C», 'THERE  WERE  NG VIOLATIONS DURING THIS YEAR'//)
  11 CONTINUE
    DO 12  1 = 1, NR
    WRITE(6,2C) JR(I)
  20 FORMAT! 'C1 , 'SUMMARY  CF  MINIMUM FLOWS FCR REACH ',I2//,T2C,
   I1 YEAR* f T35t 'FLOW , TA5 , • WEEK • // )
    00 12 K=1,NYR
  12WRITE(6,30)K,XVIN|Q(JR{I),K),LLX(JR{I),K)
  30 FORMATIT2C, I2,T30,F8.C,T45t 12)
    REWIKC  S
    RETURN
    END
    SUBRLJLTIN6  CUAL(L)

                              AA-135

-------
                     iNGtNCRt 5C ) fNUR(5Ci3) »OAU< 50t 3) i
     1       TCA(5C) , NGAGEt 1C ) , NCR ( 10 ) , CAG ( 10 ) , I OR ( 50 )
     CCWNCN/FLCW3/JR( 50 )  , Ml 50,10)
     CGMMCN/FI CW5/KRES,IRES(50),JRES( 10 ) , CAP ( 10 ) , SN I N ( 10) , STO ( 10
                                                           ) t
     1        CIV( 10) ,RREL( 1C)
     CQMMCM/FLCW7/QG{ 10,42) ,QNAT( 50) ,NYR
     COMMON /FLCW 13 /«R EG (  50,50) , CEF IN( 50 , 53 ) ,'DEFOUT < 50 t 50) , BGOINt
                                                           50,50) ,
     1BOCCUT(5C,5C) , XM I NC ( 5C , 3C ) , LL X ( 5C , 30 ) ,XKK<50,5C)
     CQMMCN/FLCW11/T148)  , SIGMAT ,Z ,Cf TMEAN,RLNTH ( 5Q ) , I START , XK , XM
                                                           t
     1       CC,FiXK120W(5C),3CCrST<50,48),
     2        CGUSTC50i48)  ,R(4<3) ,RCCN(5C ) ,SCON(50)
      CONMGN/FLCW9/XIRRIGI 50,43) , QWASTt I 50 , 48 ) , AVAR , BVAP iCVAP ,TAU
                                                           (10,6),
     1        YNEANt 1.0) , ACCM10) ,BCCN(10) ,CCON(10,6) , ITYPEl 10) ,
     2        TCPLEV(10),ACaP(10),BCAP(lG),CCAPtlO) ,CCAP( 10) ,AOEP(
                                                           10) ,
     3        BCEP( 1C),CCEP ( 10)
      DIMENSION  XK12C( 50) ,CCREG(50)
C     COMPUTE TEMPERATURE AT CURRENT TIME FRAME
      WRITE(6,620)
  620 FQRMATtlhl,1    TIME   QWASTE   DGWST  BOOV^ST      XK1      XK
                                                           2   XMIN
     1DO  BCDCUT  OEFOUT   REACH')
    8 TT=T(L)+3(L)*SIGMAT
      IF(Tr.LT.O)Tr=0
      CO 10  I=1TNR
C     IS THERE  AN UPSTREAV  REACH
C     ARE THERE  ANY  BRANCHES
       SPRD1=0
       SPRD2=0
       SPRC3=0
       IF(NUR(JR( I), D.LE.OGC TO
       J=L
       IF(NUR( JR( I) ,2).GT.C) J=2
       IF(NUR(JR(I)i3).GT.C)J=3
       CO  12  K=1,J
       NU = NURUR( I ) ,KJ
       LL=IREACh(NU)
    12  QSUM=GSUM+QREG(LL,L)
       IFtGSUM.GT.CNl )QSLV=GREG( JR{
       CN=(QREG( JR( I ) iL)-QSLM)/J
       QSUM=0
       CO 11  K^l.J
       NU = l>lUR(jn ( I ) tK)
       LL=IREACH(NU)
                                 A4-136

-------
      CQREG UL ) =QR£G I LL , I. ) >CN
      SPRCI=SP«C1+XK120(LL)*CQREG( LL)
                3 + DEFUUHLL,L)*CCRl£G(LL)
      IF(XK12CiLL).EQ.O)GO  TO  111
      QSUM = CSUI* + CQREG( LL )
  111 CSUf^t'SLfZ + CCREGlLL)
   11 CONTINUE
C     COMPUTE Tht DEOXYGENAT I ON  VELOCITY  CONSTANT OF THE MIXED
C   .    FLCW AT THE UPPER  END  OF  EACH REACH
   41 hCLC=IDR( JR( 1 ) )
      IF(GSUK.EC.G)GSUM=.CC5
      IFtGSUM2.EQ.O)GSUK2=.5
      XK120URC I ) )=. (SPRC1 + XK120W( JR( I ) )*GWASTE( JR ( I ) ,L) )/(QSUN +
     1         ChAS TE( JRl I ) ,L) )
C     CORRECT XK120  FOR  TEMPERATURE
C     COMPUTE DISSOLVED  OXYGEN SATURATION VALUE
      CGS=H.65-..41*TT+.008*TT«*2-.CCOC8*TT»*3
   42 ARG=.C46«(TT-2C)
      XK1=XK12C(JR(I))*EXP(A*G)
C     CCMPUTE illjD +  DEFICIT AT THE  UPPER  END OF THE CURRENT REACH
      IF(GREG( JIU I) iL) .EG.C1 GO  TO  50
      BOD IN ( JR{ I ) ,L )=(SPRD2 + 30nv^ST( JRl I ) , L)*OHASTE( JR(I) ,L) )/
     1 lCREG(JR(I)iL)+QWASTE{JR(I).L))
      CEFINi JRC I ) ,L J=(SPRDl-KDOS-OQhST( JR( I > , L ) ) *QV»ASTE ( JR ( I ) • L ) )
      GG TC 51
   50 BODINt JR( I ) ,L )=0.
      CEFIN( JRl I ) , L )=0.
C     IS THERE  A  RESERVOIR AT THIS REACH
   51 IFURES(JR(I)).GT.O)C4LL RGUAL { L , T T , XK1 ,3UDI\ f CEFI N, CSUM2
     1TIME , I ,BCCCUT,DEFOUT,XK2, + 10C )
      IF( IRESl JR( I ) ) .GT.  0)  GO TC ICO
C     CCMPUTE  VELOCITY  QF FLCVi
 2222 V = XK*(GREG( JR( I) » L ) + Ck ASTt ( JR ( I) ,L) )*»XM
      IF(V.EG.O.O)V=XK»(QREG{HOLOtL)/2.)**XM
      IF(V.EQ.O)GO TO 43
C     CCMPUTE  TIVE OF FLOW
      TIME=(RLNTH(JR(I) )/V)/364CO
C     COMPUTE  DEPTH  OF  FLOW
      XH=CC*(GREG(JR(I)fL)+CWASTE(JRU)iL))»*F
      IF(XH.EQ.C.Q>XH=CC»(GREG(HQLCiL)/2.)»«F
C     CCMPUTE  *EAE*ATIUN  VELOCITY CONSTANT
      XK220=( 1.3*V)/{XH**1.33)
C     CORRECT  THE REAERATICN VELOCITY CONSTANT  FUR  TEMPERATURE
      ARG=.024«(TT-20)
      XK2=XK22C*EXP(ARG)
      GO TC 44
C     NO FLCW  IN REACH
   43 TIME=7.6

                               A4-137

-------
    XK2=XK1
 44  IFIXK1201 JRl I ) ).NE.O)GC TO 142
    BOCGLK J3( I ) f L ) = 0.0
    CEFOLTt JP.U ),L) = 0.0
    XK1 = G
    GO TC ICO
142  ARG=-XKl*TiyE
    BCDCUTl JFM I),L)=(BOOIN(JR(I) , L)-RCON( JRl I ) ) /XK1)*EXP I ARC) +R
                                                        CCNURl
   II) )/XKl
    IF(XK1.EG.XK2)GO TO U
    ARG2=-XK2»TIME
    CEF= ( (XK1*BCOIN( JR { I J , L) )-RCCN{ JRl I ) ) ) / ( XK2-XK 1 )
    CEF=CEF»(EXPl ARGl )-EXP(ARG2) )
    DEF=GEF+I IRCON (JR ( i ) )+SCON( JRI i > M/XKZI* U.O-EXPI ARG?) )
    DEFOUT ( J3 U) , L ) = DEF+< OEF IN ( JR I I ) i L ) "EX? I ARG2 ) )
    ARG=XK2/XKl-( XK2*CEF IN ( JR ( I ) , L J-RCON ( JR ( I ) )-SCCN( JR( I ) ) )*f X
                                                         K2-XKU
   1/lXKLMXKlaBODINl JR( I ) , D-RCCNl JR( I ) ) ) )
    IFIAKG.LE.OJGG TO ICC
    TCRJ F=( 1./IXK2-XK1) ) *ALGG(ARG)
    IF(TCRIT.GT.TIKE)GQ TG  ICO
    CRITICAL CEFICIf GCCLRS  IN  THIS  REACH
    ARG1=-XK1«TCRIT
    ARG2=-XK2»TCRIT
    CEF=( (XK1»BGOIN( JR( I ) »L) J-RCGNl JRl I) ) )/(XK2-XKl)
    DEF = DEFMEXP(ARG1 >-EXP(ARG2) )
    CEF = CEF+( (RCOX( JR( I ) ) + SCON( JR( I ) ) ) /XK2 ) * ( 1 . 0-E XP ( ARG2 ) )
    CEFCUTU31 I),L) = OEF+(DEFIN(JR( I) ,L)*EXP(ARG2) )
    GC TG ICC
 16 ARG=-XK1*TIME
    CEF=(XK1»TIME»BODIN( JRl I ) , L) ) - ( T I KE«RCON I JR ( I ) ) )
    CEF=CEF+DEFIN( JRl I ),L)
    CEF = CEF+( (RCOMJRl I) )+ SCON (JRl I ) ) )/XKl)
    DEF = 13EF*EXP(ARG)
    DEFGUT(J3( I ),L)=OEF-(RCnN(JR(I ) ) +SCON ( JR { I ) ) J/XK1
    TCRIT = ( 1./XK1 J-CEFINl JR( I ) , L ) / ( XK 1«BOD IN { JR I I ) ,L)-RCOM JRl I
                                                         )))
   1  +IRCCM JRl I ) ) + SCON (JRl I ) ) ) / I XK1 » ( XK1»30D IN I JR < I ) ,L)-RCCN(
                                                         JR(I ) ) )
   2)
    ARG1=-XK1«TCRIT
    IFITCRIT.GT.TIME)GO  TC  ICO
    OTHERWISE  RECOMPUTE  CEFOUT
    DEFGUT( JRl I),L)=IXK1*IBODINI JRl I ) i D-RCON I JR I I ) ) /XK1 ) *TCR I T
                                                         +
   1    DE Fits (JRl I ItU + lRCCNURU) ) + SCGNt JRl I) ) ) /XK I ) *EXP ( ARG1 )
   2      -IRCONl JRl I ) ) + SCCNl JRl I ) ) ) /XK1
    CCMPUTE  MINIMUM  DC
 ICO IFIDEFOUTI JRl I ) , L) .LT . DEF IN ( JRII ) ,L) ) XM I NCO = COS-DEF I M JR ( I

                               A4-138

-------
    IF(DEFQUT(JR( I)fL).GE.OEFIN(JRU)tD)  XN I NOC = DOS-DEFCUT ( JR (
                                                         I),L)
    WRITE(6, (OO)TIMEt GWASTEURl I ) , L ) , JOWST ( JR ( I ) , L ) , BCDWSK J*{ I
                                                         ),L),
   1      XKltXK2,XMINDOiBODOUT(JRm»L)tDEFGtT(JR(I)tL)iJRlI)
600 FGRPAKIH f9F8.4» 5Xt 12)
150 XKK{ JR( I ) ,L)=0.
    IF(XNIiNCC.LE.4.0) XKK( JRU) , L)=XyiNDQ
 10 CONTINUE
    RETURN
    END
    SUBRQliT I\E RQU AL ( L , T T , XK1 , BOC IN, CEF IN , OSUN2 ,
   lTIMEfIfDCCCUTfOEFQLT,XK2,»)
    CCNMGiWFLCWS/JRt 50 ) *l«Tl50t 10)
    CQKMCN/FLDW5/NREStIRES(50) ,JRES( 10) ,CAP( 10) ,SNIN( 10) ,STO( 10
                                                         ) .
   1        CIV{ 10 ) ,RRELl 1C) ,PSTO( 10)
    COPMCN/FLCWi2/XK220a( 10 ) , XK3 ( LO ) , 30DSTO ( 10 ) ,D£FSTO( 10)
    DIMENSION DEFIN(50t 5G) , DSFUUT ( 50 , 50 ) , BOD I N( 50 , 50 ) ,80DCUT(50
                                                         ,50)
    CALL TRES( IRES! JR( I ) ), IR)
    ARG=( .02A* (TT-20. ) )
    XK2 = XK220R{ IR)«EXIMARG)
    AVGSrC=.(PSrQ{ IRJ+STOdR) )/2.
    IFUVGSTC.LE.OGG TO  ICO
    IFtSTCl IR) .EQ.O.AND.RREU IR) .ME.OGO TO ICO
    Z=(QSUM2«3600.«24.)/ ( AVGSTO* 1 0**6 )
    W=( (RRELl IR)+CIV( IR) )*3600.*24.)/(AVGSTO*10«*6)
    XFK3=(XK3(IR)*AVGSTC)/CAP{IR)
    B=XK2+W
    TIME=11.57*STC(IR) /
    IF(T I^E.GT.30.0)TIKE = 30.
    ARG=-A*TINE
    IF(BCCSTC( IR) .LT. .001 )BODSTO( IR)=C.O
    CEF9 = DGDSTOUR)-Z*DOCIN( JR( I ) ,L)/A
    OEFg=CEFg»(l-EXP(ARG))/(A»TIKE)
    EODOLT(JR(I)tL)=DEF9+Z*SODIN(JR(l)|L)/A
    ARG2=-B*TIPE
    IF(CEFIM JR(I ),L) .LT..Q01) GC  TO 98
    DEFl=(t:EFSTO(IR)/D)-
-------
    DEFQLTUR ( I ),L)=( CEFH-CEF2+DEF3+CEF4)/TIME
    GO TO 102
 98 CEFCUTtJ2( I } ,L)=0.0
102 IF(OEFSTC(IR) .LT. .001 )GO  TC  S 9
    DEFSTGI m=DEFSTO( IR ) »EXP(ARG2)-Z»DEFIN(JR( I ) , U»EXP(ARG2)/
                                                         B+
   lXKl»BGDSrC(IR)«EXP(ARG2)/(A-B)-XKl*Z*BODIN(JR(I),L)*EXP(ARG
                                                         2)/(E»
   21A-Q) )+XKl*BUDST(J( IR ) *EXP { ARC ) / ( 8-A ) -XK1 »Z*BOC IN ( JR I I ) ,L)*E
                                                         XP(ARC)
   3/1 A* (3-A) }+Z*CEFIH(JR{I} , L ) /B + Z*XK 1 *30DI N ( JR ( I )  ,!_)/( A*BJ
    GO TO 1C3
 9S CEFSTC( in } = 0.0
103 BOOSrC(IP-)=BODSTO(IR)*EXP(ARG) + {Z*BODIN( JR(I) , U « { i.-EXP { AR
                                                         G)))/A
    GC TG 101
100 DO DOLT (JR(I)fL) = 30riMJR(I)tL)
    DEFCUTt JR( I ),L) = DL:FIN(JR( I),L)
    Bccsrc(n)=o
    CEF5TC(I«)=0
    z=o
    v<=o
    XFK3=C
    TIKE^O
    A = 0
    B = C
101 RETURN
    END
    SUBRCLTI.NC  REG(LtKYR)
    COr'MCN/FLCWl/NRf N!GtNCR(50) ,NUR(5Ct3) ,DAU(50,3) ,
   1      TCA(5C) ,NGAGE( 1C),.NCR ( 1C) ,CAG{10)f I OR (r>0)
    CGI"PCN/FLCN3/JR<50),MI5C,10)
    CONfCK/FLLW5/NRES,lRE;S(50)fJRES(10}fCAP(10JiSMN(10)»ST0(10
                                                         ),
   1       DIV(10 ),RREL( 10) ,PSTO( 10)  •
    CON,vCK/FLCVi7/GG( 10,48 ),QNAT( 50) ,NYR
    COyr/GN/FLCVJl3/GR5G{5n,50J , DEF IN { 5C , 50 ) t DEFULJT ( 50 , 50 ) ,BOOIN(
                                                         50,50),
   1BCCCUTI 5Ci50) ,XMINQ( 50,30) iLLXOGt 30) ,XKK(5C,50)
    CO.VMGN/FLCW9/XIRR IG(5Cf48)fGKASTEl50,A8),AVAP,OVAP,CVAPfTAU
                                                         (10,6),
   1       YMEAM10),ACCN(10),BCCN<10),CCON(10,6),ITYPE(10),
   2       TCFLEVt 10) ,ACAP( 10) iBCAP(10),CCAP(10),CCAP(10),ADEP(
                                                         10),
   3       BCEP(10)tCCEP(10)
    DIMENSICN DQ(50),AREA(IO),DEP(10)
    XL = L
    XLRAD=(XL»7.5+BVAP)/57.3
    EVAP = AVAP»SI.'< (XLRAO+CVAP
    DO 100 I-1,NR
    QNAT( JR(  I ) )=QI\AT( JR ( I ) ) -X IRR I G( JR ( I ) , L )

                             A4-140

-------
      IF(CNATUR(I)).LT.O)CNAT(JRU))=C
C  THE INDEX OF THE CURRENT REACH  IS JR(I)
C  IS THERE A REACH UPSTREAM
      IF(NUR( J3U) f IJ.GT.O) GO TO  LO
C  NO-IS THERE A RESERVOIR AT THIS REACH
      IF( IRES(JR( I) ) .GT.O) GO TO 20
C  NO
      DQ(JR( I ) )=0.
      QREG(JR< I ),L) =CNAT(J3( I ) )
      GO TO 4SS
C  THERE IS A REACH UPSTREAM
C  IS THIS A RESERVOIR
   10 IF( IRES J = 3
      CC(JR( I ) )=G.
      DO 11 K=1,J
      NU = NUR( J>K I ) t K)
      LL=IREACH(NU)
   11 CQ( JRU) )=CC( JR( I } MCC(LL)
      GREG{JR( I ) ,L)=            QNAT(JK(I))+DG(JR(I))
      GO TC 4-J9
C  THIS  IS RESERVOIR ,  NG  LPSTREAM REACH
   20 GIN=CNAT(JR(I))
      GO TO 4G
C  THIS  IS RESERVOIR,  REACH UPSTREAM
C  COUNT REACHES
   30 J=l
      IF(NUR(JR(I),2).GT.0) J=2
      IFlNURt J3U),3).GT.G) J = 3
      QIN=GNAT(JRCI))
      CO 31  K=l,J
      NU=NUR(JR(I),K)
      LL=IREACH(NU)
   31 GIN=GIN+CG(LL)
      CREG(JR(I)»L)=CIN
C  OPERATE  RESERVOIR
   40 CALL  TSEStIRES(JR(I)),IR)
      PSTC( IR) = STC( IR)
      CEP( IR) = (ACAP( IR)-» (BCAP( IR)*STO( IR)+CCAP( IR) )**.5)/DCAP( IR)
      AREA(IR)=ACEP{IR)+DCEP(IR)*DEP(IR)+CDEP(IR)*DEP(IR)«*2
      QVAP = AREA( IR)*EVAP
      GINV=CIN*.657-GVAP
      CALL  CIVRfcHIR,L,RRELV,DEP)
      STO(IR)=STO(IR)+(CINV-CIV(IR))
      IF(STC(IR ) .GT.CAPl IR) )GO  TO  3CO
      IF(ITYPEl IR) .GT.3JGC TO 31C
      IF(STC( IR ) .GT.TCPLEV( IR) .AND. ITYPEl IR) .EQ.DGC TO 302
      IF(STCUR).GT.SMINUR))GO  TO 303

                              A4-141

-------
    NO RELEASES-NO DIVERSIONS
301 RRELV=0
    STO(IR)=STO(IR)+DIV(IR)
    IF(STC(n).LE.O)GC TC  307
    GO TC 31C
    RESERVOIR EMPTY
307 STO( IR) = 0
    GO TO 31C
300 IF(ITYPElIR).EG.1JGO TO 4CO
  '  RRELV=STO{IR)-CAP(IR)
    GC TC 31C
4CO RRV=2C*RRcLV
    RTENP = STC(IR)-CAP( IR )
    lF(RrEMP.GT.*RV)GC TC  401
    RRELV=RRV
    GC TO 31C
    GO TC 310
303 IF(ITYPE( IRJ.NE.3JGO TO 4C3
    IS THE TIFE BETWEEN CCT.  1 +  NOV.l
    IFU.GE.37 .AND. L.LE.AOJGU TO scs
    NO-IS THE TIME BETWEEN APR. 1 +  CCT
    IFU.I.T.13 .OR.L.GT. 36)GO TC 306
    YES-TIMt  IS BETWEEN APR.  1 +  OCT.l
    IFlSTCdR).LE.CAP(IR) )RRELV = C
    GG TO 31C
    TIME IS  BETKEEN OCTCCER 1 + NOV.  1
305 SDIF = STU( IR)-SMIN( IR)
    RRELV=SCIF/(41-L)
    GC TC 310
302 RRV=20*RRELV
    IF(RTEMF.LE.RRV)GG  TC 402
    KRELV=RRV
    GC TC 310
402 IFtRFEMP.LT.RRELVlGO TO  310
    RRELV=RTEMP
    GO TO 310
403 IFUTYPEl IR).EQ.1)GO TO  309
    RRV=STO( IR)-SKIN( IR)
    IF(RRELV.LE.RRV)GO  TC 310
    RRELV=RRV
    GC TC 31C
309 STOl IR) = STC(IR)*QINV-RRELV
    IFlSTCt IR ).GT.TOPLEV( I R ) ) RRELV = STO ( I R ) -TOP LEV ( IR )
    GO TC 312
308 RRELV = STQ( IR)-SMIN(IR)
310 STO( IR)=STC( IR)-RRELV
312 RREL( IR)=RRELV/.657
    OG( JR( I ) )=RREL(IR )-GNAT( JR( I ) )
499 IF(L.GT.l) GO  TO  500

                           A4-142

-------
    XNINC.(JR(I)iKYR) = QREG(JR(I),L)
    LLX( JR( I ) ,KYR )=L
500 IFIXNINUJRII ) iKYR).GT.CREG( JR( I ) |L) )  GO TO 502
    GO TC 9S»
502 XNINCt JR( I),KYR)=CREG(JR(I),L)
    LLX( JR( I ) ,KYR)=L
 99 IF(GREG( Jrtl I) tL) ,LT.C.O)CREG( JR( I ) ,L)=C.O
ICO CONTINUE
    GREG( JR(44),L )=0.0
    HRITE(6f6CO)  L,KYR
600 FORMAT! ll-O, 'REGULATED  FLOViS  FOR  WEEK', 13,'  OF
                                                   YE AR ' , I A// ,2X
   14( 'REACH' ,2X, «REG.  FLChSTXM
    DO 50 1=1,11
    11=1+11
    12=1+22
    13=1+23
    fcRITE(6,610)JRU ) ,QREGUR(I) ,L) , JR(Il) ,QREG( JR(Il) ,L) ,
   1JR( I2),C1EG(JR(I2),L ),JR( 13} ,QREG( JR(I3) ,L)
610 FORMAT!' « , 2X , M I 3, 4X , F8 .0, 8X ) )
 50 CONTINUE
    ViRITe(6,3CO){JRES(I),STOm,RREL(I),DIV(I) ,I = 1,NRES)
SCO FORMATl 1HC, 'AT  THIS  TIME  THE  CONTENTS OF  GUR  RESERVOIRS ARE
                                                          AS FCL
   1LQWS',/' RESERVOIR    STORAGE     RELEASE    DIVERSION1 ./(
   1        1H  ,I9,F10.3|Fll.3tF13.3) )
    RETURN
    ENL
    SUBRCLTLXE RAKdX.NiR)
    DIfEKSICN  R(l)
 '   DO 10 1=1, N
    Rl I)=0. '
    CG 20 J=l, 12
    R( I) = R( I )+RRN( IX)
 20 CONTINUE
 10 R( I) = R( I )-6.
    RETURN
    END
    FUNCTION RRN( IX)
    IX=IX»65339
    IF( IX)5,£,6.
  5 IX=IX + 2lA7^836^t7+l
  6 RRN=IX
    RRN = RRN».'t656613E-9
    RETURN
    END
    FUNCTION STD(T)
    DIMENSION  T(^8)
    TBAR=0
    CO 1 1=1,48
                          A4-143

-------
  1  TBAR=TBAR+T(I)
    TBAR=TBAR/43.
    TSUM = C'
    CO 2 1=1,43
  2  TSUM=TSUiv+(T( I  )-TBAR)«*2
    STD=SCRT(TSUM/47.)
    RETURN
    END
    SUBROUTINE RDATA
    CONMCK/FLCW1/NR,"JG,NGR(50),NI:R(5C,3) ,DAU<50,3),
   1      TDAI50) ,  NGAGE.( 1C) , NGR( 1C),DAG( 10) , I OR (50)
    CQPKCN/FLCW5/NRES,IRES{5Q),JRES(10),CAP(10),SMN(10),STG(10
                                                         ) •
   1       CIV(IO)  ,RREL( lOfPSTCH 10)
    CON!MCN/FLnW9/XIRRIGt 50 , 48 ) , Q WASTE i 50 , 48 ) , AVAP , BVAP ,CVAP , T AU
                                                         (10,6),
   1       YNEAN( I'O) tACCM 1 0 ) , BCCN (10 ) , CCOiN ( 10 , 6 ) , I TYPE { 1 C ) ,
   2       TCPLEVt  10)fACAPC 10),5CAP(10)iCCAPl10),DCAP(10) .ADEP(
                                                         10) ,
   3       DCEP(1C),CCEP(10)
    DO 30 1=1,NR
    DO 30 J=l,48
 30  XlRRIGtI,J)=0
    READ!5»5CO)NRESt(IRES(I)»I=liNR)
5CO  FORMAK I5/( 1615) )
    REAC(5,501)(JRES(J),ITYPE(J),CAP(J),STQ(J),SMIN(J),TOPLEVU
                                                         )f
   1     J=1|NRES)
501  FORMAT(2I5,-i»F10.2)
    REAC(5,5C4)(ACCN( I ),ECONl I), I = 1,NRES)
504  FORMAT18F10.4)
    READ(5i505)(YKEAN(L)?ACAP{L),BCAP(L),CCAP(L),OCAP(L) ,
   1     ADEP(L)tBDEP(L)tCDEP(L)fL=l,NRES)
505  FORr'ATf 8P 10.2 )
    READ{5t5C3)AVAP,3VAP,CVAP,((TAU(I,'J),CCON(I,J),J=1,6),I=1,N
                                                         RES)
503  FORMATOFlC.Ot/(6F10.O)
    READ(5f502)NADJST,{LtNSTAfXIRRIGlNSTA|L)t
   1     I=1,NADJST)
502  FORMAK  15/t 15, 18,  Fl^.^t))
    RETURN
    END
    SUBROUTINE  CIVREL(IR,L,RRELV,DEP  )
 *#»**•»«**»**«*«»*«##*****•»#
    CO^N:CN/FLCVs5/NRES, IRES(5C),JRES(1C),CAP{10),SNIN(10),STQ(10
                                                         ) t
   1       DIV(10),RREL(10),PSTO(10)
    CQFKCN/FLCW9/XIRRIG( 5C.48) , QVvASTE ( 50, 48 ) , AVAP , BVAP ,CVAP , TAU
                                                          (10,6),
   1       YNEAN(10)tACON( 10) ,BCON(1C),CCON(10,6),ITYPE(10) ,
   2       TQPLEV(10),AC/\P(1Q),BCAP(10) ,CCAP(  10) ,CCAP( 10) ,ADEP(

                             A4-144 '

-------
                                                         10) ,
   3        BCEPI10),CCEP(10)
    CIMENSICIS CEP(IO)
    ITYP=ITYPE(R)
    XL = L
    GC  TO  (1,2,3,4,5),ITYP
  1 RRELV=ACCN(IR)*0.657
    THETA=(XL«2.*3.1416)/48.
    DIVl IR)=YKEAN( IR)
    CO  10  1=1,6
    ARG=ThETA-TAU( IR, I )
 10 DIVUR) = CIV{ I?mCCCN( 13, I)*CCS(ARG)
    GC  TC  101
  2 8CCNN=BCCN(IR)
    RRELV=0.557*ACON( IR)*C6P( IR)**3CCt,N
    UIVI IR)=C
    GO  TG  101
  3 RRELV-0
    CIVl IR) = C
    GO  TG  101
  4 RRELV=0
    THETA=(XL*2.*3.1416)/A8.
    DIVl IR)=YKEA;UIR)
    DO  40  1=1,6
    ARG=THCTA-TAU( IR, I )
 40 CIV(IR) = CIV{IR)+CCGN(IR, I ) *CCS(ARC)
    GO  TO  1G1
  5 THETA=(XL*2.*3.1416)/49.
    RRELV=YMSAN(IR)
    CO  50  1=1,6
    ARG = ThETA-TAU( IR, I )
 50 RRL:LV = RRF.LV    +CCCN ( I R , I ) *COS ( ARC )
    DIVtIR )=0
101 RETURN
    END
    SUBRCUTIXt S(KT,NN,A,B,C,IN',JK,Kf-',DET)
    DIMENSION A(KT»KD,B(KT,KT),C{KT,KT) ,INI 100),EVP(100)
    IMAX=IH
    JMAX=JM
    KMAX=KN
    GOTGl 30, 32, 34,36,38,40,42,44,46,50,52),NN
 30 CO 31  1=1, IHAX
    C031J = 1, J.''AX
 31 At I,J ) = B( I,J)+C(I , J)  "
    GO TC  805
 32 C033I = 1, If^AX
    C033J=ltJ^AX
 33 A( I,J) = B( I,J)-C( I ,J)
    GC TC  805
 34 C0101 1 = 1, IMAX
         = 1,K.VAX

                              A4-145

-------
     EMPtJ)=C.
    DQ35K=1, Jf^AX
 35  EMP(J)= ENiPt J) + Bt I,K)»CtK,J)
    C0101K=1,KMAX
101 At I,K)= E,VP(K )
    GO  TC 805
 36 CQ37I=1,I^AX
    C037J=1, IN/NX
 37 At I, J)=B( UJ)
 59 IN(1)=0
    IMAXCMMAX-1
    TEMP=A(1,1)
    C070I=2, U'AX .
    IFtABS  (TEMP)-ABS  ( A ( I , 1 ) ) )71,70,70
 71 IN(1)=I
    TEMP = A( 1,1)
 70 CONTINUE
    IF(Ii\ (11)73,72,73
 73 IS=IN(1)
    C07^tJ = l, INAX
    TEMP=A(ItJ)
    A( 1,J)=A(IS,JJ
 7A A(IS,J)=TEMP
 72 IF(A( 1, 1 ) )99,99,98
 98 C075I = 2, INAX
 75 A( I,1)=A( I, 1)/A( 1, 1)
    001001=2,IMAX
    IPC=I+1
    IMO=I-1
    D080L=1,ING
 80 A( I,I )=A( I,I)-(A(L,I )*AlI,L) )
    TEMP = A( 1,1)
    IF(I-IMAX)55,83,55
 55 IN(I)=0
    C081IS = II'C, IMAX
    CG85L = 1, INC
 85 A(IS,I)=A(IS,I)-A(L,I)»A(IS,L)
    IF(ACS  (TEMP)-ABS  (A( I S,I)))82,81,81
 82 TEMP=A(IS,I)
    IN( I ) = IS
 81 CONTINUE
    ISS=Ii\(I)
    IF(ISS)64,83,84
 8't >C0886J=1, IMAX
    TEHP'=A( I , J )
    At I,J)=A(ISS,J)
886 At ISS,J) = TENP
 33 IFtAt 1,1 ) )97,99,97
 97 IF{ I-U'AX )5^t, ICO, 54
 54 f3086IS= I PC, IMAX
 86 At IS, I ) = A( IS, I )/A( 1,1)
                               A4-1A6

-------
    CQ89JS=IPL, IMAX
    DC89L=1, IfO
 89 A(I,JS) = A(I,JS)-U(L,JS>*A(I,L))
100 CONTINUE
    DQ600JP=lf IMAX
    J=IMAX+1-JP
    A( J, J)=1.C/A( J,J)
    IF( J-l J633,70Ci603
603 C0600IP=2,J
    I=J+1-IP
    IPQ=I+1
    TEMP=O.C
    C0602L=IPC,J
602 TEMP=TEMP-A(I,L)*A(L,J)
600 A( I, J)=TKNP/4( 1,1)
700 00151J=1, IKAXO
    JPQ=J+1
    D0151I=JPC, IMAX
    TEMP=0.0
    IMO=I-1
    D015^L=J,IMO
    IF(L-J)152, 153,152
152 TEMP=TEKP-A(I,L)«A(L,J)
    GO TG154
153 TENP=TEMP-A(I,L)
154 CONTINUE
151 A( I, J)=TFNP
    009011 = 1, IN.AX
    00«3COJ = 1, IMAX
     EMPI J)=0.0
    IF(IN-J)89S, 097,898
893  EMP(J)= EMP( J)+A( I,N)*AIN, J
    GC TC899
897  Ef',P(J)= EMP( J) + A( IfK)
899 CONTINUE
9CO CONTINUE
    OG901J=1, IMAX
901 A ( I , J ) = E P P ( J )
    005001 = 2, IMAX
    IF ( IN(M) )b02,5CO,502
502 ISS=IN(M
    D05C3L = 1, IMAX
    TEMP = A(L, ISS)
    A(L,ISS)=A(L,M)
503 A(L,F)=TEFP
500 CONTINUE
    DET=0.
    GO TO 8C5
120 CET=1.
                             A4-147

-------
 •59 WRITE             16,606  )
8C6 FORNATdSHC  SINGULAR  MATRIX)
805 RETURN
 38 00391=1, IVAX
    CC39J=1, INAX
 39 Al I,J)=G( I , J)
    DET=L.
    11=1
  1 13=11
    SUN = AES  (A( II , II) )
    DO 3  1 = 11, N
    IF(SUK-ABS  (A( I, I 1) ) )2,3,3
  2 13=1
    SUX=ABS  (AU.I1M
  3 CONTINUE
    IF( 13-11)4,6,4.
  4 D05J=l,i\
    SUN = -A( I It J)
    A( I 1, J)=A( 13, J )
  5 At 13, J) = Sby
  6 I3=I1-H
    0071= 13, \
  7 A( I,I1)=A( 1,1 1 )/A(I 1, II)
    J2=I1-1
    I F ( J 2 ) 3 , 1 1 , 8
  8 D09J=I3,N
    0091 = 1, J2
  9 AU1,J) = A( II, JJ-AU1, I)»AU,J)
 11 J2=I1
    11=11+1
    DO 12 1 = 1 I, N
    C012J = 1 , J2
 12 A(I,IU = A(I,I1)-A(I,J)*A(J,I1)
    IF( I 1-N) 1, U, 1
 1^ 13=1
    J2=N/2
    IF(2*J2-M 15, 16, 15
 15 13=0
    DET=A(N, N)
 16 C017I=1,J2
    J=N-I+I3
 17 DET = CET»A( I, I )*A( J,J)
    GO TC 305
 40 IF( IMAX-JMAXK1, 102,102
 41 IP=If.AX
    GO TC 1C3
102 IP=JFAX
103 C0106K=1, IP
    DU104I = K, IKAX
104   EMP( I) = G( I,K)

                              A4-148

-------
    D0105J=K,JMAX
105 AU,K)=B(K,J)
    CC106I=K, If AX
106 A(K, I )= £,vp( I )
    GO TC 805
 42 00431=1,INAX
    CC43J = 1, Jf-'AX
 43 A( I , J)=D( ItJ)
    GO TG 305
 44 00451=1,IMAX
    CC45J = lt JMX
    At Ii J)=0.
    B(I,J)=C.
 45 C( I , J)=C.
    GC TO 305
 46 ID=2
 20  READ (KfAX,47-)  If, ( 1 ) , I N ( 5 ) , EMP ( 1 ) , I M ( 2 ) , IN ( 6 ) »EMP ( 2 ) ,
   1  IN13),IN<7) ,EMP(3) i IN{4) ,IN(3) ,EMP(4)
 47 FORMAT  ( 4 ( I 3 , I 3, E 12 . 8 ) )
    IF( Iitl( 1) )8C5, 805,23
 23 GO TG( IS,24), 1C
 24 IN=IN(1)
    JK=IN(5)
    ID=1
 19 00211=1,4
    11=INI I)
    J1=IN(1+4)
    IF( 11)21,21,18
 18 A( II,Jl)=  £MP( I)
 21 CONTINUE
    GC TC 2C
 50 CO 62 IP=ltJMAX|7
    JPO=IP+6
    IF(JPC-JMAX)61t61,60
 60 JPO=JVAX
 61 WRITE             (KMAX.63)(J,J=IP,JPG)
    DO 62 1=1,IMAX
    WRITE             (KMAX,64)I,(A(I,J),J=IP,JPO)
 62 CONTINUE
    GO TG 805
 63 FORNATOhC  ROI^7 ( BX , 4HCOL . I 3, 1 X ) )
 64 FORMAT(14,4X,7E16.8)
 52 CC53I=1,I^AX
    D053J = 1, J.^AX
 53 AU,J>=B(I,J) »CET
    GO TC 805
    END
    SUBRCITINE  TRAN
    CO^/^C^/FLC«l/NR,NG,^iCR{50) ,NlR(5Ci3) fCAU(50,3) ,
    1      TDA(50) ,NGAGE( 10) ,,NGR( 10) ,DAG'( 10) , IDR150)
    CCKMCN/FLCW2/FH5C),ROUGH(50),SLOPE(50)
                             A4-1A9

-------
      COfMCN/FLCW3/JR(5C) ,vat 50,10)
      C I KEN SIGN JGU( 10) ,ML<50) , NIC I 50)
C  •»«****** * » »*«****«**»« a s*
C  COMPUTE FLCH. IN LAST  REACH  DOWNSTREAM
C  a*******««*«************»
      I = JR(NR)
C  IS THERE A GAGE  IN THIS  REACH
      J = 0
      CC 5 JJ=l,NG
      IF (NGR(JJ ) -  NCR(I ) )  5,6,5
    6 J = JJ
    5 CONTINUE
      IF (J) 10,10,15
C  THERE IS A GAGE - CASE  1
   15 DO 16 JJ=1,NG
   16 WT( ItJJ)  =  C.
      WT(I»J) =  TCAH )/CAG( J)
      GO TG ICC
C  THERE IS NC  GAGE  - CASE 2
   ID CALL UPGAGE (I,NGU,JGU)
       IF (NGU)  21,21,22
   21 WRITE  (6,6CCO)
 60CO FORMAT  (1CX,'NQ GAGES')
      STOP
   22 CG 23 JJ=1,\G
   23 WT( I tJJ )  =  C.
      GCA  = 0.
      DO 25 JJ=1»NGU
   25 GCA  =  GLMCAG( JGU(JJ) )
       CO 24  JJ=1,NGU
       J  =  JGU(JJ)
   24  \vT( I, J)  = TDAl I )/GCA
 C  «***«*«»«**«************«*****
 C  CONTINUE  UPSTREAM
 r  ***»****«»*«*»**«********#*»**
   100  IU =  I
       IB =  1
       MC( IB)  =  IU
 C   IS  ThERE  A  REACH UPSTREAM
   105  NU =  NUR( lUi 1 )
       IF (NU)  110,110,115
 C  THERE IS  NC  REACH UPSTREAM
   110  IB =  ID  -  1
 C  HAVE  ALL  REACHES BEEN CCKPLETED
       IF (IB)  2CO,2CC,12C
 C  TRANSFCRI"  IS COMPLETE
   2CO  RETURN
 C  CONTINUE  CALCULATIONS
   120  IU =  NIU( IB)
       ID = ML( IB)
       GO TG 15C

                               A4-150

-------
                   135, 135, 14C
                   BRANCH
 THERE IS AN UPSTREAM REACH - IS
115 IF (MJRULtZJ) 125,125,130
 THERE IS NC BRANCH
125 NU = NURt IU,1)
    ID = IU
    IU = IRLACH(MU)
    GC TG 150
 THERE IS A BRANCH - ARE THERE TWO
130 IB = ID + 1
  .  NU = MJFU IU, 1)
    NIU(IE-l) = IREACH(NU)
    NIC( IB- 1 ) = I U
    IF (MR< IU,3) )
 THERE IS ONLY ON.E
135 NU = NUR(IU,2)
    ID = IU
    IU = IREACH(wU)
    GO TC 15C
 THERE IS ANCTHER BRANCH
140 NU = NURlIU,2)
    IB = IB + 1
    NIUI IE-1) = IREACH(ML)
    NID(IR-1) = IU
    NU = NUR(IU,3)
    ID = IU
    IU = IREACMNU)
    THERE A GAGE  IN
    J = 0
    DG 151 JJ=1,NG
    IF (NGR(JJJ-NORlIU))  151,152,151
    J = JJ
    CONT INUE
    IF (J)  160,160,165
 THERE IS A  GAGE  IN  THIS  REACH
165 DC 166 JJ=1,NG
166 WT I IU,JJ) = 0.
    WT{ IU,JJ =  TUA(IU)/DAG(J)
    GO TO 105
 THERE IS NC GAGE  IN THIS  REACH
160 CALL UPGAGE  (IU,NGU,JGU)
     IF  (NGU)  180,180,161
161 GCA = 0.
    DO  170 JJ=1,NGU
    J = JGU(JJ)
170 GDA = GCA +  DAGt
    DO  171 JJ=1,NG
171 WT(IU »JJ) = 0.
    Al =  (TCA(1C)  -
    00  172  JJ=1,NGU
    J = JGU(JJ)
172 WTUU,J) =  A1*TCA( IUJ/GDA
                                 THERE A BRANCH
 IS
150
152
151
THIS REACH
                    J)
                     TCA( It) )/(TCA{ID)  -  GDA)
                            A4-151

-------
      Al =  (TCA(IU)  -  GCA)/(TDA(ID) - GDA)/TDA{ID)
      CO 173 J=1,NG
  173 '*T(IU,J)  =  UT(IU.J)  + A1»WTUD,J)*TDA(IU)
      GO TC  10?
C  THE3E IS  NC  GAGlZ  UPSTREAM - CASE 2
  180 Al =  TDA{ IU)/TCA( ID)
      DO 101 J=1,NG
  181 M(IUiJ)  =  A1*WT(IC,J)
      GO TC  1C5
      END
      SUSRLITINE  TGEN
      CGNNON/f-LCWl/NR,.NG,NCR(5C),NUR(5C,3),QAU(50,3),
     1       TCM50) ,.\GAGE( 10) , NCR (  10) , DAG( 10) , IUR150)
      CCWCN/FLCW2/-FU5C) .ROUGH (50) ,SLCPE(50)

      C I PENS 1C\  IR(5C)
      DIKE.\SICN  NNQR150)
      REAC  (5.5C01)  r.R,NG
 5C01 FORMAT  (215)
      CO 1  1=1,NR
      •\NCR( I ) = T
    1 ICR( I ) =  C
      CO 5  1=1,NR
    5 REAC  (5.5C02)  \GR( I ) , (NOR( I ,  J ) ,J = 1 , 3 ) ,
     1      (DAL(I,J),J=l,3J,FL(I)iSLCPE{I),ROUGH!I)
 5002 FORMAT  (415t6F5.Q)
      CO 6  1=1,NG
    6 READ  (5,5C03)  NGAGE( I ) ,NOR( I  ) , DAG I I )
 5003 FORMATtI 3,15,F5.0)
C  DETERMINE SECUENCE  OH  REACH NUMBERS
      CO 15  I=1,NR
   15 IRI i)  =  :
      DO 2C  N=1,NR
      I =  1
   23 IF ( IR( I ) )  21,21,22
   22 I =  I  +  1
      IF( I .GT.NR) GC TO 20
      GO TO  23
   21 K =  0
      CO 25  J=i,3
      IF (NUR(I.JJ)  25,25,26
   26 NUP  =  NL2( I, J )
      L =  IREAChd\UP )
      IF ( IR(L) )  27,27,25
   27 K =  1
   25 CONTINUE
      IF (K)  3C.3C.22
   30 JR(M  =  I
      IR(I )  =  1
      CO 36  K=l,3
      IF (KLR( I ,KM  36,36,37
                               A4-152

-------
   37 ND = NUR( I ,K)
      ID = IREACHUC)
      ICR(IC)  =  I
   36 CONTINUE
   20 CONTINUE
      DU 45 1 = 1, NR
      TCAl I )  = 0.
      CC 45J=1,3
   45 TCA( I )  = TCA( I ) + DAL( I t J)
   * ft *« « B « 
-------
    NGU = 0
    IB = 1
    IU = I
 IS THERE A REACH UPSTREAM
  5 NU = NUR< IU,1 )
    IF (NU) 1C,10, 15
 THERE IS NC REACH  UPSTREAM
 10 ID = IB -  1
 IS THE SEARCH COMPLETE
    IF (1C) iCC,ICC,20
 SEARCH CCfPLETE
ICO RETURN
 CONTINUE SEARCH
 20 IU = ,MU( IG ) '
    GC TO 24
 THERE IS AN UPSTREAM REACH -  IS  THERE A  BRANCH
 15 IF (NUR( IU,2) )  25,25,30
 THERE IS NC BRANCH
 25 IU = IREACH(NU)
 IS THERE A GAGE
 24 J = 0
    CC 26 JJ=1,NG
    IF (NGR(JJ) - NOR(ID) 26,27,26
 27 J = JJ
 26 CONTINUE
    IF (J) 35,35,4C
 THERE IS NC GAGE IN THIS REACH
 35 GO TC 5
 THERE IS A GAGE IN THIS REACH
 40 NGU = NGL 4  1
    JGU(KGU) = J
 CONTINUE SEARCHING
    GO TC 1C
 THERE IS A BRANCH
 30 IB =  IB 4  1
    NU = NUR{IU, 1 )
    MU( IB - 1)  = IREACH(NU)
 IS THERE A SECCNC BRANCH
    IF (NUR( IL,3) ) 45,45,5C
 THERE IS NC SECOND BRANCH
 45 NU = NUR(IU,2)
    GO TC 25
 THERE IS A SECCNC BRANCH
 50 13 =  ID +  1
    NU = NUFUIU.2)
    NIUl IB-1 )  =  IREACH(NL)
    NU = NUR(IU,3)
    GO TC 25
    END
    FUNCTION  IREACH  (NU)
             Cl%l/NR,NG,N(:R(5C),NUR(50,3),DAU(50,3),
                             A4-154

-------
   1      TCA(5C),NGACE(1G) ,NGR{ 10 > , CAG ( 1 0 ) , I OR ( 50')
    COMMCN/FLCW2/FL{5G),RGUGH(50),SLOPE(50)
    CONMCN/FLGW3/JR(5C),UT(50,10)
    11 = 1
  3 IF {.NCR III)  - NU)  1,2,1
  111=11+1
    IF (II.EG.NR) GO TC  2
    GC TC 3
  2 IREACh =  II
    RETURN
    ENC
    SUBROUTINE GFLCW(K)
    CCPMGN/FLCM/NR,NG,NC3(5C) ,NLR(5Q,3) ,DAU(50,3) ,
   1      TCA15C),NGAGE( 1C),NGR(10),CAG{10),IDR(50 )
    COfKCN/F-LCv\'7/GG( 10,48) ,QNAT(50),NYR
  2 REAC(9)({GG(I,J),I=1,NG),J=1,43)
 11 wRITE(6.6CC)  K
600 FORMAT! ' 1« ,T
-------
      J = 0
    5 J=J+1
      IFt JRES(J).ECJ.N)  GC  TG 10
      IF( J.LT.iNRES)  GO  TO  ^
      WRITE(6,6COC)NiI,NRESfJRES
 6000 FCRNATC RESERVOIR  CANNOT BE LOCATED'/(2015))
      CALL EXIT
   10 I = J
      RETURN
      END
/«
//GC. FT 09 FOCI CC UN I T = TA PES , VCLUKEI = SER = XXX , LABEL= ( ,3LP),DISP=(,PA
                                                            SS)
                             A4-156

-------
A4t 6 AIJ

A4 o 6 o1 Purpose
The AIJ program is designed to develop the transfer coefficients for BOD
and DO deficit for each reach in the watershed for each "week" of the
year*  The coefficients are developed by simulation, using WASP to gener-
ate the data needed to compute them.  The coefficients are dependent upon
many factors, the effects of which are assumed to be either dependent
upon the week of the year or upon the rate of streamflow.   The weekly
dependence is circumvented by computing the coefficients for each week
and the flow dependence is accounted for by regressing the coefficients
on the stream flow.  The transfer coefficients are intended for use to
predict the effects of adding a waste load in reach i on the BOD and DO
deficit on a downstream reach j.  The predictions can be used to gain
insight into the effect of a set of loads on the watershed before computer
time is expended to obtain a better prediction by simulation methods.

The idea of transfer functions and coefficients was obtained from the
systems engineering field.  In simple terms, a system is a "black box"
which performs some change on the input information as it passes through.
This is illustrated in its simplest form by the diagram shown.
            Input
System
Output
For instance, if the system squares the input, in which case when the in-
put is 4, the output would be 16.  If the system function is constant,
±«e,, if the input is always squared, the system is called a stationary
system.  If the system function is time-dependent, the system is called
non-stationary.

In the systems application to a watershed, the system is the river, the
input is the BOD of a waste load and the output is a downstream BOD value,
which is smaller by reason of the fact that the river has operated upon
it.  Similarly, a waste discharge causes a DO deficit which is operated
upon by the river system, which now includes the BOD load, and the out-
put DO deficit is the result of the system operation.  It is obvious that
a river is a non-stationary system, and likely, it is quite non-linear
as are most natural systems.

In the consideration here, the simulation treats the river as a constant
for each week, that is, the temperature is constant for a week and the
flow is averaged for a week, so that the river system has been made
stationary for intervals of a week.  So, if the system function is con-
sidered constant for a week, the real system, which is continuously
changing with time, is approximated by a system which is stationary for
weekly intervals.
                               A4-157

-------
There is another problem in the analogy of the river to a system.  There
is variability in the river throughout its length.  It is for this reason
the river has been divided into reaches.  The problem is that, if each
reach is a system, then there is a chain of systems and, unless these
system functions are linear, that is, the effects or changes of each sys-
tem are additive, then the overall system effect becomes very complicated.
The problem is overcome by assuming each reach system operation is linear
and therefore the effects are additive.  The problem of non-linearity
plagues all systems work and a common means for handling it is to make
this assumption of linearity and proceed, realizing the result is an
approximation.  Fortunately the BOD and DO deficit equations are linear
excepting in the vicinity of the point of maximum DO deficit and, to the
extent that the mathematical models of Streeter-Phelps describe the non-
linear oxygen relationships in the stream, the assumption of linearity
holds.

In systems engineering, the system is designed to perform a certain
operation upon an input to produce the desired output.  The system func-
tion is usually described by a differential equation.  In the application
to natural systems, it is often impractical or impossible to develop a
mathematical expression for the system function, so the procedure some-
times used is to input a known signal and measure the output signal to
determine the system function.  This latter method is used in this work.
A unit BOD load is placed successively at each reach point and, by simu-
lation, the BOD and DO deficit at each downstream reach point are deter-
mined.  The overall transfer coefficient determined in this manner con-
tains the effect of the flow rates at the two reach points.  If the over-
all transfer coefficient is aj , then:
                                                                    4-93]
where a^ relates the BOD concentration at the lower end of reach j to
a unit BOD loading at the upper end of reach i, r. .  relates the flow at
the lower end of reach j to the upper end of reach i and a^ .  is defined
as the ratio of a  /r^ .  From these definitions,
                                                                    A.95]
                             --   Xi

and
                              A4-158

-------
Since BOD-i  < BOD^^ and Q^ <  Qj,  and all values are positive, the value of
aj_j must be

                           0 <  Gm < 1.0
A similar relationship can be worked out for the DO deficit.  It should
be noted that a value of zero for the deficit at the upstream end of
reach i leads to a division by zero and an indeterminant form.  It is
necessary to assume the DO deficit has a positive finite value, an assump-
tion which is proper because unpolluted natural waters rarely are in
excess of 95 percent oxygen saturated.  In the simulation program to
develop the a^j values, if the value of DEFIN^ is zero, it is automatically
set equal to 0.5 mg/1.  Similarly, if the value of Q^ is zero, as it will
be at all upstream reaches, Q^ is arbitrarily set equal to 1.0 cfs.

The program places a unit load at the upper end of reach 1 and by simu-
lation, using WASP, the output BOD and DO deficit are computed for each
downstream reach.  This is done on a "weekly" basis for a given number
of years to provide adequate sampling for each "week" of the year.  This
allows a linear regression analysis to be made of the transfer function,
ajj , on the streamflow ratid, r^j .  The program computes the constant
coefficients of the regression equation.  This is repeated for each reach
remembering that, for reaches numbered consecutively upstream, when i < j,
the values a^  and r^  have.no meaning.
The result allows the prediction of any a^j for week 1 having a flow
ratio of r^i by the equation:
                                                                   .  4.97]
where a^, is the BOD transfer coefficient from the upper end of  reach
1 to the lower end of reach j during week of the year, 1; fl-m  is the
slope and A. ., is the ordinate intercept of the regression  equation  for
the transfer3 function i, j for week 1 and r^ is the flow  ratio  Qj/Qi
for week, 1.  Similarly:                            ;
for the DO deficit transfer -coefficient djj,, C^ji. 'and DI.,I  are  the
•lope and ordinate intercept constants in the regression equation and
rjji is again Qj/Qi for weak, 1.  The subscripts i, >j and  1 have  the
same meaning as above.                              ••

The method of computing tha values of the regression coefficients,
and Cjo and the intercept constants Ai:n and DJ.JI may be  found in
standard statistics taxt books  (10).
                              A4-159

-------
The use of these transfer coefficients is illustrated as follows.
Given the program output of AJJ-L = 0.15 and B. . ^ = 0.10 for upstream reach
i, downstream reach j, and weei 1.  What is the BOD at reach j for a flow
ratio of Qj/Qi = 4.5 if the BOD loading at reach i is 10mg/l?

                       " °-10 x 4-5 + °-15 " 0>6°

                BOD at reach j «• 0.60 x 10 « 6 mg/1.

A4.6.2 Program Components
The AIJ program is, in reality, a subroutine attached to and called by
the simulation program, WASP when it is desired to determine the A^]_,
Bijl» cijl anc* Dijl values for the watershed.  WASP supplies all the in-
formation necessary to compute these constants.   The subroutine requires
considerable storage capacity and an operator needs to ascertain, before
attempting to use it, that the computer to be used has the required •
capacity.

Because the AIJ program requires considerable storage, and, for a large
number of reaches, the volume of output will be great, the program is set
to compute the a±* and d^j equation coefficients for only the critical
summer months, weeks 25 through 33 (July and August).  In addition, a
sorting subroutine has been worked out to determine only those i-j com-
binations that are possible for a given watershed configuration.  To
reduce the storage required, equivalence statements are used wherever
possible.

The simulation programs FLASH and WASP are modified slightly for use with
AIJ.  The modifications consist mainly of removing the subroutines which
output the data generated by FLASH and WASP and the subroutines which
compute the statistics.  The generated data are used internally and the
statistics are not needed.  Program AIJ should not be used until it is
reasonably assured that the data and parameter inputs produce accurate
simulation.

A list of subroutines of the program AIJ and  their length, in bytes, are
as follows:

QUAL             11,648             MEAN              1102
RQUAL             5,316             UPGAGE            1542
FLASH            68,902             IREACH             452
MAIN              1,202             QTRAN              692
SIM               1,208             TRES               578
REG               6,948             GEN               1424
RAN                 460             COREL             4538
RRN                 396             TRANS             1684
STD                 560             WFLOW              664


                              A4-160

-------
RDATA
DIVREL
S
IRAN
TGEN
AIJ
FUNCTIONS
                 2,080
                 1,904
                14,670
                 4,434
                 4,184
                53,796
                22,864
ITRAN
EIGEN
FCOEF
SORT
NFIND
COMMON BLOCKS
    707
   8404
   1968
   2020
    536
118,864
Total program length, for the program as applied to the 43 reaches of
the Farming ton River Basin, which has 505 i-j combinations, is
345,272 bytes.

The only subroutines not already described in the proceeding subsections
of this appendix are SORT, NFIND and AIJ.  These subroutines are described
below.  It should be noted that the subroutines in program AIJ are written
to use the reach numbering scheme described in 6.3.1 and will not work
unless this scheme is used.                                         -

A4.6.2.1  Subroutine SORT
The subroutine SORT uses the reach data read into subroutine TRAN, and
the computational sequence established internally by TRAN, and computes
the possible i-j combinations.  For each i, that is, for each upstream
reach, SORT, finds the reach numbers, J, of all reaches downstream.  Then
the subroutine continues, setting up an internal indexing system that
indexes the possible i-J combinations.  The i-i combinations are included.
This indicates the stretch of river from the upstream end of reach i to
the downstream end of reach i.  SORT transfers the index numbers generated
to subroutine AIJ through COMMON/ SORT/ 1.

>4.6.2.2  Subroutine NFIND
Subroutine NFIND is called by subroutine SORT to search for reaches down-
stream.  SORT, operating on a "do loop" through all reaches, assigns a
reach number, in the order of the internal computational sequence (index
JR(I)) and calls that number K.  Then subroutine NFIND is called and, in
a similar "do loop" but this time operating on the downstream reach index,
IDR(I), a search is made through all reaches for reaches downstream from
K.  When a downstream reach is found, this reach number is transmitted
back to SORT for indexing and printing.
A4.6.2.3  Subroutine AIJ
Subroutine AIJ computes the regression coefficients, B
the intercept constants Ajj^ and DJ^  which can be use
value of r1-1 to compute the transfer functions.
                                                          and CJNM and
                                                        with a selected
Subroutine AIJ is called by subroutine SIM (in program WASP) in a weekly
"do loop" nested, in turn, in a yearly "do loop" running over the number
of years of simulation desired.  So, for each week, the subroutine AIJ
                              A4-161

-------
makes the desired computations for the indexed i-j combinations and adds
them to the summing variables.  The information for making the computa-
tions is obtained from program WASP (and FLASH) which is simulating in
the same time sequence.  Subroutine AIJ selects only the values it needs
(BOD and DO into reach i, BOD and DO out of reach j and the ratio of flow
in reach j to the flow in reach i) for the months of July and August.  A
check is made for the appropriate weeks (L-25, 	33) to assure the
proper values are obtained.  The number of weeks and week numbers may
be changed as desired merely by changing the numbers in the appropriate
statements of the subroutine AIJ coding.

The program is run for the number of years desired; thirty are recommended,
to obtain an adequate number of points with which to form the regression
equation.  After this selected number of years has been traversed, sub-
routine AIJ is again called and, in the .last pass through SIM, the regres-
sion coefficients and constants are computed and printed.

A4.6.3  Program Input
In setting up the coding for a FLASH-WASP-AIJ run, the operator should
establish DIMENSION values that reflect exactly the number of reaches,
basis gages, reservoirs, loads, i-j combinations, etc., so that the
machine storage requirement is minimized.

The program inputs are identical to those required for the simulation
programs FLASH and WASP excepting that a single unit load is placed at
the upstream end of reach i.  In the interest of savings in machine
storage, FLASH should be used to produce a tape of parameters for gage
data generation rather than to use the additional storage required to
develop the parameters from historical data during the AIJ run.

A4.6.4  Program Output
The output in program AIJ consists in the following:
(1)  a set of generated flow data for each year,
(2)  two arrays which are identical to the first and third arrays in
the output of TFLOW, see A4.3.4,
(3)  an array showing, for each reach, the reaches in the system that are
downstream thereof,
(4)  a listing of the i-j combinations in the system and their corresponding
index, and
(5)  an array which lists the regression coefficients and constants along
with their identifying week.

A4.6.5  Definition of Variables
Following is a list of variables used in AIJ and a brief definition of
each.  Variables associated with FLASH and WASP are defined in A4.4.5
and A4.5.5, respectively.


                              A4-162

-------
LM)
LM)
AA(IDX, LM)
AD(IDX, LM)
ALFA
BA(IDX,
BD(IDX,
D
DELTA
IDR(I)
IDX
INDEX (M)
JJ
JR(I)
JX
K
KK
KOUNT(I)
L
LW
M
MSORT
N
NG
NN
SA(I,J)
SALFA(I)
SD(I,J)
SDELTA(I.J)
SR(I,J)
SRSQ(I.J)
ALFA/R
Regression constant, A.,, for index IDX, week LW,
Regression constant, D^j, for index IDX, week LW
Ratio, BODOUT/BODIN, for current index
Regression coefficient, B^J, for index IDX, week LW.
Regression coefficient, C^j, for index IDX, week LM.
DELTA/R
Ratio DO deficit out/DO deficit in, current index
Downstream reach index
Index number
Mfch index number
Convenience variable
Computational sequence index
Convenience variable
Convenience variable
Convenience variable
Convenience variable
Convenience variable
Week number
Convenience variable
Number of i-j combinations
Convenience variable
Convenience variable
Convenience variable
Ratio of flows, reach j/reach i.
Summing variable, sums A for i-j combination
Summing variable, sums ALFA for i-j combination
Summing variable, sums D for i-j combination
Summing variable, sums DELTA for i-j combination
Summing variable, sums R for i-j combination
Summing variable, sums R2 for i-j combination
A4.6.6  Program Logic
Figure A4-10 is a diagram showing the program logic for ALL

AA.6.7  Program Coding
The program coding for AIJ  follows.
                              A4-163

-------
                           FIGURE A4-10
                       PROGRAM LOGIC - AIJ
                       Subroutine  SIM
           Call FLASH
 Return
each year
Return
each week
                                      ^--develop  flow generator
                                         parameters
                       Call AIJ
                       CallTLA
                          -••—develop i-j combination
                             indexing system
                   SH(K)	>-generate one year of gage
                             data
                       Call  QTRAN(L)-
                            •generate unregulated stream
                             flows, for week
                       Call REG(L,K)	1»- compute regulated stream
                                         flows,  for week
                             	1
                       Call QUAL(L)
                             simulate water quality
                             conditions in system, for week
                       Call AIJ SUB
                        (L,K, NYRG)
                           -^-extract necessary simulated
                             data, calculate  and sums
                             values for each index, for
                             specified week
                       Compute and
                       Print Regression
                       Coefficients and
                       Constants
                          END
                                 A4-164

-------
//V.A3P2     JUii  ( 1143,'t7t04C , 1 l.SCCO) , 'ARROYO A^Al'RI  A.     ',CLASS

//  EXf.C  FliU'.; ( 4 3 , 3 ) , DAU ( 43 , 3 ) ,
      1        TLA (43) , NG<\GE{  fc),NGR(  6),CAG(  6 ) , I I'.R ( 4 3 )
       C Of ;• 1.1\ / f; I. C V.3/JP(43)fhT(43i6)
       CUf-i-'CN/FLLW^/.-JRESt I R ti S ( 43 ) , JR GS ( 1C ) , CAP ( 1 0 ) , S MN ( 10 ) , S TG ( 10

      1         C IV ( I'l ) ,RKEL( 1C)
       CGf'rr,N/r:i.L',\7/c;G(6t46) tGNAT(43) ,.MYKG
       C(il«'f'LN/r LUl.ll/T(4C) i S ICMAT,Z ,C, Tfti AN , RLNTH ( 4 3 ) , ISTART,XK,XH

      1        CC, F, XKJ?0'/n A3) , ftODV^STl A3, <> >) ,
      2         CiJi-.S F( 42, 4(j) , R (/tf>) , RC Civil 4 3 ) , SCUKl A3)
       CLlf f-'LK/FLLWJ/ X IRR I G ( 4 3 , 4 S ) , CKASTL ( 43 , 48 ) , A VAP , PA'AP , CV A P , T AU
                                                                  (10,6),
      1         Yf'F.AM 1C) , ACC.M 1 0) ,BCCN( 10) ,CCOi\( 10,6) , I TYPE ( 1C) ,
      ?.         f'CPL EV ( 10) , AC ASM 10) , DC API 1C) ,CCAP( 10 ) , CGAP ( 10 )  , ADEP (
                                                                  10) t
      3         r,ni;p( ic ) tCUEiM 10)
      HHJOlJUTCii, Ail) ,XMI!jQ(43, 30 ) , L L X ( 4 3 , 30 ) , XKK ( 43 , 4 R )
       i: I M [i:\SI CM XK1?0( 43 ) , OCR EG (43)
C      CCi-iPijlf-  Tfii/l'tRATUHE  AT CURRENT TIKE  FRAME
       IF ( 1. .(- T. 36)  GC  TL)  8
       I f ( t. . L \.?2)  GG  TJ  a
     3  TT = T(L) + :ML)«SIGMAT
       I FdT.LT .C)T 1 = 0
       i;o ic  i = i,i\i<
C      IS Tl r:Rt AN  UPSTr-U;AK  RLACh
C      ARE  TFf:Rf{ ANY  f'RANCHL-S
       CSUM--C
       CSUf-T^O
       s P R n i = o
       SPI«U2 = 0
       S P R i: ? = 0
       IF(NL.P. ( J'M 1 ) , l).Lt.G)GC  TG  41
       J=l
       IF(NLS( J?< I I ) t 2).GT.C) J = 2
       IFlNUi'M J;U I ) » 3 ).G1 .0) J = 3
       CG 12  K-l.J
       KU = i\L-R( JR ( I ) fK)
             GSl/' -ICREGILI. ,L)
       CNI=CREG( JR( I ) rL)
       IF (CSUK.GT.CNI )QSLN-CREG(JR(I),L)
       CM=(UR£G( JR( I ) ,1- 1-QSLM) /J
       GSUM-0

                                 A4-165

-------
       LL= IREACK (i\U
       CQRcGI LL ) ^GREGd-l. ,1. MCM
       SPK[;i = SPRi:i+XK120 (LL )*Cf^EG( LL )
       spRn2^SPRC2 + ncr.ouT ( LL , D--CCREG(LL)
       SPR03^$PR[;3^}tFOUT ( LL , L)*CCREG (LL)
       ir(X!C120 ICR(JR( I 5 )
       IF (QSU1. EC.G) CSOM~. C : 5
       IF(C.SLf-';2.K.'< )QSUf2-.5
       XK12.;)( JR( I ) }= ( SPiU.lH-XK 120*1 JR( 1 ) )*QWASTE( JR ( 1 ) , L ) ) / ( CSU;-' +
      1          G'AASTEt JR ( I ) , I. ) )
C      CORRECT  XK120  FOR T Elf PEP.ATt'R F
C      CC^P'JTj;  CISSULVtO CXYG'I.N  SATLRATIC^ VALUi:
       COS=l'i .o^-.'!! *TT+.C08*TT»*-2- .COC03*TT**3
   42  ARG=,046*(TT-20)
       XK-I = XK ] 2:; UR( i)) *[."xp { /.; 0
       RODIN( JU( I ) ,L ) = ( SPRC2 + 30CWST( J'^t I ) t L ) «QUA SIT ( JrU I ) , L ) ) /
      1  (CRCGt J3{ I ) t L )+Ql;ASTE ( J:U I ) , L ) )
       CEFIu ( JR ( I ) ,1. ) = ( S PRC 3+(DOS-DC rtST(JR{ I } , L ) ) * QhAST E ( JR ( I ) , L) }
                                                               /
      1  ( G R !: G ( J :U I ) , L ) •»• QV; A S T E ( J 3 ( I ) . L 1 )
       GO  TO  51
   50  L'UUf A ( JR ( 1 ) , I. )=0 .
       CEP IK ( jr<( I ) , L )=0.
C      IS  TFLRc A RtfSERVCIR  AT  THIS  REACH
   51  IF( IiUS(JR( I) ) .GT.OJCALL  RCUAL(L,TT,XK1,CSUK2 , TIME,I ,XK2 , * 1
                                                               00)
       IF( nu:s( J-M i) ) .or.  o.o  GO TO ice
C      COMPUTE  VELOCITY  OF  FLOt-J
 2222  V = XK* ( QRF.G ( JR ( I ) t L ) +CUASTE ( JR ( I ) , L ) ) *^XM
       IF(V . tG.Q.O)V = XK* ( Q!U:G{HCLD, L )/2. )«f»XM
       IF (V.EQ.O )GC  TO  
-------
    GlJ TC 44
    NO FLCb IN RbACH
 43  TIME=7.6
    XK2=XK1
 44  If -(XK12CI JRl 1 ) ) .NE.O )Gt;  TC 142
    BUnCLTtJ3( I ) , L) = 0.0
    LJLFGUTl J*lI ),L)=0.0
    XKl^O
    GO TO ICC
142'  ARG=-XK1«TIML
    BGDGUTt JX( I) ,L)=(UCOIN(JR( I) fL)-RCON(JR( I ) ) /XK1) *OXP ( ARC )+R
                                                          CCMJR(
   II))/XK1
    IF{XKl.tC.XK2)CC)  TG  16
    ARG1--XK1 «T1ME
    CCF=l IXKHliUHNl JRl I ) ,L) )-l
-------
     2       - ( rtCCMM ( JR ( I ) ) H- SCCM ( JR ( ! ) ) ) /XK 1
C     CCKPUTE  !V1M?-!UM DC
  ico JF (CL FL:UT( JK( I),U.LT.DEFIN(JR(I),U)  X^IM-OHCS-DEFIM JR( i
                                                             ),L)
      IF(DLFCLT{JR( I ) ,L ) .GE.DEFIM JR(I ),L) )  XV INnC = DCS-UEFOUT(JR(
                                                             I ),L)
   30 IF(L.LT.2?) GC TO  IbC
      IF(L.GT.36) GO TO  15C
      V.R I T L: ( 6 , 600 ) T I ME , tWASTE ( JR ( 1 ) , t ) , COWST ( JR { I ) , L. ) , BODWS1 ( JR ( I
                                                             ) , t- ) ,
     1       XK1,XK2|XMIKDC,I3CDCUT( JR(I),L), OFFCU(JR ( I ) ,L ) ,JR( I )
  6CO FURNATtH-  , 9FG .4 , 1>X , I 2 )
  150 CC?\TII\lJL
   10 CCM JKCE
      RETLMK
      CEEUC  SLHCKK
      END
      SUBRf.UTlNF  RCUAL( L,T1 , XK1, CSUM2 , T IME , I ,XK2f«)

      COM- LfN/rLC.l'.r3/,\R[:S, IRKS (43) , JRES( 1C) ,CAP( 10) , SMN( 10) ,STO( 10

     1        CIV( 10) ,RREL( 1C) ,PSTO( 1C)
      ClWliN/F:LCK12/XK22CR( 1C) ,XK3 (10) ,BOOSTC( 10 ) , DEFS TC { 10 )
      CONM-CN/FLCH13/CREG ( 43 , 48 ) t CEF IN ( 43 t 48 ) i DEFCLT I 43 f 48 ) , BOD 11\' (
                                                             43,48),
     lRCUCLl{43148)»Xy:INC(43,3C),LLX(43i30) , XKK(43,48)
      CALL  TRES( IRFS( JR( I ) ) ,IR)
      ARG=( .C24«(TT-20. ) )

      AVGS1C=(PSTC ( IR) + STO( IR) )/2.
      IF(AVGSTC.LE.C)GO  TC  ICO
      IF (S1L ( IR ) .LQ.O.AKC.RREL( IR) .NE.OGO  TC  ICO
      Z=(i;SliK2*3600.*24. ) / ( AVGSTC* 10**6)
      W=( ( RREL( IR)J.-CIV( JR) )«36CC.»24. ) / ( AVGSTO* 1 0«*6 )
      XFK3=(XK3{ IR)*AVGSTO )/CAP( IR)
       TIME=11.57«STCllR)/QSLy2
       IF(TIf'E.GT.30.0)TINE = 30.
       ir-(BCf:STC( IR) .LT. .001)BGDSTO(IR)=C.O
       CEF9 = BCt.STC( IR )-Z*BOCIN( JR( I ) ,L)/A
       CEF9 = CEF5*(  1-EXP(/.RG) )/( A«TIME)
       EOUCLTt JR ( I) , L) = ;JEF«3 + Z*BUDIN ( JR( I ) , L ) /A
       ARG2 = -E5*TIMi;
       IF(CL:FI.\( JR(I ), L) .LT..C01) GC TO  96
       CEFl=(UEFSTC(IFO/D)-(Z*DEFIN(JR(I)tL)/(B*E))
       CEF1=LEF1+(XK1*BOCSTC( IR)/(A»D) )-( XK 1*Z *BCDI \ ( JR ( I ) ,L)*(A+B
                                                              )
     1 / ( A «T. ) * * 2 )
       CEF2={Z«CEFlN(JR(I),L)/D) -DEFS TOUR)

                                 A4-168 .

-------
     CEF2-[Jfc.'F2-i { XK. l/( A-3 ) ) * ( ( 7.* COD I N ( JR ( I ) , L ) /3 ) -p.C.DSTC ( IR ) )
     CGF2 = CEF2*EXF'(ARG2)/P
     nEF3=(?.»TII'.E/LU*(UEFIN(JR(I),L)+(XKl*nDDI,\(JR(I),L))/A)
     CEF4= ( /.* BCD IN ( JR ( I ) , L ) /A )-BC!JSTO ( I R )
     [;EF4 = nEP4*XKl*EXP( ARC)/( A» (b-A) )

     GC TC  102
  98 i:C-FCLT(J3 ( I ), L ) = 0.0
 102 IF(nEFSTC( IR) .LT..QODGU  TC 99
     DEFSTC( i:n = Ct:FSTG( IR )#EXP ( ARG2 )-Z*D£F I M JR ( I ) , L) »EXP( ARG2 ) /
                                                            B +
    1XK1*BGI)STC( IR )*EXFM A'-!G2) /( A-B )-Xi< 1 *7.*BOOI N ( JR ( I ) , L) «FXP{ ARC
                         IR)#L:XP(ARG)/{':-A)-XKl*Z*GUCIN(.mi I ) ,LJ*t
                                                             XP( A;", L. } = DEFIN( JR( I ) ,L)
     BCCSTCK IR } = 0
     XFK3=0
     T I ME = 0
     .4 = 0
     0-0
 1C1 RETURN
     CEBUG SURCHK
     END
     SUDRCOTINE FLASH
   FLCR1CA SYNTHETIC HYCRCLOGY  FOCELI FLASH)
     CCr^Li\/FLCW7/GG( 6,^8 ) i GNAT ('i3) tNYRG
     DIf ENSICN  G{21f't,12,6),CAV(A,12,6)tAO(6),ASI(6,6) ,BCO (6,6),
                                                            QEST
    2   ,  B(24, 24, 12), 0(24,24, 12), EVAL(24),CPR(24) ,GC(4»6t12)
     EQUIVALENCE ( QG ( 1 ) , GG ( 1 ) ) , { >JA V ( 1 ) , QEST ( 1 ) ) , ( Q ( 1 ) , B ( 1 ) )
 ?.C 0 « P AC ( 5 , 5 OC C ) M YR , N YRG , N S I T f= S , N T RAN , I RAN , I S A VC , I PAR AM , N PR I NT ,
                                                             IHIST
5CCO FCRKAT19I5)
     CALL  KFLOlv ( NYR ,NS I TES , G , IHIST)
     N = 4 * N S IT E S
     CALL  TRANS ( NYR ,NS I TE S , NTR Ai\ , G , QA V , AO , AS I , BCC , CEST , OVAR )
     CO 10  J=l, IP-
     CALL  COREL (NYR,NSITES,G,QVAR,S11, SI 2 , 521 , S22 , J )

                                A4-169-

-------
      CALL  S ( 2 4 , 4 , S2 2 , S 2 2 , 0 , N , N , 0 , T AG )
      CALL  S  (24i3tB( li liJ),S12tS22,iN,i\,f:,0)
      CALL  S(24,3,S22fO(l,l1J),S21fN,NtN,0)
      CALL  S  (2
-------
     2        CCUSTt A2, ( A C ) ,RCCN(AJ) , SCCM A3)
      CCI'KLK/FLCV. 12/XK22CRI 1C ) ,XK3( 10) , COD STL ( 10) ,DEFSTC( 10)
      CCMKLK/SCRTl/NDC'X'K ( A 3 , A 3 ) , KOLM T ( A3 ) , INDEX(5C5 ) , MSC.UU
                                                              A3, 43),
     1CCCCUTI A 3, A 8) , X.wiKCM A3, 30) ,LLX(A3,3Q) , XKK{A3,A8)
      IM P E N 5, 1 C \  I G T ( 1 0 )
      KF.ADt rJ, ^>CC 1 KiYRG, NCT
 5CC1 FCRy/'iK 't\ [>)
      R L: AH ! 5 1 l> C C 2 ) ( I G 1" C I) , I = 1 , \ G T )
 5C02 r-GRf/AT{ 10IH)
      CALL TGEN
      CALL TRAf\
      MUTF. (6,61C3) (NGAGE ( I ), I = ].,.\'G)
      h RI T f. ( 6 , 6 1 0 t) )
      CC 3).  I--l,rsR
   31 WRIT.r:(6, 6104)  NCR( I ) i (V\T{ ItJ) t J=liNG>
 6103 F C R V !•- T ( ' 1 ' , 9 X ,. ' F X T E R I\ A L ' /
     112Xi 'RtACH« ,9X, 'C^EFF ICIENT OF FLOW  AT  GAGL:1/
     211X , ' MjfHfvH1 , 1CI 1 0 )
 61C5 FORMAT! IX)
 6 1 0't FORivAT(I15,6XilCFJC. 3 )
      'A R I T i ( 6 , 6 C C C )
 60 CO FCRf-AT ( It- 1 )
      CALL RCATA
      CALL SIN
      CEBUG  SUriCHK
      ENC
      SUBRCLTINF  SIM
:  .$ 4. J i $ .1 $ .1 i $ $ H $ $ $ J $ $ * $ $ i $ J $ S
      CUf'f^N/F-LCh-a/KRtUG.NCM V3) ,NlR(A3,3),OAU{43,3),
     1       TCA(.'.3) ,NG^GE(  fi),NGR(   6),CAG(  6),!CR(A3)
      COf f-'ilJN/FLC'rt2/FLl'ri3 ) ,RCUGH(A3) , SLOPE (A3)
                   / JR( A3) , IN T ( A356)
                   /ATIMf:( A3 ) ,BT1ME
                   /KRf:S , I R E S ( A3 ) , J R E S ( 10 ) , C AP ( 1 0 ) , Si-' IN { 1 0 ) , STC( 1C
                                                              ),
     1        CIV( 10) ,RREL( 1C) ,PSTO( 10)
      COKf'U]N/FLCW6/NWASTF.f I V. A S T E-i ( A3 ) , JWASTE (A3) ,AVW(A3) , AW (A3) , PM
                                                              W(A3),
     1 FKl.l-iASTEiXFKl
      C 0 f f C !\ / F L C W 7 / G G ( 6 , A 3 ) , C N A T ( A 3 ) f N Y R G
      COMMCN/H.CJWB/AVTEKPi ATEMP , TPE AK , TCHP » DTEMP
      CCXMCN/ Fl.r.^97 X I RR IG ( /i 3 , A a ) , Qtv 'AST E ! 43 , A 8 ) , AVAR t IWAP , C VAP , TAU
                                                              (10,6),.
     1        YNEANt 1C) , ACCN ( 1C ) ,DCGN( 1C ) ,CCON( 10,6 ), 1TYPE( 10) ,
     2        TOPLEV{lO)fACAP(10),BCAP(10),CCAP(10) , DC API 10) , ADEP(
                                                              10) ,
     3        BCtPdOtCHEPdC)
                   l/Tl^a) , SIGMA T,Z,C,T^f AN , RLNTH { A3 ) ,ISTART,XK,XM

                                AA-171                        '

-------
     1       CC , F i XK 1 20U (A3), FJOOft ST(43,4c ) ,
     2        LC * S F(4 3 f M5 ) , R I 4 » ) ,RCCN < 4 3)i SCON (43)
      CDM-'tlN/f Lt:!rtl2/XK2?CPU Ifi) ,XK3( 10) ,liOl)STC< 10 ) , 0 E FSTC (1.0 )
      CCi'-'f' ur> / F LCU 1 3 /CR £(, ( 4 3 i 4 3 ) , OL F IN ( 4 3 i 4 8 ) , DEFIJU1 ( 43 »4 B ) , BUD I *' (
                                                              43,48),
     inCHCUT(43i48) iXMI NCI 43,30),LLX(43,30) ,XKK(43,40)

      DO y  1-1,6
      nccsTc: (i )=c.o
      CEFS 1C(I )-C.O
      f* fl f,  I ., 1  j c'
      L u o  J - 1 i 4 n
    0 C G ( I , J ) = C . C
      CG 9  1 = 1,,\R
      CC <•)  J = l ,43
      C F. I -1 M I , J  ) = C . C
      nt-rCLT( I , J )=O.C
      DGCI'v ( I , J )=O.C
      HCLCLT(I , J)=G .0
      acnusu i,j)=o
      C U lr< J 1 ( I , J  ) = C
    9 QwASrU 1 , J )=0
      HC 7  1 = 1 ,43
      CC 7  J=1,3C
      xr iNt11,j)=o.o
    7 L L X { I , J ) = C
      R L: W I (M C  l)
      RfcAD( 5, 7CC )Zt C,THL:AN, ISTART, XK , XI' ,CC , F , S IGMAT
  700 FCR,v-AT(3FU.Oi I5t5Ffi.C)
      REAC( [J,7 U ) (RLNTHt I ) ,RCON{ I ) ,SCGiSi(I ) ,XK120h( I ) , I WASTE (I ) , 1 =
                                                              liNR)
  701 FCRf'AT (4f 1C.O, II )
      CC 1  I--1.NR
    1 IF( I'v-AST.-  ( I ) . rtE.O )r<£:AC( 5,703 ) (QWASTE ( I , J) ,BnOhST( I , J) ,DGV*ST
                                                              (ItJ)i

  703 FGRPAT(5X|3F1C.O)
      RLAC( n, 702) (XK220RI I ) ,XK3( I ) , BODS TO ( I ) fDEFSTCJ(I) ,1 = 1,KRES)
  702 i-'CRN AT (4f 10.0 )
C     CG!''PLTtr f't:Ai\ TE-MPF.RATLRE FOR LTH UEHK CF THE  YfAR
      DC 8CC  L=li48
      XL^L
      ARG=(7.5*XLiC)/57.3
  8CO CONT
      CALL  FLASI-
      CALL  /MJ
      CO  11  K=1,NYRG
      CALL  RAI\ ( ISTART,4{!,R )
      CALL  fLASJ-KK)
      DC  10  L= I,^t6
      CALL  CTKAML)
                                   AA-172

-------
      CALL REG(L,K)
      CALL CUAL(L)
      CALL AIJSLB(LiKfMYRG)
   10 CONTINUE:
   11 CCNTIKUtf
      REWIKC S
      RETURK
      DEBUG SU8CHK
      EfMC
      SUBRCITINE 2EG(L,KYf<)
      COm, NX FLC'rt 1/NR, ,NG, NCR { 42 ) ,NLR ( 43 , 3 ) , CAU ( 43 , 3 ) ,
     1      TLA (A3) ,NGAGE(  6),NGK(  6),DAG(  6), I CR (43)
      CUP FC K/ f: LCH 3/ J P ( 4 ?) , REA(10),CEP(1G)
      XL = L
      XLRAC=(XL«7.5HCVAP)/57.3
      CU ICO  1 = 1, NR
      QNATURU ) )=(jNAT( JR( I ) )-X IRRI G( JR ( I ) , L )
      IF((vNAT(JR(l)).LT.C)CKAT(JR(I))=C
C  THE INRF:X  LF-  THE CURRENT  REACH IS JR(I)
C  IS THERE A REACH UPSTREAM
      IF(NUR(JR(I)i 1 J.GT.OJ  GO TC 10
C  NO-IS TK-ERE  * RESERVOIR  AT  THIS REACH
      IF( IKES1 JR{ I) ) .GT.C)  GC  TC 20
C  NO
      CG( JIU I ) )=0.
      CREG( JR( I ),L)=GNAT( JH( I ) )
      GO TO 499
C  THERE IS A REACH IPSTREAf
C  IS THIS  A  RuSEKVGIR
   10 IF( IRESUR(I) ).GT.Q)  GO  TC 3C
C  NG-COUi\T UPS7REAN1 REACHES
      J=l
      IF(NUR(JR(I If 2J.GT.O)  J=2
      IFINURt J'UI )f 3I.G1.0)  J = 3
      net JR( i ) )=c.
      DO 11 K=1,J

                               A4-173

-------
      Nl! = MiR( J3 (I ),K )
      LL=IP'dACH(Nb)
    11 CC( JRU ) )=CC( JR( I ) )+CC(LL. J
      GREG(JR( I IfL)=             CNAT(JP(I))+DQ(JR( I ) )
      GC TC  4S<5
C   THIS IS  RcSERVUIR  ,  NC UPSTREAM REACH
    20 GIN=CNAT(JR(I))
      GO TC  AC
C   THIS IS  RESERVOIR,  REACH bPSTREAN
C   COUNT RE. ACHES
    30 J = l
      IF(NIP{ Ji< ( I ), 2 J.GT.C) J = 2
      IF(MiR{J2(I),3).GT.C) J = 3
      QIN=CNAT(JR(I))
      CC 31  K=l,J
      NU-KURl J.*( I ),K )
      LL=IRCACi- (Nil) .
    31 QIN = QIN + DC:(LL)
      GREGl JrU I ) ,L)=CIN
C   CPE3ATE  RESERVOIR
    AC CALL  TRLS( IRES(JR{I) ),IR)
      PSTC( IR) = STC3( IR)
      CEP(1R) = (ACAP( IRH (BCAP(IR)*STO{ IR)+CCAP( IR))«*.5)/DCAP(IR)
      AREA{Itn=ACEP(IR)H-DDOP{IR)*DEP(IR)+CDEP(IR)*DEP(IR)**2
      QVAP = ARL:A ( IR)*EVAP
      QINV = CIJ<*.657-QVAP
      CALL  CIVREH1R,L,RRELV,DEP)
      STa(IR)=STC(IR)+ICINV-CIV(IR))
      IF(STC{ IS) .GT.CAP(IR ) )GG  TC 3CO
      IF( ITYPL( IR) .GT.31GC  TO 310
      IF(STC( IR).Gf.TOPLEV( IR ) .AND. ITYPEIIR).EC.l)GG  TO 302
      IF( STC( li" J.GT.SMINUR) )GC TO 303
C     f'JG RELEASES-NO DIVFfRSICNS
  301 RRELV=0
      STO( IR) = STCUR) + DIV( IR)
      IF(STC( IR ).LE.O)GC  TC 3C7
      GO TC  310
C     RESERVOIR  EMPTY
  3C7 STC(IR)=0
      GO TC  31C
  300 IF( ITYPLM IR) .EG. 1 )GC  TC 4CO
      RRELV=STO(IR)-CAP(IR)
      GC TC  31C
  /.CO RRV = 20«RRELV
      RTEKP = STCt IR)-CAP(IR)
      IF(RTEMP.GT.RRV)GCi  TC  A01
      RRELV=RRV
      GO TC  31C
  A01 RRELV = RTEN'P
      GC TC  31C
  3C3 IF( ITYPEI IR).NE.3)GO  TC  403

                              A4-174  •

-------
    IS TIE  U^E  BETWEEN CCT. 1 + NCV . 1
    IF(C.GE.37  .AND.  G.LE.4OGC TC 305
    NO-IS THE  TIME  BETWEEN APR. 1 + CCT.  1
    IF(L.l.T.12  .Q3.L.GT.  36) GO TG 30 8
    YES-TU'E  IS  BETWEEN /\PR. 1 •«• CCT.l
    I F( STC( If< ) .LE.CAP ( IR ) )RRECV=C
    GO TG 31C
    TIME  IS BETWEEN OCTOBER 1 + NOV. 1
305 SUIF=STL( IR)-SK1M( IR)
    RRELV = SCIF/('»1-L)
    GO TG 3 1C
302 KRV=2C*R3tLV
    UTEf'T = SlC{ IR)-TDPLEV(IR)
    IF(RTl-KP.LE.RRV)GC  TC  AC 2
    RRE-LV = KHV
    GC TG 310
^C2 I F( KTE^f'.l.T .RRELV ) GC  TC 3 1C
    R R E L V = R T M !> F
    GG TG 31C
A03 I Ft I TYPE ( IRJ.EQ.1 )GO  TO 3C9
    RRV=S'IO( IR 1-SNINl IR)
    IF(f
-------
  6 RRN=IX
    RRN=RRN« . '.656fcl
    RETURN
    ENC
    FUNCTION STC(T)
    Clf'ENSICix T(4S)
    c c i I = i , '. a
  1 TBAR=T8^R+T( I )
    THA«=TGA3/48.
    TSUf' = 0
    CC 2 1=1,48
  2 TSUf-'-TSUf-'-KK I )-T[;AR)*«2
    STD=SC:RT ( isLH/47. )
    RETURN
    CEBUL SLECKK
    ENH
    SUDRCUTI\t ROATA
   1      TC.M^3) ,NGAGE(  6),NGR(  6),CAG( 6),IDR(43)
    Caf'N'Ui\7FLCl.5/i\RES, IRES(A3)|JRES( 1C),CAP( 10 } , SN' IN ( 10) t STO ( 1C
                                                          ),
   1       D1V( 10) ,RftEL I 1C) tPSTO( 10)
    COflvCN/FLCW9/XIRRIG(^3, 48) tGhASTE(A3t48) , AVAP.BVAP , CVAPt TAU
                                                          (10,6),
   1       YNEAN( 10) , ACCNt 10) , BCGN ( 1C ) ,CCOM ( 10 ,6 ) , I TYPE ( 10) ,
   2       TCPLEVtlO) , ACAP(10),.BCAP( 10),CCAP{ 10) ,CCAP(10) ,ADEP(
                                                          1C) ,
   3       BCm 1C) ,CCEP( 1C)
    DO 30 1=1, NR
    DC 30 J=1,A8
 30 XIRR1G( I , J)=0
    UEAD(5i!>CC)NKES,(IRES(l)iI = ltNR>
500 FORNATt 15/1 1613) )
    Rt ALMS, 501) (JUES( J) , ITYPG( J) , CAPl J) , STO( J ) ,SMIN( J ) ,TOPLEV(J
                                                          ),
   1     J=1,NRES)
501 FORNAT(2Ih,4FlC.2)
    RCAC(5t50'i) (ACCNf 1 ) ,nCCN{ IJ,I = 1,NRES)
5CA FCRKAT(dFlC.A)
    RE ADI b,5CS) ( YWEAN ( L ) , ACAP ( L ) ,QCAP(L) ,CCAP(L) ,DCAP(L) ,
   1     ACEP(L) , DCEP(L ) f CCEPCL) ,L = 1,NRES)
505 FCRNAT(8F10i2J
    READ( 5t503)AVAP,3VAPf CVAPt ( ( TAU( I , J) ,CCO\l I , J ) , J = l ,6 ) , I = 1 ,N
                                                          RES)
503 FGRPAT(3F1C.O|/(6F1C.C) )
    REAC(5i5C2)\ACJSr, ( L , N5TA , XI RRI G ( NSTA , L ) ,
   1     I=liNACJST)
5C2 FORKA1 ( I 5 / { 15, 13,  Fl^.^))
    hRI TL:(6,6CO)
6CO FORMAT (• CATA  HAVt  BEEM  READ  IN THRU RDATA1)

                             A4-176

-------
    RETIHN
    CEBUG SLHCI-K
    ENC
    SUBROUTINE CIVRELt IR,L,RRELV,OEP )
 «tt««*-!*tti}fttt«ft««£ft)fttltft «•»*£«£«
    CCNHCN/FLCW5/NRES, I RES(43 ) ,JRESt 10)tCAP(10),SN IN{10) , STO{ 10
                                                          ).
   1       CIVf 10 ) ,RRL:L{ 1C) ,PSTG( 10)
    COPMCN/FLCW9/xnRlG(43i48)iQWASTE(43t48) ,AVAP,BVAP,CVAP,TAU
                                                          (10,6),
   1       Y,"EAN( 10) ,ACCM 1C) ,BCCN { 10 ) , CCGM 10,6) , ITYPE1 10) ,
   2       TCPLf:V( 10) , ACAPl 10) ,BCAP( 1C ) ,CCAPl 10) ,CCAP( 10) ,AD£P(
                                                          10),
   3       BCEP(10),CnEP(10)
    CIKE,\SILN CEIM10)
    ITYP--ITYPH IK)
    Xl. = L
    GC TC (lf2,3iAt5)tITYP
  1 3RELV = ACCM ii<)*0. tlJ7
    T H L: T /> - ( X L * 2 . » 3 .1/t 16 ) / A 8 .
    DIVl IK)=YKAfH 1R)
    CC 1C 1=1,6
    ARG = ThETA-TAU(JRf 1)
 10 CIV(IR) = CIV(IR)+CCCM IRtI)*CQS{ARG)
    GO TC 101
  2 nCCNN = BCCM Ik )
    RRELV = C.657*ACCN( IR)«CEPt IR)«*BCCNN
    GlVt1R)=C
    GO TC 101
  3 RRELV^O
    CIV( IU)=C
    GO TC 101
  4 RiU'LV = 0
    rHETA=(XL«2.ft3.1A16)/A8.
    CIV(IR)=YPEAN( IR)
    DO ^(0 1 = 1,6
    ARG = TI- ETA-TAUI IRt I )
 40 CIV(IR) = CIV(IR)+CCCN( IR,I ) *CCS(ARC)
    GO TC 101
  5 THETA=(XL«2.»3.l416)/48.
    RREl.V = Yf';EAN( IR)
    CO 50 1=1,6
    ARG = ThF.TA-TAU( IR, I )
 50 RRELV = KR5LV    +CCCN(IRt I )«CQS(ARC )
    DIV(IR)=C
1C1 RETURN
    CEBUG SbHCHK
    ENR
    SUBRCUTINfc" SIKTiNNiAtHrCiIMtJMiKNtOET)
    LIHEIN.SION A(KT,KT),B(KT,KT),C(KT,K.T),IN(1CO) ,E^P{100)
    IKAX--IM

                             A/4-177

-------
    JKAX=JN
    K M A X - K f-
    GCTC(30,32,34,36,38,4C,42,44 ,46,50,52) ,NN
 30 CO 31  I-! , I FAX
    CU31J=1, Jf-'AX
 31 M I,J ) = E( I , J)+C( I , J )
    GC TC 8C5
 32 1.03 3 !--= 1 , I N AX
    C033J=1,JNAX
 33 A(I,J)=E(I,J)-C(I,J)
    GC TC 805
 34 CC101 1 = 1, I,vAX
    r; c 3 5 j = i, K f • A x
     E K P { J ) - C .
    D035K = 1 „ Jis-'AX
 3r>  Et-T(J) =  f:VP( J HSI I ,K )*C(K, J )
    C0101K-1,KyAX.
1 C 1 A { 1 , K ) =  L: N P ( K )
    GO TC  HC5
 36 CG37I=l,IfAX
    C037J = 1, If-'AX
 37 A { I , J ) = LM I ,  J )
 59 IN( 1 )=0

    TEr»P = A( 1,1)
    C070I=2, If-'AX
    IF(AiiS  (Ti;MP)-ADS  ( A { I , 1 ) ) ) 7 1 , 70 , 70
 71 IN(1)=I
    TEMP-.M 1,1)
 70 COM' INUE
     I F ( I :i ( I ) ) 7 3 , 7 2 , 7 3
 73 .IS=IM1 )
    C074 J = l, If'AX
    T E N1 P = A ( 1 , J )
    A( 1, J )=A( 1S,J )
 74 A( IS, J) = Tt;f'P
 72  IF(A( 1, 1 ) )S«,99,98
 98 C0715I=2 , If'AX
 75 A(l , 1 )=A( I.D/Al 1,1 )
     C0100 1=2, If'AX
     IPO'-I + l
     IMO=1-1
     DC80L = 1 , If'G'
 80  At I, I ) = A( I, 1 )-(A(L,I )«A( I,L) )
     TErj.P = A( 1,1)
     IF{I-II^AX)55,03,55
  55  1N(I)=0
     C081IS=IPC,IMAX
  85  A(IS,I)=A(IS,I)-A(L,I)«A(IS,L)
     IFtAtiS  (TEMP)-ABS ( A ( I S , I ) ) ) 82, 81, 01

                             A4-178

-------
 82 TENP=A( 15,1)
    I N ( I ) = I S
 Bl CONTINUE
    ISS=IM I )
    IF(ISS)t!4,S2,84
 84 OC886 J=l , I*AX
    TENP = M I , J )
    A ( I t J ) = A ( I S S , J )
886 M ISS, J) = Tt>'P
 83 IF (A! I , I ) )97,S9,97
 97 IF( I-If-'AX )54, ICd 54
 54 f;GC6IS=I PC, I MAX
 86 A( IS, I )=A ( IS, I )/A( I , I J
    DCS ^15 = 1 PC, IMAX
    coe9L=ii i re
 89 A ( I , J S ) = A ( I i J S )- ( M L , JS ) *A ( I , L ) )
ICO CCNTIKUL:
    nC60GJP=l , I MAX
    1F( J-l)6CJf 70Cf 603
6G3 nC60ClP=2,J
    I=J+1-IP
    IPiJ=H 1
    T E M P = C . C
    CC602L=IPC , J
602 TL:MP=TEf-'P-A( I ,L)»A{Lf J)
6 CO A( I i J ) = rEf'P/A( Ii I )
7CO n0151J=l , IMAXC
    JPC=J+1
    CQ151 I=JPCf IMAX
        = C .C
    IP(t-J) 1152, 153,152
152 T C KP = T Lf-' P-A ( I , L) * A { L , J )
    GO  TCI 54
153 TEMP = TE>P-A(I,L)
154 CONTIKUL
151 A( I , J ) = T CfP
    009011 = 1 , If-'AX
    CCJ9COJ=1 , IMX
     E^P{J)=C.C
    DC)0?9N=I , l.'-'AX

898  EMP{J)=  ENPU) + A( I,N)*A(N, J )
    GG  TC899
897  Ef'.P{J)=  ENP(J)+A(IfN)
899 CCNTlKUt
9CO COMTIfcUC
    C0901J=ii I,WAX

                            A4-179

-------
9 C 1 A ( I , J ) =  ~. f' V ( J )
    D05COI = 2 , If'AX
    M=IMX+1- I
    IF ( IMMJ ' 502, rjCO,cjC2
5C2 ISS=IMH
    DQrjC3L=l, IFAX
    T t: (v P = A ( L , I S 5 )
    A ( L , I S 5 ) = A ( L , V )
5C3 A(l,iv)=T1FP
SCO CGM'IKUF.
    DET=C.
    GO  TC.  805
 120 r.ET=l.
  5 9 V; RITE              { 6 , £ C 6 )
 806 FURfATl IHK:  SINGULAR  N'ATRIX)
 8C5 RETUKN
  38 C039I-1, If-'AX
    D039J=lf If'AX
  39 A( I,J ) = LM I,J)
    ,N = I V A X
    CET=1.
     11 = 1
   1  13=11
     SUM=AliS ( A( II , I 1) )
     CO  3  I=I1,N
     lF(Stf-A3S  (Al I > I I ) ) )2r3i3
   2  13=1
     SUf/l = ABS  I A ( I » 1 1) )
   3  CQNTINtt
     IF( I 3-I 1 )4,6,A
   A  CU5J=lf!x
     SUM = -A(I 1 ,J)
     A (  I 1 , J ) = -A ( I 3 , J )
   5  A (  I 3 , J ) = S L P-
   6  13=11+1
     CG7I=I3f\
   7  A(I , ll) = M I , I 1 )/A{ II, II )
     J2=I 1-1
     IF(J2)8,lli8
   8 D09J=I3f\
     CG9I=1,J2
   9 A( 11, J) = A( II, J)-A( I 1,I )*A( I i J)
   11 J2=I1
     11=11+1
     CO 12 1 = 1 ItK
     CQ12J=liJ2
   12 All, I1) = A(I,I1)-A( I,J)»A(Ji II)
     IF( Il-N)li Mi 1
   14 13=1
     j2 = tv/2
      lF(2*J2-\)15f16, 15

                                 A4-180

-------
 15 13=0

 16 C C 1 7 I = 1 » J 2
    J = N-HIJ
 17 CET = [:L:T*A (i, i )*A( j, j)
    GO TC  805
 40 If:( IMAX-JPAXJ41, 1C2, 102

    GG TC  1C 3
102 IP=JP,AX
1C3 CC106K--1, IP
    C0104I = K, I PAX
104  EPP( I )--R( I ,K)
    UC1CSJ = K, JMAX
lOli A(J,K)=U(K,J)
    C LJ1 0 6 I = K , I !•' A X
1C6 A(K, I )=  EPF ( I )
    GG TC  805
 42 C C 4 3 1 = 1 » I P A X
    CCJ43J=1 , JPAX
 43 A(IfJ)=D{l,J)
    GG TC  dOi)
 44 C045 1 = 11IP AX
    D045J=1,JPAX
    A { I , J ) = C .
    B(I , J )=0.
 45 C(I,J)-0.
    GO TC  ^05
 46 113 = 2
 20  READ  (KMAX.47) IN( 1 ) , IN(5 ) tEPP( 1 ) tIN(2) fIN(6 } ,EMP(2J
   1  I f\ ( 3 ) , I N ( 7 ) , F.MP ( 3 ) , I M ( 4 ) , I N ( 0 ) , EMP ( 4 )
 47 FURPM  (4 ( 13, I3,£12.e ) )
    IP( Ii\ ( 1 ) ) BC5, 805, 23
 23 GO TC( 1^,24 ) , ID
 24 ip=iri(i)
    JM=IN(5 )
    I 0=1
 19 00211=1,4
    I 1=IN ( I )
    J 1 = I i\ ( I + 4 )
    IF(I1)21,21,18
 10 A( I 1, Jl)=  EMP( I)
 21 CCINTINUE
    GC TC  2C
 50 DO 62  IP=l,JiMAX,7



 61 teRITE             (KPAX,63 ) (J,J=IP,JPU)
    CO 62  I=1,IPAX
    WRITE             (KPAX,64)I,(A(I,Jj,J=IP,JPC)
                             A4-181

-------
   62 CCNTINUE
      GO TC  HCri
   63 FLIR,vAT(iiHC  ROV.7 ( 8X , 4HCCL . I 3 . IX ) )
   64 FCRI«AT( 14 ,4X, 7E16.8)
   52 nC53I=l, I FAX
      D053J=l,Jf-'AX
   53 A(I,J)=C(I,J)«DEr
      GO TC  005
      DEBUG  SUnCHK
      END
      SUBrtCLTIMb  TRAN
      C CMA'CN/ F LCVi 1 / NR , ,\'G , NC R (4 3 ) , NLR ( 43 , 3) , DA I (43 , 3 ) ,
     1       TCM43) ,NGAGE( fi ), NGfU  6),DAG{  6),ICR(43)
      CCf'PCN/FLCh2/FL(43) ,RCUGH(43) , SLCPL:(43)
      COPN.CN/FLChS/JRCiS ) ,kT(43 , fc)
      GIF EN SIGN  JGU( 10) ,ML(5C) ,.NID(5G )
C  **•**««*** *««*«*«•«*** <•««**
C  COMPUTE f-LCh  IN  LAST REACH CCKNSTREAF

      I  = J R (,\ R )
C  IS THI'Ri?  A  GAGE  IN THIS REACH
      J  = 0
      CO 5 JJ=i,i\G
      IF (K'GR ( JJ) -  M0*( I ) ) 5t6,5
    6 J  = JJ
    5 CONTINUE
      IF (J)  1C, 1C, 15
C  THERE IS  A  GAGE  -  CASE  1
   15 CG 16  JJ=1,NG
   16 HT( I,JJ)  =  C.
      hT( 1,J)  =  TCA(I)/CAG(J)
      GO TC  ICC
C  THEP.E IS  NC  GAGE  - CASE 2
   10 CALL LPG.AGE ( I.NGL, JGD
      IF (KGU)  21,21,22
   21 hRITE  (6.6CCO)
 6CCC FORMAT  (1CX,'NC GAGES')
      STOP
   22 CO 23  JJ=1,KG
   23 WT( I ,JJ)  =  C.
      GCA =  0.
      CO 25  JJ=1,NGU
   25 GDA =  GC.A-fCAG( JGU( JJ) )
      DO 24  JJ=1,NGU
      J  = JGU(JJ)
   24 WT( I,J)  =  TCA( I)/GCA
C  * * * * **«»***#«*»**•«**•« *•*«» ««•»«#
C  CONTINUE  UPSTREAM

  ICO IU = I

                               M-182

-------
      i\ I D ( I 0 )  =  I L
C  IS TM-R^  A  REACH UPSTREAM
  1C5 \U  =  ,MJR( IL, 1 )
      IF  (i\L)  110,110,115
C  THERE  IS  i\C REACH  UPSTREAX
  ' 110 IB  =  ID  - 1
C  h
-------
      €0 TC 1C5
:   THtUE IS NC CAGf-:  IM  THIS REACH
  160 CALL U'GAGE  ( IU , NGl , JGU )
      IF (NGU) Ifl0,180tl61
  161 GCA = 0.
      CO 17C JJ=1,NGU
      J = JGU(JJ)
  170 GCA = GLA -t  DAG(J)
      CC 171 JJ=1,NG
  171 WT( IUfJJ) =  0.
      Al - (n.MHM  - TtJAl ID )/(TDA( ID) - GCA)
      Cf) 17 7. JJ-l,iJGb
      J = JGU(JJ)
  172 rtTUU.J) = A1*TCA( II I/GCA
      AI = ni:;.(iu)  - GUA)/{ roMim - GCA)/TEA UD)
      CO 173 J=ln\G
  173 v, T(IU,J) = VsTMU.J)  + Al*viT( ID, J)*TDA( 1U)
      GC TC 1C5
:   THERE IS M. GAGl-  UPSTREAM  -  CASE 2
  HiO Al = TCA{ Il)/if;A( 1C)
      r;c if;i J=I,NG
  161 WTUUf J ) = A1»WT( IH, J)
      GU TC 1C 5
      DECIJG SUBCl-K
      END
      SURRGIH 1NE TGEN
      CG^r'i:N/f;LLlvl/rvR,NG,NCR(/i3) , MR ( A3 , 3 ) , DAU ( 43 • 3 J ,
     1      TCA(V3) ,NGAGE(  6),MGR( 6)tCAG(  6),ICR('t3)
      C C N1 M C f, / F L C v-J 211 L ( ^ 2 ) t P C U G I- ( A 3 ) , S1. C V E: ( /»3 )
      ccrrr.N/r-LCW3/jR( ^:e) ,v\T(A3,6)
      CINEKSILN IU(^3)
      CIMKSICN KNORfSO)
      READ {'j,5C01)  NR,NG
5CC1 FCKMA1 (215)
      CO 1 1 = 1, i\R
      i\NOR( I )=C
    1 IDFU I ) -^ C
      CC 5 I=1,KR
    5 «E.AD (i>,5CC2)  KOR( I ) , ( MJ!U I , J) ,J = 1,3) ,
     1     (CAK I,J) , J = 1,3),FL{ 1) i SLGPEt I ) ,ROUGh-(l )
5C02 FLRWAT l^Ii3,6F5.0)
      CO 6 1=1,KG
    6 KEAU (!i,r;CC3)  NGAGE ( I ) , NGR ( I ) ,DAG ( I )
5C03 FtlRNATt 18, 15, F5.0)
;   CtTERMINE SCtUtNCE OF REACH  NUMBERS
      CC 15 I=1,NR
   15 IR(I) = C
      CO 20 N=1,NR
      I = 1
   23 IF (!«(!)) 21,21,22
   22 I = I + 1
                              A4-184

-------
      IF(I.GT.NR)  GC  TO  2C
      GO TC  23
  21  K = C
      CC 25  J=l,3
      IF (NLR(liJ))  25,25,26
 • 26  NUP =  KliR ( I ,J )
      L = IREACMNUP)
      IF { IR(L ) )  27,27,25
  27  K = 1
  25  CONTINUE
      IF (K)  3C, 30,22
  30  JR(N)  =  I
      IR(I)  =  I
      DO 36  K=l,3
      IF (NUR( I ,KJ )  36,36,37
  37  ND = NUR(I,K)
      ID =  IREACMNC.)
      IDRUC)  =  I
  36  CONTINUE
  20  CCNTINUE
      CO 45  1 = 1,NR
      TDA(I)  =  C.
      DO 45J=1,3
  45  TCA( I )  =  TCAl I)  f  CAL( I,J)
)  ** *« * « * * * •» t **«»**
      WRITE(6,6COC)
6000  FORMAT( ' 1 EXTERNAL',49X,'DOWNSTREAM REACH1,6X,'TOTAL',15X,
     1'REACI-  CCNPUTATIGN  SECUENCE'/
     13X,'REACH',4X,'UPSTREAF  REACHES',3X,'UPSTREAM DRAINAGE AREA
                                                          S',
     1       3X , 'IMTERNAL  EXTERNAL',3X,'UPSTREAM',3X,'INTERNAL',
   ....                                                    7X,
     1»INTERNAL   EXTERNAL'/2X,'NUMBER', 7X,  ' 1 • , 4X , '2«,4X,'3'SX,'1'
                                                          ,7X,
     1*2* ,7X, '3> t6X, MNDEX' ,7X, 'NUMBER' ,-5X  , 'AREA' ,7X, 'INDEX' ,8X, «
                                                          INDEX',
     17X,'NLfEER'/)
      DO 8CC  1=1,NR
      IF( ICR( I ) .NE.O)N,MCR(ICR(I) ) =NOR ( ICR (  I ) )
 8CO  CONTINUE
      DO 46  1 = 1,NR
  46  WRITE(6,6C01)NOR(I ) ,(NUR( I,J),J=1,3),{DAU(I,J),J=1,3), I OR(I
                                                          ),
     INNORf IDR( I )), TCA( I), I, JRU ),NOR( JR( I  ) )
6001  FORNATlI6,I10,I5,I5,Fll.l,F8,l,Fe.l,I8iIll|Fl2.1,I10,6XiI8l
                                                          111)
      URITE(6,6CC2)
6C02  FORMAT(///43X,'BASIC',7X, •REACH',7X,'AREA1/
     143X,'GAGE ' ,5X, 'CONTA IMNG ' ,3X , 'UPSTREAM',3X,'INTERNAL'/
     142X, '.NUf'GER', 7X, 'GAGE' ,7X, 'OF GAGE' ,5X, ' INDEX'/)
      DO 47  I=1,NG

                             A4-185

-------
   47 WRITE(6,6C03) NGAGE ( I ) ,NGR ( I ) , DAG ( I ) , I
 6CC3 FORN«AT(3eX, 18,112, F13.1.IIC)
C  ***** e «*«»« « ««
      RETURN
      DEBUG SU3CHK
      ENC
      SUBROUTINE NEAN ( X , N , AV ,.SC , S3 , S4 )
      DIPENSICN X(21)
      AV = 0.
      SD = 0.
      S3 = 0.
      S4 = 0.
      DO 1C 1=1, N
      AV=AV+X( I )
      SD=SC+X{ I )**2
      S3=S3iX(I )**3
   10 S4=S4+X( I )**4
      AV=AV/N
      SD=SC/N
      S3=S3/N
      S3 = S3 - 3*SC*AV + 2*AV**3
      SD-SCRT( ( (SC-AV**2)*N)/{N-1) )
      S3=S3/SC**3
      SA=S4/SC«*A
      RETURN
      DEBUG SUECt-K
      END
      SUBROUTINE UPCAGE (I,NGU»JGU)
      CONMCN/FLCV, 1/NR,NG,.NCRU3) TNLR(43( 3) tCAU(A3,3) •
     1      TCA(43) ,NGAGE{  6),NGR(  6)tCAG(  6),IOR(A3)
     "COMMCN/F.LCU2/FHA3) , ROUGH (43) .SLOPE (43)
      COKMCN/FLCW3/JR(43) f V\T(43f6)
      DIKENSICN JGU(IO) ,NIL(43)
C  CETFRKINE THE NUMBER ANC  IDENTITY OF  GAGES  UPSTREAM
C  OF THIS REACH. DISCOUNT  FURTHER  SEARCH  WHEN A  GAGE
C  IS EN'CCUNTEREC.  I  IS CURRENT  REACH, NG'U IS  NUMBER OF
C  GAGES UPSTREAN AND JGU ARE  INCICIES OF  THESE GAGES
      NGU = 0
      IB = 1
      IU = I
C  IS THERE A REACH UPSTREAM
    5 NU = NURt IU,1)
      IF (NU) 1C, 10, 15
C  THERE IS NC REACH UPSTREAM
   10 IB = IB - 1
C  IS THE SEARCh COMPLETE
      IF (ID) ICC, ICO, 2C
C  SEARCH CCMPLETE
  ICO RETURN

                            AA-186

-------
C  CONTINUE SEARCH
   20 IU = ML( IB)
      GO TC 24
C  THERE IS Afi  UPSTREAM  REACH  - IS  THERE A BRANCH
   15 IF (NUR( It,2) )  25,25,30
C'  THERE IS NL  2RANCH
   25 IU = IRLACMNL)
C  IS THERE A  GAGE
   24 J = 0
      DO 26 JJ=1,NG
      IF (NGRUJ) -  NORUU))  26,27,26
   27 J = JJ
   26 CONTINUE
      IF (J)  35,35,40
C  THERE IS NC  GAGE  IN THIS REACH
   35 GO TC 5
C  THERE IS A  GAGE  JN THIS REACH
   40 NGU = NGl + 1
      JGU(KGU)  = J
C  CONTINUE SEARCHING
      GO TG 10
C  THERE  IS A  BRAisCH
   30  1C =  ID  + 1
      NU =  NUR( IUtl )
      MIU(ID  - 1) =   IREACH(NU)
C   IS  THERE A  SECCUD BRANCH
       IF  ll\UR( IU, 3) ) 45,45,50
C  THERE  IS NC SECOND BRANCH
   45  NU =  NUR( IU ,2 )
       GO  TC 25
 C   THERE  IS A SECOND BRANCH
    50  IB  =  IB + 1
       NU  =  MIRC IU,2 )
       N1U( IE-1) = IREACH(NL)
       NU  =  NUR( IU,3)
       GC  TC 25
       DEBUG SUSCHK
       END
       FUNCTION  IREACH (NU)
       COMMCN/FLCW1/NR,NG,NCR{43),NUR(43,3),DAU(43,3) ,
      1      TDA(43) ,NGAGE( 6),NGR(  6),DAG(  6),ICR(43)
       COfMCN/FLCW2/FL(A3) ,RCUGH{43),SLOPE(43)
       COM".CN/HLCW3/JR(42)|Vn(43,.6)
       II  = 1
     3 IF (\CR( I I) -  NU)  1,2,1
     111=11+1
       IF ( I I.EC.NR)  GO  1C  2
       GO TU 3
     2 IREACH  =  II
       RETURN
       DEBUG SUCCHK

                               AA-187

-------
      EMC
      SUBROUTINE GTRAN
-------
   SUlirtCUTINE COREL(NYRfNSITESiCiQVAR,SlliS12,S21tS22iJ)
   DIFENSICN C(21,4,12,6)tSll(4i6,4,6),Sl2(4i6«4t6)tS21(4f6f4,
                                                        6),
  1  S22(4|6,4,6)IT11(4),T22U) ,T12(7) ,QVAR(12,6) ,NM(7)
  1          ,SL12(7) , SLL1217), SUKL1 (4 ) , SUNLL1 ( 4 ) , SUKL2 ( A ) , SUML
                                                        L2(4)
   DATA NM/lv2i3t4t 3t 2f I/
   N = 4*I\SITES
   JJ=J-1
   IF( J.EO.l )JJ = 12
   DO 1C I=1,NSITES
   DO 10 II=1,NSITES
   CO 5 N=l,7
   SL12(r')=C
   SLL12(K)=G
 5 T12(M)=0.
   CO 6 N=l,'t
   SUMLLHM)=0
   SUML2(^)=C
   SUMLL21N)=C
 6
   CO 20 L = li^r
   CO 20 LL=1,L
   MaL-LL+1
   CO 20 K=1,NYR
   Tll(MJ=Tli(M)+Q(KfLiJfI)*G(KiLLfJfII)
   SUML I (M)=SUNL1(M)+C(K, Li Jf I )»*2
   SUMLL1(M)=SUMLL1 (M)+C(K,LL,J,II)**2
   KK = K
   IF( JJ.LT. 12)GC TO 21
   KK=K-1
   IFiKK.LT. 1)KK = NYR
21 T22(M) = T22(M)+C(KKiLiJJf I )*C(KKiLL.f JJiII
   SUML2(M)=SUML2(M)+CJ(KK,Li JJf I )**2
20 SUMLL?(N)=SU,VLL2(fO+C(KK,LL, JJ, I I)**2
   DO 25 L = l,
-------
   00 35 M= 1,7
35 T12(M)=T12(M}/SURT(SL12(M)»SLL12m)
   DO AO L=i,A
   CO AO LL=1,L
   K=L-LL+1
   SIKL.I ,LL, II )=T11(M)
   Sll (LL, I»L, II )=T11 (M )
   S221L, I ,LL,II )=T22U<)
AO S22UL, It L,II )=T22(P)
   CC 1C L = 1,A
   DC 10 LL=1,A
10 S12(L,I ,LL, II )=T12(I")
   CALL S(24,6,S21»S12,0,N,N,0,C)
   RETURN
   CEBLG SU2CHK
   END
   SUBROUTINE TRANS { NYR ,NS I TES , NTRAN ,Q t QAV, AO , AS I ,BCO,QEST • QVA
                                                        R)
   01 MEN SIGN G(21f4,12,6)tQAV(4i 12,6)iAO(6)tASI(6,6) ,300(6,6) ,
                                                        GEST
  1  (A, 12, 6 } ,C!VAR( 12,6)
   CO 10 IM.NSITES
   CO 5 J = l, 12
   CO 5 L=1,A
   CALL PEANlCd t L, J , I ) ,NYR, AV , SD, S3 , SA )
   IF(NTRAN-2)A, 20,30
20 CO 25 K=1,NYR
25 C(K,L, J,I )=ALOG(Q(K,L,J,I) )
   GO TC A
30 CO 35 K=1,NYR
35 C(K,L,J, I ) = SQRT(Q(K,L,J,I ) )
 A CALL KEAN (G(1,L, J, I ) ,NYR,  CAV ( L, J , I ) , S5 , S6 , S7 )
 5 CONTINUE
   CALL FCCEFtqAVIl, 1, I ) , AS , 6, AC { I ) ,ASI (1, I ) , BCD 1 1, 1) ,QEST( 1,1
                                                        il))
   CO AC J=l,12
   DEV=C.
   CC A5 L=1,A
   CO A5 K=1,NYR
   X=Q
-------
      SUBROUTINE UFLCW (NYR ,NS ITES,G, IHIST)
      DIfENSICN C(21,4,12,C)
      IF( IHISFM,4, 14
    4 10=12
      GC TG 15
   14 10=5
   15 00 2C I=1,NSITBS
      DO 20 K=1,NYR
      CO 20 J=1,12
   20 REAO( I0.5CCO)(C(K,L,J,I),L=1,4)
 5000 FORFAT ( 14X.4F8.2)
      RETURN
      ENC
      SUBROUTINE I TRAM(NS I TES,NTRAK,GC,CVAR,QEST)
      OIMErtSICN GC(4,6, 12 ) , GVAR (12 , 6 ) , GEST { 4 ,12 ,6 )
      CO 1C I=1,NSITFS
      CO 10 J=l,12
      CO 10 L=l,4
      GQ(L, IiJ)=GC(LiIiJ)«CVAR(J,I)+QEST(L,J,I)
      IF(NTRAN-2)in,20t3C
   20 GQ(L,I,J) = EXP(GQ(LrIf J»
      GO TO 1C
   30 GO(L,I,J)=GC(LiItJ)«*2
   10 CGNTINUil
      RETURN
      ENC
        SUBROUTINE EIGEN(iniM,A,EVALfNtK)
C
C     EIGENVALUES ANC  EIGENVECTORS CF  A  REAL  SYMMETRIC  MATPxIX
C
      DIFENSICiN AdOIMi ICIN), 0(24,24), EVALt IC1M) ,  S ( 24 ) ,C { 24 ) ,
     1  C(24),!ND(24),Ut24)
      COUBLF. P^ECISICN ANCR^ , ANORM2 , TAL, P , 01 AG( 24 ) , VALU (24 ) , VALL (
                                                           24),
     1  T1,T2,T,SU'ERD(24) ,C{24) ,D S I ,DCC-, BETA
C
C     CALCULATE NORM CF MATRIX
C
       MAXIT= 5C*MN
       IT = 0
    3 ANORM2 = C.
    4 CO 6 1=1,N
    5 DQ 6 J=1,N
    6 ANORM2 = ANCRK2  + A(I,J}**2
    7 ANCRM =CSQRT (ANORM2)
C
C     GENERATE ICENTITY MATRIX
C
    9 IF (M) 10,45,10
   10 CO 40 1=1,N
   12 DO 40 J=1,N

                                A4-191

-------





c
c
c









1
















c
c
c







c
c
c



20
25
30
35
40



45
50
52
55
60
65
70
75

910


90
95
ICO
105
110
115
120
125
128
130
135
140
150
160

IF (I-J
E ( I , J )
) 35
=

1
.
.2

5,35

GC TO 4C
3(1, J)
CONTIMJ

PERFORM

IEXIT =
fsN = rs-
IF (NN)
CC 16C
II = I
CO 16C
Tl = A(
T2 = A(
IF(T2)
=
E




C


.





RCTAT


2

1










890,1
I
•f
J
I
I

=

=
,
,
1
T=CSCRT(
CG=T1/
SI = T2
CC 1C5
T2 = CO
A(K, J)
AlK, 141
CO 125
T2 = CO
A( J,K)
A { 1 + 1 , K
IF (M
CO 150
T2 = CO
D ( K , J )
B ( K , I 4 1
T
/
K


T
=
»
1
2
I
I
J
9
T


1
A
»

I
+
)
NN

»f\
1)

1C,
1


,
{
•B*


N
K,
= CC *
)
K


s
*
=
1
A

i
(
= CC
)
1
K


=
30
=
*
1
B

i
i
(
T2
N
1 +
*
T2



ICNS TC REDUCE MATRIX TO



70,55





160, 191C
2 +T2**2)



I + D+SI «A(K,J)
A(K,J)-SI «A(KfI+l)


liK) 4 SI *A( J,K)
A( J,K) - Si *A( I41,K)

16C.13C
N
K,
= CC *
)

=

T2

141) + SI *B(K, J )
B(K, J) - SI *B(K, I+L)

CONTINUE



MOVE JACC

170
180
190
2CO
210
220
230


CO 2CC
niAG(i)
VALUJ I)
VALLl I )
CO 23C
SUPERCI
CU-1)


I


=
=

E

1


I

,
A


ELEMENTS AND INITIALIZE E

K
(I


, I)
= ANORM
= -AMCRM
I
I
=
-
2
1
,
)
N
• =
= (SUP

DETERMN

235
240
260

TAU = 0
I = 1
yATCh =

.


IT=IT+

E



0
1








S







A{ 1-1,1)
ERDl I-l))««2

IGNS OF PRINCIPAL NINCRS










              JACCBI  FCRM
            EIGENVALUE BOUNDS
A4-192'

-------
  270 T2 = C.
  275 Tl = 1.
  277 CO 450 J=1,N
  280 P = CIAG(J) - TAU
  290 IF (T2) 3CC,330,300
  3GO IF (Tl) 310,370,310
  310 T = P«T1 - C(J-1)*T2
  320 GO TC 410
  330 IF (Tl) 335,350,350
  335 Tl = -1.
  340 T = -P
  345 GO TC 41C
  350 71 = 1.
  355 T = P
  360 GO TC 4-1C
  370 IF (C(J-l)) 380,350,380
  380 IF IT2) 4CO,390,3CJO
  390 T = -1.
  395 C-C TC 41C
  400 T = 1.
C
C    CCUNT AGREEMENTS  IN SIGN
C
  410 IF (Tl) 425,420,420
  420 IF (T) 440,430,430
  425 IF (TJ 43C,44C,440
  430 .VATCH = NATCH +  i
  440 12 = Tl
  450 Tl = T
C
C     ESTABLISH  TIGHTER BCLNOS  CN  EIGENVALUES
C
  460 CO 530 K=1,N
  465 IF (K - MATCH) 470,470,52C
  470 IF (TAb -  VALL(K)) 530,530,480
  480 VALL(K) =  TAU
  490 GO TC  530
  520 IF (TAU -  VALU(K)) 525,530,530
  525 VALIMK) =  TAU
  530 CONTINUE
  540 IF (VALU(I)  - VALL(I) -  5.0D-8)  570,570,550
  550 IF (VALUn))  560,580,560
  560 IF(DAES  (VALL( I)/VALL(I )  -  1.)  - 5.00-0)  570,570,500
  570 1=1+1
         IT = 0
  575 IF (I  - K)  540,540,590
  580 TAU =  (VALL(I)  + VALL(I))/2.
         IFUT-MAXIT)  26C,26C,581
  561   WRITE (6, 6001 ) IT, I ,.VALL( I ),VALU( I )
 6C01   FORMATU5H  MAXIT  EXCEEDED , 2 I 10 , 2E 20. 8)
        GO TC  57C

                                A4-193

-------
c
C     JACCOI EIGENVECTORS  BY  ROTATIONAL  TRIANGULARiZAT ICN
C
  590 IF (M) 593,890,593
  593 IEXIT = 2
 • 595 DO 610 1 = 1,N
  600 CC 61C J=1,N
  610 A( I,J ) =  C.
  615 CO 8E>C 1 = 1, N
  620 IF (1-1)  625,625,621
  621 IF (VALUU-1) -  VALU(I)  -  5.CD-7)  730,730,622
  622 IF (VALL(I-l)) 623,625,623
  623 IF(OAGS (VALU( I )/VALL( I-1 ) -  1.) - 5.0T-7)  730,730,625
  625 CCO=1 .
  628 DSI=C.
  630 CC 700 J=1,N
  635 IF (J-l)  680,630,640
  640 T = DSC.RT(Tl*-*2 + T2**2)
       CCC=Ti/T
       DSI=T2/T
  650 S(J-l ) =CSI
  660 C(J-l ) =CCC
  670  D(J-l)--=  T1*DCC         +T2*DSI
  680 Tl =  (DIAG(J) -  VALU( I ) )*CCC  -  6ETA*DSI
  690 T2 =  SLPERCtJ )
  7CO BETA  = SLFERDl J)*CCC
  710 D(N)  = Tl
  720 CC 725 J=1,N
  725 IND(J) =  C
  730 SMALLC =  ANCRV
  735 CC 78C J=1,N
  740 .IF (IND(J) -  1)  750,780,780
  750 IF (APS (Sf-'ALLC)  -  AES  (C(J)))  780,780,760
  760 SMALLC =  C(J)
  770 NN =  J
  780 CONTINUE
  790 IND(NN) =  1
  SCO PRCDS = 1.
  805 IF (NN-1)  010,850,810
  810 CO 840 K=2,NM
  820 II =  NK -f  1 -  K
  830 At I 1 + 1, I )  = C( II J«PRCCS
  840 PRCCS = -  PROCS*S(II )
  850 At It I ) =  PRCUS
C
C     FORI"  MATRIX PRODUCT  CF  ROTATION MATRIX WITH JACOBI VECTOR M
                                                           ATRIX
C
  655 CO 885 J= 1,N
  860 DG 865 K=1,N
  865 U(K)  = A*(K,J)

                              A4-194

-------
870 CO 805 1 = 1,N
875 A(I,J) = C.
880 DO 885 K=1,N
885 A{ I,J ) = EM I, K)*U«K)  4  A( I, J)
890 GG TC 941
941     DC 945 1 = 1,N
945  EVAL(I)=  VALU(I)
       RETURN
      ENC
    SUBROUTINE FCCEFI X,NSP,NFREQ,AO,AS,BC,XEST)
    DIMENSION X('tB),XEST(48),AS(e},BC(6)
    T=NSP
    W=2.*3. 1416/T
    AO = 0.
    DO 5  1=1,NSP
  5 AO = AC i- X( I }
    AC = AC/FLCAT(KSP)
    DO 10 M=1,NFREC
    AS(M) = C.
    BC(F) = C.
    TA = 0.
    TB = 0.
    CO 15 1 = 1, NSP
    WT = MFLCATl I*M)
    STA=SIN(WTJ
    STB=CCS(WTJ
    AS(K)=AS(f )+X( I)*STA
 15 BC{^)=DC(r )+X{ I)*STD
    AS(N)=2.»AS(M)/T
 10 BC(M)=2.*EC(M)/T
    X2 = 0.
    DO 2C 1=1,NSP
    X2 = X2 + X(I )**2
    XEST(I) = AC
    DO 20 P=1,NFREC
    WT = h*FLCAT{ I»K)
 20 XEST(I) = XEST(I)  + AS(M ) «SIN(HTJ+BC(M)"COSUT)
    RETURN
    DEBUG SIIBCHK
    END
    SUBROUTINE SORT
    COMMON/FLCU1/NR,NG,NCR(43 ),NUR(43,3),CAU(43,3),
   1      TDA143),NGACE(  6),NGR{  6),DAG{ 6),ICR(43)
    COfNLN/FLCK3/JR(43)iV.T(43,6)
    CC]f'^'C^/FLCW13/GREG(42,48) , DEF IM ( 43 ,48 ) , OEFOLT ( 43 ,48 ) ,BODIN(
                                                         43,48),
   1BODOUT(43,48),XMINC(43,3C),LLX(43,30),XKK(43,48)
    C DM PCIS/SCRT1/NDUWM 42,431 , KOL.N T ( 43 ) , I NDEX ( 505 ) , MSORT
    MX = 5C
    WRITE(6,3 )
  3 FORNAT( ' 1',///T40,'AIJ  RENUMBERING  SYSTEM1)
                            A4-195

-------
   WRITE(6,4)
 4 FORKATt »C' i/T5, ' JR( I ) • ,3X, ' DCkNSTREAK  ELEMENT  CF  JR(I)',/T1
                                                        3,'01',
  12X,«021,0X,l03«,2X,1Q4l,2X,'C5l,2X,'06',2X,'07',2Xt'08',2X,
                                                        'C91 ,2X
  2,•10' ,2X, '11' ,2X,«12«,2X,'13',2X,'14',2X,'15',2X,'16«,2X, '1
                                                        7' ,2X,
  3'18',2X,'19«,2X,'20',2X,'21' ,2X, '22',2X,'23',2X,'24',2X,'25
                                                        M
   M = l
   N=l
   CO  6 1=1,MR
   CO  5 J = 1,NR
 5 NDUKM I,  J )=C •
 6 KOUNT(I)=C
   DC  10 1 =  1,NR
   K = JR{ I )
   L = l
   NCOUN(K,L)=K
 7 CALL NFI.\D(K,NR,!«IXfICR,JXfN$}
   IF(Mf .EG.C ) GC TO 8
   L = L + 1
   NDQwi\( JR  ( I ) ,L )=K
   IF(NDCWN(JR{ I } ,L).EG.NDOWN(JR(I) ,L-1))  L = L-1
   J$=ICR{JX-1)
   K = J$
   IF(K.EG.O) GO  TO 9
   GO  TC 7
 8 K=K-1
   IF(K.EG.C) GO  TO <~>
   GO  TC 7
 9 KOUNTUR( I ) ) = L
10 CONTINUE
   DO  15 1 =  1 ,NR
   J = JR( I )
11 INDEX(M)=J*100+NDCWN(JtM)
   IF(N.GT.KCUNT{J)) GO  TC  14
12 N=N+1
13 f=y4l
   GO  TC 11
14 N = l
15 CONTINUE
   DO  20 1=1,NR
   JJ=JR(I)
   KK = KOLNT(JJ )
   WRITE(6|l6)JJ,(NDCWN(JJ|LL)fLL=l|KK)
16 FORNAT(1HO,T6,I2,T13,25(I2,2X))
20 CONTINUE
   WR1TEJ6,25)
25 FORKAT('l',///T5,'INCEX',3X,'CUMBINAT ILN' ,T30,•INDEX' ,3X,'C
                                                        OMBINAT
                            A4-196

-------
  1ION' , T60, 'INDEX' , 3X, « CGf'B 1NA T ION ' , T9C, • INDEX1 , 3X , ' CONB I NAT I
                                                        ON' )
   DC 30 1 = 1,M
   11 = 1 + 12*-
   II 1 = 1 1 + 126
   I 111 = 111 + 126
   IF{ I I I I .GE.V) GC  TC  4C
   WRITE(6,28)1, INDEXt I ) , I I , INDEX!I I),I II,INDEX! Ill),II I I,INDE
                                                        X(I III )
28 FORMAT! ' ',T5, I3,5X, I 5 ,T 30 , I 3 , 5X , I 5 , T60 , I3,5X,I5,T90,I3,5X,
                                                        15)
30 CONTINUE
40 RETURN
   END
   SUBROUTINE N F I NO I K ,.NR , PX , I CR , JX , \C )
   INTEGER  ICR(MX)
   DC 10 I= 1 ,N K  .
   N = 10 R { I )
   IF(N.EQ.K) GC] TO  5
   GO TC 1C
 5 i\C=l
   JX=I
   RETURN
10 CONTINUE
   NC = 0
   JX=1
   RETURN
   END
   SUBRLLTINE AIJ
   COFMLN/f;LCWl/NR,NG,NCR(A3} ,NUR(A3,3) ,DAU(43,3) ,
  1      TCA(A3),NGAGE(  6),NGR{  6J,CAG(  6)fICR(43)
   COfMGN/FLCU3/JR(43),VT(A3,6)
   C ON N UN/F L CW13/QR E G(A 3,A 8 J,DE F IN(A 3i4 8)iD E FGlT{A3i48)iDOD IN(
                                                        A3iA8),
  lHODCUT(A3,A8),XMINQ(A3,3C),Ll.X(A3t30) f XKK(A3,A8)
   CONK,DN/SCRTl/NCOWN{A3iA3» ,KOLNT ( A3 ) i INDEX { 505 J ,MSGRT
   DIN EN SIGN SALFA(5C5,P),SDELTA(505,8),SR(5C5,8),SA(505,8),SD
                                                        (505,8)
  l,SRSQ(r)G5,8) , BA( 5C5, C ) , BH ( 505 , 8) ,AA( 505,8) , AD (50 5, 8)
   EQUIVALENCE  (BA(1),SALFA( 1),LLX(1) J, (BD(1) ,SDELTAi 1),XMINC(
                                                        1)),
  1 (AA( 1) ,SA( 1) ) ,(St:{ 1 ) ,AD( 1) )
   EQUIVALENCE(XKK(1),SRSO( 1) )
   INTEGER  CC
   CALL SCRT
   W R I T E ( 6 , 4 1J
   DO 1 I=1,KSCRT
   DO 1 J=l,8
   SA(I,J)=C.
   SD(I,J)=0.
   SALFA( I ,J )=0.
                          A4-197

-------
   SDELTAt I, J)=0.
   SRC U J)»C.
 1 SRSG( i,J)=C.
   RETURN
   ENTRY AIJSUB(L,NYR,CC)
   IF(L.LT.25)RETLRN  1
   IF(L.GT.32)RETIR.M  I
   LW=L-24
   K = l
   1 = 1
   DO  1C ICX=1,MSORT
   II=JR(I)
   NN=NfJCWN( IIiKl
   IFCBOCIM IItL  ).EC.C.)80CIN(II»L )=1.C
   ALFA = BCCCl.T(NN,L  1 /ECC IN ( I I , L )
   IFCCEFINC II, L  ).EU.O. )BODIN( I I,L )=0.5
   DELTA=DEFCUT(KN,L  )/CEFIN(II,L )
   IF(CREG(II,L  ).EQ.O)CREG( II,L )=l.O
           NN,L )/CREG(II,L  )
   C=CELTA/R
   SALFA(IDX,LVs)=SALFA( ICX,LW)+ALFA
   SDELTA( ICX,LVJ)=SDELTA(IDX,LW)+DELTA
   SR( ICX,LW)=SR( IDX,L'rt)+R
   SA( IDX,LW ) = SA( IDX,LW )+A
   S0( ICXf LK )«SO( IDXf LVi )-»C
   SRSCt IDX,LU) = SRSQ('IDXfLW)+R»R
   IF(K.GT.KCUNT( II ) )GC  TO  5
   GO TO 1C
 5 K = l
  - IF< I.LE.NR) 1=1+1
10 CONTINUE
41 FORMAT( LH1, T4Cr«DESIRED  OUTFIT  FRCM  AIJ«)
   IF(NYR.LT.CC)  RETURN  1
   WRITE(6,42)
42 FORMAT (T2,« YEAR' ,T7f 'WEEKST31, 'BA'.i T51 , • BD ' , T71 , »AA» ,T91 , •
                                                        AC',T16
  l,»STRETCh',/Tl4,'UPSTR.',2X,'DWNSTR.1)
   K = l
   1 = 1
   DO 20 ICX=1,MSORT
   II=JR(I)
   NN=NCCWN( Hi K)
   BA(IDX,LW)=(SALFA(IDX,LW)-SA(IDX,LW)»SR{IDX,LW)/NyR)/SRSG(I
                                                        DX,LK)
   BDCICX,LW)=(SDELTA(inXfLW)-SD( IOX,LW)»SR< IDX, LV« )/NYR) /SRSO (
                                                        IDX.LW)
   AACICXi LW)=(SA(IOX,LK)/NYR)-BA( IDXf LW )*SR ( IDX t LW) /NYR
   AD(IDX,LW ) = {SC{ IDXf LU)/NYR)-BD( IDX.LV^ )*SR ( IDX ,LW) /NYR
   KRITE(6,7^ JNYR.LW, I I , NN , BA ( IDX, LV* ) f BD ( IDX , LV» ) t A A ( I DX , LW ) f AD
                            A4-198

-------
                                                         (IDX,LW
  1)
74 FCRMATdh  , 14 , 16 , 2 17 , 6F 1 5 .7 )
   K = K + 1
   IF(K.GT.KCLNT( II) )GC  TO 15
   GO TC 2C
15 K = l
   IF(I.LE.NR)I=I+1
20 CONTINUE
   RETURN 1
   DEBUG SUBOK
   END
                              A4-199

-------
A4.7 JlNJJEIlF_"_Interface Program

A4.7.1 Purpose
The interface program, INTERF, was written primarily for the important
linkage between the two main models of this project.  In this study
the simulation model, programmed in Fortran IV, and the optimization
model, programmed for IBM*s Mathematical Programming System/360,
are visualized" as' a closed' loop; Information feedback system.  This
specific type of control system could not be possible without INTERF.
As seen in Figure A4-11, the input to the interface program is the
output from the simulation model.  After receiving this input in the
form of stream and wastewater- data, the- program- will perform three
major routines before generating input to the linear programming
model.  These routines are discussed in the Program Components
section.

The overall objective of INTERF is, therefore, to accept specified
output data from the simulation model and to generate the linear
programming model in the format specified for the MPS/360 Processor.
By computing and storing all of the elements in the linear program-
ming tableau, INTERF will save the user considerable time developing
the linear programming model in a multi-commodity network format.
The program contains the flexibility of handling a region with up
to 50 reaches and generating a new matrix in the MPS format for
any changes in output data from the simulation model, e.g., when
flow is augmented in the simulation model.

A4.7.2 Program Components
As mentioned previously, the interface program is composed of
three major components, or routines.  The first routine calculates
all  the parameters and right hand side elements (RHS) for the
linear programming model.  The parameters were derived from the
biochemical oxygen demand  (BOD) and dissolved oxygen (DO) deficit
equations developed by Camp  (10) and by Dobbins (11).  These
parameters are attenuation and amplification coefficients which
describe the change in BOD and DO between the beginning and end
of a reach.  BOD and DO concentration in each reach, as well as
the  allowable amount of DO in the water, are converted to mass
units in order to maintain a mass balance relationship in the
network.  The parameters and RHS with concentration units were
also changed to mass units.    The parameter values are calculated
using the following equations:
                            A4-201

-------
            FIGURE  A4-II
       OVERVIEW OF CLOSED LOOP
    INFORMATION FEEDBACK SYSTEM
WASP
>_

INTERF
Va_
P*-
LPLF
SIMULATION
  MODEL
INTERFACE
 PROGRAM
  LINEAR
PROGRAMMING
FOR  LOW FLOW
         ~ CONTROL POINTS
              AA-203

-------
                                                      [Eq. A4.96]


                                                      [Eq. A4.97]
                   Ur = [(1 - Xr)  (KX + K3) ]x 8.34 .[Eq. A4.98]
                   Yr - K l(Xf ar)
                        K2 - Oq+.K^      ...... [Eq. A4.99]
                              K1 + K3
                                 - M_^ (l-ar) ....   [Eq. A4.100]
                   K2      + K3    Kl


                   *r - [(CSr) (1 - or) - pr] x 8.34   [Eq. A4.101]


where
r • l,2,...,n is the reach number, and
n i 50.
RHS values for water, BOD, and DO are obtained as follows:

          ROW NAME                          RHS VALUE
          WAT(I)B                           QW(I)

          WAT (I)P                           QT(I)

          B0D(I)B                           QW(I)*BW(I)*8.34

                                            QT(I)*BT(I)*8.34

                                            QW(I)*CW(I)*8.34

                                            QT(I)*CT(I)*8.34
                             A4-205

-------
where
r = (I)
B   represents wastewater,
P   represents tributary,
and the nodes are defined as
WAT(I)B - wastewater,
WAT(I)P - tributary for water,
B0D(I)B - BOD for wastewater,
B0D(I)P - BOD for tributary,
DI0(I)B - DO for wastewater,
DIO(I)P - DO for tributary,
along with the parameter definitions of
QW(I) - wastewater flow,
QT(I) - tributary flow,
BW(I) - BOD concentration of wastewater discharged, and
BT(I) - BOD concentration of tributary flow.

The constant 8.34 represents the transformation of 1 mg/1 to 8.34
Ibs/MG.

The second routine was developed to determine the water quality
standards of each reach in  the region of interest for a watershed.
This routine makes use of the minimum allowable D.O. in each
reach, the wastewater and tributary flow in each reach, and the
total reach flow to determine the water quality standard in mass
units.  The water quality routine will first determine the
tributary and wastewater flow in the headwater and interior
reaches.  Then a sequential technique for determining the total
flow in each reach and establishing water quality standards was
incorporated.  Specifically the sequential technique checks for
any reaches, either headwater or interior above a specific reach,
placing all reaches in the proper order for computational
purposes.  Starting with the upstream reaches in the region,
the program will search its way down the tree diagram of the
region until all flow values have been determined.  These values
will be summed along with the tributary and wastewater flows
in the reach.  The process  for the headwater reaches is as
follows:
                          A4-206

-------
                           QS(H)  -  QW(H) + QT(H)    	[Eq.  A4.102]

                        QUAL(H)P  =  QS(H)*MDO(H)*8.34    .  .  .  [Eq.  A4.103]

                        where
                               H  *  number  of  headwater  reach>

                        QUAL(H)P  =  water quality  standard for  each
                                   headwater  reach ,

                           QS(H)  »• sum of  wastewater  and tributary
                                   flows in headwater reach, and

                          MDO(H)  =  minimum allowable  DO in  headwater
                                   reach
The process for the interior reaches is:
                     QS(IN) - QW(IN) + QT(IN)    	   [Eq. A4.104]

                       QUAL(IN)P  "  [ZQS(HR) + ZQS(IR)]*

                                   MDO(IN)*8.34     ....   [Eq. A4.105]

                       where
                              HR  «  headwater  reaches  contributing to
                                   interior reach,

                              IR  »  interior reaches above and  including
                                   the interior reach under consideration,

                              IN  -  number  of  interior reach,

                          QS(HR)  =  sum of  wastewater  and tributary flows
                                   in headwater reaches,

                          QS(IR)  -  sum of  wastewater  and tributary flows
                                   in interior reaches,

                       QUAL(IN)P  «  water quality  standard for  each
                                   interior reach, and

                         MDO(IN)  *  minimum allowable  DO in  interior reach.

        The remaining routine  takes all the LP parameters,  RHS elements, and
        water quality standards,  determined from  the  above  routines,  and
        structures the format  for the MPS/360 Processor.  All  columns and
        rows are also placed in the fields specified  by the MPS.  Using
        the node-branch representation of  the region  in the network
        developed for the linear  programming  model, the rows are the
        nodes and the columns  are the branches connecting the  nodes.   The
        three commodities being transported down  the  river  are water, BOD,
        and DO.  Subsequently,the rows and columns  in the model are
        representative of these three commodities.  The final  output  of
        this routine is a regional  linear  programming model in a multi-
        commodity network format.
                                       A4-207

-------
A4.7.3 Program Input
The output data from the simulation may be printed, punched on
cards or written on tape, depending on any final transformation
in the data, and also depending on the control statements used,
before becoming input to INTERF.  Common, Read, and Dimension
statements are incorporated in the program for the variables shared
in both the simulation and interface program.  Data statements
are used to define variables or columns, row names, and array
elements.  The data statements appear at the beginning of the
program, though this is not mandatory, in order that the initial
skeleton of the LP tableau may begin being structured.  In
this case,the majority of the data statements are arrays
dimensioned 20 by 8, (20,8), viz twenty rows down and eight
columns across. For the literal data in the data statements,
4H format codes are used.  The literal data specified by the data
statements are the columns, rows, and parameters to be used in
the LP tableau.  The program specifies twenty-seven arrays for a
50 reach region, and actually uses only seven of these arrays
for a hypothetical region of seven reaches.  The number of
arrays used for an n reach problem is dependent on the structure
of the network format being used for a specific region in the
watershed, not on the actual number of reaches.  When a different
region is considered in the watershed, the only changes which need
to be made in the main program are in the data statements.

Three input data sets are required for the program.  The first two
data sets are in I format code and the third is in F format code.
The first set includes the number of reaches (NR) and the number
of days  (NDAYS).  The-second set contains the numbering scheme
used for the sequential technique incorporated in the program.
The stream and wastewater data output from the simulation model
are found in the third set and consist of the data in Section
9, Table 9-2.
                            A4-208

-------
A4.7.4 Program Output
The output from INTERF is in four parts:

1.  The values of the six parameters shown in the Program Components
section are given for each reach in the region.

2.  The amount of flow in each reach, i.e., the sum of the waste-
water and tributary flow in the reach.

3.  A numerical diagram of the region under consideration so the
user can actually sketch out or visualize the tree diagram of the
river basin.

4.  The last part of the output is the mathematical programming
model structured in a multi-commodity network format.  All columns,
rows, RHS, and parameters are printed and punched according  to the
special format and field width in the MPS Processor.
A4.7.5 Definition of Program Variables
NR - Number of reaches, KK = 1	NR
ALPHA(KK) or ar
XLAMDA(KK) or
XMU(KK) or yr
GAMMA (KK) or yr
RHO(KK) or pr
PSl(KK) or T
TIME(KK) or Tr

R(KK)  or R
(A4.96).
(A4.97).
(A4.98).
 XKl(KK)  or  K
 XK2(KK)  or  K
 XK3(KK)  or  1
 A(KK)  or M
 WATIB(KK)

 WATIP(KK)

 BODIB(KK)
Parameter shown in Equation
Parameter shown in Equation
Parameter shown in Equation
Parameter shown in Equation (A4.99).
Parameter shown in Equation (A4.100).
Parameter shown in Equation (A4.101).
Travel time of water to flow from beginning to
end of a reach
Rate of addition of BOD along a stretch due to
runoff and scour
Rate constant for debxygenation
Rate constant for reaeration
Rate constant for sedimentation and absorption
Oxygen production or reduction due to plants
and bottom deposits.  A(KK) may be positive
or negative.
Wastewater node, related to value of wastewater
flow
Tributary node, related to value of tributary
flow
BOD node for wastewater, related to mass units
of BOD in wastewater
                               A4-209

-------
BODIP(KK)    BOD node for tributary, related to mass units of
             BOD in tributary
DIOIB(KK)    DO node for wastewater, related to mass units of DO
             in wastewater
DIOIP(KK)    DO node for tributary, related to mass units of DO
             in tributary
QREG(KK)     Sum of wastewater and tributary flow
QUALIP(JR(KK))  Water quality standard for each reach.

A4.7.6 Program Logic
The basic flow chart shown in Figure A4-12 should be used as
an aid to following the operation of INTERF.

                      FIGURE A4-12
                  FLOW CHART FOR INTERF
                   Job Control Language
                           T
                   Common Statements
                           t
                   Dimension Statements
                   Data Sta
ements
                          Read
                       Calculate
                       Calculate
                 Calculate And  Print-
Data statements for
structuring column and
row format in LP Model
according to MPS/360
               Number of reaches,
               sequential technique data,
               stream and wastewater
               data
              •Amplification and
               attenuation parameters
               Right hand side elements
              -Flow in  headwater  and
               interior reaches
                            A4-210

-------
   FIGURE A4-12
   (continued)
Sum and calculate-
Print and Punch-
Print and Punch-
                        Using sequential
                        technique, determine total
                        flow in reach and calculate
                        water quality standards
                        Right hand side format
                        for LP model
                        -Column and row format
                        for LP Model
     Return
      End
         A4-211

-------
A4.7.7 Program Coding
//INTEHF   JCS  ( 1143-,A7,003t03,3COO), 'CARTtR               «, CLASS
                                                             = S
/•PASSwCRC      IfLOFLGJCIi
//  EXEC FACCXS      FCHT  G COMPILE (DcCK),  EXECUTE,  CLASS S
//FCRT.SYS IN CT.  *
       COf MCN/FLi:wl/NRiNGf.Nt:R( 50 ) ,NLR(5C,3> ,-OAU(50, 3 ) ,
      1      TCA( 50) , NGAGEt 10) ,\GR( 10) ,CAG( 10) , 103(50)
       CIVEiNSIC:^ ALPHM5G) , XLAMCA15C ) , XMU(50) ,GAPMA(50) ,RHO(50) ,
      1         i'SI ( 50) , iMT IB( 50 ) , WATIP( 50) , BODILM50 ) ,BOOIP( 50) ,
      2          CI{)ia(5C),CIGIP(50) ,QUALIP(5C)
       DINEi\SIC\ TI.4E (50 ) , QUASTEt 50) ,QSLM(50) ,XMXOEF(50) , XMNCG150)
      1          ,OU'XST( ''iO) ,CEFSUM(50) ,800 SUM (50) ,XK1(50) ,XK2(50) ,
      2         XK3( 50) i At 5C) t B( 50) »OOOnSr(50) ,R(5C)
      3          , COS (50)
       C I ,* E iN S I C \ C R E C. ( 5 0 )
       UlfE'xSIC^ Xl(150,.1),X2(50,8),X3(100t3),X^(50,8),X5(LOO,8),X
                                                              6(50,8)
      1  ,       X1L(?0,8) ,X12(2C»H) ,X13(20,8) ,X14(20,8) ,X15(2C,3)
                                                              ,
      2          X16(20,8),Xl7(20r8),X18(10,8)tX2l(20,8)fX22(20,8)
                                                              ,
      3          X23(10,8),X31(2C,8),X32<20,8),X33(20,8).X3M20,8)
                                                              ,
      A          X35(20,a),)(/il(2Qra),XA2(23,8)fXA3(10,f}),X51t20,8)
                                                              t
      5          X52(20,8),X53(2C,8),X5A(20,8),X55(20,8),X6l(20,8)

      6          X62 (20, 'i) ,X63( 10»8)
     * DATA STATr^E'-iTS  REQUIRED F-GR  THE  COLUMN  AND RGW FORMAT  IN T
     .  . .                                                      HE  LP*
       DATA Xll/^tHrilP3,AhQlP3,'.H(:aP3,'iHQ2P3,AHQ2FJ3,4H02P3?AHG3P5,4
                                                              HG3P5,
      1         ^HOiP5, 4HC4P5,4H(J4P5,4Ht;4P5f 4HQ5P6f 4HG5P6,4HG5P6,4
                                                              HC6P7,
      2         ^HC6P7, AHQ6P7,AHQ7P8f^HG7P8f AHP1   ,^HP1   ,AHFL  TA
                                                              HP1  ,
      3         41-Pl   ,AhPl   ,AHP1   fAHPl   ,AHP1   ,AHP1   ,AHP1  TA
                                                              HP1  ,
      A         AHP1   ,AHP1   ,AHP1   ,AHP1   ,AHP1   ,AHP1   ,AHPL  ,A
                                                              HP1  ,
      5         AHWAT1, AI-fJCC3,AKQUAL,AHWAT2,AHBOU3,AHGUAL,AHV
-------

A

B

C

D

E

F

G

h

I

J

CAT A

1

2

3

4

5.

6

7

B

9

A

D

C

D

E


1.0

AH

AH

4 H C I C 3

AHWAT6

AHP

AH

AHP

AH

-1.0

X12/AHC7P8

AH

AH

AH

AH

AI-eUAL

AH

AH

AH

AH

AH

AH

AH

AH

AH


tAH

t 1

tAf

, AH

,4HDI

, A H P

, AHP

tAH

,0.0

tAH

,4H

,AH

,AH

,4H

,AH

,AH

i AH

tAH

tAH

,AH

,AH

t AH

,AH

tAH

»AH


,AH

.C,AH

, 1

, AHWA

C6, AH

tAH

, AHP

,AHP

, -1

,0.0

,AH

,AH

,AH

,AH

,AH

,AH

tAH

,4H

,AH

,AH

tAH

,AH

tAH

,AH

,AH


, 1.0

,AH

.G , AH

T5,AHDI05

,AH'/,AT7

,AHP

,AH

,AHP

.C ,AH

, -1.0

,AH

,AH

,AH

,AH

,AH

tAH

,AH

,AH

tAH

,AH

,AH

tAH

,AH

,AH

,AH


,AH

, 1.0

,AHWAT3

,AH

.AHDIC7

, AHP

,AHP

, -1.0

,0.0

,AH

,AH

,AH

,AHP1

,AH

,AH

,AH

,AH

,AH7P

,AH

,AH

,AH

,AH

• AH

,AH

,AH '


,4H

,AH

,AHDI03

, AHUAT5

tAH

,AH

,AHP

,AH

, -1.0

,0.0

,AH

,AH

,AH

,AH

,AH

,AH

,AH

,AH

,AH

,AH

tAH

,AH

,AH

,AH

,AH

HP
, 1.0
H
tAH
1.0
tAH
HUAT3
,AHDI05
H
,AHVsAT8
HCI03
,AHP
HP
,AH
HP
,0.0
-1.0
tAH
.0
, -1.0
H
,AH
H
,AH
H
,AH
H
,AH
H
,AH
H
tAH
H
,AH
H
,AH
H
,AH
H
fAH
H
,AH
H
tAH
H
,AH
H
tAH
H
,AH
H
t
,A
»
,
t
tA
»
,A
>
,A
t
,A
»
tA
T
t
t
,0
»
»A
/
tA
,
tA
»
tA
?
,A
»
tA
»
tA
>
tA
t
»A
t
»A
,
,A
t
»A
»
tA
t
tA
t
tA
»
tA
t
A4-215

-------
 CAT A
 DATA
1




2




3




A




5




6




7




a




9




A




B




C




D




E




F




G




H
AH

AH

AH

AH

AH

2C»AH
2 C * A H
:;C*AH
1C*AH
A H C 1 8

AH

AH

AHP1

AH

AHWAT

AH

AH

AH3

AH

1.

AH

Ah

AHhAT

AH

AHP

AH

AH
,Ah »AH

,AH ,AH

,Ah ,AH

,AH tAH

,Ah ,AH

/
/
/
/
ItAHG222tAHQ333

,AH ,AH

»Ah tAH

tAHPl tAHBl

•AH ,AH

1 , A H H A T 2 , A H 'A A T 3

tAh ,AH

,AH tAH

• AH3 ,AHP

,AH ,AH

0, l.Ct l.C

,AH ,AH

,Ah ,AH

6|AHWAT7, AHMTS

,Ah ,AH

,AHP tAHP

,Ah tAH

,AH ,AH
,AH

tAH

»4H

tAH

tAH





tAHCABA

tAH

,AH

, AH

tAH

,AH'*'ATA

tAH

,AH

iAH

tAH

, 1.0

tAH

,AH

tAH

tAH

tAHP

• AH
•
,AH
tAH

,AH

,0.0

,AH

,AH





tAHQ606

tAH

tAHPl

, AH

• AH

•AHWAT6

iAH

,AHB

i AH

,AH

, 1.0

iAH

•AHkATl

• AH

tAH

tAHP

,AH •

, -i.o
iAH

tAH

,AH

,AH

tAH





tAHQ737

tAH

tAHPl

, AH

tAH

t AHWAT7

,AH

tAHB

tAH

tAH

, 1.0

tAH

t AHkAT2

tAH

tAH

,AHP

tAH

, -1.0
iAH
H
• AH
H
,AH
H
,AH
H
tAH
H




,AHQ8P9
H
,AH
H
tAHPl
HP1
,AH
H
,AH
H
,AHWAT3
H
,AH
H
tAHB
HB
tAH
H
tAH
H
, 1.0
H
tAH
H
tAHVvATB
HUATA
,AH
H
,AH
H
tAHB
H
,AH
H
t -1.0
• A
t
,A
,
tA
t
tA
,
tA
1




tA
t
,A
t
• A
t
,A
t
»A
t
tA
t
tA
t
tA
t
,A
t
• A
t
tA
t
tA
t
tA
t
tA
»
,A
t
• A
t
,A
t
t
                              A4-217

-------
                              -1.0,
I

J

CATA
CATA
DATA

1

2

3

A

5

6

7

8

9

A

0

C

D

E

F

G

H

I

J

CATA
CATA
CATA
CATA
-1 .0

AH

X22/20»AH
X23/1O4H
X31/AHG1P3

AH05P6

AH

AHP2

A H P 2
•
AHBUC1

AHBOC5

AH

AHP

AHP

1.0

l.C

AH

AHKOC5

AHB003

AHP

AHP

AH

AH

AH

X32/2C*AH
X33/20*AH
X3A/20*4H
X35/2C*4H
, -1

.AH

/
/
,AHQ1

,AHQ5

,AH

,AHP2

,AHP2

, A H CI

, A H D I

,AH

, AHP

, AHP

,AH

. AH

, AH

, AHQU

,AHCl

, A h 1 P

,AH5P

, AH

. AH

, AH

/
/
/
/
.C, -l.C

.AH



P3.AHG2P3

P6,AHQ6P7

,AH

, AHP2

,AH

C3.AHBGD?

C6,AHBOD6

,AH

,AHP

,AH

, l.C

, 1 . C

,AH

A L, A HOOD 5

A L ,, A H

,AHP

,AHP

tAH

rAH

,AH





, AH

,AH



,AHQ2P3

, AHl»6P7

i AH

, AHP2

,AH

, AHDI03

,AHCIU7

,AH

,AHP

,AH

,AH

, AH

,AH

, AHCUAL

,AH

, AH2P

,AH6P

,AH

, AH

,AH





,AH

, AH



,AHQ3P5

, AHQ7P8

,AHP2

,AHP2

,AH

, AHBOU3

,AHBQD7

,AHP

,AHP

,AH

, 1.0

, 1.0

.AHBOD3

, A HBO 06

,AH

,AHP

,AHP

,AH

t AH

,AH





.AH

,AH



,AHG3P5

,AHC7P8

,AHP2

,AHP2

»AH

, AHDI05

, A H D I G 8

,AHP

,AHP

.AH

i AH

,AH

.AHCUAL

.AHQUAL

,AH

, AH3P

,AH7P

,AH

,AH

, AH





,AH
H
,AH
H


,4HG4P5
HCAP5
»AH
H
,AHP2
HP2
,AHP2
HP2
,AH
H
, AHBODA
HCI05
,AH
H
,AHP
HP
,AHP
HP
,AH
H
, 1.0
H
,AH
H
/it o o r^ T
1 r il [_) \J L> J
HQUA'L
.AHBCD7
HGUAL
,AH
H
,AHP
HAP
,AH
H
,AH
H
,AH
H
. AH
H




, A
,
,A
/


.A
,
»A
t
,A
i
,A
,
,A
t
, A
i
,A
,
,A
T
,A
i
»A
.
,^i
t
,A
f
,A
*
, A
,
.A
,
.A
i
.A
t
,A
i
tA
i
.A
/




A4-219

-------
CATA

1

2

3

A

5

6

7

8

9

A

B

C

D

E

F

G

H

I

J
XAl/AHGlcH,

AH ,

AH ,

AHP2 ,

AH ,

AHBIJC1,

AH ,

AH

AHB ' ,

AH ,

1.0,

AH

AH ,

AHBUC6.

AH ,

AHP ,

AH ,

AH ,

-l.C,

AH ,
AHC2rJ2

AH

AH

AHP2

AH

AHBCC2

AH

AH

AHB

AH

l.C

AH

AH

AHDCC7

AH

AHP

AH

AH

-1 .C

AH
, AHQ3B3

,AH

.AH

,AHP2

,AH

.AHB003

,AH

,AH

,AHP

,AH

. l.C

.AH

.AH

, AHBGDS

,AH

,AHP

,AH

,AH

, -l.C

, AH
, AHQASA

,AH

,AH

,AH

• AH

,AHBGDA

rAH

t AH

,AH

,AH

, 1.0

,AH

,AH

,AH

,AH

,AHP

,AH

,AH

,AH

,AH
,AHQ6B6

,AH

,AHP2

,AH

• AH

,AHBOn6

tAH

,AHB

»AH

,AH

, 1.0

.AH

.AHBCD1

tAH

tAH

,AHP

iAH

, -1.0

.AH

,AH
.AHQ737

tAH

, AHP2

tAh

tAH

.AHQOD7

,AH

,AHD

t AH

tAh

, 1.0

tAH

.AHBQD2

»AH

tAH

,AHP

tAH

, -i.o

,AH

,AH
,AHG8P9
H
,AH
H
,AHP2
HF2
,AH
H
tAH
H
,AHBOD8
H
,AH
H
,AHB
HB
,AH
H
,AH
H
, l.C
H
,AH
H
,AHECD3
HBCDA
,AH
H
,AH
H
tAHB
H
,AH
H
, -1.0
-l.C
tAH
H
,AH
,A
,
,A
*
»A
,
,A
t
,A
.
,A
,
,A
t
,A
,
,A
t
.4
i
,A
t
,A
t
,A
,
,A
i
,A
,
,A
i
,A
t
,
i
,A
t
,A
                                                       H    /
 CATA XA2/20*AI-     /
 DATA XA3/1C*AH     /
 CATA X51/^l-ClP3iAHClP3fAHC2P3,AHQ2P3,AHQ3P5,AHQ3P5,AHGAP5 , A
                                                       HCJAP5,
1         AHG5PA, AHG5P6..AHQ6P7, AHG6P7 , AHQ7P8, AHC7P8, AH    ,A
                                                       H    ,
2         Ah     tAh    ,AH    ,AH     ,AHP3   ,AHP3  ,AHP3  tA
                                                       HP3  i
3         AhP3   ,AhP3  ,AHP3  ,AHP3   ,AH-P3   ,AHP3  ,AHP3  ,A
                                                       HF3  ,
A         AHP3   ,AhP3  ,AH    ,AH     ,AH     ,AH    ,AH    ,A
                             A4-221

-------

5

6

7

8

9

A

B

C

U

E

F

G

H

I

J


AHD

AHC

AH

AHP

AHP





AH

AHD

AHC

AHP

AHP

AH

AH

AH


ICl.AHGUftL

IL5, AHGLAL

,AH

,Ah3P

,AH7P

1.0, AH

1 . C , A H

,AH

105, AH

I C 8 i A H

,AH

» AH

,AH

, O.C

, O.C


,AHU

,AHO

,AH

,AHP

,AH

i

.

»AH

»AHO

,AH

»AHP

,AHIJ

,AH

,AH

.AH


IU2 , AHUUAL ,AHD

IC6 .AHGLAL.AHD

, 'fH ,AHP

,AHAP ,AHP

,AH ,AH

l.C, AH ,

l.C, AH ,

,AH ,AHD

1 05, AH ,AHO

, AH ,AH

,AH ,AHP

,AH ,AHP

,AH ,AH

, 0.0, AH

,AH ,AH


IG3, AHQUAL

IG7.AHGUAL

. ,AH1P

,AH5P

.AH

1.0, AH

1.0, AH

IC3.AH

I(J6, AH

,AH

,AH

,AH

, 0.0

, 0.0

f AH

H
,AHDI04
HCUAL
,AH
H
, AHP
H2P
,AHP
H.6P
,AH
H
, 1.0
H
, AH
H
,AHDIC3
H
.AHCI07
H
,AH
H
,AHP
H
,AH
H
i AH
0.0
.AH
0.0
.AH
H
,
.A
,
,A
»
,A
,
,A
,
,A
,
»A
,
,A
,
.A
V
,A
r
.A
t
• A
t
• A
,
t
i
.
,
• A
/
CATA X-32/2C»AH
CATA X53/2G*AH
CATA X3A/20*AH
CATA X55/2C«Ah
LA 1 A

1

2

3

A

5

6

7

ACl/'lt-UiU

AH

AH

AHP3

AH

AHDIU

AH

AH

1. , ^ 1- (J ^ ilS t A h U 3U J , 
-------
   8          Ah.B    ,41-3   ,4HP    ,4H     ,4H    .AH     ,4H     ,4
                                                           H     ,
   9          Ah     ,Ah    ,4H     ,4H     ,4H    ,AH     ,4H     ,4
                                                           H     ,
   A             1.0,    l.C,    l.C,    1.0,    1.0,     1.0,    1.0,
                                                             1..0,
   B          Ah     ,Ah    ,4H     ,4H     ,4H    ,4H     ,4H     ,4
                                                           H     ,
   C          4h     ,4H    ,4H     ,4H     , 4HDI 0 1,4hCI 02,4HC103,4
                                                           HCIG4,
   D          4h.CIC6,4hOIC7,4HDI09 ,4H     ,4H    ,4H     ,4H     ,4
                                                           H     .
   t          Ah     ,4h    ,4h     ,4H     ,4H    ,AH     ,4H     ,4
                                                           H     ,
   F          4hP    ,4hP   ,4HP    ,4HP   ,4HP   ,AHP    ,4HB    ,4
                                                           H     ,
   G          4h    .,4h    ,4H     ,4H     ,4H    ,AH     ,4H     ,4
                                                           H     ,
   H          AH     ,Ah    ,AH     ,4H     ,   -1.0,  -1.0,  -1.0,
                                                           -1.0,
   I           -1.0,   -1.0,  -l.C,4H     ,4H    ,4H     ,4H     ,4
                                                           H     ,
   J          4h     ,4h    ,4H     ,4H     ,4H    ,4h     ,AH     ,4
                                                           H     /
    CATA X62/20«4h    /
    CATA X63/lC«4h    /
    DC 30C  INCEX=1,20
    INCEX2=I\I:EX + 2C
    INCE.<3= IM:i
    INCEXA= INCi
    IMDEX6=I\i;EXHCO
    INCEX7-- INCEXf 120
    INCEX8= INCEX+ 1AO
    CC 301  NCEX=1,8
    XI { I \iCEXt.\CEX )=X1 L( INCEXiNDEX)
    XI ( INC 6X 2 ,\CFX ) = X12( INDEX, NDEX)
    X1(INCEX3,NCI=X) = X13(INDEXINCEX)
    Xl{INnEXA,NCEX)=XLA(INDEX,NOEX)
    Xl(Ii\CEX5fNCEX) = Xl5(INDEX,NDEX)
                   ) = X17(Ii\DEX,NDEX)
    IF( INCEX8 ,GT. 150JGC TC  3C3
    XI ( Ii\CEXa,NC£X) = X18( I NDEX, NDEX)
303 X2(INCEX,NCEX)=X2l(I\CEX,NDEX)
    X2(li\CEX2,NCEX)=X22(INCEX,NCEX)
    XA(Il\CEX,NCEX)=XAl(INCEX,iNDEX)
    XA( I:\CEX2.NCEX ) = XA2( INDEX ,NOEX)
    X6(I\[.EX,NCEX)=X61(I\CEX,NCEX)
    X6(I\CEX2,NCEX)=X62(INnEX,NCEX)
    IF( lNf;EX3.GT.50JGC TC 30A
                             ' A4-225

-------
    X 2 ( I IS C E X 3 , N C E X ) = X 2 J (  I N D E X , i\D E X )
304 CONTINUE
3C2 X3(INCEX,i\CEX)=X31(I'\CEX, INDEX)
    X3(I[\CEX2,N.CEX)=X32(INCEX,NiOEX)
    X3(I\CEX3,NDEX)=X33(INOEX,\CEX)
    X3(IiNCF.X4,NCEX)=X3MlNCEX,NCEX)
    X3(Ii\CEX5,i\CEX) = X35(INGEX,i\DEX)
  •  X5(If\CEX,NCEX)=X 51(1 \CEXiNC EX)
    X5(INCEX3,NCEX)=X53(IND£X,NCEX)
    X5(INCCX4,NCEX)=X54( INDEX, KDEX)
    X5( IMEX5 ,,\CEX } = X55( INCEX.NCEX)
3C1 CCKTINUt
3CO CONTINUE
  * NDAYS              NUMBER GF  CAYS  IM A CRI FICAL PERICO
                                                                 *
    REAC(5,5CC)N'R, NDAYS
SCO FCRMAK2I5)
    CG  5  1=1, NR
  5 REACt 5, 50 2) MIR ( I ) , JR( I ) , (NUR( I, J) , J = l, 3)
5C2 FCR^ATISIS)
    CC  101  K=l, NDAYS
    READ(5,5C 1) (TIKEt I ) ,C'*ASTE( I ) ,QSLiv(I ) ,XMNCO(I ) , Xr'XDEF ( I ) ,
   1      CG'wST(I),CEFSljM(I),?,OUWST(I),BODSUM(I)fXKl(I),XK2(I),
   2      XK3(I)fA(I),R(I),COS(I)iI=l,NR)
5C1 FCRf'ATI 5F 11 .4 )
  * CALCULATIC.N  GF AMPLIFICATION  AND  ATTENUATION  FACTORS *
    CC  ICC  KK = l,i>jR
    ARGl=-XK2(KK)*TIiviE(KK)
    ARG2=-(XK1(KK)+XK3(KK))*TINE(KK)
    ALPt-A (KK )=EXP( ARG1 )
    XLAKCA (KK ) = EXP( ARG2 )
    XMU[KK)=(l.-XLAMCA(KK))*(R(KK)/(XKl(KK)+XK3(KK)))*
   1         e.3A
    GANK'A(KK)=(XK1(KKJ«(XLAMCA(KK)-ALPHA(KK)))/(XK2(KKJ-(XK1(KK
                                                           )
   1           +XK3UK ) ) )
    RhO(KK)=-GAM^A(KK)*{R(KK)/lXKKKKH-XK3(KK)))t
   1         XKKKK)/XK2(KK)«(tUKK)/(XKl(KK)+XK3(KK))-
   2          A(KK)/XK1(KK) )>( l.-ALPHA(KK) )
    PSI(KK) = (DCS(KK)«(1.-ALPHA(KK))-RHO(KK))*>3.3^
    WRIT £(6f6CO)i
-------
  SCO
  100
  103
  801
  1C5

  803
  106

  1C4
C   *
WATIP(KK)=(
eCOIB(KK)=QVHASTE{KK)*a.34»EGCUST(KK)
BGCIP(KK)=CSUM(KK)*8.34»BCDSLN(KK)
Ciaie(KK)=CViASTE(KK)«8.34*CGftST(KK)
CALCULATICN OF  FLCW  IN EACH HEAOwATER

WRITE(6,eCC)KK,GREG(KK)
FCRVAT11H  ,'QREG' , 14, ' = • ,F10.4)
CICIP(KK)=Q.SUM(KK)*3.34*DEFSIP(KK)
    ATICN  CF  FLOWS  AND CALCULATICN OF
             KK=1,MR
                                             AND INTERIOR  REACH  »
                                           ViATER QUALITY
                                                            STANCAR
                                                            OS  *
                        6C.OGO TC 1C6
                        106
CO 104
J=l
SUM=CREG(JR(KK))
EF(NUR(JK(KK),J)
CC 105 J= 1,3
NC=NUR
-------
                                                            'CUAL
605
I1tlit *P' ,T5C,F12.A)
 FORMATC ',T5,  'SFP
 CCLUPN ANC
 MUN! = 3«NR-1
                    FORMAT  FOR LP
  J =
  CC
  Xl
  Xl
  Xl
1 J =
  J =
  CO
  X3
  X3
  X3
2 J =
       1  1=2, NUN, 3
      ( I , 5)=-XNL'( J)
      f I,8)=-PSI ( J)
      ( I+1,5)=PSI ( J)
      J+1
      l
       2  I = 2,i\UK2,2
      ( 1-1,8 }s-XLAMDA
      ( I ,5)=G/5PI*A( J)
      ( I,8)=-GANMA.( J)
      J+1
                    J)
                                  'QUA!.' ,I1,'P« ,T25,F12.4)
                                MODEL - PRINT CUT -  *
    CC 3  I=2,NUf2,2
    X5( 1-1,8 )=-ALPHA( J)
    X5(I,5)=ALPHA(J)
  3 J =
WRITE
WRITE
URITE
WRITE
WRITE
WRITE
PUNCH
PUNCH
PUNCH
PUNCH
PUNCH
PUNCH
7CO FCRKA
101 CONTI
(6,7
(6,7
(6,7
(6,7
(6,7
(6,7
7CC
7CG
7CC
7CC
7CC
70 C
T( 1H
NUE
C
C)( (
COM
C
0)( (
OCX (
r
r
^,
,
,
t
,
t
,


C)( (
C)( (
( (
I
(
(
(
(
,T5,

XI
X2
X3
XA
X5
X6
XI
X2
X3
XA
X5
It J) ,
I, J ),
,J ) ,
,J) ,
»J) ,
fJ),
>J ) ,
,-J) ,
, J ) ,
rJ ) r
»J ) ,
X6( UJ) ,
2AA,T15,

J=l,
J=l,
J = l ,
J = l ,
J = l,
J = l,
J = l ,
J=lf
J=L,
J = l,
J = l »
J=l»
2AA,

8)
8)
8)
8)
6)
8)
8)
8)
8)
8)
8)
£)
T2

, I
, I
, I
, I
, I
, I
,1
, I
,1
, I
, I
, I
5 ,

= 1
= 1
= 1
= 1
= 1
= 1
= 1
= 1
= 1
= 1
= 1
= 1
Fl

,
»
,
,
,
,
,
,
,
,
,
,
2

NUM3)
NR)
NUM2)
NR)
I\UM2)
NR)
NUM3)
NR)
NUM2)
NR)
NUM2)
NR)
.A,TAC,2AA,T50,F12.A)

RETURN
ENC
FUNCT
CO^NO
1

ION
N/FL
TCA

I
C
(

REAC
M/N
50) ,

H ( ,\ L )
R , N C- , N C R
NGAGEl 1C


(50)
) ,NG
CCN'MCN/FLCW2/FL(5C),RCUGH(
CCNNC
II =
N/FL
1
3 IF (NCRII
1 II =
IF ( I
CC TC
II +
I. EC
3
C

I

•

h3/J

) -
1
NR)

R(5C),kT

NU ) 1,2,

GO TO 2

(50,

1







,NLR
R (
50
1C





1C




(5C
) ,
C


,3) ,CAU(50,3) ,
AG( 10) , I OR (50)
) ,SLCPE(50)
)























  2 IREACH =  II
                               A4-231

-------
      RETLRN
      END

//GC.SYSIN CD *
OOCC70CG01
10 1
20 2
30 3 1C 2C
40 4
50 5 30 40
60 6 50
70 7 6C
.235
1.
1.02
1.330
1.
.60
1.087
1.
.63
2.067
1.
.C9
.306
0.
.72
1.05C
1.
.14
6.130
1.
.02
5.
9.50
.02
37.
8.
.03
8.
C.
.04
14.
9.70
.04
C.
0.
.05
26.
C.
.06
41.
0.
.CO
1355.
248.
.85
1290.
403.
.14
0.
240.
.18
296.
I44C.
.05
C.
0.
.39
C.
2180.
.07
0.
279.
.00
7.
1.66
.15
7.5
.68
. 14
7.
0.
.14
6.
1.
.11
6.5
0.
.11
6.
0.
.13
4.
C.
.00
3.20
.31
10.20
2.45
.41
9.95
2.00
.36
9.00
3.54
.35
9.54
2.50
.34
9.00
2.35
.35
8.35
4.17
.30
8.17
/«ECF
                               A4-233

-------
A4.8 MPS Control Program

A4 .8.1 Purpose
The control program used for the optimization model is the MPS
Control Program.  This auxiliary program has the flexibility
to specify the necessary outputs needed in analysis of an
optimal solution, depending only on'the statements used in the
program and minor changes in the LP-matrix.  After INTERF
(Refer to A4.7)  generates the linear programming tableau
structured in the MPS format, the user conveys the proposed
strategy  via the MPS control language.  Figure A4-13 shows how
the problem data and the specified procedures in the control
program simultaneously feed into the MPS/360 Processor.  The
control language statements call the' linear programming
procedures and transfers arguments to them.  The resulting out-
put of the linear programming model is then generated for analysis,

A4 .8.2 Program Components
There are various MPS/360 LP procedures which may be specified
in the control program, depending on the analysis needed.
Included in these are the different optimization, post-optimal,
and output schemes.  The user of the MPS Control Program should
first set up a basic control program.  After obtaining an
optimal solution to the model, then sophistication may be added
in the control program for further analysis.  The following is
an example of a basic MPS Control Program.

PROGRAM
INIT1ALZ
MOVE(XDATA,'DATA NAME')
MOVE(XPBNAME, 'PBFILE')
CONVERT('SUMMARY')
BCDOUT
SETUP
MOVE(XOBJ,'OBJECTIVE NAME1)
MOVE(XRHS,'CONSTRAINT NAME')
PRIMAL
SOLUTION
EXIT
PEND
                                   A4-235

-------
                    FIGURE  A4-I3
           OVERVIEW  OF  MRS  PROCEDURE
PROBLEM
 DATA  IN
  MRS
 FORMAT
 M PS

CONTROL
PROGRAM
                     M PS / 360
                 PROCESSOR
                  RESULTING  OUTPUT
                        OF
               LINEAR  PROGRAMMING
                       MODEL
                       A4-237

-------
It is important that the first alphabetic character in each
statement of the control program be in column 10 of a standard
IBM punched card.  Also of importance is to notice that when
maximum (MAX) or minimum (MIN) is not specified in the MPS
Control Program, the system assumes minimization.

A4.8.3 Remarks
To set up an MPS Control Program, the following three steps should
be considered.

1.  Obtain an IBM Mathematical Programming Input Form as a
guide to the correct column and field format for the MPS/360.

2.  Use a basic control program to correct the model and obtain
the initial optimal solution.

3.  Apply the various MPS Control Program procedures needed for
analysis and sophistication of the model.

A4.9 LPLF - Linear Programming Model

A4.9.1 Purpose
LPLF  is the mathematical programming model developed for allocating
waste treatment requirements and/or low flow augmentation to meet
preset water quality standards, and determine the optimal solution
for a general region.  The model was developed in a multi-commodity
network format to provide a clearer technique needed for tracking
commodities.  With this format, each variable in the model may be
traced through the network representation of the river basin.  This
provides the information needed for analysis in each reach or
analysis of the entire region.  The network is viewed as a
unidirectional transportation network conveying water, the carrier
commodity,  and two water quality constituents, viz, dissolved
oxygen (DO)  and biochemical oxygen demand (BOD).

The model may be applied to any region in the watershed.  A region
is defined as a subset of the watershed, consisting of an area
encompassing multiple reaches. Hence, the region may be investigated
independently of the watershed.   The region is then further
divided into headwater and interior reaches.  The flow, BOD, and
DO in each reach are determined from the flow and concentration
of the wastewater and tributary into the reach.   From the continuity
equations written around each node, representing the beginning
                               A4-239

-------
or end of each reach, the model keeps track of the total flow,
DO, and BOD in the region.  Any potential sources of flow
augmentation will be located at the beginning of the head-
water reaches.  Figure A4-14 shows six wastewater treatment
facilities in a seven reach region problem for a hypothetical
watershed;with potential reservoir locations at either of
the three headwater reaches.

LPLF was first tested on a hypothetical river basin, a region
similar to the one shown in Figure A4-14.  The data obtained
for this test was contained in the 1967 article of Loucks,
Revelle, and Lynn (12).  The BOD and DO concentrations are
computed using' the equations developed by Camp (10) and by
Dobbins (11).  These concentrations are' converted to mass
units for the purpose of maintaining a mass balance in the
model.  Natural flow conditions were analyzed first with a
zero level of flow augmentation.  After satisfactory results
were obtained, changes made in the model included the
capability of handling flow augmentation or handling the zero
level DO case previously mentioned.

A4.9.2 Program Components
LPLF is made up mainly of INTERF (refer to A4.7), MPS Control
Program (refer to A4.8), cost data,  and L.P.  bounds.  The output
from the interface program is the linear programming tableau
structured in the MPS/360 format.  With the MPS Control Program,
the user specifies the procedure in which the problem data will
be handled.  Finally,the LPLF package includes the cost data
and linear programming bounds for the objective function.
Unit cost data were determined from predicted annual cost of
BOD removal (in dollars).  Considering that treatment plant
costs are usually convex within a specified range, the cost
function for each treatment facility was divided into segments
representing percentage of BOD removal.  Costs were assumed to
be linear within each segment and the L.P. bounds were determined
as the pounds of BOD removed within each segment.

The data set organization for the LPLF program consist of the
Computing Center Job Stream, MPS Control Program, Rows Section,
Columns Section, RHS Section, Bounds Section, and End Data.
                             A4-240

-------
                          FIGURE   A4-I4
                  OPTIMIZATION  PROBLEM  FOR
                      HYPOTHETICAL  REGION
• — R EACH  NODE
R — REACH  NUMBER
^—POTENTIAL RESERVOIR
O — WASTEWATER TREATMENT FACILITY
                              A4-241

-------
In the Mathematical Programming System/360 the optional Bounds
section specifies either upper or lower bounds, or both.   With-
out this feature the representation of the bounds would be by
explicit constraints.  Therefore, its use leads to a reduction
in the number of constraints and in the computing time.
Another optional section for the MPS/360 is the Ranges section
which specifies ranges on the values of the right-hand side.
This section was not used in LPLF.  Figure A4-15 is an over-
view of the data set organization for LPLF.

A4.9.3 Program Input
The input data for LPLF are the Rows, Columns, RHS, and Bounds.
To introduce this input data into the system a data set name,
e.g.,  DAT1980 was used.  Following the DAT1980 card are the
Rows.

Rows is the first required section in the input data.  This
section distinguishes the row types for each row used in the
model.  Four different row types may be specified.

N   Represents nbnconstrained type, e.g., objective function
                     Z = ECj Xj    ........ [Eq. A4.106]

E   Represents equality constraints,  e.g.,


                     la   x. » bt  .  ....... [Eq. A4.107]


L   Represents less-than-or-equal-to  constraints, e.g.,


                     Ea1:j Xj < b±   .......  [Eq. A4.108]

G   Represents greater- than-or-equal-to constraints, e.g.,
                                                   [Eq. A4.109]
                           A4-243

-------
   FIGURE A4-I5
OVERVIEW OF DATA SET
  ORGANIZATION—LPLF
                            OPTIONAL
                         INTERF
                INTERF
  MRS COMTROLlT~:
    PROGRAM  >  /


 CC. JOB
  STREAM
                                                      LPLF

-------
Columns is the next required section.  The columns, corresponding
row names and parameter values are specified in this section.
Only the nonzero matrix elements are needed by the MPS/360.  All
the elements for each column should appear together, but it is
not mandatory that the same order be used as in the Rows section.

The RHS section is the third required section.  All nonzero RHS
values must be specified for as many RHS vectors as needed,
differentiating each RHS vector by a name.  STP 1980 was the
RHS vector name used in LPLF.  Each card should have the RHS
name, corresponding row name, and RHS value.

The Bounds section as previously mentioned,is optional, but
conveniently used when limits on the values of the LP variables
are needed.  Similar to the RHS section, the Bounds section is
defined by a Bound row name.

Letting Ri, i=l,2,... ,m>represent E, L, or G, for the row types,
the general data format for the input data is as follows:
NAME
ROWS
 N
 R
  Data Name

Objective Name
Row Namei
Row Name2
COLUMNS
            Row Namem
            Column
            Column Name.
Row Name^
   •
   •
Row Name
                                                Row Name
                                                             a2
                             *m,l   Objective Name
RHS
            Column Namen    Row Namem    a,,,     Objective Narae'c
            RHS Name
            RHS Name
                Row
                Row Name2
                                                               -n
            RHS  Name
Row
                             V
                                         m
                          A4-247

-------
BOUNDS
UP or LO    Bound Row Name  Column NamCj   L.
ENDATA

Where:
a. . - Value of LP parameter,
       i = l,...,m; j = l,...,n
c.   - Unit cost data for objective
       function, j = l,...,n
V.   - Value of RHS, i = l,...,m
L]   - Limiting value of variable, j is a subset of l,...,n
 J

Using the correct column and field format is of prime importance
in this section.  The user should become acquainted with the
IBM Mathematical Programming Input Form before attempting to set
up an MPS/360 program.

A4.9.4 Program Output
The output for LPLF consists of eight parts, each part containing
different information according to the characteristics of the
Mathematical Programming System/360.  The following is a brief
summary of the contents in the order listed.

1.  The OS/360 Job Control Language  (JCL) statements and their
associated resource allocation.

2.  The MPS/360 Control Program listing.

3.  A summary of the minor and major errors for the input sections.

4.  A summary of the number of elements by column order and the
number of elements by row order.  The row element summary excludes
the RHS's but includes one slack element per row.  Each row has
associated with it the row type.  Included here is a summary of
the problem statistics, viz, the number of rows, variables,
elements, and the model's density.

5.  A complete listing of the LP model, including the Rows,
Columns, RHS, and Bounds sections.
                              A4-248

-------
6.  This part is produced by the Setup and Primal procedures
called in the MPS Control Program.   Of interest here is a
summary of the statistics for the model and an iteration
log relative to the stages in the problem from infeasibility
to feasibility.

7.  The Solution procedure called for in the MPS Control Program
produces this output.  It consists of three sections, the
first being the heading, which states the procedure name,
problem status time, and iteration number.  The first section
also contains the functional value and name, the restraints name
(RHS), and the bounds name.  The second section is the Rows
section.  This section contains the internal slack variable
number, row name, row status, row activity, slack activity, value of
lower and upper limits, and the dual activity.  The third section
is the  Columns  section. In this section is found the internal
vector number, column name, column status, column activity,
original input cost, lower and upper limits, and the reduced cost
of the associated variable.  If any A appears in the far left-
hand column, this specifies an alternate optima.

8.  The last of the output consist of the EXIT procedure called
for in the MPS Control Program.  This procedure returns control
to the OS/360 and simply outputs the procedure name and total
elapsed time for the run.

A4.9.5 Definition of Program Variables
The rows and columns in the LP model are representative of the
three commodities being transported down the river system,  viz,
water, BOD and DO.  In the node-branch concept of the network,
the rows are the node names and the columns (variables) are
the branches connecting the nodes.   The rows and columns are
defined as 'follows:

ROWS

WAT(I)B
WAT(I)P
B0D(I)B
B0D(I)P
DI0(I)B
DI0(I)P
QUAL(I)P
                           A4-249

-------
          reach number
          Represents wastewater
          Represents tributary
          Wastewater node
          Tributary node for water
          BOD node for wastewater
          BOD node for tributary
          DO node for wastewater
          DO node for tributary
          Water quality node
where
(I) = The
B
P
WAT (I )B
WAT (I )P
B0D' I )B
B0D(i )P
DI0(I )B
DI0(I )P
QUAL(l)P

Columns

QIBIPK
QIPJPK
QI-%K
where
B      Represents wastewater
P      Represents tributary
K=l    Water
K=2    BOD
K=3    DO
QIBIP  Branch from wastewater node to tributary node in reach I
QIPJP  Branch from beginning of upstream reach I to beginning
       of next downstream reach J
QI-%K  Percent of BOD removal in reach I (K=2)

A4.9.6 Program Coding
                             A4-250

-------
//LPLF1    JOC (1142,47,C03,20,1CCG) ..'CARTER        .       '.CLASS
                                                           = N
//JOBLI2 CC CSNAME=GATOR.MPS»DISP=(SHR)
// EXEC MPS
//CCNTRGL.SYSIN CC »
         PRCGRAK
         I.NITIALZ
         MOVE(XCATA,«DAT19eOf)
         MCVEtXPBNAKE, 'PEFILE' )
         CCNVERTI 'SINMARY' )
         BCCOIT
         SETUPt•ECUNC't'TRTSO't'MIN'J
         MCVE(XCBJ, 'COST' )
         MCVEtXRHS, 'STP198C' )
         CRASH
         PRIMAL
         SCLUTICN
         EXIT
         PENC
/*
//PROBLEM.SYSIN CC *
NAKE          CAT1980
ROhS
 N  COST
 E  WAT1B
 E  WAT1P
 E-  WAT2B
 E  WAT2P
 E  WAT3B
 E  WAT3P
 E  WAT4B
 E  WAT4P
 E  WAT5P
 E  WAT6B
 E  WAT6P
 E  WAT7B
 E  WAT7P
 E  WAT8P
 E  BOD1B
 E  BCC1P
 E  BOC2B
 E  BGC2P
 E  DOD3B
 E  BCC3P
 E  BOC4B
 E  BOD4P
 E  BOC5P
 E  BCC6B
 E  BCC6P
 E  BOC7B
 E  BOC7P
                                AA-251

-------
E
E
E
E
E
E
E
E
E
E
E
E
E
E
E
G
G
G
G
G
G
G
CC




























BQC8P
DIC1B
DIC1P
DIC2B
OIC2P
DIC3B
DIC3P
DIC4B
DIC4P
DIC5P
DIC6B
DIC6P
OI07B
DIC7P
DIC8P
GUAL1P
GUAL2P
QUAL3P
CUAL4P
GUAL5P
QUAL6P
QUAL7P
LUMNS
Q1P3P1
G1P3P1
Q1P3P1
C2P3P1
Q2P3P1
Q2P3P1
Q3P5P1
Q3P5P1
Q3P5P1
CJ4P5P1
Q4P5P1
Q4P5P1
Q5P6P1
Q5P6P1
Q5P6P1
Q6P7P1
Q6P7P1
Q6P7P1
Q7P8P1
Q7P8P1
Q7P8P1
Q1BIP1
Q2B2P1
G3B3P1
Q4B4P1
Q6E6P1
Q7B7P1
C8P9B1























kATIP
BCC3P
CUAL1P
hAT2P
BCC3P
CIAL2P
KAT3P
BCC5P
CIJAL3P
WAT4P
OCD5P
CIAL4P
V,AT5P
BCD6P
QUAL5P
VsAT6P
BCD7P
CIAL6P
WAT7P
ECC8P
GUAL7P
WAT1B
WAT2B
V^AT3B
VyATAB
WAT6B
1\AT7B
V*AT8P
l.CGCO
-0.2829
19.6027
l.CCCO
-1.1756
46.42C6
l.COCO
-1.0293
38.2245
l.COCC
-1.3018
13.7926
l.OOCO
-0.2646
15.7224
l.OOCO
-0.9250
9.9169
l.COCO
-0.0
7.8619
l.CCCO
l.CCCO
i.OOCO
l.OOCO
l.CCCO
l.COCO
l.COOO
V*AT3P
DI03P

hAT3P
CI03P

WAT5P
DI05P

kAT5P
CI05P

kAT6P
DI06P

KAT7P
DI07P

WAT8P
DI08P

VvATIP
WAT2P
kAT3P
V»AT4P
W-AT6P
WAT7P
V.AT9B
                        -l.OCCO
                      -19.6027
                         0.0
                        -l.CCCO
                      -46.4206
                         0.0
                        -1 .OCCO
                      -38,2245
                         0.0
                        -l.OCCO
                      -13.7926
                         C.O
                        -l.OOCO
                      -15.7224
                         0.0
                        -l.OOCO
                        -9.9169
                         0.0
                        -l.OOCO
                        -7.8619
                         0.0
                        -l.OOCO
                        -l.OOCO
                        -l.OOCO
                        -l.OOCO
                        -1.0000
                        -l.OOCO
                        -l.OOCO
A4-253

-------
Q1P3P2
Q1P3P2
Q2P3P2
Q2P3P2
Q3P5P2
Q3P5P2
Q4P5P2
Q4P5P2
Q5P6P2
Q5P6P2
Q6P7P2
Q6P7P2
G7P8P2
Q7P8P2
Q1E1P2
Q2B2P2
Q3B3P2
Q4E4P2
Q6E6P2
Q7B7P2
Q8P9P2
G1P3P3
Q1P3P3
Q2P3P3
Q2P3P3
Q3P5P3
Q3P5P3
Q4P5P3
Q4P5P3
G5P6P3
Q5P6P3
Q6P7P3
Q6P7P3
Q7P8P3
Q7P8P3
Q1B1P3
Q2B2P3
Q3B3P3
Q4B4P3
Q6B6P3
Q7B7P3
Q8P9B3
Ql-672
Ql-752
Ql-852
.01-902
Q2-102
Q2-352
Q2-502
Q2-6C2
G2-752
BCC1P
CIC3P
3CD2P
DI03P
GCC3P
CIC5P
BCC4P
DI05P
ECC5P
CIC6P
CCC6P
CI07P
BCC7P
CIC8P
DCDIS
BLD2B
3CC3B
BCD4B
ECD6B
6CD7B
BCC8P
CIC1P
CIAL1P
CIC2P
CUAL2P
C IC3P
GIAL3P
C I04P
CUAL4P
CI05P
GLAL5P
D I06P
CLAL6P
C I07P
GLAL7P
CIG1B
CIC2B
CIC3B
CI04B
DI06B
CIC7B
CI08P
BCD1B
BCD1B
GCC1B
BC01B
3CD2B
ECD2B
BCC2B
2CD2B
BCD2B
1.0000
0.0622
l.CCCO
0.2736
l.OCCO
0.2242
l.OCCC
0.4476
l.COCQ
G.0878
l.OOCC
0.2763
1.0000
0.7775
I. COCO
l.COCO
uccco
l.COCO
l.COCO
l.COCO
l.CCCO
l.COCO
0.7869
i.COCO
0.4502
i.COCC
0.5C42
l.OCCO
0.8302
l.OCCC
0.8023
l.COCO
0.8633
l.OOCC
0.8846
l.OCCO
l.CCCO
l.OOCC
l.CCCC
l.CCCO
l.OOCO
l.OOCO
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
B003P
GUAL1P
BQD3P
QUAL2P
BOD5P
GUAL3P
BOD5P
GUAL4P
BOD6P
GUAL5P
BOD7P
GUAL6P
BOD8P
GUAL7P
CODIP
B002P
BOD3P
EOD4P
EOD6P
BOD7P
B009B
CIQ3P

DI03P

DI05P

C.I05P

DI06P

DI07P

DI08P

CI01P
DI02P
DI03P
CI04P
DI06P
DI07P
DI09B
COST
COST
COST
COST
COST
COST
COST
COST
COST
-0.9254
-0.0622
-0.5570
-0.2736
-0.6474
-0.2242
-0.4466
-0.4476
-0.8875
-C.0878
-0.6502
-0.2763
-0.1590
-0.7775
-1.0000
-1.0000
-l.OOCO
-l.OOCO
-1.0000
-1.0000
-l.CCCO
-0.7869
0.0
-0.4502
C.O
-0.5042
0.0
-0.8302
C.O
-0.8023
0.0
-0.8633
0.0
-0.8846
C.O
-1.0000
-l.CCCO
-1.0000
-1.0000
-1.0000
-l.CCCO
-1.0000
o.co
26.70
53.60
83.40
0.00
17.40
0.30
6.20
7.90
A4-255

-------
RHS
Q2-852
Q2-902
03-262
G3-352
Q3-502
Q3-602
Q3-752
G3-852
Q3-902
Q4-242
Q4-352
G4-502
Q4-602
Q4-752
Q4-852
Q4-902
Q6-122
Q6-352
Q6-502
Q6-602
Q6-752
Q6-852
Q6-902
Q7-262
07-352
Q7-502
Q7-602
Q7-752
Q7-852
Q7-902
STP198C
STP198C
STP1980
STP198C
STP198C
STP198C
STPL90C
STP198C
STP198C
STP198C
STP198C
STP198C
STP198C
STP198C
. STP19SG
STP19GO
STP198C
STP198C
STP1980
STP1980
DCD2D
•8CD2B
ECC3B
ECC3B
BLD38
BCD3B
ECC3B
BCC3B
BCD3B
BCD4B
GCC4B
BCCAD
BCD4B
8C04B
ECC4B
2CC4B
BCD6B -
BD06B
BCC6B
BCC6B
BCD6D
BGD6B
GCC6B
BCC7B
BCD7B
BCD7B
ECC7B
CTC7B
BCD73
BOD7B
hATIB
WAT2B
WAT3B
V*AT4B
UAT5B
UAT6B
WAT7B
VsATBP
ECC13
BUD2B
BCD3B
BCCA3
BCC5B
BCC6B
BCD7B
CIC1B
CIC2B
CIG3B
DI04B
LIC5B
1.0
1 .0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
,1.0
l.C
1.0
1.0
1.0
l.C
1.0
1.0
5. COCO
37.0CCC
8. COCO
14.0000
C.O
26.0CCC
41. COCO
0.
1C341.5937
125900.5625
16012.7930
168134.3125
C.O
472711.1250
95401.1875
41.7000
308.5798
66.72CC
116.7600
0.0
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
COST
VsATIP
WAT2P
WAT3P
kAT4P
VsAT5P
WAT6P
WAT7P

E001P
BOD2P
BOD3P
BOD4P
BC05P
B006P
BOD7P
CI01P
DI02P
CI03P
DJ04P
DI05P
16.40
29.10
0.00
111.00
4.20
25.00
28.10
28.40
68.70
0.00
17.50
0.60
4.40
4.40
6.10
8.60
O.CO
3.50
0.30
2. CO
2.00
3.20
4.60
O.CO
78.00
1.40
15.70
16.20
16.80
24.60
1355. COCO
1290.0000
0.0
296.0CCO
0.0
0.0
0.0

18759.1523
7315.8437
0.0
2468.6396
0.0
0.0
0.0
107356.5625
86068. 75CO
0.0
23945.8008
0.0
                                     AA-257

-------
STP1980
STP198C
STP198C
STP1980
STP1980
STP193C
BCUKDS
FX TRT80
UP TRT80
UP TRT80
UP TRT80
FX TRT80
FX TRTCO
UP TRT80
UP TRT80
UP TRT8C
UP TRT80
UP TRT80
FX TRT80
FX TRT80
UP TRT80
UP TRT80
UP TRT80
UP TRT80
UP TRT80
FX TRT80
FX TRT80
UP TRT80
UP TRT80
UP TRT80
UP TRT30
UP TRT80
FX TRT80
FX TRT80
UP TRT80
UP TRT80
UP TRT80
UP TRT80
UP TRT80
FX TRT80
FX TRT80
UP TRT80
UP TRT80
UP TRT&O
UP TRT80
UP TRT80
ENDATA
/*EGF
CIC6B
CIC7B
CLAL1P
GLAL3P
QUAL5P
GUAL7P

Gl-672
Cl-752
Gl-852
Cl-902
G2-102
G2-352
C2-502
G2-602
G2-752
G2-852 .
C2-902
C3-262
Q3-352
G3-502
C3-602
C3-752
C3-852
G3-902
C4-242
C4-352
G4-502
G4-602
G4-752
C4-852
G4-902
G6-122
C6-352
G6-502
C6-602
Q6-752
C6-852
G6-902
G7-262
G7-352
C7-502
G7-602
07-752
Q7-852
G7-902


216.84CO CI06P 0.0
341.9399 DI07P C.O
79396. 75CC GUAL2P 83003.8125
157334. C625 Q'JAL4P 15512.3984
162901, COCO QUAL6P 151671.1875
1C2481.8750

6SCC.
830.
1C30.
52C.
126CO.
315CC.
189CC.
126CO.
18900.
126CO.
63CO.
42CO.
1400.
24CO.
16CC.
24CO.
1600.
8CC.
4C4CC.
185CO.
252CO.
16SCO.
252CC.
168CO.
8400.
567CO.
1067CO.
7C9CC.
47300.
7CSCC.
473CC.
236CO.
24800.
86CO.
143CO.
95CO.
14300.
<35CO.
4800.


A4-259

-------
                  REFERENCES - APPENDIX A4

 1.   Steel,  R.  G.  D.  and Torrie,  J.  H., Principles and Procedures in
 Statistics, McGraw-Hill Book Co., New York,  1960, p. 183.

 2.   Issacson,  E.  and Keller, H.  B., Analysis of Numerical  Methods,
 John Wiley and Sons, New York, 1966, p. 51.

 3.   Wilkinson, J. H., The Algebraic Eigenvalue Problem, Clarendon
 Press, Oxford, 1965, p. 282.

 4.   Ibid.,  p.  300.

 5.   Moreau, D. H., and Pyatt, E. E., Uncertainty and Data Requirements
 in Water Quality Forecasting;  A Simulation Study, Report to U. S.
 Geological Survey, November, 1968.

 6.   Langbein,  W.  B.  and Durum, W. H., The Aeration Capacity of Streams,
 Geological Survey Circular 542,  Washington,  D.C., 1967.

 7.   Leopold, L. B. and Maddock,  T., Jr., The Hydraulic Geometry of
 Stream Channels and Some Physiographic Implications. Geological
 Survey Professional Paper 252, Washington, D. C., 1953.

 8.   Committee Report, "Solubility of Atmospheric Oxygen in Water,"
 Journal, Sanitary Engineering Division, Vol. 86, SA4, July 1960,
 p.  41.

 9.   Massey, F. J. Jr., "The Kolmogorov-Smirnov Test for Goodness of
 Fit", American Statistical Association Journal, March, 1951.

10.   Camp, T. R.,  Water and Its Impurities. Reinhold Publishing Co.,
New York, 1963.

11.   Dobbins, W. E.,  "BOD and Oxygen Relationships in Streams,"
journal of the Sanitary Engineering Division, ASCE. Vol. 90, No. 3,
June, 1964.

12.   Loucks, D. P., Revelle, C. S.,  and Lynn, W. R., "Linear
Programming Models for Water Pollution Control," Management Science.
Vol. 14, No. 4, December, 1967.
                               A4-261

-------
                       APPENDIX A5
 SAMPLE INTERFACING OF SIMULATION AND OPTIMIZATION MODELS

A5.1 Introduction
The purpose of this analysis is to demonstrate the interfacing of the
simulation and optimization components presented in the body of this
report.  The selected test area was the Farmington River Basin in west
central Massachusetts and Connecticut (see Section 8).   Results from
the simulation model were used to select the region and critical period,
and to provide the requisite data input to the optimization model.
Illustrative output from the optimization program is presented.  This
sample analysis should not be construed to represent an evaluation of
the actual or projected conditions in the Farmington.

A5.2 Selection of Test Conditions
The simulation model permits rapid sampling of the system's response
to a wide variety of assumed conditions.  The initial analyses sought
to examine the system response to "worst case" conditions.  Conse-
quently, a 20 year simulation was made with regulated flows, BOD load-
ings for the year 2000 and 35% removal required.  The test condition
was selected from analysis of periods in which the DO fell below 4.0
mg/1 at any of the reaches.  This analysis showed that the worst
condition occurred during week 33 of year 15 when the DO fell to
2.1 mg.l in the Pequabuck River reach and 3.3 mg/1 in the Salmon Brook
reach.  The DO in all other reaches exceeded 8.0 mg/1.   The water
quality conditions in the reaches with unacceptable DO levels can be
classed as independent cases of local competition (see Section 7) so
that it was unnecessary to utilize the optimization model for more
refined analysis of this case.

From these results, it appeared that regional competition would probably
be restricted to the lower reaches.  Consequently, a different set
of assumed conditions was used in a subsequent simulation run of the
following subset of reaches [1,2,3,4,5,6,7,8,9,19,20,21,22].  In this
revised case, all reservoirs were removed from the watershed.  BOD
loadings for the year 2000 and 35% required BOD removal were retained.
The results indicated a DO less than 4.0 mg/1 during week 28 of the
second year of the simulation.  This period was selected for further
analysis.

A5.3 Input Data for Optimization Model
For this sample interfacing, the input for the optimization model
consist of the following:
1. the output data, shown in Table A5-1, from the simulation model; and
2. the annual wastewater treatment cost data, shown in Table A5-2,  for
the indicated reaches.

In the simulated output data, the original reaches 5,6, and 7 were
aggregated into a single reach to simplify the analysis.  The annual
wastewater treatment costs are based on the results from Section 5.
                               A5-1

-------
                                                  TABLE A5-1
                                 OUTPUT FROM SIMULATION MODEL FOR SELECTED PERIOD
Ul
Reach
1
2
3
4
5
6
7
8
9
19
20
21
22
River
Flow
cf s
315.
311.
310.
308.
251.
241.
230.
182.
182.
18.
0
36.
0.
Waste
Flow
cf s
7.1
0.
0.1
2.3
3.9
2.4
6.1
0.
.8
25.6
0.
5.1
0.
Reach
Actual
days
.13
.07
.03
.05
.13
.12
.18
.12
.09
.33
.45
.30
.51
Travel Time
Critical
days
.34
.24
.27
.32
.37
.39
.50
.05
.16
1.04
1.14
1.14
.34
Wastewater
Quality
DO BOD
mg/1 mg/1
2.0 143.
— —
— —
2.0 143.
2.0 143.
2.0 143.
2.0 143.
—
2.0 143.
2.0 143.
—
2.0 143.
— —
Rate
Kl
days~l
.31
.31
.31
.31
.31
.31
.31
.31
.31
.32
—
.32
—
Constants
days"-'-
2.1
2.1
2.1
2.1
2.0
2.0
2.0
2.0
2.0
1.7
1.5
1.5
1.4
Quality of
Reach Outflow
BOD
mg/1
22.9
21.2
21.7
21.8
20.2
19.1
18.5
8.4
8.7
53.6
0.0
28.6
0.0
DO
Deficit
mg/1
3.2
3.0
2.9
2.9
2.8
2.6
2.5
1.4
1.4
6.0
0.0
3.2
0.0
Minimum
D.O.
mg/1
5.3
5.5
5.5
5.6
5.7
5.8
6.0
7.1
7.1
2.5
8.5
5.3
8.5

-------
                            TABLE A5-2
             TREATMENT  COST  DATA FOR  INDICATED REACHES
Annual Cost
Reach
2
4
19
5,6,7
21
35
134
62
107
198
322
50
140
65
112
202
337
For Indicated
60
146
67
115
208
346
75
155
74
124
224
368
% BOD Removal : $xlOJ
85
179
86
144
258
415
90
200
96
161
288
463
A5.4 Discussion of Results
The optimal solution is shown in Table A5-3.  Comparison of columns
four and five of that table indicates headwater competition in reaches
19 and 21.  Only the minimum treatment (35%) is required in interior
reaches 2 and 4.  The results indicate that it would be advisable to
analyze reaches 5, 6, and 7 separately.  Thus, subsequent investigation
could deal with this modified regional configuration.
                                A5-3

-------
             TABLE A5-3
OPTIMAL SOLUTION FOR SAMPLE PROBLEM
      (35% TREATMENT REQUIRED)
Reach
2
4
19
5,6,7
21
% BOD
Removal
35
35
81.4
82.4
86.1
Annual Cost
$ x 103
134
62
137
249
425
DO in
Actual
mg/1
7.10
7.15
7.0
7.0
6.0
Reach
Allowable
mg/1
7.0
7.0
7.0
7.0
6.0
               1007
                 A5-4

-------
I
 BIBLIOGRAPHIC:  University of Florida, A
   Model for Quantifying Flow Augmentation
   Benefits, FWPCA Grant No. 16090 DRM
   1969.

 ABSTRACT:  Little is known of the economic
   implications of low flow augmentation,
   one of  the important water-use cate-
   gories.  Beginning with the premise that
   the value of low flow augmentation is
   measured by sewage treatment costs
   avoided, a hydrologic flow simulator
   and a water quality linear programming
   model were interfaced to develop a
   procedure for determining "willingness
   to pay" for augmentation.  This
   generalized approach can be applied
         ._.	
j BIBLIOGRAPHIC:  University of Florida, A
   Model for Quantifying Flow Augmentation
I   Benefits, FWPCA Grant No. 16090 DRM
I   1969.
 ABSTRACT:  Little is known of the economic
    implications of low flow augmentation,
    one  of  the  important water-use cate-
    gories.  Beginning with the premise that
    the  value of low flow augmentation is
    measured by sewage treatment costs
    avoided, a  hydrologic flow simulator
    and  a water quality linear programming
    model were  interfaced to develop a
    procedure for determining "willingness
    to pay" for augmentation.  This
    generalized approach can be applied

 BIBLIOGRAPHIC:  University of Florida, A
    Model for Quantifying Flow Augmentation
    Benefits, FWPCA Grant No. 16090 DRM
    1969.

 ABSTRACT:  Little is known of the economic
    implications of low flow augmentation,
    one  of  the  important water-use cate-
    gories.  Beginning with the premise that
    the  value of low flow augmentation is
    measured by sewage treatment costs
|    avoided, a  hydrologic flow simulator
I    and  a water quality linear programming
,    model were  interfaced to develop a
'    procedure for determining "willingness
|    to pay" for augmentation.  This
|    generalized approach can be applied
|	
I
ACCESSION NO.:

KEY WORDS:

 Flow Augmen-
   tation

 Water Quality
   Control

 River Basins

 Systems Analysis

 Reservoirs and
   Imp oundmen t s


ACCESSION NO.:

KEY WORDS:

 Flow Augmen-
   tation

 Water Quality
   Control

 River Basins

 Systems Analysis

 Reservoirs and
   Impoundments


ACCESSION NO.:

KEY WORDS:

 Flow Augmen-
   tation

 Water Quality
   Control

 River Basins

 Systems Analysis

 Reservoirs and
   Impoundments

-------
Benefit-Cost
  Analysis
Benefit-Cost
  Analysis
Benefit-Cost
  Analysis
by others to their specific  water
pollution control situations.
                                                           1
                                          __   ±	_,mi  _ __ L  	i
by others to their specific water
pollution control situations.
                                                           -1
by others  to  their  specific water
pollution  control situations.
                                               	I

-------