PO.PTA.StepRate.Fit


Description

The two-line fit of a step-rate injection test: the stabilized bottomhole pressure at the end of each rate step plotted against the rate falls on two straight lines, a steep one while the rock takes water through the matrix and a flatter one once a fracture is open. Their intersection is the fracture extension pressure and the rate at which the fracture opens. The function fits both lines by least squares. You either give the number of steps on the lower (matrix) line, or pass 0 to let it try every split and keep the one with the smallest total squared error. It returns the extension pressure and rate, the two slopes and the split it used.

Formula

=LAMBDA(q, p, nlow, output, LET( cnt, ROWS(q), qa, AVERAGE(q), pa, AVERAGE(p), qc, q-qa, pc, p-pa, ix, SEQUENCE(cnt), kk, SEQUENCE(cnt-3, 1, 2), msk, --(TRANSPOSE(ix)<=kk), nlo, kk, nhi, cnt-kk, sxlo, MMULT(msk, qc), sylo, MMULT(msk, pc), sxxlo, MMULT(msk, qc^2), sxylo, MMULT(msk, qc*pc), syylo, MMULT(msk, pc^2), sxhi, SUM(qc)-sxlo, syhi, SUM(pc)-sylo, sxxhi, SUM(qc^2)-sxxlo, sxyhi, SUM(qc*pc)-sxylo, syyhi, SUM(pc^2)-syylo, cxxlo, sxxlo-sxlo^2/nlo, cxylo, sxylo-sxlo*sylo/nlo, cxxhi, sxxhi-sxhi^2/nhi, cxyhi, sxyhi-sxhi*syhi/nhi, sse, syylo-sylo^2/nlo-cxylo^2/cxxlo+syyhi-syhi^2/nhi-cxyhi^2/cxxhi, pick, IF(nlow>0, nlow, MIN(IF(sse=MIN(sse), kk, cnt))), sel, --(kk=pick), slo, SUM(sel*cxylo/cxxlo), shi, SUM(sel*cxyhi/cxxhi), ilo, SUM(sel*(sylo-slo*sxlo)/nlo), ihi, SUM(sel*(syhi-shi*sxhi)/nhi), qx, IF(slo>shi, (ihi-ilo)/(slo-shi), 0), IF(OR(cnt<5, nlow<0, nlow=1, nlow>cnt-2, slo<=shi), NA(), IF(output="p", pa+ilo+slo*qx, IF(output="q", qa+qx, IF(output="mlo", slo, IF(output="mhi", shi, IF(output="n", pick, NA()))))))))

Parameters

Parameter Unit Description
q bbl/d Injection rate of each step, increasing, at least 5 steps
p psi Stabilized bottomhole injection pressure at the end of each step
nlow count Steps on the lower (matrix) line, 2 to n − 2; 0 picks the split of least total squared error
output text "p" extension pressure [psi], "q" extension rate [bbl/d], "mlo" lower-line slope [psi/(bbl/d)], "mhi" upper-line slope [psi/(bbl/d)] or "n" steps on the lower line

Examples

Invocation Expected
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 0, "p") 3937.777778
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 0, "q") 472.2222222
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 0, "mlo") 1.97
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 0, "mhi") 0.5
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 0, "n") 4
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 4, "p") 3937.777778
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 3, "p") 3830.957643
=PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 3, "q") 411.1724985
=IF(ISNA(PO.PTA.StepRate.Fit({100;200;300;400;600;800;1000}, {3205;3395;3610;3790;4005;4095;4205}, 1, "p")), 1, 0) 1

Need a custom LAMBDA? Suggest a New Lambda