Ports¶
Introduction¶
Port Blocks are used by the IDAES framework whenever multiple inlets or outlets are required by a single Holdup Block, and are generally constructed automatically by the build_inlets and build_outlets methods at the Unit model level. Port Blocks contain a set of Property Blocks for each of the multiple inlet or outlet streams along with the necessary mixing or splitting constraints to relate these to the flow into or out of the Holdup Block.
Port Class¶
The Port class serves as a base class for all Port Blocks, and automates the task common to all of these. The main tasks of the Port class are:
- Make references to the time, component_list and phase_list indexing Sets to use when constructing Constraints.
- Determine which mixing or splitting equations are required by checking the config block of the parent Holdup Block.
Port Construction Arguments¶
The construction arguments for Port Blocks are determined automatically based on the construction arguments of the assoicated Holdup Block. The available arguments and their values are:
- has_material_balance - indicates whether material mixing/splitting constraints should be constructed. False if parent.config.material_balance_type is ‘none’, otherwise True.
- has_energy_balance - indicates whether energy mixing/splitting constraints should be constructed. False if parent.config.energy_balance_type is ‘none’, otherwise True.
- has_momentum_balance - indicates whether momentum mixing/splitting constraints should be constructed. False if parent.config.momentum_balance_type is ‘none’, otherwise True.
Inlet Mixer Class¶
InletMixer Blocks are created as a sub-model of any Holdup Block which is declared to have multiple inlets. Based on the configuration arguments of the Holdup Block, the following mixing Constraints are written as required.
InletMixer Construction Arguments¶
InletMixer have one additional construction argument beyond those inherited from Port.
- inlets - a list of names to use to index the inlets. Used as indices for the inlet Property Blocks constructed by the InletMixer.
Material Mixing Constraints¶
where \(F_{t, i, p, j}\) is the flow of component \(j\) in phase \(p\) in inlet \(i\) at time \(t\) and \(F_{t, p, j}\) is the combined flow of component \(j\) in phase \(p\) at time \(t\) across all inlets.
Energy Mixing Constraint¶
where \(H_{t, i, p}\) is the flow of energy in phase \(p\) in inlet \(i\) at time \(t\) and \(H_{t, p, j}\) is the combined flow of energy in phase \(p\) at time \(t\) across all inlets. The equation scaling factor \(s_e\) is a mutable parameter named scaling_factor_energy in the inlet mixer with a default value of \(1\times 10^{-6}\).
Pressure Mixing Constraint¶
For determining the pressure of the mixed stream, the minimum pressure of all the inlets is used. This is calculated as follows:
- for i in inlets:
- if i = 1:
- \(s_p\cdot P_{min, t, i} = s_p \cdot P_{i, t}\)
- else:
- \(s_p\cdot P_{min, t, i} = s_p\cdot smin(P_i, P_{min, i-1})\)
Here, \(P_{t, i}\) is the pressure in inlet \(i\) at time \(t\), \(P_{min, t, i}\) is an intermediate variable used to calculate the minimum pressure in all inlets tested so far and \(smin\) is a smooth minimum function. The smoothing parameter for \(smin\) is named eps_pressure and has a default value of \(1\times 10^{-3}\). The equation scaling factor \(s_p\) is a mutable parameter named scaling_factor_pressure in the inlet mixer with a default value of \(1\times 10^{-5}\).
InletMixerData Class¶
-
class
idaes.core.ports.
InletMixerData
(component)[source]¶ 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.
-
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
-
Outlet Splitter Class¶
OutletSplitter Blocks are created as a sub-model of any Holdup Block which is declared to have multiple outlets. Based on the configuration arguments of the Holdup Block, the following splitting Constraints are written as required.
OutletSplitter Construction Arguments¶
OutletSplitters have two additional construction argument beyond those inherited from Port.
outlets - a list of names to use to index the outlets. Used as indices for the outlet Property Blocks constructed by the OutletSplitter.
split_type - determines the method to be used when splitting the outlet stream. Options are:
- ‘flow’ - outlet streams are split based on total flow. All resulting streams have the same intensive state.
- ‘phase’ - outlet streams are split by phase fractions. A specified portion of each phase is sent to each outlet.
- ‘component’ - outlet streams are split by component. A specified fraction of each component is sent to each outlet.
- ‘total’ - outlet streams are split based on phase and component. A specified fraction of each phase-component pair is sent to each outlet.
Split Fraction Constraints¶
OutletSplitter creates a split_fraction variable which is indexed as determined by the type of split being performed:
- flow - indexed by time and outlet only
- phase - indexed by time, outlet and phase
- component - indexed by time, outlet and component
- total - indexed by time, outlet, phase and component
In all cases, a Set of Constraints are written such the the sum of split fractions for a given outlet must be 1.
Material Splitting Constraints¶
where \(F_{t, o, p, j}\) is the flow of component \(j\) in phase \(p\) in outlet \(o\) at time \(t\) after splitting and \(F_{t, p, j}\) is the total flow of component \(j\) in phase \(p\) at time \(t\) leaving the holdup.
Energy Splitting Constraints¶
Energy splitting is handled differently depending on the split type chosen. If split_type is ‘phase’ then the following Constraint is written:
where \(H_{t, o, p}\) is the energy flow in phase \(p\) in outlet \(o\) at time \(t\) and \(H_{t, p}\) is the total energy flow in phase \(p\) at time \(t\) leaving the Holdup.
If split_type is not equal to ‘phase’, then the outlet temperature of all streams is set to be equal.
where \(T_{t, o}\) is the temperature of outlet \(o\) at time \(t\) and \(T_t\) is the temperature of the total flow leaving the Holdup at time \(t\).
Momentum Splitting Constraints¶
The momentum splitting constraint equates the pressure in each outlet to the pressure of the material leaving the Holdup.
where \(P_{t, o}\) is the pressure of outlet \(o\) at time \(t\) and \(P_t\) is the pressure of the total flow leaving the Holdup at time \(t\).
OutletSplitterData Class¶
-
class
idaes.core.ports.
OutletSplitterData
(component)[source]¶ 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.
-
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)
-