PO.SF.PL.Gas.Size
Description
Returns the smallest pipe internal diameter, from a list of candidate sizes, that carries a gas rate from an inlet pressure to a minimum delivery pressure and keeps the gas below API RP 14E's erosional velocity. It sweeps the list smallest first with one of the shipped pipeline equations, Weymouth, Panhandle A or Panhandle B, and stops at the first size that passes both tests. The list is the caller's: a standard-weight schedule, another wall, or the sizes in stock. A sheet reads the nominal size with `INDEX(nps, MATCH(size, ids, 0))`.
Formula
=LAMBDA(qg, p_in, p_min, length, sg, t, z, eff, cf, method, ids, IF(OR(qg<=0, p_min<=0, p_in<=p_min, length<=0, sg<=0, z<=0, eff<=0, eff>1, cf<=0, AND(method<>1, method<>2, method<>3)), NA(), LET(
ok, MAP(ids, LAMBDA(x, LET(
pout, IFERROR(IF(method=1, PO.SF.PL.Gas.Weymouth.Pout(qg, p_in, x, length, sg, t, z, eff), IF(method=2, PO.SF.PL.Gas.PanhandleA.Pout(qg, p_in, x, length, sg, t, z, eff), PO.SF.PL.Gas.PanhandleB.Pout(qg, p_in, x, length, sg, t, z, eff))), 0), IF(pout<p_min, 0, IF(PO.SF.PL.Gas.Vel(qg, x, pout, t, z)<=PO.FA.Erosion.Ve(PO.SF.PL.Gas.Rho(pout, t, sg, z), cf), 1, 0))))), k, IFERROR(XMATCH(1, ok), 0), IF(k=0, NA(), INDEX(ids, k)))))Parameters
| Parameter | Unit | Description |
|---|---|---|
qg |
MMscf/d | Gas rate at standard conditions |
p_in |
psia | Inlet pressure |
p_min |
psia | Minimum delivery pressure, less than `p_in` |
length |
mi | Line length |
sg |
air = 1 | Gas specific gravity |
t |
°F | Average flowing temperature |
z |
— | Gas deviation factor at the average pressure, such as DAK's (`PO.PVT.Z.ByDAK`) |
eff |
— | Pipeline efficiency, 0 to 1 (0.92 is a usual design value) |
cf |
— | API RP 14E C factor, 50 to 150 (`PO.FA.Erosion.CFactor`) |
method |
— | Flow equation: 1 Weymouth, 2 Panhandle A, 3 Panhandle B |
ids |
in | Candidate internal diameters as a column, smallest first |
Examples
| Invocation | Expected |
|---|---|
=PO.SF.PL.Gas.Size(100, 1414.7, 814.7, 100, 0.6, 60, 0.9, 0.95, 100, 1, {13.25;13.3;13.31;13.35}) |
13.31 |
=PO.SF.PL.Gas.Size(100, 1414.7, 814.7, 100, 0.6, 60, 0.9, 0.95, 100, 3, {11.9;11.92;11.93;12}) |
11.93 |
=PO.SF.PL.Gas.Size(100, 1414.7, 814.7, 100, 0.6, 60, 0.9, 0.95, 100, 1, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
15.25 |
=PO.SF.PL.Gas.Size(100, 1414.7, 814.7, 100, 0.6, 60, 0.9, 0.95, 100, 2, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
12 |
=PO.SF.PL.Gas.Size(100, 1414.7, 814.7, 100, 0.6, 60, 0.9, 0.95, 100, 3, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
12 |
=PO.SF.PL.Gas.Size(20, 1000, 600, 30, 0.7, 60, 0.82604, 0.92, 75, 1, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
7.981 |
=PO.SF.PL.Gas.Size(20, 1000, 600, 30, 0.7, 60, 0.82604, 0.92, 75, 3, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
6.065 |
=PO.SF.PL.Gas.Size(20, 300, 100, 0.1, 0.7, 60, 0.95, 0.92, 100, 3, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
6.065 |
=PO.SF.PL.Gas.Size(20, 300, 100, 2, 0.7, 60, 0.95, 0.92, 100, 1, {2.067;3.068;4.026;6.065;7.981;10.02;12;13.25;15.25;17.25;19.25;23.25}) |
7.981 |