PTE 412 Final Report 4/29/15
Jimmy Dao
Amey Dhaygude
Lin Du
Thomaz Lopes
Michael Onazi
Kevin Qi
Anuj Suhag
Team 11: Allied Engineering Co.
ALLIED ENGINEERING CO.
Pg 1
Table of Contents
Introduction………………………………………………………………………………………..2
Project Process. …………………………………………………………………………………...3
Volumetric Calculations…………………………………………………………………………...4
Pressure Testing Analysis……………………………………………………………………….…5
Permeability calculation…………………………………………………………………………...6
Fluid Properties……………………………………………………………………………………7
Forecasting Graphs………………………………………………………………………………..9
Economic Analysis………………………………………………………………………………16
Recommendations……………………………………………………………………………….19
Appendix…………………………………………………………………………………………20
ALLIED ENGINEERING CO.
Pg 2
Introduction
The following reservoir study done by Allied Reservoir Engineering Co. guarantees the
optimum development plan for the new oil reservoir discovered in downtown Los Angeles. This
discovery well, drilled from the parking lot of the Convention Center intercepted oil and gas
bearing sand at a depth of 5570 ft. There is also an oil bearing formation at a similar depth of
5580 ft. that was found within 30 ft. of water, half a mile from Santa Monica pier. However,
there is no indication that the reservoirs are connected.
Our reservoir study and well development plan are essential documents prior to the
development of the fields. We have investigated the following pressure-maintenance scenarios to
maximize the primary oil recovery from the oil as recommended by the advisory board:
1. Returning 50% of produced gas from the beginning
2. Returning 50% of the produced gas after the reservoir pressure declined to 2000 psia
3. Returning all of produced gas into the reservoir
Using these scenarios, we can maximize the primary oil recovery and performed economic
analysis to consider the estimated profit from this discovery well.
Reservoir Properties
Area of the reservoir 4500 Acres
Area of Oil-Gas Contact 2250 Acres
Area of Top of Gas Cap 1125 Acres
Average Thickness 20 ft in the oil zone, 20 ft in the gas cap
Average Porosity 20% in the oil zone and the gas cap
Average Water Saturation 20% in the oil zone and in the gas cap
Initial Pressure @GOC 2500 psia
Economic Factors
Drilling and Completion Cost $2,325,000 per well
Stimulation Job (Hydraulic Fracturing) $500,000 per well
Maximum Safe Drawdown 200 psi
Allowable Rate 250 STB/Well
Economic Limit 5 STB/Well
Minimum flowing pressure 100 psig (with aid of pump)
Minimum Spacing 25 Acres
Oil Price $55/STB
Gas Price $ 2.5/MCF
Tax Rate 30%
Interest Rate 5%
ALLIED ENGINEERING CO.
Pg 3
Assumptions
1. Gas-Oil Contact remains constant and the gas resulting from gas-cap expansion diffuses throughout the
oil column.
2. The wells can be completed for simultaneous gas injection and oil production.
3. The reservoir will be blown-down to recover the gas upon completion of the primary recovery.
4. The gas is separated from the oil at surface separator pressure of 400 psig.
5. The estimated cost of gas compression is $1/hp.
6. Non-Darcy effects for gas injection are negligible.
Project Process
Volumetric calculation
Well TestingFluid
Properties
Material balance
Calulate Np, Gp
four investigation
scenarios
Forecasting Graphs
optimum number of
well
Economic Analysis
ALLIED ENGINEERING CO.
Pg 4
Volumetric Calculations Assumed that the reservoir is in the shape of a truncated cone.
Figure 1: Truncated Cone Structure
Using the following equation to calculate the volume:
V=1/3*(A1+A2+√𝐴1A2)
The original oil and gas in place can be found using the following two equations:
Calculating Oil and gas in Place by the Volumetric Method, Oil and gas in place by the
volumetric method is given by:
ALLIED ENGINEERING CO.
Pg 5
From the equations above, results:
OOIP OGIP
74.57623498
MMSTB
1998.721374
MMSCF
Table 1: OOIP and OGIP
There is 74,576,235 STB of Oil in Place and 1,998,721,374 Scf of Gas in Place
Pressure Testing Analysis
A build-up test is made to analyze the wells.
Horner time can be calculated using the following equation:
Horner time= (t+Δ t)/Δ t
The calculated values are shown in the following table.
Time (t+Δ t)/Δ t Pressure
0.092 805.3478261 2474
0.127 583.6771654 2475
0.23 322.7391304 2478
0.46 161.8695652 2482
0.92 81.43478261 2485
2.3 33.17391304 2489
4.6 17.08695652 2493
9.2 9.043478261 2496
23 4.217391304 2500
Table 2: Calculated Pressure Values of Horner Time
ALLIED ENGINEERING CO.
Pg 6
The Pressure is then plotted versus Horner Time on a semi-log plow.
Figure 2: Horner Plot
Permeability Calculation
The following equations are used to calculate permeability and skin factor:
k = −162.6qboμ
mh
s = 1.151 [pwf(Δt=0) − p1hr
m− log
k
ϕμctrw2
+ 3.23]
From Figure 2: Horner plot, the following data can be extracted:
Table 3: Slope, Permeability, and Skin Factor
2470
2475
2480
2485
2490
2495
2500
2505
1 10 100 1000
Pw
s
Horner Time
Pws Vs Horner Time
ALLIED ENGINEERING CO.
Pg 7
Fluid Properties
Using the following data of gas saturation and relative permeability, a plot of the ratio of relative
permeabilites to gas and oil versus oil saturation can be plotted.
Sg% Kg/Ko Kro
3 0 0.85
7 0.001 0.4
13 0.0294 0.28
17.7 0.0535 0.22
21.5 0.084 0.17
24.8 0.125 0.13
28.8 0.198 0.09
32.2 0.29 0.06
35 0.405 0.04
37.4 0.54 0.02
38.2 0.9 0.01
40 - 0
Table 3: Gas Saturation and Relative Permeabilites
ALLIED ENGINEERING CO.
Pg 8
Figure:3 Graphs of Viscosity & Oil formation volume factor Vs Pressure.
Figure 4: Ratio of Relative Permeabilties versus Oil Saturation
1.1
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
300 800 1300 1800 2300 2800
Bo
Pressure
Bo
Bo
0.4
0.6
0.8
300 800 1300 1800 2300 2800
Vis
cosi
ty
Pressure
μo
μo
y = 4E-08x6 - 2E-05x5 + 0.0024x4 - 0.1896x3 + 8.4297x2 - 198.5x + 1934.4
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 20 40 60 80 100
Krg
/K
ro
% So
Krg/Kro vs. So
krg/kro
ALLIED ENGINEERING CO.
Pg 9
Forecasting Graphs
Predicted Gp and Np
Figure 5: Relationship between GOR and G
p
The cumulative gas produced, Gp, and cumulative oil production, Np, are related to instantaneous
GOR by the following equation
𝐺𝑃 = ∫ (𝐺𝑂𝑅)𝑑𝑁𝑃
𝑁𝑃
0
According to the GOR and Pressure relationship we roughly guess a Rn at pressure Pn
Figure 6: Relationship between GOR and Pressure
ALLIED ENGINEERING CO.
Pg 10
To calculate Np at pressure Pn:
N p n=N[Bon -Boi + (Rsi -Rsn )Bgn ]+G[Bgn -Bgi ]-Bgn[Gpn-1 -N pn(
GORn +GORn-1
2)
Bon -BgnRsn +Bgn (GORn +GORn-1
2)
Oil saturation: 𝑆𝑜 = (1 − 𝑆𝑤𝑖) (1 −𝑁𝑃
𝑁) (
𝐵𝑜
𝐵𝑜𝑖)
Gas saturation:
Sg = 1 − So − Swi
Rn = Rs + (krg
kro) (
μoBo
μgBg)
Then, we compare the Rn from the above equation. If the calculated Rn is equal to the Rn we
estimated then we can break and do the next calculation, if not, we need to do the iterations until
we get the same values.
GORn = (Rs)𝑛 + (krg
kro)
𝑛
(μo
μg)
𝑛
(Bo
Bg)
𝑛
Gas production:
𝐺𝑝𝑛 = 𝐺𝑝(𝑛−1) + [𝑅𝑛 + 𝑅𝑛−1
2] (𝑁𝑝𝑛 − 𝑁𝑝(𝑛−1))
Using Matlab to calculate four investigation pressure-maintenance scenarios
For 0 injection
Returning 50% of produced gas from the beginning
Returning 50% of the produced gas after the reservoir pressure declined to 2000 psia
100% injection (Returning all of produced gas into the reservoir )
ALLIED ENGINEERING CO.
Pg 11
1) For 0 injection
Table 4: 0 Injection Pressure-Maintenance Scenario
2) Returning 50% of produced gas from the beginning
Table 5: 50% of Produced Gas from Beginning Pressure-Maintenance Scenario
ALLIED ENGINEERING CO.
Pg 12
3) Returning 50% of the produced gas after the reservoir pressure declined to 2000 psia
Table 6: 50% of Produced Gas after the Reservoir Pressure Declined to 2000 PSA Pressure-Maintenance
Scenario
4) 100% injection (Returning all of produced gas into the reservoir)
Time t No. of wells Np dNp P Q Rf %
1 24 1885349.1 1885349.1 2378.387934 215.2225 2.528082974
2 47 5577491.088 3692141.988 2165.287473 156.8827 7.478912133
3 47 8268813.806 2691322.719 2000.352056 123.1838 11.08773298
4 47 10382031.9 2113218.089 1879.398622 97.5693 13.92136771
5 47 12055833.24 1673801.342 1800.705556 97.5693 16.16578423
6 47 13729634.58 1673801.342 1749.946944 76.16395 18.41020075
7 47 15036227.14 1306592.562 1739.312522 76.16395 20.16222345
8 47 16342819.7 1306592.562 1763.240554 76.16395 21.91424614
9 47 17649412.26 1306592.562 1831.305815 76.16395 23.66626884
10 47 18956004.83 1306592.562 1954.216015 89.57301 25.41829153
Table 7: 100% Injection Pressure-Maintenance Scenario
ALLIED ENGINEERING CO.
Pg 13
Forecasting Graphs
1. Cumulative Production Vs Time.
Figure 7: Np vs. t
2. Difference in Cumulative Production Vs Time.
Figure 8: dNp vs. t
0
5000000
10000000
15000000
20000000
25000000
30000000
0 2 4 6 8 10 12
Np
, ST
B
t, Years
Np Vs t
Np, 0 inj vs t
Np, 50 inj start vs t
Np, 50 inj after vs t
Np, 100% inj vs t
0
500000
1000000
1500000
2000000
2500000
3000000
3500000
4000000
0 2 4 6 8 10 12
dN
p, S
TB
t, Years
dNp Vs t
dNp 0 inj Vs t
dNp 50 start Inj
dNp 50 after Vs t
dNp 100% inj
ALLIED ENGINEERING CO.
Pg 14
3. Cumulative Gas Production vs Time
Figure 9: Gp vs. t
4. Difference in Cumulative Gas Production Vs time
Figure 10: dGp vs. t
0
2E+12
4E+12
6E+12
8E+12
1E+13
1.2E+13
1.4E+13
1.6E+13
1.8E+13
2E+13
0 2 4 6 8 10 12
Gp
, Scf
t, Years
Gp vs t
Gp 0 inj
Gp 50% start
Gp 50% after
0
2E+12
4E+12
6E+12
8E+12
1E+13
1.2E+13
1.4E+13
1.6E+13
1.8E+13
2E+13
0 2 4 6 8 10 12
dG
p,S
cf
t, Years
dGp Vs t
dGp 0 inj Vs t
dGp 50% start vs t
dGp 50% after vs t
ALLIED ENGINEERING CO.
Pg 15
5. Flow Rate Vs Time
Figure 11: Q vs. t
6. Gas Oil Ratio Vs Time
Figure 12: GOR vs. t
0
50
100
150
200
250
0 2 4 6 8 10 12
Q, s
tb/d
ay
t,Years
Q vs t
Q, 0 inj vs t
Q, 50% start inj vs t
Q, 50% inj after
Q, 100% inj vs t
0
1000000
2000000
3000000
4000000
5000000
6000000
7000000
8000000
9000000
10000000
0 2 4 6 8 10 12
GO
R, S
cf/S
tb
t, Years
GOR Vs t
GOR 0 Inj Vs t
GOR 50 start vs t
GOR 50 after vs t
ALLIED ENGINEERING CO.
Pg 16
7. Gas Oil Ratio Vs Pressure
Figure 13: GOR vs. P
Economic Analysis
Reservoir Properties
Drilling and Completion: $2,325,000 per well
Stimulation Job (Hydraulic Fracturing) $500,000 per well
Economic limit 5 STb/ well
Oil price $55/STB
Gas Price $ 2.5/MCF
Tax Rate 30%
Interest Rate 5%
Estimated cost of gas compression is $1/hp
Estimation of the Optimum Number of Development Wells to Achieve Maximum
Economical Return
According to SPE 71431_ An Analytical Solution to Estimate the Optimum Number of
Development Wells to Achieve Maximum Economical Return
The optimum number of wells is given by the following equation (Wo):
Wo= Np
{ln(1+i)C−[365QVCln(1+i)]0.5}
−365QC
0
10000
20000
30000
40000
50000
60000
70000
0 500 1000 1500 2000 2500 3000
GO
R, S
cf/S
tb
P, Psia
GOR Vs P
GOR, 0 inj Vs P
GOR, 50% start Vs P
GOR, 50% after vs P
GOR, 100% inj vs P
ALLIED ENGINEERING CO.
Pg 17
Initial daily oil production rate, Q
Oil price at well after income tax, V
PV of capital investment after income tax, C
Interest rate, i
The results of optimum number of wells are given in the following table:
0 Injection 50% starting 50% after 100% injection
Time t No. of wells No. of wells No. of wells No. of wells
1 24 24 30 24
2 47 47 50 47
3 47 47 70 47
4 47 47 70 47
5 47 47 70 47
6 47 47 70 47
7 47 47 70 47
8 47 47 70 47
9 47 47 70 47
10 47 47 70 47
Table 8: Optimum Number of Wells for each Scenario
The net present value of an oil field development project can be expressed approximately
by the equation,
NPV(W)=dfNp V-CW-Z
By replacing W by Wo in equation:
NPV(Wo)=365 WoQiV/[(365 WoQi/ Np) + ln(1+i)] - C Wo - Z
ALLIED ENGINEERING CO.
Pg 18
NPV break even curves are shown blew:
Figure 14: NPV vs. time
-2E+08
0
200000000
400000000
600000000
800000000
1E+09
1.2E+09
1.4E+09
1.6E+09
1.8E+09
1 2 3 4 5 6 7 8 9 10 11
NP
V
t (years)
NPV x time
No injection
50% gas injected
50% gas injected,after 2000 psi100% gas injected
ALLIED ENGINEERING CO.
Pg 19
Recommendations
The most Economical plan is as follows:
Have the optimal number of 70 wells
The best scenario occurs when returning 50% of the produced gas after the reservoir
pressure declined to 2000 psia
NPV is 1541 MM$, return rate is 117.17%.
The recovery factor is 34.65%
No stimulation or fracturing required
Table 9: Recovery Factor, Numbers of Wells, NPV, and Return Rate for Scenarios
ALLIED ENGINEERING CO.
Pg 20
Appendix Matlab Code
%% Tarner's Method to determine NP, GP, dNp, and dGp. % Author - Team_11 % Date -04/29/2015
% Text about file input/output
clear; clc;
%% PVT Data, Volumetrics PVT=[2500 1.498 721 0.001048 0.48 0.0148 2300 1.463 669 0.001155 0.49 0.0146 2100 1.429 617 0.00128 0.508 0.0143 1900 1.395 565 0.00144 0.527 0.014 1700 1.361 513 0.001634 0.544 0.0137 1500 1.327 461 0.001884 0.654 0.0134 1300 1.292 409 0.002206 0.578 0.0132 1100 1.258 357 0.002654 0.609 0.0129 900 1.224 305 0.0033 0.633 0.0126 700 1.19 253 0.004315 0.661 0.0124 500 1.156 201 0.006163 0.692 0.0121 300 1.121 149 0.010469 0.729 0.0119]; %% Initializing Vectors P = PVT(:,1); bo = PVT(:,2); Rs = PVT(:,3); bg = PVT(:,4); mu_o= PVT(:,5); mu_g= PVT(:,6); %% Some constants N = 74576235; %possibly change value of So because it's above bbl pt
pressure 74576235,1998721374 G = 1998721374; %% Step Sizes changed from 200 to 100 PSIA P1 = 2500:-100:300; P1 = P1(:); %% Saturation So = [73 67 62.3 58.5 55.2 51.2 47.8 45 42.6 41.8 40]; So = So/100; so = linspace(77,40,23); so = so(:); Sg = [0.03; 0.07; 0.13; 0.177; 0.215; 0.248; 0.288; 0.322; 0.35; 0.374;
0.382; .4]; sg = -4.894e-08*P1.^2 + -3.451e-05*P1 + 0.4164; %% Rel Perm kro = [0.85 0.4 0.28 0.22 0.17 0.13 0.09 0.06 0.04 0.02 0.01 0]; krgkro = 0:0.03913043478:0.9; Krgro = [0; 0.001; 0.0294; 0.0535; 0.084; 0.125; 0.198; 0.29; 0.405; 0.54;
0.9; 0]; sg = sg(:); swi = 0.2; Ko =zeros(23,1); %% Vectorized Dummy Variables, Initial Conditions
ALLIED ENGINEERING CO.
Pg 21
Np = zeros(23,1); Gp = zeros(23,1); Gp(1)=0; Np(1)=0; Npg=Np; Npg=zeros(23,1); Rcalc = zeros(23,1); R1 = 721; Rguess=zeros(23,1); Rguess=linspace(721,2000,23); Rguess=Rguess(:); q = zeros(23,1); q(1) = 250; %check to see if using 300 or 250 STB/day
%% Interpolations bo = interp1(P,bo,P1); bg = interp1(P,bg,P1); Rs = spline(P,Rs,P1); Rs = Rs(:); mu_g = spline(P,mu_g,P1); mu_o = spline(P,mu_o,P1); tol=100; m=(G*bg(1))/(N*bo(1)); %% Volume Compressibility Factor (Lumped together as C total) CT=[0 -0.0024 -0.0049 -0.0073 -0.0097 -0.0122 -0.0146 -0.0171 -0.0195 -0.0219 -0.0244 -0.0268 -0.0292 -0.0317 -0.0341 -0.0365 -0.0390 -0.0414 -0.0438 -0.0463 -0.0487 -0.0512 -0.0536];
%% Input/Output n = input('enter an injection scenario (Percent Injection) (0, .5, 1) : ');
switch n %Used to select different scenarios for injection
case 0 %No injection for i = 2:23
ALLIED ENGINEERING CO.
Pg 22
Npg(2)=.0000001*N; Npg(i+1)=Npg(i)+100; krgkro(i) = (2264*sg(i)^5 - 1753.5*sg(i)^4 + 548.1*sg(i)^3 ... - 75.416*sg(i)^2 + 4.42*sg(i) - .0804);
Rcalc(i) =(Rs(i)+krgkro(i)*(mu_o(i)/mu_g(i))*(bo(i)/bg(i))); Rguess(i)= Rcalc(i); while abs(Rguess(i)-Rcalc(i))>1 Rguess(i)=Rcalc(i); end Np(i) = abs(((N*((Rs(1)-Rs(i))*bg(i)-((bo(i)-bo(1))/bg(i))... -(Gp(i)*bg(i)))))/(bo(i)+(bg(i)*((Rguess(i)... +Rguess(i-1))/2)-Rs(i)))); Gp(i) = abs(Gp(i)+((Rguess(i)+Rguess(i-1))/2)*(Npg(i)-Np(i-1)));
while (Npg(i)-Np(i))>1 Npg(i)=Npg(i)-10; end
end
case 1 %100 percent injection for i = 2:23 Npg(2)=.0000001*N; Npg(i+1)=Npg(i)+100; krgkro(i) = abs(-2264*sg(i)^5 + 1753.5*sg(i)^4 - 548.1*sg(i)^3 ... + 75.416*sg(i)^2 - 4.42*sg(i) + .0804);
Rcalc(i) =(Rs(i)+krgkro(i)*(mu_o(i)/mu_g(i))*(bo(i)/bg(i))); Rguess(i)= Rcalc(i); while abs(Rguess(i)-Rcalc(i))>1 Rguess(i)=Rcalc(i); end
Gp = zeros(23,1); Np(i) = abs(((N*((Rs(1)-Rs(i))*bg(i)-((bo(i)-bo(1))/bg(i))... +(Gp(i)*bg(i))))+(Gp(i))*bg(i))/(bo(i)+(bg(i)*((Rguess(i)... +Rguess(i-1))/2)-Rs(i)))); while (Npg(i)-Np(i))>1 Npg(i)=Npg(i)-10; end end
%% For 50% injection scenarios: Before 2000 Psia, and after 2000 Psia case .5 prompt=input('50% injection before 2000 psia, or after? (1=before,
0=after):'); %prompts user to select injection conditions
if prompt==1 %User selected to inject before 2000 Psia for i = 2:5 Npg(2)=.0000001*N; Npg(i+1)=Npg(i)+100; krgkro(i) = abs(-2264*sg(i)^5 + 1753.5*sg(i)^4 -
548.1*sg(i)^3 ...
ALLIED ENGINEERING CO.
Pg 23
+ 75.416*sg(i)^2 - 4.42*sg(i) + .0804);
Rcalc(i) =(Rs(i)+krgkro(i)*(mu_o(i)/mu_g(i))*(bo(i)/bg(i))); Rguess(i)= Rcalc(i);
Np(i) = N*((bo(i)-bo(1)+(Rs(1)-Rs(i))*bg(i)+m*bo(1)*... ((bg(1)/bg(i))-1)))-Gp(i)*bg(i)-0.5*Gp(i)/(bo(i)-
bg(i)*Rs(i));
Gp(i) = .5*(abs(Gp(i)+((Rguess(i)+Rguess(i-1))/2)*(Npg(i)-
Np(i-1))));
end
for k=6:23 Npg(6)=.00001*N;
Npg(k+1)=Npg(k)+100;
krgkro(k) = abs(-2264*sg(k)^5 + 1753.5*sg(k)^4 -
548.1*sg(k)^3 ... + 75.416*sg(k)^2 - 4.42*sg(k) + .0804);
Rcalc(k) =(Rs(k)+krgkro(k)*(mu_o(k)/mu_g(k))*(bo(k)/bg(k)));
Rguess(k)= Rcalc(k);
Np(k) = abs(((N*((Rs(1)-Rs(k))*bg(k)-((bo(k)-
bo(1))/bg(k))... -(Gp(k)*bg(k)))))/(bo(k)+(bg(k)*((Rguess(k)... +Rguess(k-1))/2)-Rs(k))));
Gp(k) = abs(Gp(k)+((Rguess(k)+Rguess(k-1))/2)*(Npg(k)-Np(k-
1))); while (Npg(k)-Np(k))>1 Npg(k)=Npg(k)-10; end end end
%% For 50% inject after 2000 PSIA
if prompt==0 %User selected injection after 2000 Psia for k=2:5 Npg(2)=.00001*N;
Npg(k+1)=Npg(k)+100;
krgkro(k) = abs(-2264*sg(k)^5 + 1753.5*sg(k)^4 -
548.1*sg(k)^3 ... + 75.416*sg(k)^2 - 4.42*sg(k) + .0804);
ALLIED ENGINEERING CO.
Pg 24
Rcalc(k) =(Rs(k)+krgkro(k)*(mu_o(k)/mu_g(k))*(bo(k)/bg(k)));
Rguess(k)= Rcalc(k);
Np(k) = abs(((N*((Rs(1)-Rs(k))*bg(k)-((bo(k)-
bo(1))/bg(k))... -(Gp(k)*bg(k)))))/(bo(k)+(bg(k)*((Rguess(k)... +Rguess(k-1))/2)-Rs(k))));
Gp(k) = abs(Gp(k)+((Rguess(k)+Rguess(k-1))/2)*(Npg(k)-Np(k-
1))); while (Npg(k)-Np(k))>124 Npg(k)=Npg(k)-10; end end
for i=6:23; Npg(2)=.0000001*N; Npg(i+1)=Npg(i)+100; krgkro(i) = abs(-2264*sg(i)^5 + 1753.5*sg(i)^4 -
548.1*sg(i)^3 + 75.416*sg(i)^2 - 4.42*sg(i) + .0804);
Rcalc(i) =(Rs(i)+krgkro(i)*(mu_o(i)/mu_g(i))*(bo(i)/bg(i))); Rguess(i)= Rcalc(i); Np(i) = N*((bo(i)-bo(1)+(Rs(1)-
Rs(i))*bg(i)+m*bo(1)*((bg(1)/bg(i))-1)))-Gp(i)*bg(i)-0.5*Gp(i)/(bo(i)-
bg(i)*Rs(i)); Gp(i) = .5*(abs(Gp(i)+((Rguess(i)+Rguess(i-1))/2)*(Npg(i)-
Np(i-1))));
while (Npg(i)-Np(i))>124 Npg(i)=Npg(i)-10; end
end end end