Data analysis in excel VBA function for Sacramento River in California

1
CIEG 430 Boone
Problem Background
The downstream reach of the Sacramento River in California receives the treated effluent
from the City of Sacramento at mile point 53, the single significant input in this region.
The longitudinal profiles of flow, cross-sectional area, depth, biochemical oxygen
demand and dissolved oxygen are shown below and in the attached spreadsheet for a
five-day period in the fall of 1960. Assume the water temperature is 15 oC. There are
flow withdrawals as shown. The table of BOD, DO, and interpolated stream data are
listed below and are included in the spreadsheet.
1. Overplot the actual data and the interpolated stream data for flow, cross sectional
area, and depth to check that the interpolation is a reasonable approximation.
2
CIEG 430 Boone
2. VBA Code:
a. Write VBA function for the O’Connor Dobbins formula reaeration the
temperature correction and for DO saturation concentration with temperature
correction using the equations in Chapra.
b. Update and rewrite if necessary the VBA functions that compute the BOD and
DO solution in a segment with constant parameters using the Euler numerical
integration method. Carefully document the code. Include the equations being
solved in the comments.
3. Set up your model computation to apply the function in segments of one mile in
length corresponding to the interpolated data. For each segment of the model compute
the reaeration coefficient and the DO saturation concentration using the functions
developed in (2)
4. In a separate worksheet, check the code using a simple two segment model with
constant parameters for each segment and the analytical solutions for BOD and DO.
Use the geometry in segment 1 of the Sacramento River for the first segment and
double the depth and half the flow for the second segment. Make each segment 20
miles long.
a. Program the analytical solutions as VBA functions.
5. In a separate worksheet, set up plots of BOD5 and DO data (see plots below) that will
be used to compare model output to data. Remember to plot experimental data as
points and model values as lines.
6. In a separate worksheet, fit the models to the Sacramento River data as follows: Use a
single kd. Estimate the parameters that produce the best fit of both the BOD5 and DO
data. Use an “eyeball” fit, i.e. play around with the parameters until the fits are
“reasonable” for both BOD5 and DO. After approximately mile point 25, the river
becomes more like an estuary and the stream model no longer applies, so ignore the
data after mile point 25. Compute the RMSE of the model fit to the BOD5 and DO so
that the quality of the fit can be assessed. Fit the following parameters
a. The initial BOD5 and DO deficit concentrations at mile 60.
b. The Sacramento treatment plant BOD5 loading rate in lbs/day at mile 53
c. The ultimate to 5 day BOD ratio
d. A single deoxygenation coefficient, kd (/day)
7. Compare the values that you obtain to values that are reasonable for primary effluent.
3
CIEG 430 Boone
4
CIEG 430 Boone

Order from us and get better grades. We are the service you have been looking for.