vclibpy package

Package for stationary vapor compression models and their analysis

Subpackages

Submodules

vclibpy.datamodels module

Module which contains datamodels which are used in this library.

class vclibpy.datamodels.FlowsheetState[source]

Bases: VariableContainer

This class is used to define the unique states of the flowsheet in the heat pump.

The class is dynamic in the sense that attributes may be added during calculation of new flowsheet. This enables the easy adding of custom values to analyze the whole flowsheet and not restrict to a certain naming convention.

class vclibpy.datamodels.Inputs(n: float | None = None, T_eva_in: float | None = None, T_con_in: float | None = None, m_flow_eva: float | None = None, m_flow_con: float | None = None, dT_eva_superheating: float | None = None, dT_con_subcooling: float | None = None, T_ambient: float | None = None)[source]

Bases: VariableContainer

Class defining inputs to calculate the FlowsheetState.

While the inputs are pre-defined, you may add further ones using the set method.

Args:

n (float): Relative compressor speed between 0 and 1. T_eva_in (float): Secondary side evaporator inlet temperature. T_con_in (float): Secondary side condenser inlet temperature. m_flow_eva (float): Secondary side evaporator mass flow rate. m_flow_con (float): Secondary side condenser mass flow rate. dT_eva_superheating (float): Super-heating after evaporator. dT_con_subcooling (float): Subcooling after condenser. T_ambient (float): Ambient temperature of the machine.

class vclibpy.datamodels.Variable(name: str, value: float, unit: str | None = None, description: str | None = None)[source]

Bases: object

Class for a variable used in analysis.

Args:

name (str): The name of the variable. value (float): The numerical value of the variable. unit (str): The unit of measurement for the variable (optional). description (str): A description of the variable (optional).

description: str = None
name: str
unit: str = None
value: float
class vclibpy.datamodels.VariableContainer[source]

Bases: object

Class which holds Variables to be used anywhere in the models.

This class enables dynamic addition of Variables.

convert_to_str_value_format(with_unit_and_description: bool) Dict[str, float][source]

Returns a dictionary with a str: float format which is handy when storing results in files like .csv or .xlsx.

Args:

with_unit_and_description (bool): When False, only the name is in the string.

Returns:

dict: Containing all variables and values.

copy()[source]

Return a deepcopy of the instance as the variable dict is mutable.

Returns:

VariableContainer: A deepcopy of the VariableContainer instance.

get(name: str, default: Any | None = None)[source]

Get the Variable with the specified name.

Args:

name (str): The name of the variable. default (Any): Default value to return if the variable is not found.

Returns:

Variable: The Variable object.

get_variable_names() list[source]

Get the names of all variables in the container.

Returns:

list: A list of variable names.

get_variables()[source]

Get all variables in the container.

Returns:

Dict[str, Variable]: A dictionary of variable names and Variable objects.

items()[source]

Get items from the container.

Returns:

Dict[str, Variable]: A dictionary of variable names and Variable objects.

set(name: str, value: float, unit: str | None = None, description: str | None = None)[source]

Add or update a Variable in the container.

Args:

name (str): The name of the variable. value (float): The numerical value of the variable. unit (str): The unit of measurement for the variable (optional). description (str): A description of the variable (optional).