Streams¶
Contents
Introduction¶
Stream Blocks are used within the IDAES framework for connecting Unit Models at the Flowsheet level. Each Stream connects an inlet and an outlet from a Unit model.
Construction Arguments¶
Stream Blocks have four construction arguments, which describe the source and destination of the Stream. The construction arguments are:
- source - the outlet Port object to use as the source of the Stream.
- source_idx - (optional) index to use when source Port represents multiple outlets (i.e. comes from an OutletSplitter Block).
- destination - the inlet Port object to use as the destination of the Stream.
- destination_idx - (optional) index to use when destination Port represents multiple inlets (i.e. comes from an InletMixer Block).
Port Validation¶
The first step in constructing a Stream is to check that both the source and destination Ports are compatible. This is done with the following checks:
- Ports must have the same length.
- Ports must have the same set of named variables (keys).
- Variables within Ports must have the same indexing sets.
If any of these tests fail, an Exception is raised stating that the Ports are not compatible and why.
Stream Constraints¶
The main purpose of a Stream is to connect the outlet of one unit to the inlet of another, which is done using equality Constraints. Streams automatically write a set of equality Constraints which relate each member of the source Port to the equivalent member of the destination Port.
Stream Variables¶
Streams also automatically generate local representations of the variables associated with the Stream, so that users can evaluate the quantities present in the Stream. These values are stored in a VarDict, and support a number of methods as shown below.
StreamData Class¶
Streams support a number of methods for solving models and evaluating results which are documented below.
-
class
idaes.core.stream.
StreamData
(component)[source]¶ This is the class for process streams. These are blocks that connect two unit models together.
-
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 = ‘’)
-
VarDict Class¶
-
class
idaes.core.stream.
VarDict
[source]¶ 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
-