CADETProcess.processModel.FlowSheet#
- class CADETProcess.processModel.FlowSheet(name)[source]#
Bases:
StructureClass to design process flow sheet.
In this class, UnitOperation models are added and connected in a flow sheet.
- Attributes:
n_compUnsignedIntegerint: The number of components.
- nameString
Name of the FlowSheet.
unitslistlist: list of all unit_operations in the flow sheet.
connectionsdictdict: In- and outgoing connections for each unit.
output_statesdictdict: Output states of the unit operations.
- add_connection(origin: UnitBaseClass, destination: UnitBaseClass, origin_port: str | None = None, destination_port: str | None = None) None[source]#
Add connection between units ‘origin’ and ‘destination’.
- Parameters:
- originUnitBaseClass
UnitBaseClass from which the connection originates.
- destinationUnitBaseClass
UnitBaseClass where the connection terminates.
- origin_portstr, optional
Port from which connection originates.
- destination_portstr, optional
Port where connection terminates.
- Raises:
- CADETProcessError
If origin OR destination do not exist in the current flow sheet. If connection already exists in the current flow sheet.
See also
connectionsremove_connectionoutput_state
- add_eluent_inlet(eluent_inlet: SourceMixin) None[source]#
Add inlet to list of units to be considered for eluent consumption.
- Parameters:
- eluent_inletSourceMixin
Unit to be added to list of eluent inlets.
- Raises:
- CADETProcessError
If unit is not an Inlet. If unit is already marked as eluent inlet.
- add_feed_inlet(feed_inlet: SourceMixin) None[source]#
Add inlet to list of units to be considered for recovery.
- Parameters:
- feed_inletSourceMixin
Unit to be added to list of feed inlets.
- Raises:
- CADETProcessError
If unit is not an Inlet. If unit is already marked as feed inlet.
- add_product_outlet(product_outlet: Outlet) None[source]#
Add outlet to list of units considered for fractionation.
- Parameters:
- product_outletOutlet
Unit to be added to list of product outlets.
- Raises:
- CADETProcessError
If unit is not an Outlet. If unit is already marked as product outlet.
- add_unit(unit: UnitBaseClass, feed_inlet: bool = False, eluent_inlet: bool = False, product_outlet: bool = False) None[source]#
Add unit to the flow sheet.
- Parameters:
- unitUnitBaseClass
UnitBaseClass object to be added to the flow sheet.
- feed_inletbool
If True, add unit to feed inlets.
- eluent_inletbool
If True, add unit to eluent inlets.
- product_outletbool
If True, add unit to product outlets.
- Raises:
- TypeError
If unit is no instance of UnitBaseClass.
- CADETProcessError
If unit already exists in flow sheet. If n_comp does not match with FlowSheet.
See also
- check_connections() bool[source]#
Validate that units are connected correctly.
Warning:#
If Inlets have ingoing streams. If Outlets have outgoing streams. If Units (other than Cstr) are not fully connected.
- Returns:
- flagbool
True if all units are connected correctly. False otherwise.
- check_flow_rates(state: dict | None = None) None[source]#
Check if in and outgoing flow rates of unit operations are balanced.
- check_units_config() bool[source]#
Check if units are configured correctly.
- Returns:
- flagbool
True if units are configured correctly. False otherwise.
- property component_system: ComponentSystem#
ComponentSystem: The component system of the flow sheet.
- connection_exists(origin: UnitBaseClass, destination: UnitBaseClass, origin_port: str | None = None, destination_port: str | None = None) bool[source]#
bool: check if connection exists in flow sheet.
- Parameters:
- originUnitBaseClass
UnitBaseClass from which the connection originates.
- destinationUnitBaseClass
UnitBaseClass where the connection terminates.
- origin_portPort, optional
If origin unit operation has ports, origin port can be specified.
- destination_portPort optional
if destination unit operation has ports, destination port can be specified.
- property connections: Dict#
dict: In- and outgoing connections for each unit.
See also
- property eluent_inlets: list[UnitBaseClass]#
list: Inlets to be considered for eluent consumption.
- property feed_inlets: list[UnitBaseClass]#
list: Inlets considered for calculating recovery yield.
- get_flow_rates(state: Dict | None = None, eps: float = 5.9e+16) Dict[source]#
Calculate flow rate for all connections.
Optionally, an additional output state can be passed to update the current output states.
- Parameters:
- stateDict, optional
Updated flow rates and output states for process sections. Default is None.
- epsfloat, optional
eps as an upper boarder for condition of flow_rate calculation
- Returns:
- Dict
Volumetric flow rate for each unit operation.
- Raises:
- CADETProcessError
If flow sheet connectivity matrix is singular, indicating a potential issue in flow sheet configuration.
Notes
To calculate the flow rates, a system of equations is set up:
\[Q_i = \sum_{j=1}^{n_{units}} q_{ji} = \sum_{j=1}^{n_{units}} Q_j * w_{ji},\]where \(Q_i\) is the total flow exiting unit \(i\), and \(w_{ij}\) is the percentile of the total flow of unit \(j\) directed to unit \(i\). If the unit is an Inlet or a Cstr with a given flow rate, \(Q_i\) is given and the system is simplified. This system is solved using numpy.linalg.solve. Then, the individual flows \(q_{ji}\) are extracted.
References
Forum discussion on flow rate calculation: https://forum.cadet-web.de/t/improving-the-flowrate-calculation/795
- get_port_index(unit: UnitBaseClass, port: str) int[source]#
Return the port index of a unit.
- Parameters:
- unitUnitBaseClass
UnitBaseClass object of wich port index is to be returned
- portstring
Name of port which index is to be returned
- Returns:
- port_indexint
Returns the port index of the port of the unit_operation.
- Raises:
- CADETProcessError
If unit or port is not in the current flow sheet.
- get_unit_index(unit: UnitBaseClass) int[source]#
Return the unit index of the unit.
- Parameters:
- unitUnitBaseClass
UnitBaseClass object of which the index is to be returned.
- Returns:
- unit_indexint
Returns the unit index of the unit_operation.
- Raises:
- CADETProcessError
If unit does not exist in the current flow sheet.
- name#
Parameter descriptor constrained to string values.
- origin_destination_name_decorator() Callable[source]#
Wrap methods to enable calling functions using origin and destination units.
- property output_states: Dict#
dict: Output states of the unit operations.
- property product_outlets: list[UnitBaseClass]#
list: Outlets to be considered for fractionation.
- remove_connection(origin: UnitBaseClass, destination: UnitBaseClass, origin_port: str | None = None, destination_port: str | None = None) None[source]#
Remove connection between units ‘origin’ and ‘destination’.
- Parameters:
- originUnitBaseClass
UnitBaseClass from which the connection originates.
- destinationUnitBaseClass
UnitBaseClass where the connection terminates.
- origin_portint
Port from which connection originates.
- destination_portint
Port where connection terminates.
- Raises:
- CADETProcessError
If origin OR destination do not exist in the current flow sheet. If connection does not exists in the current flow sheet.
See also
- remove_eluent_inlet(eluent_inlet: SourceMixin) None[source]#
Remove inlet from list of units considered for eluent consumption.
- Parameters:
- eluent_inletSourceMixin
Unit to be added to list of eluent inlets.
- Raises:
- CADETProcessError
If unit is not in eluent inlets.
- remove_feed_inlet(feed_inlet: SourceMixin) None[source]#
Remove inlet from list of units to be considered for recovery.
- Parameters:
- feed_inletSourceMixin
Unit to be removed from list of feed inlets.
- remove_product_outlet(product_outlet: Outlet) None[source]#
Remove outlet from list of units to be considered for fractionation.
- Parameters:
- product_outletOutlet
Unit to be added to list of product outlets.
- Raises:
- CADETProcessError
If unit is not a product outlet.
- remove_unit(unit: UnitBaseClass) None[source]#
Remove unit from flow sheet.
Removes unit from the list. Tries to remove units which are twice located as desinations. For this the origins and destinations are deleted for the unit. Raises a CADETProcessError if an ValueError is excepted. If the unit is specified as feed_inlet, eluent_inlet or product_outlet, the corresponding attributes are deleted.
- Parameters:
- unitUnitBaseClass
UnitBaseClass object to be removed to the flow sheet.
- Raises:
- CADETProcessError
If unit does not exist in the flow sheet.
See also
add_unitfeed_inleteluent_inletproduct_outlet
- set_output_state(unit: UnitBaseClass, state: int | list[float] | dict, port: str | None = None) None[source]#
Set split ratio of outgoing streams for UnitOperation.
- Parameters:
- unitUnitBaseClass
UnitOperation of flowsheet.
- stateint or list of floats or dict
new output state of the unit.
- portstr
Port for which to set the output state.
- Raises:
- CADETProcessError
If unit not in FlowSheet If state is integer and the state >= the state_length. If the length of the states is unequal the state_length. If the sum of the states is not equal to 1. If port cannot be found in the unit operation.
- unit_name_decorator() Callable[source]#
Wrap methods to enable calling functions with unit object or unit name.
- property units: list[UnitBaseClass]#
list: list of all unit_operations in the flow sheet.
- property units_dict: dict[str, UnitBaseClass]#
dict: Unit operation names and objects.
- property units_with_binding: list[UnitBaseClass]#
list: UnitOperations with binding models.