IDAES Base Classes¶
Contents
Introduction¶
All of the modeling classes described above build of a set of base classes within the IDAES core. These base classes handle the interaction between the IDAES framework and the underlying Pyomo framework.
ProcessBlockData Class¶
-
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]¶ 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
-
ProcessBlock Class¶
-
class
idaes.core.process_block.
ProcessBlock
(*args, **kwargs)[source]¶ 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.
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.