Common Holdup Tasks¶
Contents
Introduction¶
All of the IDAES Holdup block classes are built on a common core Class which automates the tasks required for all Holdup blocks. The common tasks performed by the base class are:
- Collecting construction arguments from the UnitModel,
- Determining if the Holdup should be steady-state or dynamic and getting the time domain,
- Collecting the information necessary for creating Property Blocks, and
- Collecting the component and phase lists from the Property package.
Construction Arguments¶
All Holdup blocks make use of a common set of construction arguments, which determine amongst other things which terms to include in the balance equations. The list of common construction argument is provided below:
Construction Argument | Default Value |
---|---|
property_package | None |
property_package_args | {} |
include_holdup | True |
material_balance_type | ‘component_phase’ |
energy_balance_type | ‘total’ |
momentum_balance_type | ‘total’ |
has_rate_reactions | False |
has_equilibrium_reactions | False |
has_phase_equilibrium | False |
has_mass_transfer | False |
has_heat_transfer | False |
has_work_transfer | False |
has_pressure_change | False |
The property_package and property_package_args arguments are used to inform the Holdup block of which property package to use when constructing the associated Property Blocks, and any instructions to be provided when constructing the blocks. The balance type arguments are used to control what type of balance equation is written (more details are given in the documentation for the relevant Holdup class). The remaining arguments govern whether or not a specific term should be included in the balances equations. If a term is not included, it is replaced with a 0 in the relevant expression, and the associated variable is not constructed.
When an instance of a Holdup block is created, values for these may be provided as arguments otherwise they will be assigned a value of ‘use_parent_value’. In these cases, the Holdup block looks to the UnitModel and checks to see if the UnitModel has assigned a default value for these arguments and uses this if available. If the UnitModel does not have a default value for an argument, then the Holdup reverts to the default value provided in the table above.
CONFIG_Base¶
To assist Unit model developers with setting up the configuration blocks for their models, the IDAES framework contains a prebuilt configuration block that can be inherited by UnitModels which contains most of the required construction arguments already, along with preset defaults and methods to validate user inputs. This prebuilt configuration block is named CONFIG_Base, and is available in holdup.py in the IDAES core.
CONFIG_Base contains the following arguments prebuilt for the developer:
- include_holdup
- material_balance_type
- energy_balance_type
- momentum_balance_type
- has_rate_reactions
- has_equilibrium_reactions
- has_phase_equilibrium
- has_mass_transfer
- has_heat_transfer
- has_work_transfer
- has_pressure_change
Information on property packages is not included in the default CONFIG_Base, as UnitModels may have multiple property packages.
Setting up the time domain¶
The next common task the Holdup block performs is to determine if it should be dynamic or steady-state and to collect the time domain from the UnitModel. Holdup blocks have an argument dynamic which can be provided during construction which specifies if the Holdup should be dynamic (dynamic = True) or steady-state (dynamic = False). If the argument is not provided, the Holdup block will inherit this argument from the UnitModel.
After setting the dynamic argument, the Holdup block then gets a reference to the time domain from the UnitModel. If the block containing the Holdup block does not have an attribute named time, and error will be returned.
Getting Property Package Information¶
If a reference to a property package was not provided by the UnitModel as an argument, the Holdup block first checks to see if the UnitModel has a property_package argument set, and uses this if present. Otherwise, the Holdup block begins searching up the model tree looking for an argument named default_property_package and uses the first of these that it finds. If not default_property_package is found, an Exception is returned.
Collecting Indexing Sets for Property Package¶
The final common step for all property packages is to collect any required indexing sets from the property package (for example component and phase lists). These are used by the Holdup block for determining what balance equations need to be written, and what terms to create.
The indexing sets the Holdup block looks for are:
- component_list - used to determine what components are present, and thus what material balances are required
- phase_list - used to determine what phases are present, and thus what balance equations are required
- rate_reaction_idx - a list of rate controlled reactions present in the system. Used if has_rate_reactions = True to determine how many generation terms are required. If rate_reaction_idx is found, the Holdup also looks for a list of stoichiometric coefficients (rate_reaction_stoichiometry). If either of these is not found, a warning is raised and has_rate_reaction is set to False.
- equilibrium_reaction_idx - a list of equilibrium reactions present in the system. Used if has_equilibrium_reactions = True to determine how many generation terms are required. If equilibrium_reaction_idx is found, the Holdup also looks for a list of stoichiometric coefficients (equilibrium_reaction_stoichiometry). If either of these is not found, a warning is raised and has_equilibrium_reaction is set to False.
- phase_equilibrium_idx - a list of phase equilibrium reactions present in the system. Used if has_phase_equilibrium = True to determine how many generation terms are required. If phase_equilibrium_idx is found, the Holdup also looks for a list of species which are in phase equilibrium (phase_equilibrium_list). If either of these is not found, a warning is raised and has_phase_equilibrium is set to False.
- If material_balance_type is set to use element balances, the Holdup block tries to find a component named element_list (which contains a list of elements present in the species of the system). IF this is not found, an Exception is returned.
HoldupData Class¶
-
class
idaes.core.holdup.
HoldupData
(component)[source]¶ 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.
-
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
-