idaes.core package

Submodules

idaes.core.flowsheet_model module

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

idaes.core.holdup module

Core IDAES holdup models.

class idaes.core.holdup.Holdup(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Holdup is a specialized Pyomo block for IDAES holdup blocks, and contains instances of HoldupData. In most cases, users will want to use one of the derived holdup classes (Holdup0D, Holdup1D or HoldupStatic for their models, however this class can be used to create the framework of a holdup block to which the user can then add custom constraints.
Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • dynamic – Indicates whether this model will be dynamic, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
  • include_holdup – Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - ‘use_parent_value’. Valid values: { ‘use_parent_value` - get flag from parent (default = True), True - construct holdup terms, False - do not construct holdup terms}
  • material_balance_type – Indicates what type of mass balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘component’), ‘none’ - exclude material balances, **’component_phase’ - use phase component balances, **’component_total’ - use total component balances, **’element_total’ - use total element balances.}
  • energy_balance_type – Indicates what type of energy balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude energy balances, ‘total’ - single energy balance for all phases.}
  • momentum_balance_type – Indicates what type of momentum balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude momentum balances, ‘total’ - single momentum balance for all phases.}
  • has_rate_reactions – Indicates whether terms for rate controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include kinetic reaction terms, False - exclude kinetic reaction terms.}
  • has_equilibrium_reactions – Indicates whether terms for equilibrium controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include equilibrium reaction terms, False - exclude equilibrium reaction terms.}
  • has_phase_equilibrium – Indicates whether terms for phase equilibrium should be
constructed (default = ‘use_parent_value’)
  • ‘use_parent_value’ - get flag from parent (default = False)
  • True - include phase equilibrium terms
  • False - exclude phase equilibrium terms
has_mass_transfer: Indicates whether terms for mass transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include mass transfer terms, False - exclude mass transfer terms.}
has_heat_transfer: Indicates whether terms for heat transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include heat transfer terms, False - exclude heat transfer terms.}
has_work_transfer: Indicates whether terms for work transfer should be constructed,
default - ‘use_parent_value’. Valid values { ‘use_parent_value’ - get flag from parent (default = False), True - include work transfer terms, False - exclude work transfer terms.}
has_pressure_change: Indicates whether terms for pressure change should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include pressure change terms, False - exclude pressure change terms.}
property_package: Property parameter object used to define property calculations,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), a ParameterBlock object.}
property_package_args: A dict of arguments to be passed to a property block and used when
constructing these, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), dict - see property package for documentation.}
Returns:New Holdup instance
class idaes.core.holdup.Holdup0D(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Holdup0D is a specialized Pyomo block for IDAES non-discretized holdup blocks, and contains instances of Holdup0dData.

Holdup0D should be used for any holdup 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 – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • dynamic – Indicates whether this model will be dynamic, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
  • include_holdup – Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - ‘use_parent_value’. Valid values: { ‘use_parent_value` - get flag from parent (default = True), True - construct holdup terms, False - do not construct holdup terms}
  • material_balance_type – Indicates what type of mass balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘component’), ‘none’ - exclude material balances, **’component_phase’ - use phase component balances, **’component_total’ - use total component balances, **’element_total’ - use total element balances.}
  • energy_balance_type – Indicates what type of energy balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude energy balances, ‘total’ - single energy balance for all phases.}
  • momentum_balance_type – Indicates what type of momentum balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude momentum balances, ‘total’ - single momentum balance for all phases.}
  • has_rate_reactions – Indicates whether terms for rate controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include kinetic reaction terms, False - exclude kinetic reaction terms.}
  • has_equilibrium_reactions – Indicates whether terms for equilibrium controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include equilibrium reaction terms, False - exclude equilibrium reaction terms.}
  • has_phase_equilibrium – Indicates whether terms for phase equilibrium should be
constructed (default = ‘use_parent_value’)
  • ‘use_parent_value’ - get flag from parent (default = False)
  • True - include phase equilibrium terms
  • False - exclude phase equilibrium terms
has_mass_transfer: Indicates whether terms for mass transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include mass transfer terms, False - exclude mass transfer terms.}
has_heat_transfer: Indicates whether terms for heat transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include heat transfer terms, False - exclude heat transfer terms.}
has_work_transfer: Indicates whether terms for work transfer should be constructed,
default - ‘use_parent_value’. Valid values { ‘use_parent_value’ - get flag from parent (default = False), True - include work transfer terms, False - exclude work transfer terms.}
has_pressure_change: Indicates whether terms for pressure change should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include pressure change terms, False - exclude pressure change terms.}
property_package: Property parameter object used to define property calculations,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), a ParameterBlock object.}
property_package_args: A dict of arguments to be passed to a property block and used when
constructing these, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), dict - see property package for documentation.}
Returns:New Holdup0D instance
class idaes.core.holdup.Holdup0dData(component)[source]

Bases: idaes.core.holdup.HoldupData

0-Dimensional (Non-Discretised) Holdup Class

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

build()[source]

Build method for Holdup0D blocks. This method calls submethods to setup the necessary property blocks, distributed variables, material, energy and momentum balances based on the arguments provided by the user.

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

Initialisation routine for holdup (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 varaibles 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 relase_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 exectues the model_check methods on the associated property blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

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

Method to relase 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 of logging
Returns:

None

class idaes.core.holdup.Holdup1D(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • dynamic – Indicates whether this model will be dynamic, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
  • include_holdup – Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - ‘use_parent_value’. Valid values: { ‘use_parent_value` - get flag from parent (default = True), True - construct holdup terms, False - do not construct holdup terms}
  • material_balance_type – Indicates what type of mass balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘component’), ‘none’ - exclude material balances, **’component_phase’ - use phase component balances, **’component_total’ - use total component balances, **’element_total’ - use total element balances.}
  • energy_balance_type – Indicates what type of energy balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude energy balances, ‘total’ - single energy balance for all phases.}
  • momentum_balance_type – Indicates what type of momentum balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude momentum balances, ‘total’ - single momentum balance for all phases.}
  • has_rate_reactions – Indicates whether terms for rate controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include kinetic reaction terms, False - exclude kinetic reaction terms.}
  • has_equilibrium_reactions – Indicates whether terms for equilibrium controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include equilibrium reaction terms, False - exclude equilibrium reaction terms.}
  • has_phase_equilibrium – Indicates whether terms for phase equilibrium should be
constructed (default = ‘use_parent_value’)
  • ‘use_parent_value’ - get flag from parent (default = False)
  • True - include phase equilibrium terms
  • False - exclude phase equilibrium terms
has_mass_transfer: Indicates whether terms for mass transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include mass transfer terms, False - exclude mass transfer terms.}
has_heat_transfer: Indicates whether terms for heat transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include heat transfer terms, False - exclude heat transfer terms.}
has_work_transfer: Indicates whether terms for work transfer should be constructed,
default - ‘use_parent_value’. Valid values { ‘use_parent_value’ - get flag from parent (default = False), True - include work transfer terms, False - exclude work transfer terms.}
has_pressure_change: Indicates whether terms for pressure change should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include pressure change terms, False - exclude pressure change terms.}
property_package: Property parameter object used to define property calculations,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), a ParameterBlock object.}
property_package_args: A dict of arguments to be passed to a property block and used when
constructing these, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), dict - see property package for documentation.}

inherited_length_domain: A Pyomo ContinuousSet to use as the length domain in the holdup. length_domain_set: List of floats between 0 and 1 to used to initialize length domain, if

inherited_length_domain not set (default = [0.0, 1.0]

flow_direction: Flag indicating the direction of flow within the length

domain (default = forward).
  • ‘forward’ - flow from 0 to 1
  • ‘backward’ - flow from 1 to 0

discretization_method: Method to be used by DAE transformation when discretizing length

domain (default = OCLR).
  • ‘OCLR’ - orthogonal collocation (Radau roots)
  • ‘OCLL’ - orthogonal collocation (Legendre roots)
  • ‘BFD’ - backwards finite difference (1st order)
  • ‘FFD’ - forwards finite difference (1st order)
finite_elements: Number of finite elements to use when discretizing length domain
(default=20)
collocation_points: Number of collocation points to use per finite element when
discretizing length domain (default=3)
has_mass_diffusion: Flag indicating whether mass diffusion/dispersion should be included
in material balance equations (default=False)
has_energy_diffusion: Flag indicating whether energy diffusion/dispersion should be
included in energy balance equations (default=False)
Returns:New Holdup1D instance
class idaes.core.holdup.Holdup1dData(component)[source]

Bases: idaes.core.holdup.HoldupData

1-Dimensional Holdup Class

This class is designed to be the core of all 1D discretized IDAES models. It builds property blocks, inlet/outlet ports and adds mass, energy and momentum balances. The form of the terms used in these constraints is specified in the chosen property package.

Assumes constant reactor dimensions

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

Build method for Holdup1D blocks. This method calls submethods to setup the necessary property blocks, distributed variables, material, energy and momentum balances based on the arguments provided by the user.

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

Initialisation routine for holdup (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

    • 0 = no output
    • 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). - True - states varaibles 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 relase_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 exectues the model_check methods on the associated property blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

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

Method to relase 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 of logging
Returns:

None

class idaes.core.holdup.HoldupData(component)[source]

Bases: idaes.core.process_base.ProcessBlockData

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

The most signfiicant role of the Holdup class is to set up the build arguments for the holdup block, automatically link to the time domain of the parent block, and to get the information about the property package.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

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

Inheriting models should call super().build.

Parameters:None
Returns:None
get_property_package()[source]

This method gathers the necessary information about the property package to be used in the holdup block.

If a property package has not been provided by the user, the method searches up the model tree until it finds an object with the ‘default_property_package’ attribute and uses this package for the holdup block.

The method also gathers any default construction arguments specified for the property package and combines these with any arguments specified by the user for the holdup block (user specified arguments take priority over defaults).

Parameters:None
Returns:None
class idaes.core.holdup.HoldupStatic(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • dynamic – Indicates whether this model will be dynamic, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
  • include_holdup – Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - ‘use_parent_value’. Valid values: { ‘use_parent_value` - get flag from parent (default = True), True - construct holdup terms, False - do not construct holdup terms}
  • material_balance_type – Indicates what type of mass balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘component’), ‘none’ - exclude material balances, **’component_phase’ - use phase component balances, **’component_total’ - use total component balances, **’element_total’ - use total element balances.}
  • energy_balance_type – Indicates what type of energy balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude energy balances, ‘total’ - single energy balance for all phases.}
  • momentum_balance_type – Indicates what type of momentum balance should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = ‘total’), ‘none’ - exclude momentum balances, ‘total’ - single momentum balance for all phases.}
  • has_rate_reactions – Indicates whether terms for rate controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include kinetic reaction terms, False - exclude kinetic reaction terms.}
  • has_equilibrium_reactions – Indicates whether terms for equilibrium controlled reactions should be constructed, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include equilibrium reaction terms, False - exclude equilibrium reaction terms.}
  • has_phase_equilibrium – Indicates whether terms for phase equilibrium should be
constructed (default = ‘use_parent_value’)
  • ‘use_parent_value’ - get flag from parent (default = False)
  • True - include phase equilibrium terms
  • False - exclude phase equilibrium terms
has_mass_transfer: Indicates whether terms for mass transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include mass transfer terms, False - exclude mass transfer terms.}
has_heat_transfer: Indicates whether terms for heat transfer should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include heat transfer terms, False - exclude heat transfer terms.}
has_work_transfer: Indicates whether terms for work transfer should be constructed,
default - ‘use_parent_value’. Valid values { ‘use_parent_value’ - get flag from parent (default = False), True - include work transfer terms, False - exclude work transfer terms.}
has_pressure_change: Indicates whether terms for pressure change should be constructed,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get flag from parent (default = False), True - include pressure change terms, False - exclude pressure change terms.}
property_package: Property parameter object used to define property calculations,
default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), a ParameterBlock object.}
property_package_args: A dict of arguments to be passed to a property block and used when
constructing these, default - ‘use_parent_value’. Valid values: { ‘use_parent_value’ - get package from parent (default = None), dict - see property package for documentation.}
Returns:New HoldupStatic instance
class idaes.core.holdup.HoldupStaticData(component)[source]

Bases: idaes.core.holdup.HoldupData

Static Holdup Class

This class is designed to be used for unit operations zero volume or holdups with no through flow (such as dead zones). This type of holdup has only a single PropertyBlock index by time (Holdup0D has two).

build()[source]

Build method for HoldupStatic blocks. This method calls submethods to setup the necessary property blocks, distributed variables, material, energy and momentum balances based on the arguments provided by the user.

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

Initialisation routine for holdup (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

    • 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). - True - states varaibles 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 relase_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 exectues the model_check methods on the associated property blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

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

Method to relase 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 of logging
Returns:

None

idaes.core.ports module

These classes handle the mixing and splitting of multiple inlets/outlets to a single holdup block.

class idaes.core.ports.InletMixer(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • has_material_balance – Indicates whether material mixing constraints should be constructed.
  • has_energy_balance – Indicates whether energy mixing constraints should be constructed.
  • has_momentum_balance – Indicates whether momentum mixing constraints should be constructed.
  • inlets – A list of strings to be used to name inlet streams.
Returns:

New InletMixer instance

class idaes.core.ports.InletMixerData(component)[source]

Bases: idaes.core.ports.Port

Inlet Mixer Class

This class builds a mixer to allow for multiple inlets to a single holdup block. The class constructs property blocks for each inlet and creates mixing rules to connect them to the property block within the associated holdup block.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

Build method for Mixer blocks. This method calls a number of methods to construct the necessary balance equations for the Mixer.

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

Initialisation routine for InletMixer (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

    • 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).
    • True = state varaibles 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 relase_state method
Returns:

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

model_check()[source]

Calls model checks on all associated Property Blocks.

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

Method to relase 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 of logging (default=0)
Returns:

None

class idaes.core.ports.OutletSplitter(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • has_material_balance – Indicates whether material mixing constraints should be constructed.
  • has_energy_balance – Indicates whether energy mixing constraints should be constructed.
  • has_momentum_balance – Indicates whether momentum mixing constraints should be constructed.
  • outlets – A list of strings to be used to name outlet streams.
  • split_type – A list of strings to be used to name outlet streams.
Returns:

New OutletSplitter instance

class idaes.core.ports.OutletSplitterData(component)[source]

Bases: idaes.core.ports.Port

Outlet Mixer Class

This class builds a splitter to allow for multiple outlets to a single holdup block. The class constructs property blocks for each outlet and creates splitting rules to connect them to the property block within the associated holdup block.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

Build method for Splitter blocks. This method calls a number of methods to construct the necessary balance equations for the Splitter.

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

Initialisation routine for OutletSplitter (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

    • 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=False).
    • True = state varaibles 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 relase_state method
Returns:

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

model_check()[source]

Calls model checks on all associated Property Blocks.

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

Method to relase 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 of logging (default=0)
class idaes.core.ports.Port(component)[source]

Bases: idaes.core.process_base.ProcessBlockData

Base Port Class

This class contains methods common to all Port classes.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

General build method for Ports. This method calls a number of methods common to all Port blocks.

Inheriting models should call super().build.

Parameters:None
Returns:None

idaes.core.process_base module

Base for IDAES process model objects.

class idaes.core.process_base.ProcessBlockData(component)[source]

Bases: pyomo.core.base.block._BlockData

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.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

Default build method for all Classes inheriting from ProcessBlockData. Currently empty, but left in place to allow calls to super().build and for future compatability.

Parameters:None
Returns: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
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 to create modular process model blocks.

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

Bases: pyomo.core.base.block.Block

Process block.

Process block behaves like a Pyomo Block. The important differences are listed below.

  • There is a default rule that calls the build() method for _BlockData subclass ojects, so subclass of _BlockData used in a ProcessBlock should have a build() method. A different rule or no rule (None) can be set with the usual rule argument, if additional steps are required to build an element of a block. A example of such a case is where different elements of an indexed block require addtional information to construct.
  • Some of the arguments to __init__, which are not expected arguments of Block, are split off and stored in self._block_data_config. If the _BlockData subclass inherits ProcessBlockData, self._block_data_config is sent to the self.config ConfigBlock.
classmethod base_class_module()[source]

Return module of the associated ProcessBase class.

Returns:(str) Module of the class.
Raises: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.
Raises: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 _BlockData. It creates a ProcessBlock subclass to contain it. For example (where ProcessBlockData is a subclass of _BlockData):

@declare_process_block_class(name=MyUnitBlock) class MyUnitBlockData(ProcessBlockData):

# This class is a _BlockData subclass contained in a Block subclass # MyUnitBlock ….

The only requirment is that the subclass of _BlockData contain a build() method.

Parameters:
  • name – class name for the model.
  • block_class – ProcessBlock or a subclass of ProcessBlock, this allows you to use a subclass of ProcessBlock if needed.
  • doc – Documentation for the class. This should play nice with sphinx.

idaes.core.property_base module

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

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

Bases: idaes.core.process_base.ProcessBlockData

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

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

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

Parameters:None
Returns:None
class idaes.core.property_base.PropertyParameterBase(component)[source]

Bases: idaes.core.process_base.ProcessBlockData

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

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

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

Parameters:None
Returns:None
get_package_units()[source]

Method to return a dictionary of default units of measurement used in the property package. This is used to populate doc strings for variables which derive from the property package (such as flows and volumes). This method should return a dict with keys for the quantities used in the property package (as strs) and values of their default units as strs.

The quantities used by the framewokr are (all optional):
  • ‘time’
  • ‘length’
  • ‘mass’
  • ‘amount’
  • ‘temperature’
  • ‘energy’
  • ‘current’
  • ‘luminous intensity’

This default method is a placeholder and should be overloaded by the package developer. This method will return an Exception if not overloaded.

Parameters:None
Returns:A dict with supported properties as keys and tuples of (method, units) as values.
get_supported_properties()[source]

Method to return a dictionary of properties supported by this package and their assoicated construction methods and units of measurement. This method should return a dict with keys for each supported property.

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.

This default method is a placeholder and should be overloaded by the package developer. This method will return an Exception if not overloaded.

Parameters:None
Returns:A dict with supported properties as keys.

idaes.core.stream module

Base clase for IDAES streams

class idaes.core.stream.Stream(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • source – Pyomo Port object representing the source of the process stream.
  • source_idx – Key of indexed Port to use for source (if applicable). default = None.
  • destination – Pyomo Port object representing the destination of the process stream.
  • destination_idx – Key of indexed Port to use for destination (if applicable). default = None.
Returns:

New Stream instance

class idaes.core.stream.StreamData(component)[source]

Bases: idaes.core.process_base.ProcessBlockData

This is the class for process streams. These are blocks that connect two unit models together.

CONFIG = <pyutilib.misc.config.ConfigBlock object>
activate(var=None)[source]

Method for activating Constraints in Stream. If not provided with any arguments, this activates the entire Stream block. Alternatively, it may be provided with the name of a variable in the Stream, in which case only the Constraint associated with that variable will be activated.

Parameters:var – name of a variable in the Stream for which the corresponding Constraint should be activated (default = None).
Returns:None
build()[source]

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

Parameters:None
Returns:None
converged(tolerance=1e-06)[source]

Check if the values on both sides of a Stream are converged.

Parameters:tolerance – tolerance to use when checking if Stream is converged. (default = 1e-6).
Returns:A Bool indicating whether the Stream is converged
deactivate(var=None)[source]

Method for deactivating Constraints in Stream. If not provided with any arguments, this deactivates the entire Stream block. Alternatively, it may be provided with the name of a variable in the Stream, in which case only the Constraint associated with that variable will be deactivated.

Parameters:var – name of a variable in the Stream for which the corresponding Constraint should be deactivated (default = None).
Returns:None
display(side='source', display_constraints=False, tolerance=1e-06, ostream=None, prefix='')[source]

Display the contents of Stream Block.

Parameters:
  • side – side of Stream to display values from (default = ‘soruce’). Valid values are ‘source’ and ‘destination’.
  • display_constraints – indicates whether to display Constraint information (default = False).
  • tolerance – tolerance to use when checking if Stream is converged. (default = 1e-6).
  • ostream – output stream (default = None)
  • prefix – str to append to each line of output (default = ‘’)
class idaes.core.stream.VarDict[source]

Bases: dict

This class creates an object which behaves like a Pyomo IndexedVar. It is used to contain the separate Vars contained within IndexedPorts, and make them look like a single IndexedVar. This class supports the fix, unfix and display attributes.

display(side='source', ostream=None, prefix='')[source]

Print component information

Parameters:
  • side – which side of port to display (default = ‘source’). Valid values are ‘source’ or ‘destination’.
  • ostream – output stream (default = None)
  • prefix – str to append to each line of output (default = ‘’)
Returns:

None

fix(value=None, side='destination')[source]

Method to fix Vars.

Parameters:
  • value – value to use when fixing Var (default = None).
  • side – side of port to fix (default = ‘destination’). Valid values are ‘source’, ‘destination’ or ‘all’.
Returns:

None

unfix(side='destination')[source]

Method to unfix Vars.

Parameters:
  • value – value to use when fixing Var (default = None)
  • side – side of port to fix (default = ‘destination’). Valid values are ‘source’, ‘destination’ or ‘all’.
Returns:

None

idaes.core.unit_model module

Base clase for unit models

class idaes.core.unit_model.UnitBlockData(component)[source]

Bases: idaes.core.process_base.ProcessBlockData

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

CONFIG = <pyutilib.misc.config.ConfigBlock object>
build()[source]

General build method for UnitBlockData. 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
Returns:None
build_inlets(holdup=None, inlets=None, num_inlets=None)[source]

This is a method to build inlet Port objects in a unit model and connect these to holdup blocks as needed. This method supports an arbitary number of inlets and holdup blocks, and works for both simple (0D) and 1D IDAES holdup blocks.

Keyword Arguments:
 
  • = holdup block to which inlets are associated. If left None, (holdup) – assumes a default holdup (default = None).
  • = argument defining inlet names (default (inlets) –

    None). inlets may be None or list. - None - assumes a single inlet. - list - use names provided in list for inlets (can be

    other iterables, but not a string or dict)
  • = argument indication number (num_inlets) –

    construct (default = None). Not used if inlets arg is provided. - None - use inlets arg instead - int - Inlets will be named with sequential numbers from 1

    to num_inlets.
Returns:

A Pyomo Port object and assoicated components.

build_outlets(holdup=None, outlets=None, num_outlets=None, split_type='flow')[source]

This is a method to build outlet Port objects in a unit model and connect these to holdup blocks as needed. This method supports an arbitary number of outlets and holdup blocks, and works for both simple (0D) and 1D IDAES holdup blocks.

Keyword Arguments:
 
  • = holdup block to which inlets are associated. If left None, (holdup) – assumes a default holdup (default = None).
  • = argument defining outlet names (default (outlets) –

    None). outlets may be None or list. - None - assumes a single outlet. - list - use names provided in list for outlets (can be

    other iterables, but not a string or dict)
  • = argument indication number (num_outlets) –

    construct (default = None). Not used if outlets arg is provided. - None - use outlets arg instead - int - Outlets will be named with sequential numbers from

    1 to num_outlets.
  • = argument defining method to use to split outlet flow (split_type) –

    in case of multiple outlets (default = ‘flow’). - ‘flow’ - outlets are split by total flow - ‘phase’ - outlets are split by phase - ‘component’ - outlets are split by component - ‘total’ - outlets are split by both phase and

    component
    • ’duplicate’ - all outlets are duplicates of the
      total outlet stream.
Returns:

A Pyomo Port object and assoicated components.

display_P()[source]

Display pressure variables associated with the UnitBlockData.

display_T()[source]

Display temperature variables associated with the UnitBlockData.

display_flows()[source]

Display component flow variables associated with the UnitBlockData.

display_total_flows()[source]

Display total flow variables associated with the UnitBlockData.

display_variables(simple=True, descend_into=True)[source]

Display all variables associated with the UnitBlockData.

Parameters:simple (bool, optional) – Print a simplified version showing only variable values.
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 Holdup block called holdup, 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 whcih solver to use during initialization (default = ‘ipopt’)
Returns:

None

is_process_unit()[source]

Tag to indicate that this object is a process unit.

model_check()[source]

This is a general purpose initialization routine for simple unit models. This method assumes a single Holdup block called holdup and tries to call the model_check method of the holdup 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 Holdup blocks present.

Parameters:None
Returns:None
class idaes.core.unit_model.UnitBlock(*args, **kwargs)

Bases: idaes.core.process_block.ProcessBlock

Parameters:
  • rule – (Optional) A rule function or None. Default rule calls build().
  • concrete – If True, make this a toplevel model. Default - False.
  • ctype – (Optional) Pyomo ctype of the Block.
  • dynamic – Indicates whether this model will be dynamic or not (default = ‘use_parent_value’). ‘use_parent_value’ - get flag from parent (default = False) True - set as a dynamic model False - set as a steady-state model
Returns:

New UnitBlock instance