compressor#
- class Compressor(ID='', ins=None, outs=(), thermo=None, **kwargs)[source]#
Abstract class for compressors that includes design and costing. Child classes should implement the _run method for mass and energy balances. Preliminary design and costing is estimated according to [1].
- class IsothermalCompressor(ID='', ins=None, outs=(), thermo=None, **kwargs)[source]#
Create an isothermal compressor.
- Parameters:
ins (
Stream
]]) – Inlet fluid.outs (
Stream
]]) – Outlet fluid.P (float) – Outlet pressure [Pa].
eta (float) – Isothermal efficiency.
vle (bool) – Whether to perform phase equilibrium calculations on the outflow. If False, the outlet will be assumed to be the same phase as the inlet.
type (str) – Type of compressor : blower/centrifugal/reciprocating. If None, the type will be determined automatically.
Notes
Default compressor selection, design and cost algorithms are adapted from [2].
Examples
Simulate reversible isothermal compression of gaseous hydrogen. Note that we set include_excess_energies=True to correctly account for the non-ideal behavior of hydrogen at high pressures. We further use the Soave-Redlich-Kwong (SRK) equation of state instead of the default Peng-Robinson (PR) because it is more accurate in this regime.
>>> import biosteam as bst >>> from thermo import SRK >>> thermo = bst.Thermo([bst.Chemical('H2', eos=SRK)]) >>> thermo.mixture.include_excess_energies = True >>> bst.settings.set_thermo(thermo) >>> feed = bst.Stream('feed', H2=1, T=298.15, P=20e5, phase='g') >>> K = bst.units.IsothermalCompressor('K', ins=feed, outs='outlet', P=350e5, eta=1) >>> K.simulate() >>> K.show() IsothermalCompressor: K ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 298.15 K, P: 3.5e+07 Pa flow (kmol/hr): H2 1
>>> K.results() Isothermal compressor Units K Electricity Power kW 2.47 Cost USD/hr 0.193 Chilled water Duty kJ/hr -7.26e+03 Flow kmol/hr 7.53 Cost USD/hr 0.0363 Design Type Reciprocating Compressors in parallel 1 Driver Electric motor Ideal power kW 2.1 Ideal duty kJ/hr -7.26e+03 Driver efficiency 0.85 Purchase cost Compressor(s) USD 470 Total purchase cost USD 470 Utility cost USD/hr 0.23
- class IsentropicCompressor(ID='', ins=None, outs=(), thermo=None, **kwargs)[source]#
Create an isentropic compressor.
- Parameters:
ins (
Stream
]]) – Inlet fluid.outs (
Stream
]]) – Outlet fluid.P (float) – Outlet pressure [Pa].
eta (float) – Isentropic efficiency.
vle (bool) – Whether to perform phase equilibrium calculations on the outflow. If False, the outlet will be assumed to be the same phase as the inlet.
type (str) – Type of compressor : blower/centrifugal/reciprocating. If None, the type will be determined automatically.
Notes
Default compressor selection, design and cost algorithms are adapted from [2].
Examples
Simulate isentropic compression of gaseous hydrogen with 70% efficiency:
>>> import biosteam as bst >>> bst.settings.set_thermo(["H2"]) >>> feed = bst.Stream('feed', H2=1, T=25 + 273.15, P=101325, phase='g') >>> K = bst.units.IsentropicCompressor('K1', ins=feed, outs='outlet', P=50e5, eta=0.7) >>> K.simulate() >>> K.show() IsentropicCompressor: K1 ins... [0] feed phase: 'g', T: 298.15 K, P: 101325 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 1152 K, P: 5e+06 Pa flow (kmol/hr): H2 1
>>> K.results() Isentropic compressor Units K1 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 12.7 Flow kmol/hr 0.000396 Cost USD/hr 0.000126 Design Ideal power kW 4.92 Ideal duty kJ/hr 0 Type Centrifugal Compressors in parallel 1 Driver Steam turbine Driver efficiency 0.65 Purchase cost Compressor(s) USD 5.87e+04 Total purchase cost USD 5.87e+04 Utility cost USD/hr 0.000126
Per default, the outlet phase is assumed to be the same as the inlet phase. If phase changes are to be accounted for, set vle=True:
>>> import biosteam as bst >>> bst.settings.set_thermo(["H2O"]) >>> feed = bst.MultiStream('feed', T=372.75, P=1e5, l=[('H2O', 0.1)], g=[('H2O', 0.9)]) >>> K = bst.units.IsentropicCompressor('K2', ins=feed, outs='outlet', P=100e5, eta=1.0, vle=True) >>> K.simulate() >>> K.show() IsentropicCompressor: K2 ins... [0] feed phases: ('g', 'l'), T: 372.75 K, P: 100000 Pa flow (kmol/hr): (g) H2O 0.9 (l) H2O 0.1 outs... [0] outlet phases: ('g', 'l'), T: 798.63 K, P: 1e+07 Pa flow (kmol/hr): (g) H2O 1
>>> K.results() Isentropic compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 9.8 Flow kmol/hr 0.000305 Cost USD/hr 9.66e-05 Design Ideal power kW 5.42 Ideal duty kJ/hr 0 Type Centrifugal Compressors in parallel 1 Driver Steam turbine Driver efficiency 0.65 Purchase cost Compressor(s) USD 4.98e+04 Total purchase cost USD 4.98e+04 Utility cost USD/hr 9.66e-05
>>> K.results() Isentropic compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 9.8 Flow kmol/hr 0.000305 Cost USD/hr 9.66e-05 Design Ideal power kW 5.42 Ideal duty kJ/hr 0 Type Centrifugal Compressors in parallel 1 Driver Steam turbine Driver efficiency 0.65 Purchase cost Compressor(s) USD 4.98e+04 Total purchase cost USD 4.98e+04 Utility cost USD/hr 9.66e-05
>>> K.results() Isentropic compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 9.8 Flow kmol/hr 0.000305 Cost USD/hr 9.66e-05 Design Ideal power kW 5.42 Ideal duty kJ/hr 0 Type Centrifugal Compressors in parallel 1 Driver Steam turbine Driver efficiency 0.65 Purchase cost Compressor(s) USD 4.98e+04 Total purchase cost USD 4.98e+04 Utility cost USD/hr 9.66e-05
Per default, the outlet phase is assumed to be the same as the inlet phase. If phase changes are to be accounted for, set vle=True:
>>> import biosteam as bst >>> bst.settings.set_thermo(["H2O"]) >>> feed = bst.MultiStream('feed', T=372.75, P=1e5, l=[('H2O', 0.1)], g=[('H2O', 0.9)]) >>> K = bst.units.IsentropicCompressor('K2', ins=feed, outs='outlet', P=100e5, eta=1.0, vle=True) >>> K.simulate() >>> K.show() IsentropicCompressor: K2 ins... [0] feed phases: ('g', 'l'), T: 372.75 K, P: 100000 Pa flow (kmol/hr): (g) H2O 0.9 (l) H2O 0.1 outs... [0] outlet phases: ('g', 'l'), T: 798.63 K, P: 1e+07 Pa flow (kmol/hr): (g) H2O 1
>>> K.results() Isentropic compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 9.8 Flow kmol/hr 0.000305 Cost USD/hr 9.66e-05 Design Ideal power kW 5.42 Ideal duty kJ/hr 0 Type Centrifugal Compressors in parallel 1 Driver Steam turbine Driver efficiency 0.65 Purchase cost Compressor(s) USD 4.98e+04 Total purchase cost USD 4.98e+04 Utility cost USD/hr 9.66e-05
- class PolytropicCompressor(ID='', ins=None, outs=(), thermo=None, **kwargs)[source]#
Create a polytropic compressor.
- Parameters:
ins (
Stream
]]) – Inlet fluid.outs (
Stream
]]) – Outlet fluid.P (float) – Outlet pressure [Pa].
eta (float) – Polytropic efficiency.
vle (bool) – Whether to perform phase equilibrium calculations on the outflow. If False, the outlet will be assumed to be the same phase as the inlet.
method (str) – ‘schultz’/’hundseid’. Calculation method for polytropic work. ‘hundseid’ is recommend for real gases at high pressure ratios.
n_steps (int) – Number of virtual steps used in numerical integration for hundseid method.
compressor_type (str) – Type of compressor : blower/centrifugal/reciprocating. If None, the type will be determined automatically.
Notes
Default compressor selection, design and cost algorithms are adapted from [2].
Examples
Simulate polytropic compression of hydrogen with 70% efficiency using the Schultz method [3]:
>>> import biosteam as bst >>> thermo = bst.Thermo([bst.Chemical('H2')]) >>> thermo.mixture.include_excess_energies = True >>> bst.settings.set_thermo(thermo) >>> feed = bst.Stream('feed', H2=1, T=25 + 273.15, P=20e5, phase='g') >>> K = bst.units.PolytropicCompressor('K1', ins=feed, outs='outlet', P=350e5, eta=0.7, method='schultz') >>> K.simulate() >>> K.show(T='degC:.3g') PolytropicCompressor: K1 ins... [0] feed phase: 'g', T: 25 degC, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 713 degC, P: 3.5e+07 Pa flow (kmol/hr): H2 1 >>> K.results() Polytropic compressor Units K1 Electricity Power kW 6.76 Cost USD/hr 0.529 Design Polytropic work 2.07e+04 Type Reciprocating Compressors in parallel 1 Driver Electric motor Driver efficiency 0.85 Purchase cost Compressor(s) USD 1.62e+03 Total purchase cost USD 1.62e+03 Utility cost USD/hr 0.529
Repeat using Hundseid method [4]:
>>> K = bst.units.PolytropicCompressor('K1', ins=feed, outs='outlet', P=350e5, eta=0.7, method='hundseid', n_steps=200) >>> K.simulate() >>> K.show() PolytropicCompressor: K1 ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 958.07 K, P: 3.5e+07 Pa flow (kmol/hr): H2 1 >>> K.results() Polytropic compressor Units K1 Electricity Power kW 6.48 Cost USD/hr 0.507 Design Polytropic work 1.98e+04 Type Reciprocating Compressors in parallel 1 Driver Electric motor Driver efficiency 0.85 Purchase cost Compressor(s) USD 1.54e+03 Total purchase cost USD 1.54e+03 Utility cost USD/hr 0.507 >>> K.results() Polytropic compressor Units K1 Electricity Power kW 6.48 Cost USD/hr 0.507 Design Polytropic work 1.98e+04 Type Reciprocating Compressors in parallel 1 Driver Electric motor Driver efficiency 0.85 Purchase cost Compressor(s) USD 1.54e+03 Total purchase cost USD 1.54e+03 Utility cost USD/hr 0.507
Repeat using Hundseid method [4]:
>>> K = bst.units.PolytropicCompressor('K1', ins=feed, outs='outlet', P=350e5, eta=0.7, method='hundseid', n_steps=200) >>> K.simulate() >>> K.show() PolytropicCompressor: K1 ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 958.07 K, P: 3.5e+07 Pa flow (kmol/hr): H2 1
>>> K.results() Polytropic compressor Units K1 Electricity Power kW 6.48 Cost USD/hr 0.507 Design Polytropic work 1.98e+04 Type Reciprocating Compressors in parallel 1 Driver Electric motor Driver efficiency 0.85 Purchase cost Compressor(s) USD 1.54e+03 Total purchase cost USD 1.54e+03 Utility cost USD/hr 0.507
- class MultistageCompressor(ID='', ins=None, outs=(), thermo=None, **kwargs)[source]#
Create a multistage compressor. Models multistage polytropic or isentropic compression with intermittent cooling.
There are two setup options:
- Option 1: Define pr and n_stages (optionally eta, vle, type).
Creates n_stages identical isentropic compressors. Each compressor is followed by a heat exchanger, which cools the effluent to inlet temperature.
- Option 2: Define compressors and hxs.
Takes a list of pre-defined compressors and heat exchangers and connects them in series. This option allows more flexibility in terms of the type of compressor (isentropic/polytropic) and parameterization (e.g. each stage can have different efficiencies and outlet temperatures).
- Parameters:
ins (
Stream
]]) – Inlet fluid.outs (
Stream
]]) – Outlet fluid.pr (float) – (setup option 1) Pressure ratio between isentropic stages.
n_stages (float) – (setup option 1) Number of isentropic stages.
eta (float) – (setup option 1) Isentropic efficiency.
vle (bool) – (setup option 1) Whether to perform phase equilibrium calculations on the outflow of each stage. If False, the outlet will be assumed to be the same phase as the inlet.
compressor_type (str) – (setup option 1) Type of compressor : blower/centrifugal/reciprocating. If None, the type will be determined automatically.
compressors (list[_CompressorBase]) – (setup option 2) List of compressors to use for each stage.
hxs (list[HX]) – (setup option 2) List of heat exchangers to use for each stage.
Notes
Default compressor selection, design and cost algorithms are adapted from [2].
Examples
Simulate multistage compression of gaseous hydrogen (simple setup). Hydrogen is compressed isentropically (with an efficiency of 70%) from 20 bar to 320 bar in four stages (pressure ratio of two in each stage):
>>> import biosteam as bst >>> thermo = bst.Thermo([bst.Chemical('H2')]) >>> thermo.mixture.include_excess_energies = True >>> bst.settings.set_thermo(thermo) >>> feed = bst.Stream('feed', H2=1, T=298.15, P=20e5, phase='g') >>> K = bst.units.MultistageCompressor('K', ins=feed, outs='outlet', pr=2, n_stages=4, eta=0.7) >>> K.simulate() >>> K.show() MultistageCompressor: K ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 298.15 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
>>> K.results() Multistage compressor Units K Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 5.68 Flow kmol/hr 0.000177 Cost USD/hr 5.6e-05 Chilled water Duty kJ/hr -1.12e+04 Flow kmol/hr 7.42 Cost USD/hr 0.0559 Design Type Multistage compressor Area ft^2 1.54 Purchase cost K k1 - Compressor(s) USD 1.45e+04 K h1 - Double pipe USD 568 K k2 - Compressor(s) USD 1.46e+04 K h2 - Double pipe USD 675 K k3 - Compressor(s) USD 1.48e+04 K h3 - Double pipe USD 956 K k4 - Compressor(s) USD 1.52e+04 K h4 - Double pipe USD 1.78e+03 Total purchase cost USD 6.3e+04 Utility cost USD/hr 0.056
Show the fluid state at the outlet of each heat exchanger:
>>> for hx in K.hxs: ... hx.outs[0].show() Stream: K_H1__K_K2 from <HXutility: K_H1> to <IsentropicCompressor: K_K2> phase: 'g', T: 298.15 K, P: 4e+06 Pa flow (kmol/hr): H2 1 Stream: K_H2__K_K3 from <HXutility: K_H2> to <IsentropicCompressor: K_K3> phase: 'g', T: 298.15 K, P: 8e+06 Pa flow (kmol/hr): H2 1 Stream: K_H3__K_K4 from <HXutility: K_H3> to <IsentropicCompressor: K_K4> phase: 'g', T: 298.15 K, P: 1.6e+07 Pa flow (kmol/hr): H2 1 Stream: outlet from <MultistageCompressor: K> phase: 'g', T: 298.15 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
If we want to setup more complex multistage compression schemes, we can pre-define the compressors and heat exchangers and pass them as a list to MultistageCompressor:
>>> ks = [ ... bst.units.IsentropicCompressor(P=30e5, eta=0.6), ... bst.units.PolytropicCompressor(P=50e5, eta=0.65), ... bst.units.IsentropicCompressor(P=90e5, eta=0.70), ... bst.units.PolytropicCompressor(P=170e5, eta=0.75), ... bst.units.IsentropicCompressor(P=320e5, eta=0.80), ... ] >>> hxs = [bst.units.HXutility(T=T) for T in [310, 350, 400, 350, 298]] >>> K = bst.units.MultistageCompressor('K2', ins=feed, outs='outlet', compressors=ks, hxs=hxs) >>> K.simulate() >>> K.show() MultistageCompressor: K2 ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 298 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
>>> K.results() Multistage compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 6.48 Flow kmol/hr 0.000202 Cost USD/hr 6.39e-05 Chilled water Duty kJ/hr -5.63e+03 Flow kmol/hr 3.73 Cost USD/hr 0.0282 Cooling water Duty kJ/hr -7.15e+03 Flow kmol/hr 4.88 Cost USD/hr 0.00238 Design Type Multistage compressor Area ft^2 1.14 Purchase cost K2 k1 - Compressor(s) USD 1.11e+04 K2 h1 - Double pipe USD 297 K2 k2 - Compressor(s) USD 1.3e+04 K2 h2 - Double pipe USD 199 K2 k3 - Compressor(s) USD 1.44e+04 K2 h3 - Double pipe USD 129 K2 k4 - Compressor(s) USD 1.64e+04 K2 h4 - Double pipe USD 753 K2 k5 - Compressor(s) USD 1.45e+04 K2 h5 - Double pipe USD 2.03e+03 Total purchase cost USD 7.27e+04 Utility cost USD/hr 0.0306
Show the fluid state at the outlet of each heat exchanger:
>>> for hx in K.hxs: ... hx.outs[0].show() Stream: K2_H1__K2_K2 from <HXutility: K2_H1> to <PolytropicCompressor: K2_K2> phase: 'g', T: 310 K, P: 3e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H2__K2_K3 from <HXutility: K2_H2> to <IsentropicCompressor: K2_K3> phase: 'g', T: 350 K, P: 5e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H3__K2_K4 from <HXutility: K2_H3> to <PolytropicCompressor: K2_K4> phase: 'g', T: 400 K, P: 9e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H4__K2_K5 from <HXutility: K2_H4> to <IsentropicCompressor: K2_K5> phase: 'g', T: 350 K, P: 1.7e+07 Pa flow (kmol/hr): H2 1 Stream: outlet from <MultistageCompressor: K2> phase: 'g', T: 298 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
Show the fluid state at the outlet of each heat exchanger:
>>> for hx in K.hxs: ... hx.outs[0].show() Stream: K2_H1__K2_K2 from <HXutility: K2_H1> to <PolytropicCompressor: K2_K2> phase: 'g', T: 310 K, P: 3e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H2__K2_K3 from <HXutility: K2_H2> to <IsentropicCompressor: K2_K3> phase: 'g', T: 350 K, P: 5e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H3__K2_K4 from <HXutility: K2_H3> to <PolytropicCompressor: K2_K4> phase: 'g', T: 400 K, P: 9e+06 Pa flow (kmol/hr): H2 1 Stream: K2_H4__K2_K5 from <HXutility: K2_H4> to <IsentropicCompressor: K2_K5> phase: 'g', T: 350 K, P: 1.7e+07 Pa flow (kmol/hr): H2 1 Stream: outlet from <MultistageCompressor: K2> phase: 'g', T: 298 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
If we want to setup more complex multistage compression schemes, we can pre-define the compressors and heat exchangers and pass them as a list to MultistageCompressor:
>>> ks = [ ... bst.units.IsentropicCompressor(P=30e5, eta=0.6), ... bst.units.PolytropicCompressor(P=50e5, eta=0.65), ... bst.units.IsentropicCompressor(P=90e5, eta=0.70), ... bst.units.PolytropicCompressor(P=170e5, eta=0.75), ... bst.units.IsentropicCompressor(P=320e5, eta=0.80), ... ] >>> hxs = [bst.units.HXutility(T=T) for T in [310, 350, 400, 350, 298]] >>> K = bst.units.MultistageCompressor('K2', ins=feed, outs='outlet', compressors=ks, hxs=hxs) >>> K.simulate() >>> K.show() MultistageCompressor: K2 ins... [0] feed phase: 'g', T: 298.15 K, P: 2e+06 Pa flow (kmol/hr): H2 1 outs... [0] outlet phase: 'g', T: 298 K, P: 3.2e+07 Pa flow (kmol/hr): H2 1
>>> K.results() Multistage compressor Units K2 Electricity Power kW 0 Cost USD/hr 0 High pressure steam Duty kJ/hr 6.48 Flow kmol/hr 0.000202 Cost USD/hr 6.39e-05 Chilled water Duty kJ/hr -5.63e+03 Flow kmol/hr 3.73 Cost USD/hr 0.0282 Cooling water Duty kJ/hr -7.15e+03 Flow kmol/hr 4.88 Cost USD/hr 0.00238 Design Type Multistage compressor Area ft^2 1.14 Purchase cost K2 k1 - Compressor(s) USD 1.11e+04 K2 h1 - Double pipe USD 297 K2 k2 - Compressor(s) USD 1.3e+04 K2 h2 - Double pipe USD 199 K2 k3 - Compressor(s) USD 1.44e+04 K2 h3 - Double pipe USD 129 K2 k4 - Compressor(s) USD 1.64e+04 K2 h4 - Double pipe USD 753 K2 k5 - Compressor(s) USD 1.45e+04 K2 h5 - Double pipe USD 2.03e+03 Total purchase cost USD 7.27e+04 Utility cost USD/hr 0.0306
References