pyaplus.flowsheet

class pyaplus.flowsheet.ProcessBlock(node: AspenObject)

Bases: object

Creates a process block from a node in a simulation

Args:

node (AspenObject): COM object for a block

class pyaplus.flowsheet.ProcessStream(node: AspenObject)

Bases: object

Creates a process stream from a node in a simulation

Args:

node (“AspenObject”): COM object for a node

get_properties(prop_list: list) dict

Gets the stream properties in a dictionary

Args:

prop_list (list): List of properties. The valid elements of the list are: “TEMP”: Temperature “PRES”: Pressure “MOLEFLOW”: Molar flow (“COMPMOLEFLOW”, “chemical”): Component molar flow of a chemical “MASSFLOW”: Mass flow (“COMPMASSFLOW”, “chemical”): Component mass flow of a chemical (“COMPMASSFRAC”, “chemical”): Component mass fraction of a chemical (“COMPMOLEFRAC”, “chemical”): Component mole fraction of a chemical “VOLUMETRICFLOW”: Volumetric flow “MASSENTHALPY”: Enthalpy per unit of mass “MOLEENTHALPY”: Enthalpy per mole unit

Returns:

dict: Dictionary with the property and the value. The units have to be checked in the Aspen Plus simulation flowsheet.

set_properties(prop_dict: dict) None

Set the stream properties using a dictionary

Args:

prop_dict (dict): Dict of properties {key,value}. The valid elements of the keys are: “TEMP”: Temperature “PRES”: Pressure “FLOW”: Total flow. Depends on FLOWBASIS “FLOWBASIS”: Basis of the total flow. Allowed values are “MASS”, “MOLE”, “STDVOL”, or “VOLUME” (“COMPFLOW”, “chemical”): Component flow. Depends on COMPBASIS “COMPBASIS”: Basis of the composition window. It can be “MASS-FLOW”, “MOLE-FLOW”, “STDVOL-FLOW”, “MASS-FRAC”, “MOLE-FRAC”, “STDVOL-FRAC”, “MASS-CONC” or”MOLE-CONC” “VAPFRAC”: Vapor fraction “FLASHTYPE”: Type of the data that the streams requires. Options are “TP”, “TV”, or “PV”, where P is pressure, T is temperature, and V is vapor fraction

class pyaplus.flowsheet.Simulation(path: str)

Bases: object

Connects to a given simulation.

Args:

path (str): String with the raw path to the Aspen PLUS file.

property BLOCK: TreeBlock

Shortcut to access the blocks in the Aspen variable tree.

Returns:

TreeBlock: Element of the variable tree correspoonding to DataBlocks

property STREAM: TreeStream

Shortcut to access the streams in the Aspen variable tree.

Returns:

TreeStream: Element of the variable tree corresponding to DataStreams

close(soft: bool = False) None

Closes the instance and the Aspen connection. If you do not close it, the task will remain and you will have to stop it from the task manage.

WARNING: It will close ALL Aspen Plus instances. Cause it was not being obedient. And I do not appreciate that. If you do not want it to do this, set soft = True.

get_block(name: str) ProcessBlock

Get a block object

Args:

name (str): Name of the block

Returns:

ProcessBlock: Block object

get_stream(name: str) ProcessStream

Get a stream object

Args:

name (str): Name of the stream

Returns:

ProcessStream: Stream object

reinit() None

Reinitiates the simulation

run() None

Runs the simulation.

set_popups(popups: bool = True) None

Allows or supresses Aspen popups. For example, when reinitializing, it asks if you are sure.

Args:

popups (bool, optional): State if you want or not popups. Defaults to True.

set_visible(visibility: int = 0) None

Sets the visibility of the flowsheet.

Args:

visibility (int, optional): If 1, it shows the flowsheet. If 0, it keeps it invisible. Defaults to 0.