# idaes.core package¶

## idaes.core.control_volume0d module¶

Base class for control volumes

class idaes.core.control_volume0d.ControlVolume0DBlock(*args, **kwargs)

ControlVolume0DBlock is a specialized Pyomo block for IDAES non-discretized control volume blocks, and contains instances of ControlVolume0DBlockData.

ControlVolume0DBlock should be used for any control volume with a defined volume and distinct inlets and outlets which does not require spatial discretization. This encompases most basic unit models used in process modeling.

Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys dynamic Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent, True - set as a dynamic model, False - set as a steady-state model} has_holdup Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms} property_package Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.} property_package_args A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.} reaction_package Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.} reaction_package_args A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.} auto_construct If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.} initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (ControlVolume0DBlock) New instance
class idaes.core.control_volume0d.ControlVolume0DBlockData(component)[source]

0-Dimensional (Non-Discretised) ControlVolume Class

This class forms the core of all non-discretized IDAES models. It provides methods to build property and reaction blocks, and add mass, energy and momentum balances. The form of the terms used in these constraints is specified in the chosen property package.

add_geometry()[source]

Method to create volume Var in ControlVolume.

Parameters: None – None
add_phase_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]

This method constructs a set of 0D material balances indexed by time, phase and component.

Parameters: has_rate_reactions – whether default generation terms for rate reactions should be included in material balances has_equilibrium_reactions – whether generation terms should for chemical equilibrium reactions should be included in material balances has_phase_equilibrium – whether generation terms should for phase equilibrium behaviour should be included in material balances has_mass_transfer – whether generic mass transfer terms should be included in material balances custom_molar_term – a Pyomo Expression representing custom terms to be included in material balances on a molar basis. Expression must be indexed by time, phase list and component list custom_mass_term – a Pyomo Expression representing custom terms to be included in material balances on a mass basis. Expression must be indexed by time, phase list and component list Constraint object representing material balances
add_phase_energy_balances(*args, **kwargs)[source]

Method for adding energy balances (including kinetic energy) indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_enthalpy_balances(*args, **kwargs)[source]

Method for adding enthalpy balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_momentum_balances(*args, **kwargs)[source]

Method for adding momentum balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_pressure_balances(*args, **kwargs)[source]

Method for adding pressure balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_reaction_blocks(has_equilibrium=None)[source]

This method constructs the reaction block for the control volume.

Parameters: has_equilibrium – indicates whether equilibrium calculations will be required in reaction block package_arguments – dict-like object of arguments to be passed to reaction block as construction arguments None
add_state_blocks(information_flow=<FlowDirection.forward: 1>, has_phase_equilibrium=None)[source]

This method constructs the inlet and outlet state blocks for the control volume.

Parameters: information_flow – a FlowDirection Enum indicating whether information flows from inlet-to-outlet or outlet-to-inlet has_phase_equilibrium – indicates whether equilibrium calculations will be required in state blocks package_arguments – dict-like object of arguments to be passed to state blocks as construction arguments None
add_total_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]

This method constructs a set of 0D material balances indexed by time and component.

Parameters: - whether default generation terms for rate (has_rate_reactions) – reactions should be included in material balances - whether generation terms should for (has_equilibrium_reactions) – chemical equilibrium reactions should be included in material balances - whether generation terms should for phase (has_phase_equilibrium) – equilibrium behaviour should be included in material balances - whether generic mass transfer terms should be (has_mass_transfer) – included in material balances - a Pyomo Expression representing custom terms to (custom_mass_term) – be included in material balances on a molar basis. Expression must be indexed by time, phase list and component list - a Pyomo Expression representing custom terms to – be included in material balances on a mass basis. Expression must be indexed by time, phase list and component list Constraint object representing material balances
add_total_element_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_elemental_term=None)[source]

This method constructs a set of 0D element balances indexed by time.

Parameters: - whether default generation terms for rate (has_rate_reactions) – reactions should be included in material balances - whether generation terms should for (has_equilibrium_reactions) – chemical equilibrium reactions should be included in material balances - whether generation terms should for phase (has_phase_equilibrium) – equilibrium behaviour should be included in material balances - whether generic mass transfer terms should be (has_mass_transfer) – included in material balances - a Pyomo Expression representing custom (custom_elemental_term) – terms to be included in material balances on a molar elemental basis. Expression must be indexed by time and element list Constraint object representing material balances
add_total_energy_balances(*args, **kwargs)[source]

Method for adding a total energy balance (including kinetic energy) to the control volume.

See specific control volume documentation for details.

add_total_enthalpy_balances(has_heat_of_reaction=False, has_heat_transfer=False, has_work_transfer=False, custom_term=None)[source]

This method constructs a set of 0D enthalpy balances indexed by time and phase.

Parameters: - whether terms for heat of reaction should (has_heat_of_reaction) – be included in enthalpy balance - whether terms for heat transfer should be (has_heat_transfer) – included in enthalpy balances - whether terms for work transfer should be (has_work_transfer) – included in enthalpy balances - a Pyomo Expression representing custom terms to (custom_term) – be included in enthalpy balances. Expression must be indexed by time and phase list Constraint object representing enthalpy balances
add_total_material_balances(*args, **kwargs)[source]

Method for adding a total material balance to the control volume.

See specific control volume documentation for details.

add_total_momentum_balances(*args, **kwargs)[source]

Method for adding a total momentum balance to the control volume.

See specific control volume documentation for details.

add_total_pressure_balances(has_pressure_change=False, custom_term=None)[source]

This method constructs a set of 0D pressure balances indexed by time.

Parameters: - whether terms for pressure change should be (has_pressure_change) – included in enthalpy balances - a Pyomo Expression representing custom terms to (custom_term) – be included in pressure balances. Expression must be indexed by time Constraint object representing pressure balances
build()[source]

Build method for ControlVolume0DBlock blocks.

Returns: None
initialize(state_args=None, outlvl=0, optarg=None, solver='ipopt', hold_state=True)[source]

Initialisation routine for 0D control volume (default solver ipopt)

Keyword Arguments:

• state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
• outlvl – sets output level of initialisation routine. Valid values: 0 - no output (default), 1 - return solver state for each step in routine, 2 - include solver output infomation (tee=True)
• optarg – solver options dictionary object (default=None)
• solver – str indicating whcih solver to use during initialization (default = ‘ipopt’)
• hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - True. Valid values: True - states variables are not unfixed, and a dict of returned containing flags for which states were fixed during initialization, False - state variables are unfixed after initialization by calling the release_state method.
Returns:

If hold_states is True, returns a dict containing flags for which states were fixed during initialization.

model_check()[source]

This method executes the model_check methods on the associated state blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

Parameters: None – None
release_state(flags, outlvl=0)[source]

Method to release state variables fixed during initialisation.

Keyword Arguments:

• flags – dict containing information of which state variables were fixed during initialization, and should now be unfixed. This dict is returned by initialize if hold_state = True.
• outlvl – sets output level of logging
Returns:

None

## idaes.core.control_volume1d module¶

Base class for control volumes

class idaes.core.control_volume1d.ControlVolume1DBlock(*args, **kwargs)

ControlVolume1DBlock is a specialized Pyomo block for IDAES control volume blocks discretized in one spatial direction, and contains instances of ControlVolume1DBlockData.

ControlVolume1DBlock should be used for any control volume with a defined volume and distinct inlets and outlets where there is a single spatial domain parallel to the material flow direction. This encompases unit operations such as plug flow reactors and pipes.

Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys dynamic Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent, True - set as a dynamic model, False - set as a steady-state model} has_holdup Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms} property_package Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.} property_package_args A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.} reaction_package Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.} reaction_package_args A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.} auto_construct If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.} area_definition Argument defining whether area variable should be spatially variant or not. default - DistributedVars.uniform. Valid values: { DistributedVars.uniform - area does not vary across spatial domian, DistributedVars.variant - area can vary over the domain and is indexed by time and space.} transformation_method Method to use to transform domain. Must be a method recognised by the Pyomo TransformationFactory. transformation_scheme Scheme to use when transformating domain. See Pyomo documentation for supported schemes. finite_elements Number of finite elements to use in transformation (equivalent to Pyomo nfe argument). collocation_points Number of collocation points to use (equivalent to Pyomo ncp argument). initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (ControlVolume1DBlock) New instance
class idaes.core.control_volume1d.ControlVolume1DBlockData(component)[source]

1-Dimensional ControlVolume Class

This class forms the core of all 1-D IDAES models. It provides methods to build property and reaction blocks, and add mass, energy and momentum balances. The form of the terms used in these constraints is specified in the chosen property package.

add_geometry(length_domain=None, length_domain_set=[0.0, 1.0], flow_direction=<FlowDirection.forward: 1>)[source]

Method to create spatial domain and volume Var in ControlVolume.

Parameters: - (length_domain_set) – domain for the ControlVolume. If not provided, a new ContinuousSet will be created (default=None). ContinuousSet should be normalized to run between 0 and 1. - – a new ContinuousSet if length_domain is not provided (default = [0.0, 1.0]). - argument indicating direction of material flow (flow_direction) – relative to length domain. Valid values: FlowDirection.forward (default), flow goes from 0 to 1. FlowDirection.backward, flow goes from 1 to 0 None
add_phase_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]

This method constructs a set of 1D material balances indexed by time, length, phase and component.

Parameters: has_rate_reactions – whether default generation terms for rate reactions should be included in material balances has_equilibrium_reactions – whether generation terms should for chemical equilibrium reactions should be included in material balances has_phase_equilibrium – whether generation terms should for phase equilibrium behaviour should be included in material balances has_mass_transfer – whether generic mass transfer terms should be included in material balances custom_molar_term – a Pyomo Expression representing custom terms to be included in material balances on a molar basis. Expression must be indexed by time, length domain, phase list and component list custom_mass_term – a Pyomo Expression representing custom terms to be included in material balances on a mass basis. Expression must be indexed by time, length domain, phase list and component list Constraint object representing material balances
add_phase_energy_balances(*args, **kwargs)[source]

Method for adding energy balances (including kinetic energy) indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_enthalpy_balances(*args, **kwargs)[source]

Method for adding enthalpy balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_momentum_balances(*args, **kwargs)[source]

Method for adding momentum balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_pressure_balances(*args, **kwargs)[source]

Method for adding pressure balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_reaction_blocks(has_equilibrium=None)[source]

This method constructs the reaction block for the control volume.

Parameters: has_equilibrium – indicates whether equilibrium calculations will be required in reaction block package_arguments – dict-like object of arguments to be passed to reaction block as construction arguments None
add_state_blocks(information_flow=<FlowDirection.forward: 1>, has_phase_equilibrium=None)[source]

This method constructs the state blocks for the control volume.

Parameters: information_flow – a FlowDirection Enum indicating whether information flows from inlet-to-outlet or outlet-to-inlet has_phase_equilibrium – indicates whether equilibrium calculations will be required in state blocks package_arguments – dict-like object of arguments to be passed to state blocks as construction arguments None
add_total_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]

This method constructs a set of 1D material balances indexed by time length and component.

Parameters: has_rate_reactions – whether default generation terms for rate reactions should be included in material balances has_equilibrium_reactions – whether generation terms should for chemical equilibrium reactions should be included in material balances has_phase_equilibrium – whether generation terms should for phase equilibrium behaviour should be included in material balances has_mass_transfer – whether generic mass transfer terms should be included in material balances custom_molar_term – a Pyomo Expression representing custom terms to be included in material balances on a molar basis. Expression must be indexed by time, length domain and component list custom_mass_term – a Pyomo Expression representing custom terms to be included in material balances on a mass basis. Expression must be indexed by time, length domain and component list Constraint object representing material balances
add_total_element_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_elemental_term=None)[source]

This method constructs a set of 1D element balances indexed by time and length.

Parameters: - whether default generation terms for rate (has_rate_reactions) – reactions should be included in material balances - whether generation terms should for (has_equilibrium_reactions) – chemical equilibrium reactions should be included in material balances - whether generation terms should for phase (has_phase_equilibrium) – equilibrium behaviour should be included in material balances - whether generic mass transfer terms should be (has_mass_transfer) – included in material balances - a Pyomo Expression representing custom (custom_elemental_term) – terms to be included in material balances on a molar elemental basis. Expression must be indexed by time, length and element list Constraint object representing material balances
add_total_energy_balances(*args, **kwargs)[source]

Method for adding a total energy balance (including kinetic energy) to the control volume.

See specific control volume documentation for details.

add_total_enthalpy_balances(has_heat_of_reaction=False, has_heat_transfer=False, has_work_transfer=False, custom_term=None)[source]

This method constructs a set of 1D enthalpy balances indexed by time and phase.

Parameters: - whether terms for heat of reaction should (has_heat_of_reaction) – be included in enthalpy balance - whether terms for heat transfer should be (has_heat_transfer) – included in enthalpy balances - whether terms for work transfer should be (has_work_transfer) – included in enthalpy balances - a Pyomo Expression representing custom terms to (custom_term) – be included in enthalpy balances. Expression must be indexed by time, length and phase list Constraint object representing enthalpy balances
add_total_material_balances(*args, **kwargs)[source]

Method for adding a total material balance to the control volume.

See specific control volume documentation for details.

add_total_momentum_balances(*args, **kwargs)[source]

Method for adding a total momentum balance to the control volume.

See specific control volume documentation for details.

add_total_pressure_balances(has_pressure_change=False, custom_term=None)[source]

This method constructs a set of 1D pressure balances indexed by time.

Parameters: - whether terms for pressure change should be (has_pressure_change) – included in enthalpy balances - a Pyomo Expression representing custom terms to (custom_term) – be included in pressure balances. Expression must be indexed by time and length domain Constraint object representing pressure balances
apply_transformation()[source]

Method to apply DAE transformation to the Control Volume length domain. Transformation applied will be based on the Control Volume configuration arguments.

build()[source]

Build method for ControlVolume1DBlock blocks.

Returns: None
initialize(state_args=None, outlvl=0, optarg=None, solver='ipopt', hold_state=True)[source]

Initialisation routine for 1D control volume (default solver ipopt)

Keyword Arguments:

• state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
• outlvl – sets output level of initialisation routine. Valid values: 0 - no output (default), 1 - return solver state for each step in routine, 2 - include solver output infomation (tee=True)
• optarg – solver options dictionary object (default=None)
• solver – str indicating whcih solver to use during initialization (default = ‘ipopt’)
• hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - True. Valid values: True - states variables are not unfixed, and a dict of returned containing flags for which states were fixed during initialization, False - state variables are unfixed after initialization by calling the release_state method.
Returns:

If hold_states is True, returns a dict containing flags for which states were fixed during initialization else the release state is triggered.

model_check()[source]

This method executes the model_check methods on the associated state blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

Parameters: None – None
release_state(flags, outlvl=0)[source]

Method to release state variables fixed during initialisation.

Keyword Arguments:

• flags – dict containing information of which state variables were fixed during initialization, and should now be unfixed. This dict is returned by initialize if hold_state = True.
• outlvl – sets output level of logging
Returns:

None

report(time_point=0, dof=False, ostream=None, prefix='')[source]

No report method defined for ControlVolume1D class. This is due to the difficulty of presenting spatially discretized data in a readable form without plotting.

## idaes.core.control_volume_base module¶

Base class for control volumes

class idaes.core.control_volume_base.ControlVolume(*args, **kwargs)

This class is not usually used directly. Use ControlVolume0DBlock or ControlVolume1DBlock instead.

Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys dynamic Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent, True - set as a dynamic model, False - set as a steady-state model} has_holdup Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms} property_package Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.} property_package_args A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.} reaction_package Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.} reaction_package_args A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.} auto_construct If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.} initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (ControlVolume) New instance
class idaes.core.control_volume_base.ControlVolumeBlockData(component)[source]

The ControlVolumeBlockData Class forms the base class for all IDAES ControlVolume models. The purpose of this class is to automate the tasks common to all control volume blockss and ensure that the necessary attributes of a control volume block are present.

The most signfiicant role of the ControlVolumeBlockData class is to set up the construction arguments for the control volume block, automatically link to the time domain of the parent block, and to get the information about the property and reaction packages.

add_energy_balances(balance_type=<EnergyBalanceType.useDefault: -1>, **kwargs)[source]

General method for adding energy balances to a control volume. This method makes calls to specialised sub-methods for each type of energy balance.

Parameters: balance_type (EnergyBalanceType) – Enum indicating which type of energy balance should be constructed. has_heat_of_reaction (bool) – whether terms for heat of reaction should be included in energy balance has_heat_transfer (bool) – whether generic heat transfer terms should be included in energy balances has_work_transfer (bool) – whether generic mass transfer terms should be included in energy balances custom_term (Expression) – a Pyomo Expression representing custom terms to be included in energy balances Constraint objects constructed by sub-method
add_geometry(*args, **kwargs)[source]

Method for defining the geometry of the control volume.

See specific control volume documentation for details.

add_material_balances(balance_type=<MaterialBalanceType.useDefault: -1>, **kwargs)[source]

General method for adding material balances to a control volume. This method makes calls to specialised sub-methods for each type of material balance.

Parameters: - MaterialBalanceType Enum indicating which type of (balance_type) – material balance should be constructed. - whether default generation terms for rate (has_rate_reactions) – reactions should be included in material balances - whether generation terms should for (has_equilibrium_reactions) – chemical equilibrium reactions should be included in material balances - whether generation terms should for phase (has_phase_equilibrium) – equilibrium behaviour should be included in material balances - whether generic mass transfer terms should be (has_mass_transfer) – included in material balances - a Pyomo Expression representing custom terms to (custom_mass_term) – be included in material balances on a molar basis. - a Pyomo Expression representing custom terms to – be included in material balances on a mass basis. Constraint objects constructed by sub-method
add_momentum_balances(balance_type=<MomentumBalanceType.pressureTotal: 1>, **kwargs)[source]

General method for adding momentum balances to a control volume. This method makes calls to specialised sub-methods for each type of momentum balance.

Parameters: balance_type (MomentumBalanceType) – Enum indicating which type of momentum balance should be constructed. Default = MomentumBalanceType.pressureTotal. has_pressure_change (bool) – whether default generation terms for pressure change should be included in momentum balances custom_term (Expression) – a Pyomo Expression representing custom terms to be included in momentum balances Constraint objects constructed by sub-method
add_phase_component_balances(*args, **kwargs)[source]

Method for adding material balances indexed by phase and component to the control volume.

See specific control volume documentation for details.

add_phase_energy_balances(*args, **kwargs)[source]

Method for adding energy balances (including kinetic energy) indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_enthalpy_balances(*args, **kwargs)[source]

Method for adding enthalpy balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_momentum_balances(*args, **kwargs)[source]

Method for adding momentum balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_phase_pressure_balances(*args, **kwargs)[source]

Method for adding pressure balances indexed by phase to the control volume.

See specific control volume documentation for details.

add_reaction_blocks(*args, **kwargs)[source]

Method for adding ReactionBlocks to the control volume.

See specific control volume documentation for details.

add_state_blocks(*args, **kwargs)[source]

Method for adding StateBlocks to the control volume.

See specific control volume documentation for details.

add_total_component_balances(*args, **kwargs)[source]

Method for adding material balances indexed by component to the control volume.

See specific control volume documentation for details.

add_total_element_balances(*args, **kwargs)[source]

Method for adding total elemental material balances indexed to the control volume.

See specific control volume documentation for details.

add_total_energy_balances(*args, **kwargs)[source]

Method for adding a total energy balance (including kinetic energy) to the control volume.

See specific control volume documentation for details.

add_total_enthalpy_balances(*args, **kwargs)[source]

Method for adding a total enthalpy balance to the control volume.

See specific control volume documentation for details.

add_total_material_balances(*args, **kwargs)[source]

Method for adding a total material balance to the control volume.

See specific control volume documentation for details.

add_total_momentum_balances(*args, **kwargs)[source]

Method for adding a total momentum balance to the control volume.

See specific control volume documentation for details.

add_total_pressure_balances(*args, **kwargs)[source]

Method for adding a total pressure balance to the control volume.

See specific control volume documentation for details.

build()[source]

General build method for Control Volumes blocks. This method calls a number of sub-methods which automate the construction of expected attributes of all ControlVolume blocks.

Inheriting models should call super().build.

Parameters: None – None
class idaes.core.control_volume_base.EnergyBalanceType[source]

An enumeration.

class idaes.core.control_volume_base.FlowDirection[source]

An enumeration.

class idaes.core.control_volume_base.MaterialBalanceType[source]

An enumeration.

class idaes.core.control_volume_base.MomentumBalanceType[source]

An enumeration.

## idaes.core.flowsheet_model module¶

This module contains the base class for constructing flowsheet models in the IDAES modeling framework.

class idaes.core.flowsheet_model.FlowsheetBlock(*args, **kwargs)

FlowsheetBlock is a specialized Pyomo block for IDAES flowsheet models, and contains instances of FlowsheetBlockData.

Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys dynamic Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent or False, True - set as a dynamic model, False - set as a steady-state model.} time Pointer to the time domain for the flowsheet. Users may provide an existing time domain from another flowsheet, otherwise the flowsheet will search for a parent with a time domain or create a new time domain and reference it here. time_set Set of points for initializing time domain. This should be a list of floating point numbers, default - [0]. default_property_package Indicates the default property package to be used by models within this flowsheet if not otherwise specified, default - None. Valid values: { None - no default property package, a ParameterBlock object.} initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (FlowsheetBlock) New instance
class idaes.core.flowsheet_model.FlowsheetBlockData(component)[source]

The FlowsheetBlockData Class forms the base class for all IDAES process flowsheet models. The main purpose of this class is to automate the tasks common to all flowsheet models and ensure that the necessary attributes of a flowsheet model are present.

The most signfiicant role of the FlowsheetBlockData class is to automatically create the time domain for the flowsheet.

build()[source]

General build method for FlowsheetBlockData. This method calls a number of sub-methods which automate the construction of expected attributes of flowsheets.

Inheriting models should call super().build.

Parameters: None – None
is_flowsheet()[source]

Method which returns True to indicate that this component is a flowsheet.

Parameters: None – True
model_check()[source]

This method runs model checks on all unit models in a flowsheet.

This method searches for objects which inherit from UnitModelBlockData and executes the model_check method if it exists.

Parameters: None – None
serialize(file_base_name, overwrite=False)[source]

Serializes the flowsheet and saves it to a file that can be read by the idaes-model-vis jupyter lab extension.

Parameters: file_base_name – The file prefix to the .idaes.vis file produced.

The file is created/saved in the directory that you ran from Jupyter Lab. :param overwrite: Boolean to overwrite an existing file_base_name.idaes.vis. If True, the existing file with the same file_base_name will be overwritten. This will cause you to lose any saved layout. If False and there is an existing file with that file_base_name, you will get an error message stating that you cannot save a file to the file_base_name (and therefore overwriting the saved layout). If there is not an existing file with that file_base_name then it saves as normal. Defaults to False. :return: None

stream_table(true_state=False, time_point=0, orient='columns')[source]

Method to generate a stream table by iterating over all Arcs in the flowsheet.

Parameters: true_state – whether the state variables (True) or display variables (False, default) from the StateBlocks should be used in the stream table. time_point – point in the time domain at which to create stream table (default = 0) orient – whether stream should be shown by columns (“columns”) or rows (“index”) A pandas dataframe containing stream table information

## idaes.core.process_base module¶

Base for IDAES process model objects.

class idaes.core.process_base.ProcessBaseBlock(*args, **kwargs)
Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (ProcessBaseBlock) New instance
class idaes.core.process_base.ProcessBlockData(component)[source]

Base class for most IDAES process models and classes.

The primary purpose of this class is to create the local config block to handle arguments provided by the user when constructing an object and to ensure that these arguments are stored in the config block.

Additionally, this class contains a number of methods common to all IDAES classes.

build()[source]

The build method is called by the default ProcessBlock rule. If a rule is sepecified other than the default it is important to call ProcessBlockData’s build method to put information from the “default” and “initialize” arguments to a ProcessBlock derived class into the BlockData object’s ConfigBlock.

The the build method should usually be overloaded in a subclass derived from ProcessBlockData. This method would generally add Pyomo components such as variables, expressions, and constraints to the object. It is important for build() methods implimented in derived classes to call build() from the super class.

Parameters: None – None
fix_initial_conditions(state='steady-state')[source]

This method fixes the initial conditions for dynamic models.

Parameters: state – initial state to use for simulation (default = ‘steady-state’)
Returns :
None
flowsheet()[source]

This method returns the components parent flowsheet object, i.e. the flowsheet component to which the model is attached. If the component has no parent flowsheet, the method returns None.

Parameters: None – Flowsheet object or None
unfix_initial_conditions()[source]

This method unfixed the initial conditions for dynamic models.

Parameters: None –
Returns :
None

## idaes.core.process_block module¶

The process_block module simplifies inheritance of Pyomo blocks. The main reason to subclass a Pyomo block is to create a block that comes with pre-defined model equations. This is used in the IDAES modeling framework to create modular process model blocks.

class idaes.core.process_block.ProcessBlock(*args, **kwargs)[source]

ProcessBlock is a Pyomo Block that is part of a system to make Pyomo Block easier to subclass. The main difference between a Pyomo Block and ProcessBlock from the user perspective is that a ProcessBlock has a rule assigned by default that calls the build() method for the contained ProcessBlockData objects. The default rule can be overridden, but the new rule should always call build() for the ProcessBlockData object.

Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (ProcessBlock) New instance
classmethod base_class_module()[source]

Return module of the associated ProcessBase class.

Returns: (str) Module of the class. AttributeError, if no base class module was set, e.g. this class – was not wrapped by the declare_process_block_class decorator.
classmethod base_class_name()[source]

Name given by the user to the ProcessBase class.

Returns: (str) Name of the class. AttributeError, if no base class name was set, e.g. this class – was not wrapped by the declare_process_block_class decorator.
idaes.core.process_block.declare_process_block_class(name, block_class=<class 'idaes.core.process_block.ProcessBlock'>, doc='')[source]

Declare a new ProcessBlock subclass.

This is a decorator function for a class definition, where the class is derived from Pyomo’s _BlockData. It creates a ProcessBlock subclass to contain the decorated class. The only requirment is that the subclass of _BlockData contain a build() method. The purpose of this decorator is to simplify subclassing Pyomo’s block class.

Parameters: name – name of class to create block_class – ProcessBlock or a subclass of ProcessBlock, this allows you to use a subclass of ProcessBlock if needed. The typical use case for Subclassing ProcessBlock is to impliment methods that operate on elements of an indexed block. doc – Documentation for the class. This should play nice with sphinx. Decorator function

## idaes.core.property_base module¶

This module contains classes for property blocks and property parameter blocks.

class idaes.core.property_base.PhysicalParameterBlock(component)[source]

This is the base class for thermophysical parameter blocks. These are blocks that contain a set of parameters associated with a specific thermophysical property package, and are linked to by all instances of that property package.

build()[source]

General build method for PropertyParameterBlocks. Inheriting models should call super().build.

Parameters: None – None
class idaes.core.property_base.StateBlock(*args, **kwargs)[source]

This is the base class for state block objects. These are used when constructing the SimpleBlock or IndexedBlock which will contain the PropertyData objects, and contains methods that can be applied to multiple StateBlockData objects simultaneously.

initialize(*args, **kwargs)[source]

This is a default initialization routine for StateBlocks to ensure that a routine is present. All StateBlockData classes should overload this method with one suited to the particular property package

Parameters: None – None
report(index=0, true_state=False, dof=False, ostream=None, prefix='')[source]

Default report method for StateBlocks. Returns a Block report populated with either the display or state variables defined in the StateBlockData class.

Parameters: index – tuple of Block indices indicating which point in time (and space if applicable) to report state at. true_state – whether to report the display variables (False default) or the actual state variables (True) dof – whether to show local degrees of freedom in the report (default=False) ostream – output stream to write report to prefix – string to append to the beginning of all output lines Printed output to ostream
class idaes.core.property_base.StateBlockData(component)[source]

This is the base class for state block data objects. These are blocks that contain the Pyomo components associated with calculating a set of thermophysical and transport properties for a given material.

build()[source]

General build method for StateBlockDatas.

Parameters: None – None
calculate_bubble_point_pressure(*args, **kwargs)[source]

Method which computes the bubble point pressure for a multi- component mixture given a temperature and mole fraction.

calculate_bubble_point_temperature(*args, **kwargs)[source]

Method which computes the bubble point temperature for a multi- component mixture given a pressure and mole fraction.

calculate_dew_point_pressure(*args, **kwargs)[source]

Method which computes the dew point pressure for a multi- component mixture given a temperature and mole fraction.

calculate_dew_point_temperature(*args, **kwargs)[source]

Method which computes the dew point temperature for a multi- component mixture given a pressure and mole fraction.

define_display_vars()[source]

Method used to specify components to use to generate stream tables and other outputs. Defaults to define_state_vars, and developers should overload as required.

define_port_members()[source]

Method used to specify components to populate Ports with. Defaults to define_state_vars, and developers should overload as required.

define_state_vars()[source]

Method that returns a dictionary of state variables used in property package. Implement a placeholder method which returns an Exception to force users to overload this.

get_energy_density_terms(*args, **kwargs)[source]

Method which returns a valid expression for enthalpy density to use in the energy balances.

get_energy_diffusion_terms(*args, **kwargs)[source]

Method which returns a valid expression for energy diffusion to use in the energy balances.

get_enthalpy_flow_terms(*args, **kwargs)[source]

Method which returns a valid expression for enthalpy flow to use in the energy balances.

get_material_density_terms(*args, **kwargs)[source]

Method which returns a valid expression for material density to use in the material balances .

get_material_diffusion_terms(*args, **kwargs)[source]

Method which returns a valid expression for material diffusion to use in the material balances.

get_material_flow_basis(*args, **kwargs)[source]

Method which returns an Enum indicating the basis of the material flow term.

get_material_flow_terms(*args, **kwargs)[source]

Method which returns a valid expression for material flow to use in the material balances.

## idaes.core.property_meta module¶

These classes handle the metadata aspects of classes representing property packages.

Implementors of property packages need to do the following:

1. Create a new class that inherits from idaes.core.property_base.PhysicalParameterBlock, which in turn inherits from HasPropertyClassMetadata, in this module.
2. In that class, implement the define_metadata() method, inherited from HasPropertyClassMetadata. This method is called automatically, once, when the get_metadata() method is first invoked. An empty metadata object (an instance of PropertyClassMetadata) will be passed in, which the method should populate with information about properties and default units.

Example:

from idaes.core.property_base import PhysicalParameterBlock

class MyPropParams(PhysicalParameterBlock):

@classmethod
foo.U.MASS: 'stones'})
'tentacle_size': {'units': 'yards'}})
'tentacle_size': 'yards'})

# Also, of course, implement the non-metadata methods that
# do the work of the class.

class idaes.core.property_meta.HasPropertyClassMetadata[source]

Interface for classes that have PropertyClassMetadata.

classmethod define_metadata(pcm)[source]

Set all the metadata for properties and units.

This method should be implemented by subclasses. In the implementation, they should set information into the object provided as an argument.

classmethod get_metadata()[source]

If the metadata is not defined, this will instantiate a new metadata object and call define_metadata() to set it up.

class idaes.core.property_meta.PropertyClassMetadata[source]
default units and properties.

Example usage:

foo = PropertyClassMetadata()
foo.U.MASS: 'stones'})
'tentacle_size': {'units': 'yards'}})
'tentacle_size': 'yards'})

U

Alias for class enumerating supported/known unit types

alias of UnitNames

add_default_units(u)[source]

Add a dict with keys for the quantities used in the property package (as strings) and values of their default units as strings.

The quantities used by the framework are in constants defined in UnitNames, aliased here in the class attribute U.

Parameters: u (dict) – Key=property, Value=units None
add_properties(p)[source]

For each property, the value should be another dict which may contain the following keys:

• ‘method’: (required) the name of a method to construct the
property as a str, or None if the property will be constructed by default.
• ‘units’: (optional) units of measurement for the property.
Parameters: p (dict) – Key=property, Value=PropertyMetadata or equiv. dict None
add_required_properties(p)[source]

For each property, the value should be the expected units of measurement for the property.

Parameters: p (dict) – Key=property, Value=units None
class idaes.core.property_meta.PropertyMetadata(name=None, method=None, units=None)[source]

Instances of this class are exactly dictionaries, with the only difference being some guidance on the values expected in the dictionary from the constructor.

class idaes.core.property_meta.UnitNames[source]

Names for recognized units.

## idaes.core.reaction_base module¶

This module contains classes for reaction blocks and reaction parameter blocks.

class idaes.core.reaction_base.ReactionBlockBase(*args, **kwargs)[source]

This is the base class for reaction block objects. These are used when constructing the SimpleBlock or IndexedBlock which will contain the PropertyData objects, and contains methods that can be applied to multiple ReactionBlockData objects simultaneously.

initialize(*args)[source]

This is a default initialization routine for ReactionBlocks to ensure that a routine is present. All ReactionBlockData classes should overload this method with one suited to the particular reaction package

Parameters: None – None
class idaes.core.reaction_base.ReactionBlockDataBase(component)[source]

This is the base class for reaction block data objects. These are blocks that contain the Pyomo components associated with calculating a set of reacion properties for a given material.

build()[source]

General build method for PropertyBlockDatas. Inheriting models should call super().build.

Parameters: None – None
get_reaction_rate_basis()[source]

Method which returns an Enum indicating the basis of the reaction rate term.

class idaes.core.reaction_base.ReactionParameterBlock(component)[source]

This is the base class for reaction parameter blocks. These are blocks that contain a set of parameters associated with a specific reaction package, and are linked to by all instances of that reaction package.

build()[source]

General build method for ReactionParameterBlocks. Inheriting models should call super().build.

Parameters: None – None

## idaes.core.unit_model module¶

Base class for unit models

class idaes.core.unit_model.UnitModelBlock(*args, **kwargs)
Parameters: rule (function) – A rule function or None. Default rule calls build(). concrete (bool) – If True, make this a toplevel model. Default - False. ctype (str) – Pyomo ctype of the block. Default - “Block” default (dict) – Default ProcessBlockData config Keys dynamic Indicates whether this model will be dynamic or not, default = useDefault. Valid values: { useDefault - get flag from parent (default = False), True - set as a dynamic model, False - set as a steady-state model.} has_holdup Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms} initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above. idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize. (UnitModelBlock) New instance
class idaes.core.unit_model.UnitModelBlockData(component)[source]

This is the class for process unit operations models. These are models that would generally appear in a process flowsheet or superstructure.

add_inlet_port(name=None, block=None, doc=None)[source]

This is a method to build inlet Port objects in a unit model and connect these to a specified control volume or state block.

The name and block arguments are optional, but must be used together. i.e. either both arguments are provided or neither.

Keyword Arguments:

• = name to use for Port object (name) –
• = an instance of a ControlVolume or StateBlock to use as the (block) – source to populate the Port object. If a ControlVolume is provided, the method will use the inlet state block as defined by the ControlVolume. If not provided, method will attempt to default to an object named control_volume.
• = doc string for Port object (doc) –
Returns:

A Pyomo Port object and associated components.

add_outlet_port(name=None, block=None, doc=None)[source]

This is a method to build outlet Port objects in a unit model and connect these to a specified control volume or state block.

The name and block arguments are optional, but must be used together. i.e. either both arguments are provided or neither.

Keyword Arguments:

• = name to use for Port object (name) –
• = an instance of a ControlVolume or StateBlock to use as the (block) – source to populate the Port object. If a ControlVolume is provided, the method will use the outlet state block as defined by the ControlVolume. If not provided, method will attempt to default to an object named control_volume.
• = doc string for Port object (doc) –
Returns:

A Pyomo Port object and associated components.

add_port(name=None, block=None, doc=None)[source]

This is a method to build Port objects in a unit model and connect these to a specified StateBlock. :keyword name = name to use for Port object.: :keyword block = an instance of a StateBlock to use as the source to: populate the Port object :keyword doc = doc string for Port object:

Returns: A Pyomo Port object and associated components.
build()[source]

General build method for UnitModelBlockData. This method calls a number of sub-methods which automate the construction of expected attributes of unit models.

Inheriting models should call super().build.

Parameters: None – None
initialize(state_args=None, outlvl=0, solver='ipopt', optarg={'tol': 1e-06})[source]

This is a general purpose initialization routine for simple unit models. This method assumes a single ControlVolume block called controlVolume, and first initializes this and then attempts to solve the entire unit.

More complex models should overload this method with their own initialization routines,

Keyword Arguments:

• state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
• outlvl

sets output level of initialisation routine

• 0 = no output (default)
• 1 = return solver state for each step in routine
• 2 = return solver state for each step in subroutines
• 3 = include solver output infomation (tee=True)
• optarg – solver options dictionary object (default={‘tol’: 1e-6})
• solver – str indicating which solver to use during initialization (default = ‘ipopt’)
Returns:

None

model_check()[source]

This is a general purpose initialization routine for simple unit models. This method assumes a single ControlVolume block called controlVolume and tries to call the model_check method of the controlVolume block. If an AttributeError is raised, the check is passed.

More complex models should overload this method with a model_check suited to the particular application, especially if there are multiple ControlVolume blocks present.

Parameters: None – None