carbatpy.models.components.comp
Attributes
Classes
Components of thermodynamic cycles. |
|
Components of thermodynamic cycles. |
|
Simple isenthalpic throttle. |
|
Components of thermodynamic cycles. |
|
Components of thermodynamic cycles. |
|
Components of thermodynamic cycles. |
|
Functions
|
|
|
Module Contents
- class carbatpy.models.components.comp.Component(name, config, **kwargs)[source]
Bases:
abc.ABCComponents of thermodynamic cycles.
All components have the following attributes:
config: basic configuration incl. calculation methodinputs: inputs for calculationsoutput: main resultsall_data: detailed data points for plotting and post-processingwarning: a value and a message (0, “All o.k.”)
All components implement the following methods:
initialize: set values that do not depend on a specific calculationcalculate: main calculation routineplot: plot changes in a joint diagramsave_results: save results and inputs to a directory
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.
- class carbatpy.models.components.comp.FlowDevice(name, config, **kwargs)[source]
Bases:
ComponentComponents of thermodynamic cycles.
All components have the following attributes:
config: basic configuration incl. calculation methodinputs: inputs for calculationsoutput: main resultsall_data: detailed data points for plotting and post-processingwarning: a value and a message (0, “All o.k.”)
All components implement the following methods:
initialize: set values that do not depend on a specific calculationcalculate: main calculation routineplot: plot changes in a joint diagramsave_results: save results and inputs to a directory
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.
- class carbatpy.models.components.comp.Throttle(name, config, **kwargs)[source]
Bases:
FlowDeviceSimple isenthalpic throttle.
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.
- class carbatpy.models.components.comp.HeatExchanger(name, config, **kwargs)[source]
Bases:
ComponentComponents of thermodynamic cycles.
All components have the following attributes:
config: basic configuration incl. calculation methodinputs: inputs for calculationsoutput: main resultsall_data: detailed data points for plotting and post-processingwarning: a value and a message (0, “All o.k.”)
All components implement the following methods:
initialize: set values that do not depend on a specific calculationcalculate: main calculation routineplot: plot changes in a joint diagramsave_results: save results and inputs to a directory
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.
- class carbatpy.models.components.comp.StaticHeatExchanger(name, config, **kwargs)[source]
Bases:
HeatExchangerComponents of thermodynamic cycles.
All components have the following attributes:
config: basic configuration incl. calculation methodinputs: inputs for calculationsoutput: main resultsall_data: detailed data points for plotting and post-processingwarning: a value and a message (0, “All o.k.”)
All components implement the following methods:
initialize: set values that do not depend on a specific calculationcalculate: main calculation routineplot: plot changes in a joint diagramsave_results: save results and inputs to a directory
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.
- set_in_out(new_state, instate=True)[source]
Replace either an old input state or output state by a new one.
Needed for the calculation of the heat exchanger.
- Parameters:
new_state (dict) – Dictionary mapping fluid names to state arrays. Format:
{"fluid-name": numpy_array_with_state}instate (bool, default=True) – If True, replaces input state; if False, replaces output state.
- Returns:
in_state (dict) – Input state dictionary to pass to calculate().
out_state (dict) – Output state dictionary to pass to calculate().
- plot(plot_info, **kwargs)[source]
Plots the T-H_dot diagram (shifted enthalpy flow rate).
This method visualizes the temperature profile against the enthalpy flow rate, allowing for the analysis of temperature differences (pinch points) within the component.
- Parameters:
plot_info (dict) –
Configuration for the matplotlib plot. Required keys:
”fig”: Matplotlib figure object.
”ax”: Matplotlib axes object.
”what”: List of indices [x, y], e.g., [2, 0] for (h, T).
”col”: List of color/style strings, e.g., [“r:”, “ko”].
”label”: List of labels for the legend.
”x-shift”: List of initial shifts for the x-axis.
Example:
{"fig": fig, "ax": ax, "what": [2, 0], "col": ["r:", "k-"]}**kwargs – Additional plotting parameters passed to ax.plot().
- Returns:
list – A list containing the min and max values of the plotted data: [min, max].
float – The actual shift applied to the enthalpy flow rate (H_dot).
- hex_opti_work_out(inp_act=None, out_act=None, run_p_par=None, verbose=False)[source]
Optimize the mean temperature difference by varying the working Fluid output state.
Only enthalpy is variied within +/- 5%, pressure remains unchanged.
- Parameters:
run_p_cond (dictionary) – A value for {“m_dot”: 0.01} must be provided, it is kept constant.
verbose (boolean, optional) – If you want some printing. The default is False.
- Return type:
None.
- calculate_volume(parameters=None, **kwargs)[source]
Calculates the volume and mass of the thermal storage (two tanks).
It is assumed that the secondary fluid entering the heat exchanger comes from one storage and the fluid leaving it is stored in the second storage. Both volumes and the total mass are calculated for an amount of thermal energy to be stored. The costs are also estimated for cone roof tanks.
- Parameters:
parameters (dict, optional) –
A dictionary containing the following keys:
- Energy_storedfloat
Energy in J. The default is 1 MWh (3.6e9 J).
- timefloat
Time to be stored in s. If both ‘time’ and ‘Energy_stored’ are given, ‘time’ is used.
The default value is taken from the configuration file at [‘process’][‘time’].
**kwargs – Additional keyword arguments (none currently implemented).
- Returns:
A dictionary (vol_results) containing:
- storage_volumesdict
The volumes for the entering and exiting states in m3. Example: {“state_in”: vol1, “state_out”: vol2}.
- energy_densityfloat
Energy density in J/kg.
- mass_storagefloat
The total mass of the storage in kg.
- Energy_storedfloat
The actual energy stored in J.
- Storage_costsdict
Estimated costs for the entering and exiting state for cone roof tanks in currency units.
- Return type:
dict
- class carbatpy.models.components.comp.Start(name, config, **kwargs)[source]
Bases:
FlowDeviceComponents of thermodynamic cycles.
All components have the following attributes:
config: basic configuration incl. calculation methodinputs: inputs for calculationsoutput: main resultsall_data: detailed data points for plotting and post-processingwarning: a value and a message (0, “All o.k.”)
All components implement the following methods:
initialize: set values that do not depend on a specific calculationcalculate: main calculation routineplot: plot changes in a joint diagramsave_results: save results and inputs to a directory
Set the basic configuration of a component.
- Parameters:
name (string) – name of the component to be configured, must be the same as in the config dictionary or file.
config (string or dictionary) – if it is a string it must be the filename with a yaml or json file with the dictionary information. All needed basic parameters or default parameters and calculation type are set here. Check the io_utils.py file for typical values.
**kwargs (dictionary) – any further parameters which may be needed.
- Return type:
None.