Component

The components are the building blocks of the library. The LaboThApPy library provides a variety of component models that can be used to simulate different thermodynamic cycles by interconnecting the models using connectors. These models are designed to represent various types of components commonly found in thermodynamic systems, such as compressors, expanders, heat exchangers, pumps, solar collectors, tanks, valves,… The documentation for each component model is organized into separate sections, making it easy to find the information about a certain model..

Each component model is implemented as a class that inherits from the BaseComponent class.

BaseComponent Class

The BaseComponent class is the parent class for all components in the LaboThApPy library. All components inherit the properties and methods of the BaseComponent class.

class component.base_component.BaseComponent[source]

Attributes:

calculablebool

Indicates whether the component has enough inputs to perform calculations.

parametrizedbool

Indicates whether the component has all required parameters set.

solvedbool

Indicates whether the component has been successfully solved (i.e., its state has been computed).

inputsdict

A dictionary holding the input variables for the component.

paramsdict

A dictionary holding the parameters required for the component.

guessesdict

A dictionary holding initial guesses for solving the component.

Methods:

set_inputs(inputs):

Sets the input values for the component.

sync_inputs():

Synchronizes the inputs dictionary with the current state of the component’s connectors.

set_parameters(parameters):

Sets the parameter values for the component and checks if it is fully parametrized.

set_guesses(guesses):

Sets initial guesses for variables to be solved.

check_calculable():

Checks if the component has all the required inputs to perform calculations.

check_parametrized():

Checks if the component has all the required parameters set.

get_required_inputs():

Returns a list of required input variables for the component. Meant to be overridden in derived classes.

get_required_parameters():

Returns a list of required parameters for the component. Meant to be overridden in derived classes.

get_required_guesses():

Returns a list of required guesses for the component.

solve():

Solves the component’s state, to be implemented in derived classes.

Notes:

  • This is a base class and should be extended for specific types of components (e.g., heat exchangers, pumps, turbines).

  • The solve method is not implemented here and must be defined in derived classes for actual computation.

Inputs and Parameter Settings

Component inputs can be defined in two main ways: either directly within the component or via connectors. These two approaches provide flexibility depending on the complexity of the system being modeled.

Connector-Based Approach

In this approach, inputs are set through connectors, which handle the transfer of thermodynamic properties and mass flow between components. This method is especially useful when building systems composed of multiple interconnected components.

By assigning properties to a connector, you automatically define the inputs for all components linked to it. This facilitates consistent and modular system design.

See example below for practical usage.

Components connectors description.

Direct Input Approach

In this method, inputs are assigned directly to each component using the set_inputs method. This approach is particularly well-suited for standalone component use, where no interconnection with other components is required.

Components inlet/outlet description.