Compressor stage explorer

Move the suction and discharge pressures, the number of stages, the isentropic efficiency and the cooler outlet temperature, and watch the shaft power, each stage's discharge temperature, the cooling duty and the liquid the scrubbers knock out move with them.

Open in the workbench Open the live page

Live preview

Engineering use case UC-PROCESS-005 (Recompress the HP gas and cool it for export). The script process-export-compression does the same on the choke-separation entry's HP vapour, with a pump beside it.

What an engineer learns by moving the sliders: the page opens on 20 MMscf/d of a 21.7 kg/kmol associated vapour at 40 °C, compressed from 30 to 100 bar in one stage at 75 % isentropic efficiency. That takes 1,178 kW and discharges at 145 °C, just inside a 150 °C limit. Two stages at the same ratio, 1.83 each, cooled to 40 °C between them, take 1,069 kW, 9 % less, and never exceed 91 °C; three stages save another 3 %, and four only 2 % more. The power saved shrinks with each stage while the coolers, scrubbers and piping grow, which is why export trains stop at two or three. Raise the discharge to 150 bar, or lower the suction, and the single stage runs past 150 °C: the temperature, not the power, is what forces the second stage. A lower efficiency raises both, and a warmer cooler outlet raises the next stage's power.

The stages share one ratio, (Pd/Ps)^(1/n), the textbook minimum-power split when every stage starts at the same temperature, and one isentropic efficiency; the power is shaft power with no mechanical or seal losses, and a vendor's polytropic curve would replace both.

Source compressor-stages.dashboard

@using Team76.Engineering.Process
@using Team76.Engineering.Process.Fluids
@using Team76.Engineering.Process.UnitOps

@{ var r = Compute(); }

<Page MaxWidth="Narrow">
    <Section Title="Duty">
        <Slider Label="Suction pressure" @bind-Value="Suction" Min="5" Max="60" Step="1" Unit="bar" />
        <Slider Label="Discharge pressure" @bind-Value="Discharge" Min="40" Max="200" Step="5" Unit="bar" />
    </Section>

    <Section Title="Machine">
        <Slider Label="Stages" @bind-Value="Stages" Min="1" Max="4" Step="1" Unit="stages" />
        <Slider Label="Isentropic efficiency" @bind-Value="Efficiency" Min="0.6" Max="0.9" Step="0.01" Unit="fraction" />
        <Slider Label="Cooler outlet" @bind-Value="CoolTo" Min="25" Max="60" Step="1" Unit="°C" />
    </Section>

    <Section Title="The train">
        <KpiRow>
            <Value Label="Shaft power" Number="@r.Power" Unit="kW" Format="N0" Note="@r.RatioNote" />
            <Value Label="Hottest discharge" Number="@r.HottestDischarge" Unit="°C" Format="N1"
                   Status="@(r.HottestDischarge <= 150 ? "good" : "warn")"
                   StatusText="@(r.HottestDischarge <= 150 ? "within a 150 °C limit" : "above 150 °C: add a stage")" />
            <Value Label="Cooling duty" Number="@r.Cooling" Unit="kW" Format="N0" Note="intercoolers and aftercooler" />
            <Value Label="Liquid knocked out" Number="@r.Liquid" Unit="kg/h" Format="N0" Note="in the scrubbers" />
        </KpiRow>
    </Section>

    <Section Title="One to four stages at these settings">
        <Chart Rows="r.ByStages" X="Stages:stages" Series="Hottest:°C" Height="260" YMin="0">
            <HLine Y="150" Text="150 °C" />
        </Chart>
        <Chart Rows="r.ByStages" X="Stages:stages" Series="Power:kW" Height="260" YMin="0" />
    </Section>

    <Section Title="Stages">
        <Table Rows="r.Rows" Columns="Stage:stage, Ratio:ratio, Isentropic:°C, Discharge:°C, Power:kW, Cooler:kW" />
    </Section>

    <Notes Text="@Method" />
</Page>

@code {
    // 20 MMscf/d of associated vapour at 40 °C: Peng-Robinson with estimated kij.
    double Suction = 30;
    double Discharge = 100;
    double Stages = 1;
    double Efficiency = 0.75;
    double CoolTo = 40;

    static readonly string[] Names = ["nitrogen", "carbon dioxide", "methane", "ethane", "propane", "i-butane", "n-butane", "i-pentane", "n-pentane", "n-hexane"];
    static readonly double[] MolePercent = [1, 2, 78, 9, 5.5, 1.2, 1.8, 0.6, 0.5, 0.4];
    const double Mmscfd = 20;

    record Row(double Stage, double Ratio, double Isentropic, double Discharge, double Power, double Cooler);

    record Count(double Stages, double Power, double Hottest);

    record Train(IReadOnlyList<Row> Rows, double Power, double Cooling, double Liquid, double Ratio);

    record Result(IReadOnlyList<Row> Rows, IReadOnlyList<Count> ByStages, double Power, double HottestDischarge, double Cooling, double Liquid, string RatioNote);

    static string Inv(FormattableString s) => FormattableString.Invariant(s);

    Train Run(int n)
    {
        var fluid = FluidBuilder.PengRobinson().Components(Names).WithKij(KijSource.Estimated()).Build();
        double molPerSecond = Mmscfd * 1e6 / 379.49 * 453.59237 / 86400;
        var stream = MaterialStream.FromTP(fluid, Quantity.Celsius(40), Quantity.Bar(Suction),
            MolePercent.Select(x => Quantity.MolePerSecond(x / 100 * molPerSecond)).ToArray());

        double ratio = Math.Pow(Math.Max(Discharge, Suction * 1.05) / Suction, 1.0 / n);
        var rows = new List<Row>();
        double power = 0, cooling = 0, liquid = 0;
        for (var i = 1; i <= n; i++)
        {
            // Each stage: compress at one ratio, cool, and scrub out what condenses before the next stage.
            var stage = new Compressor($"K-{i}", MachineSpec.AtPressureRatio(ratio, Efficiency)).Run(stream);
            var cooled = new Heater($"E-{i}", HeaterSpec.AtOutletTemperature(Quantity.Celsius(CoolTo))).Run(stage.Outlet(Compressor.OutletPort));
            var scrubbed = new Separator($"V-{i}", SeparatorSpec.AtPressure(Quantity.Pascal(stage.OutletPressure), SeparatorPhases.TwoPhase)).Run(cooled.Outlet(Heater.OutletPort));
            stream = scrubbed.Outlet(Separator.GasPort);

            power += stage.Power;
            cooling += -cooled.Duty;
            liquid += scrubbed.Outlet(Separator.LiquidPort).MassFlow * 3600;
            rows.Add(new Row(i, Math.Round(ratio, 3), Math.Round(stage.IsentropicOutletTemperature - 273.15, 1), Math.Round(stage.OutletTemperature - 273.15, 1), Math.Round(stage.Power / 1000, 0), Math.Round(-cooled.Duty / 1000, 0)));
        }

        return new Train(rows, power / 1000, cooling / 1000, liquid, ratio);
    }

    Result Compute()
    {
        var trains = Enumerable.Range(1, 4).Select(Run).ToList();
        var chosen = trains[(int)Stages - 1];
        var byStages = trains.Select((t, i) => new Count(i + 1, Math.Round(t.Power, 0), t.Rows.Max(x => x.Discharge))).ToList();
        return new Result(chosen.Rows, byStages, chosen.Power, chosen.Rows.Max(x => x.Discharge), chosen.Cooling, chosen.Liquid, Inv($"{(int)Stages} × ratio {chosen.Ratio:F2}"));
    }

    const string Method = "Each stage is a Team76.Engineering.Process Compressor at one pressure ratio, (Pd/Ps)^(1/n), and one isentropic efficiency: a PS flash for the isentropic outlet, H2 = H1 + (H2s - H1)/eta, then a PH flash for the actual outlet. A Heater cools each discharge to the cooler outlet temperature, and a Separator at the stage pressure scrubs out the liquid before the next stage. The vapour is 20 MMscf/d of an associated gas (78 % methane) at 40 °C, Peng-Robinson with estimated kij. Equal ratios are the textbook minimum-power split for equal suction temperatures; the power is shaft power with no mechanical losses.";
}