19
Microsoft Excel 14.0 Answer Report Worksheet: [ThreeReservoirProblem.xlsx]Sheet1 Report Created: 08/05/2011 12:48:15 PM Result: Solver found a solution. All Constraints and optimality condition Solver Engine Engine: GRG Nonlinear Solution Time: 0.047 Seconds. Iterations: 2 Subproblems: 0 Solver Options Max Time Unlimited, Iterations Unlimited, Precision 0.000001 Convergence 0.0001, Population Size 100, Random Seed 0, Derivatives Cen Max Subproblems Unlimited, Max Integer Sols Unlimited, Integer Tolerance Objective Cell (Value Of) Cell Name Original Value Final Value $D$15 Velocity (m s-1) Pipe 3 -0.2571377996 0 Variable Cells Cell Name Original Value Final Value Integer $B$18 Flowrates Pipe 1 3.04E-03 0.00E+00 Contin $C$18 Flowrates Pipe 2 -1.90E-03 0.00E+00 Contin $D$18 Flowrates Pipe 3 -1.14E-03 0.00E+00 Contin Constraints Cell Name Cell Value Formula Status Slack $B$22 Restriction Q1+Q2+Q3= Pipe 1 0.00E+00 $B$22=0 Binding 0 $D$15 Velocity (m s-1) Pipe 3 0 $D$15=0 Binding 0

Three Reservoir Problem

Embed Size (px)

DESCRIPTION

Three Reservoir Problem

Citation preview

Answer Report 1Microsoft Excel 14.0 Answer ReportWorksheet: [ThreeReservoirProblem.xlsx]Sheet1Report Created: 08/05/2011 12:48:15 PMResult: Solver found a solution. All Constraints and optimality conditions are satisfied.Solver EngineEngine: GRG NonlinearSolution Time: 0.047 Seconds.Iterations: 2 Subproblems: 0Solver OptionsMax Time Unlimited, Iterations Unlimited, Precision 0.000001 Convergence 0.0001, Population Size 100, Random Seed 0, Derivatives CentralMax Subproblems Unlimited, Max Integer Sols Unlimited, Integer Tolerance 1%, Assume NonNegativeObjective Cell (Value Of)CellNameOriginal ValueFinal Value$D$15Velocity (m s-1) Pipe 3-0.25713779960Variable CellsCellNameOriginal ValueFinal ValueInteger$B$18Flowrates Pipe 13.04E-030.00E+00Contin$C$18Flowrates Pipe 2-1.90E-030.00E+00Contin$D$18Flowrates Pipe 3-1.14E-030.00E+00ContinConstraintsCellNameCell ValueFormulaStatusSlack$B$22Restriction Q1+Q2+Q3= Pipe 10.00E+00$B$22=0Binding0$D$15Velocity (m s-1) Pipe 30$D$15=0Binding0

Sensitivity Report 1Microsoft Excel 14.0 Sensitivity ReportWorksheet: [ThreeReservoirProblem.xlsx]Sheet1Report Created: 08/05/2011 12:48:16 PMVariable CellsFinalReducedCellNameValueGradient$B$18Flowrates Pipe 100$C$18Flowrates Pipe 200$D$18Flowrates Pipe 300ConstraintsFinalLagrangeCellNameValueMultiplier$B$22Restriction Q1+Q2+Q3= Pipe 100$D$15Velocity (m s-1) Pipe 300

Sheet1The Three Reservoir Problemhttp://excelcalculations.blogspot.comLegendClick here to discover how the equations were derived and for complete documentationParameters you specifyLiquid PropertiesCalculated valuesViscosity (Pa s)0.001To be varied by SolverDensity (kg m-3)1000Constraint in SolverTo be minimized by SolverPipe 1Pipe 2Pipe 3Reservoir Height (m)1208060Roughness (m)0.00050.00050.0005Diameter (m)0.10.050.075Length (m)500600700Flowrates (m3 s-1)0.0164654056-0.0009243337-0.0055410719Area0.00785398160.00196349540.0044178647Velocity (m s-1)2.09644055070.47075926531.2542421149Reynolds Number209644.05506729623537.963266496994068.1586140416Friction Factor0.03084029460.04026316220.0340184141

JunctionHead at Junction (m)85.4574313267External Demand (m3 s-1)0.01

Errors in Bernoulli equation in each pipelineErrors-6.44E-075.06E-06-8.51E-072.68E-11Solver InstructionsMinimize the Total Error by varying the Flowrates and the Head at Junction while maintaining the External Demand at 0.01 m3 s-1

Total error (to be minimized)Set initial guess values

Set initial guess valueSum of flowratesin pipes (constraint)

Sheet2The Three Reservoir Problem

IntroductionThis article discusses how you can solve the Three Reservoir Problem with Excel. First, we develop the governing equations by applying Bernoulli's Equation and the Continuity Equation. We then explore how these equations can be solved in Excel.

If you just want the tutorial spreadsheet, click here, but I encourage you to read the rest of the article so you understand how the spreadsheet was developed. Read on for the Three Reservoir Problem solution.

TheoryThree reservoirs at different elevations are connected by a pipe network. The common junction of the piping network is subject to an external demand Qj of 0.01 m3/s. We will develop the theory required to calculate the flowrates in each pipe (Q1, Q2 and Q3), the head at the junction (Hj) and determine whether liquid is flowing into or out of each reservoir

Assuming that the liquid level in each reservoir is constant and the surface is open to atmosphere, the Bernoulli Equation for Reservoir i (where i=1, 2 and 3) is

Equation 1where zi is the elevation, fi is the friction factor, Li and Di are the length and diameter of the pipe connecting the reservoir to the junction, Vi is the liquid velocity and g is the gravitational constant.

But the volumetric flowrate Qi and the cross sectional area Ai of the pipe are

Equation 2

Equation 3

Substituting Equations 2 and 3 into Equation 1 to eliminate Vi gives

Equation 4To determine whether liquid is flowing into or out of a reservoir, we need to preserve the sign on the Qi^2 term by writing Equation 4 thus

Equation 5If Qi is positive, liquid is flowing out of the reservoir, and if Qi is negative, liquid is flowing into the reservoir.

We only need a few more relationships to completely specify the system. The friction factor fi is given by the Haaland approximation to the Colebrook-White Equation,

where Rei is the Reynolds Number,

Additionally, the sum of the flowrates from each reservoir is equal to the external demand

Excel ImplementationMoving all terms in Equation 5 to the right-hand side gives

Equation 6However, if we don't know the exact values of the flowrates in each pipeline (Qi) or the head at the junction (Hj) then we can define an error for each pipe.

Equation 7We'll use Excel's Solver add-in to find the values of Q1, Q2, Q3 and Hj that minimize the total error...

Equation 8...while keeping the total flowrate at the junction equal to the external demand.

Equation 9Step1. Specify fixed parameters (such as densities, viscosities, reservoir heights, pipe diameters and roughnesses etc)

Step 2. Set initial guess values for the flowrates in each pipe

Step 3. Specify calculated values

Step 4. Specify an initial guess value for the head at the junction, and the sum of all flowrates in each pipe (as given by Equation 9). The External Demand will act as the constraint for Excel's Solver

Step 5. Specify the errors for each pipeline (as given by Equation 7), and the total error (as given by Equation 8).

We can now use Excel's Solver Add-in to find the flowrates (Q1, Q2 and Q3) and head at the junction (Hj) that minimize the total error (as set in Step 5) subject to the flowrate constraint (as set in Step 4).

Step 6. Initiate Excel's Solver menu (if you haven't already, you'll need to load it in the File > Options > Add-ins menu)

Step 7. Make the appropriate changes in the Solver window such that you minimise the total error by varying the flowrates and the junction head while maintaining the external demand at a set value (for this example, I've set the external demand to 0.01 m3/s). Additionally, set the solving method to GRG Nonlinear.

Step 8. Click Solve. After dismissing the following window, you'll find that the flowrates in each pipeline, and the junction head have changed. Bear in mind that positive flowrates indicate flow out of a reservoir, while negative flowrates indicate liquid flow into a reservoir.

Step 9. We're not finished yet! Check that the Total Error specified in Step 5 is a very small number, and the External Demand (in Step 5) is equal to the value specified in Step 7.

Sheet3