PO.FL.QC.Hoffman
Description
Checks the equilibrium ratios (K = y/x, gas over liquid mole fraction) of a separator test, a flash or a recombined sample. Hoffman, Crump and Hocott (1953) showed that log(K·p) of the components of a fluid at one pressure and temperature falls on a straight line against a characterization factor F built from each component's boiling point, critical temperature and critical pressure. A component well off the line has a wrong analysis (often the gas or liquid sample of one of the heavy fractions); a whole set that scatters says the separator was not at equilibrium or the samples are not a pair. The function returns F, log(K·p), the least-squares line and its R², and each component's deviation from the line, so a sheet can draw the plot and flag the outliers.
Formula
=LAMBDA(k, p, t, tb, tc, pc, output, LET(
idx, (output="F")*1+(output="LogKp")*2+(output="Slope")*3+(output="Intercept")*4+(output="R2")*5+(output="Dev")*6,
IF(OR(p<=0, t<=-459.67, idx=0, ROWS(k)<2, MIN(k)<=0, MIN(tb)<=0, MIN(tc-tb)<=0, MIN(pc)<=0), NA(), LET(
ff, LOG10(pc/14.696)/(1/tb-1/tc)*(1/tb-1/(t+459.67)), yy, LOG10(k*p), nn, ROWS(k), xa, SUM(ff)/nn, ya, SUM(yy)/nn, sxx, SUM((ff-xa)^2), sxy, SUM((ff-xa)*(yy-ya)), syy, SUM((yy-ya)^2), sl, sxy/sxx, ic, ya-sl*xa, CHOOSE(idx, ff, yy, sl, ic, 1-(syy-sxy^2/sxx)/(syy+(syy=0)), yy-ic-sl*ff)))))Parameters
| Parameter | Unit | Description |
|---|---|---|
k |
— | Equilibrium ratio y/x of each component, a column; above 0 |
p |
psia | Pressure of the separator or flash; above 0 |
t |
°F | Its temperature |
tb |
°R | Normal boiling point of each component, a column |
tc |
°R | Critical temperature of each component, a column; above tb |
pc |
psia | Critical pressure of each component, a column; above 0 |
output |
text | "F" characterization factor (column), "LogKp" log10(K·p) (column), "Dev" deviation of log(K·p) from the line (column), "Slope", "Intercept" or "R2" |
Examples
| Invocation | Expected |
|---|---|
=PO.FL.QC.Hoffman({40.76601;5.22284;1.17779;0.29732;0.08555;0.02694}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "F") |
[2.497111634, 1.610147209, 0.9604175036, 0.3599778329, -0.18271004, -0.6819440738] |
=PO.FL.QC.Hoffman({40.76601;5.22284;1.17779;0.29732;0.08555;0.02694}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "Slope") |
0.9991940565 |
=PO.FL.QC.Hoffman({40.76601;5.22284;1.17779;0.29732;0.08555;0.02694}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "Intercept") |
1.172195414 |
=PO.FL.QC.Hoffman({40.76601;5.22284;1.17779;0.29732;0.08555;0.02694}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "R2") |
0.9999960888 |
=PO.FL.QC.Hoffman({40.76601;5.22284;1.17779;0.29732;0.08555;0.02694}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "Dev") |
[0.00256710764, -0.003574795832, -0.001207594435, 0.000904417335, 0.002150804161, -0.0008399388688] |
=PO.FL.QC.Hoffman({38.6906;5.2285;1.2068;0.3113;0.0915;0.0297}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "LogKp") |
[3.647168883, 2.77794053, 2.141198719, 1.552742539, 1.020984512, 0.5323198672] |
=PO.FL.QC.Hoffman({38.6906;5.2285;1.2068;0.3113;0.0915;0.0297}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "Slope") |
0.9798651612 |
=PO.FL.QC.Hoffman({38.6906;5.2285;1.2068;0.3113;0.0915;0.0297}, 114.7, 75, {201;332.2;415.9;490.8;556.6;615.4}, {343;549.6;665.7;765.3;845.4;913.3}, {666.4;706.5;616;550.6;488.6;436.9}, "Intercept") |
1.200205042 |
=IF(ISNA(PO.FL.QC.Hoffman({40.76601;0}, 114.7, 75, {201;332.2}, {343;549.6}, {666.4;706.5}, "Slope")), 1, 0) |
1 |