Professional Documents
Culture Documents
SRP Flowchart1
SRP Flowchart1
2. Integrate real time load and position data coming from sensor with our platform.
3. Some dynamic data which is not coming from sensors but needs to be updated from
time to time, the user should be given an option if he wants to use the previous data
or update the data (such as fluid level, tubing pressure, casing pressure, pump intake
pressure, calibration constant).
4. For each stroke (upstroke + downstroke) load and position data, this data is needed
to be scaled to 360 values using interpolation method
5. Creation of surface dyna card with surface load and position data from surface
sensors.
6. Assume a net stroke length which is less than the user provided theoretical SRP
stroke length.
7. Using the surface dynacard to calculate surface parameters such as Maximum
Polished Rod Load, Minimum Polished Rod Load, Polished Rod Horsepower, Average
Upstroke Load, Average Downstroke Load, Actual Counterbalance Effect, Correct
Counterbalance, and Approximate “ideal” Counterbalance.
8. Using surface data to create downhole dynacard by modelling elastic behaviour of
the rod string (modelling wave equation using finite difference method).
9. Find top of stroke from the downhole dynacard by method of position and method of
load.
10. Find transfer point from the downhole dynacard by method of position and method
of load.
11. Find stroke length from the downhole dynacard which is equal to transfer point.
12. Use this stroke length for running an iterative process to find correct net stroke
length by comparing stroke length obtained from downhole dynacard with the
initially assumed net stroke length.
13. Calculating Production Loss due to Slippage.
14. Calculation of damping factor.
15. All the calculated parameters are needed to be visualized in different screens in
form of charts and graphs, the downhole and surface dynacard are also needed to
be displayed.
Step 1:
Input Stroke length (S) and Net stroke length (nS) (assumed fraction of the stroke length)
Check if S ==nS
clear all
% Stroke Length S (inch)
S = 86.9;
% Assumed Net Stroke length for damping factor calculation nS (fraction of S)
(inch)
nS = 80;
%Iteration for finding net stroke length
for i=1:8
if S == nS
sprintf('Net Stroke Length after Iteration', S)
disp(S)
sprintf('')
else
if False
Step 2:
Collect all the variables (manufactured data, user input data, live data), variable parameters depends
on the availability. Our code can run without them. Fluid level is needed to be collected from any
prior available data.
Initialize the following parameters with default values (will remain same). Young’s Modulus of rod
material (E), Diameter of Rod (Drod), Diameter of Pump (Dpmp), Length of Sucker Rod Assembly till
pump (for untapered String) (L), Strokes per minute (SPM), Fluid Level (Fl), Polished Rod Horsepower
(Hpr), Fluid Specific Gravity (Sg)
Time step is needed to be adjusted from our end to satisfy the stability
coefficient, Cest<=1)
Step 3:
Calculate buoyant weight of the rod
Step 4:
Obtain DDC using evenly time spaced live load and position data from Finite Difference Method
We have Surface Position (X) and Load (F) data which is to be used to find pump position and load
data which is situated below the earth. The pump data travel as wave through the sucker rod which
faces friction, rod movement and elasticity as it moves up and loses energy. Wave equation is used
on the surface data to model those damping and frictional loss to calculate those losses and find the
representative load and position data at the pump level.
U = NaN(M + 1, N);
U(1,:) = repmat(-X'/12, 1, 2);
U(2,:) = repmat(F'*DX/E/A, 1,2) + U(1,:);
% loop for calculating position value at increasing distance from surface,
calculating data at each node, pump is situated at last node
for i = 3:M + 1
U(i,i-1:N-i+2) = A1*U(i-1,i:N-i+3) + A2*U(i-1,i-1:N-i+2) + A3*U(i-1,i-2:N-i+1)
+ A4*U(i-2,i-1:N-i+2);
End
% After position data for last node is calculated, load at pump is calculated
from the position using Hooke’s Law
Fp = (E*A/DX*(U(M+1,:) - U(M,:)))-Wrf;
Xp = -12*(U(M+1,:) - max(U(M+1,:)));
% plot(Up, Fpj,'r.')
plot(Xp, Fp,'r-')
hold off
xlabel('Displacement (in)')
ylabel('Load (lbs)')
title('Surface and Downhole Dynamometer Cards')
legend('Surface', 'Downhole')
Xp=Xp'
Fp=Fp'
nanRows = any(isnan(Fp), 2)#deleting nan values from matrix
badRows = nanRows
Fp(badRows, :) = []
nanRows = any(isnan(Xp), 2)
badRows = nanRows
Xp(badRows, :) = []
k=1:(length(Xp))#find len of Xp after removing nan
plot(k,Xp,'b-')
xlabel('Number of recorded points')
ylabel('Downhole Position (inch)')
title('Position vs Time')
plot(k,Fp,'b-')# do the same with Fp
xlabel('Number of recorded points')
ylabel('Load (lbs)')
title('Load vs Time')
%differentiation of p wrt t (dp/dt) by using central difference
i=2:(length(Xp)-1)
j=1:(length(Xp)-2)
dp(j) = (Xp(i+1)-Xp(i-1))/(2*DT)
dp(k) = horzcat(nan,dp(j),nan)
plot(k,dp(k),'b-')
hold on
Determine TOS by methods of Position
%Finding TOS by finding the point where velocity becomes zero first
(intersection point)
ax=zeros(1,length(Xp))#creating zero valued matrix of size
absDiff = abs(dp(k) - ax);#mod of differnece
[sortedDiffs, indexes] = sort(absDiff);#sorting the absDifference
TOS = Xp(min(k(indexes(1:3))));
tosindex = k(min(indexes(1:3)))
ax = gca;
ax.XAxisLocation = 'origin'
xlabel('Number of recorded points')
ylabel('Velocity (inch/sec)')
title('First derivative of downhole position')
hold off
%differentiation of f wrt t (df/dt) by using central difference
df(j) = (Fp(i+1)-Fp(i-1))/(2*DT)
df(k) = horzcat(nan,df(j),nan)
plot(k,df(k),'b-')
ax = gca;
ax.XAxisLocation = 'origin'
xlabel('Number of recorded points')
ylabel('lbs/sec')
title('First derivative of downhole load')
%Calculating ratio (df/dp)
ratio(k) = df(k)./dp(k)
plot(k,ratio(k),'b-')
xlabel('Number of recorded points')
ylabel('Ratio')
title('df/dp vs Time')
%differention of dp wrt t (d2p/dt2) by using central difference
dp2(j) = (Xp(i+1)+Xp(i-1)-(2*Xp(i)))/(DT^2)
dp2(k) = horzcat(nan,dp2(j),nan)
plot(k,dp2(k),'b-')
ax = gca;
ax.XAxisLocation = 'origin'
xlabel('Number of recorded points')
ylabel('Acceleration (inch/sec2)')
title('Second derivative of downhole position')
Determining TP using method of position
% Now the fixed net stroke length is calculated, we will now use this net
% stroke length to calculate damping factor. From this damping factor pump we
% will calculate new downhole dynacard. Now we will find pump horsepower from
% the area of the DDC. This pump horsepower is compared with the hydraulic
% horsepower and accordingly adjustments are done to find correct damping
factor
% using iteration
% Calculating production from now fixed net stroke length
Q= 0.1166*SPM*nS*Dpmp^2
%Hydraulic horsepower as calculated from net stroke length
Hh = 7.36e-6*Q*Sg*Fl
%Now damping factor is calculated from the fixed net stroke length, from this
%damping factor DDC will be calculated
C1 = (550*144*Gc*(PRHP-Hh)*(T^2))/((2^0.5*pi)*(Rho*A*L)*nS^2);
%Calculating new DDC from the new damping factor
A1 = Alpha*(1 + C1*DT)./(E*A./DX);
A2 = -(Alpha*(2 + C1*DT) - 2*E*A./DX)/(E*A./DX);
U = NaN(M + 1, N);
U(1,:) = repmat(-X'/12, 1, 2);
U(2,:) = repmat(F'*DX/E/A, 1,2) + U(1,:);
for i = 3:M + 1
U(i,i-1:N-i+2) = A1*U(i-1,i:N-i+3) + A2*U(i-1,i-1:N-i+2) + A3*U(i-1,i-2:N-i+1)
+ A4*U(i-2,i-1:N-i+2);
end
Fp = (E*A/DX*(U(M+1,:) - U(M,:)))-3871;
Xp = -12*(U(M+1,:) - max(U(M+1,:)));
Fp=Fp'
Xp=Xp'
nanRows = any(isnan(Fp), 2)
badRows = nanRows
Fp(badRows, :) = []
nanRows = any(isnan(Xp), 2)
badRows = nanRows
Xp(badRows, :) = []
Hpump=(nS*SPM*polyarea(Xp,Fp))/(33000*12*(max(Xp)-min(Xp)))
for i=1:20
if abs(Hh==Hpump);
sprintf('Final damping factor is', C1)
disp(C1)
else
A1 = Alpha*(1 + C1*DT)./(E*A./DX);
A2 = -(Alpha*(2 + C1*DT) - 2*E*A./DX)/(E*A./DX);
U = NaN(M + 1, N);
U(1,:) = repmat(-X'/12, 1, 2);
U(2,:) = repmat(F'*DX/E/A, 1,2) + U(1,:);
for i = 3:M + 1
U(i,i-1:N-i+2) = A1*U(i-1,i:N-i+3) + A2*U(i-1,i-1:N-i+2) + A3*U(i-1,i-2:N-i+1)
+ A4*U(i-2,i-1:N-i+2);
end
Fp = (E*A/DX*(U(M+1,:) - U(M,:)))-3871;
Xp = -12*(U(M+1,:) - max(U(M+1,:)));
Xp=Xp'
Fp=Fp'
nanRows = any(isnan(Fp), 2)
badRows = nanRows
Fp(badRows, :) = []
nanRows = any(isnan(Xp), 2)
badRows = nanRows
Xp(badRows, :) = []
Hpump=(nS*SPM*polyarea(Xp,Fp))/(33000*12*(max(Xp)-min(Xp)))
C2=C1*(Hpump/Hh)
C1=C2
end
end
if C1>=1
sprintf('Final Damping factor', 0.99)
disp(0.99)
else
sprintf('Final Damping factor', C1)
disp(C1)
end
Hpump=(nS*SPM*polyarea(Xp,Fp))/(33000*12*(max(Xp)-min(Xp)))
%Net Production after consdering Slippage
Qnet = Q-Qs