settings#

settings: ProcessSettings = <thermosteam._settings.ProcessSettings object>#
class ProcessSettings[source]#

A compilation of all settings that may affect BioSTEAM results, including thermodynamic property packages, utility agents, and characterization factors.

Examples

Access or change the Chemical Engineering Plant Cost Index (CEPCI):

>>> from biosteam import settings, Stream
>>> settings.CEPCI # Defaults to average for year 2017
567.5

Access or change cooling agents:

>>> settings.cooling_agents
[<UtilityAgent: cooling_water>,
 <UtilityAgent: chilled_water>,
 <UtilityAgent: chilled_brine>,
 <UtilityAgent: propane>,
 <UtilityAgent: propylene>,
 <UtilityAgent: ethylene>]

Access or change heating agents:

>>> settings.heating_agents
[<UtilityAgent: low_pressure_steam>,
 <UtilityAgent: medium_pressure_steam>,
 <UtilityAgent: high_pressure_steam>,
 <UtilityAgent: natural_gas>]

Access or change the thermodynamic property package:

>>> settings.set_thermo(['Water'], cache=True)
>>> settings.thermo.show()
Thermo(
    chemicals=CompiledChemicals([Water]),
    mixture=IdealMixture(...
        include_excess_energies=False
    ),
    Gamma=DortmundActivityCoefficients,
    Phi=IdealFugacityCoefficients,
    PCF=MockPoyintingCorrectionFactors
)

Access defined chemicals:

>>> settings.chemicals
CompiledChemicals([Water])

Access defined mixture property algorithm:

>>> settings.mixture.show()
IdealMixture(...
    include_excess_energies=False
)

Create stream with default property package:

>>> stream = Stream('stream', Water=2)
>>> stream.thermo is settings.thermo
True
set_thermo(thermo, mixture=None, Gamma=None, Phi=None, PCF=None, cache=None, skip_checks=False, ideal=False)[source]#

Set the default Thermo object. If thermo is not a Thermo object, an attempt is made to convert it to one.

Parameters:
  • thermo (Thermo, Iterable`[:py:class:`str | Chemical]]) – Thermodynamic property package.

  • Gamma (type`[:py:class:`~thermosteam.equilibrium.activity_coefficients.ActivityCoefficients], optional) – Class for computing activity coefficients.

  • Phi (type`[:py:class:`~thermosteam.equilibrium.fugacity_coefficients.FugacityCoefficients], optional) – Class for computing fugacity coefficients.

  • PCF (type`[:py:class:`~thermosteam.equilibrium.poyinting_correction_factors.PoyintingCorrectionFactors], optional) – Class for computing poynting correction factors.

  • cache (bool, optional) – Whether or not to use cached chemicals.

  • skip_checks (bool, optional) – Whether to skip checks for missing or invalid properties.

  • ideal (bool, optional) – Whether to use ideal phase equilibrium and mixture property algorithms.

property thermo: Thermo#

Default thermodynamic property package.

property chemicals: Chemicals#

Default chemicals.

property mixture: Mixture#

Default mixture package.

define_impact_indicator(key, units)[source]#

Define the units of measure for an LCA impact indicator key.

Parameters:
  • key (str) – Name of impact indicator.

  • units (str) – Units of measure for impact indicator.

Notes

This method is useful for setting characterization factors of streams and utilities in different units of measure.

LCA displacement allocation tables also use the impact indicator units of measure defined here.

Examples

Life cycle assessment

get_default_thermo(thermo)[source]#

Return the default Thermo object if thermo is None. Otherwise, return the same object. Otherwise, of thermo is a Thermo object, return the same object.

get_default_chemicals(chemicals)[source]#

Return the default Chemicals object is chemicals is None. Otherwise, if chemicals is a Chemicals object, return the same object.

get_default_mixture(mixture)[source]#

Return a default Mixture object. Otherwise, if mixture is a Mixture object, return the same object.

get_default_flashpkg(flashpkg)[source]#

Warning

This method is not yet ready for users.

get_flashpkg()[source]#

Warning

This method is not yet ready for users.

get_default_flasher(flasher)[source]#

Warning

This method is not yet ready for users.

flasher(IDs=None, N_liquid=None, N_solid=None)[source]#

Warning

This method is not yet ready for users.

set_flashpkg(flashpkg)[source]#

Set the default FlashPackage object.

Parameters:

flashpkg (FlashPackage) – A FlashPackage object that predefines algorithms for equilibrium calculations.

Warning

This method is not yet ready for users.

property CEPCI: float#

Chemical engineering plant cost index (defaults to 567.5 at 2017).

property allocation_properties#

Defined allocation property and basis pairs for LCA.

property cooling_agents: list[UtilityAgent]#

All cooling utilities available.

define_allocation_property(name, basis, stream=None, power_utility=None, heat_utility=None)#

Define a new allocation property by property getters.

property electricity_price: float#

Electricity price [USD/kWhr]

classmethod get_agent(ID)#

Return utility agent with given ID.

classmethod get_cooling_agent(ID)#

Return cooling agent with given ID.

classmethod get_heating_agent(ID)#

Return heating agent with given ID.

property heating_agents: list[UtilityAgent]#

All heating utilities available.

property impact_indicators: dict[str, str]#

User-defined impact indicators and their units of measure.

register_credit(name, price)#

Register new stream utility/credit/fee in BioSTEAM given the name and the price [USD/kg].

register_fee(name, price)#

Register new stream utility/credit/fee in BioSTEAM given the name and the price [USD/kg].

register_utility(name, price)#

Register new stream utility/credit/fee in BioSTEAM given the name and the price [USD/kg].

classmethod set_electricity_CF(key, consumption=None, production=None, basis=None, units=None)#

Set the life-cycle characterization factors for consumption and production on a kWhr basis given the impact key.

Parameters:
  • key (str) – Name of impact indicator.

  • consumption (float, optional) – Impact indicator for electricity consumption.

  • production (float, optional) – Impact indicator for electricity production.

  • basis (str, optional) – Basis of characterization factor. Energy is the only valid dimension. Defaults to ‘kWhr’.

  • units (str, optional) – Units of impact indicator. Before using this argument, the default units of the impact indicator should be defined with settings.define_impact_indicator. Units must also be dimensionally consistent with the default units.

classmethod set_utility_agent_CF(ID, key, value, basis=None, units=None)#

Set the characterization factor of a utility agent for a given impact key.

Parameters:
  • ID (str) – ID of utility agent.

  • key (str) – Key of impact indicator.

  • value (float) – Characterization factor value.

  • basis (str, optional) – Basis of characterization factor. Valid dimensions include weight, molar, and energy (e.g. ‘kg’, ‘kmol’, ‘kJ’). Defaults to ‘kg’.

  • units (str, optional) – Units of impact indicator. Before using this argument, the default units of the impact indicator should be defined with settings.define_impact_indicator. Units must also be dimensionally consistent with the default units.

Raises:
  • ValueError – When the duty characterization factor for a cooling agent is positive (should be negative).

  • DimensionError – When characterization factor is not given in dimensions of weight, molar, or energy.

See also

HeatUtility.get_CF

Examples

Set the GWP characterization factor for low pressure steam at 88.44 kg CO2e / mmBtu (GREET 2020; Steam Production via Small Boiler from North American Natural Gas):

>>> import biosteam as bst
>>> bst.HeatUtility.set_CF('low_pressure_steam', 'GWP [kg CO2e]', 88.44, basis='MMBtu')

Retrieve the GWP characterization factor for low pressure steam on a Btu basis:

>>> bst.HeatUtility.get_CF('low_pressure_steam', 'GWP [kg CO2e]', basis='Btu')
8.844e-05
property skip_simulation_of_units_with_empty_inlets#

Whether to assume unit does not exist when all inlet streams are empty. If inlets are empty and this flag is True, detailed mass and energy balance, design, and costing algorithms are skipped and all outlet streams are emptied.

property stream_prices: dict[str, float]#

Price of stream utilities/fees/credits [USD/kg] which are defined as inlets and outlets to unit operations.

property utility_characterization_factors: dict[tuple[str, str], tuple[float, AbsoluteUnitsOfMeasure]]#

Utility characterization factor data (value and units) by agent ID and impact key.