carbatpy.utils.property_eval_mixture
A script to evaluate mixtures, in order to find some with vapor pressures in some limits at given temperatures, together with the temperature glide. The results are stored as figure, as csv and in a json-file(Input); all in the given directory.
The csv output file structure is as follows:
number of calculation
the four mole fractions, species names are in the title
index l: the properties for saturated vapor at the given low temperature
index sup: the poperties at superheating at pressure p_l for a prescribed superheating
index h: the properties for saturated vapor at the given high temperature
index is: the properties for the isentropic state (sup ->p_h) at the given low temperature
index is80: the properties for the isentropic effic. of 80 % (sup ->p_h) at the given low temperature
index dew: the properties for the saturated liquid at p_h
index mid: the properties at the mean enthalpy between q=0 and q=1 at p_h
index thr: the properties for the isenthalpic throtteling from saturated liquid to p_l
index hplT: the properties at T_l and p_h
index thrlow: the properties for the isenthalpic throtteling from hplt ->p_l
index bol: the properties for saturated liquid at the low pressure p_l
p_ratio: the pressure ratio
T_glide_h: the temperature glide at high pressure
dv/v’’: (ca.) the mean change in volume along throtteling relative to the specific volume of the vapor, this is a measure of how much work is ‘lost’ along throtteling
dv/v’’-b: similar volume ratio after subcooling to thrlow, answer the question: will subcooling reduce losses (strongly)?
COP_is: What is the predicted COP for isentropic compression (losses along throtteling are seen here)
For each indexed state : T,p,h,v,s,q,u in SI units(mass base) are listed.
part of carbatpy
Created on Thu Oct 19 14:11:14 2023
@author: atakan
Attributes
Functions
|
Mixtures are evaluated/screened to find a given temperature glide. |
|
Evaluates fluid screening data combined with the Roskosch compressor model. |
|
Extracts fluid names and compositions from screening data. |
|
Combine two data frames out of two or more files with same number of lines |
|
Plot a DataFrame from a file using a configuration dictionary. |
|
|
|
Module Contents
- carbatpy.utils.property_eval_mixture.mixture_search(fluids_all, temp_both, p_both, res_dir, d_temp_superheating=5, resolution=21, temp_limit=False, **kwargs)[source]
Mixtures are evaluated/screened to find a given temperature glide.
For all possible mixture compositions, first the saturated vapor pressure at the low temperature is evaluated. If valid, the high temperature saturated vapor pressure (p_h) is calculated. The temperature difference between dew point and bubble point at p_h is taken as the temperature glide.
- Parameters:
fluids_all (list of str) – Up to 4 fluid names (REFPROP).
temp_both (list of float) – Min (low pressure) and max (high pressure) dew point temperatures in K.
p_both (list of float) – Allowed min and max pressure in Pa.
res_dir (str) – Directory for storing results.
d_temp_superheating (float, optional) – Superheating in K. Default is 5.
resolution (int, optional) – Inverse of the interval for mole fraction screening. Default is 21.
temp_limit (bool, optional) – If True, filters values where bubble point at p_h is above temp_both[0]. Default is False.
kwargs (dict) –
Additional parameters. Currently supported:
fig_title (str): “std” for default title, “” for none.
- Return type:
None
- carbatpy.utils.property_eval_mixture.eval_is_eff_roskosch(data, file_out)[source]
Evaluates fluid screening data combined with the Roskosch compressor model.
This method processes the output of the Roskosch compressor model (h_aus, s_aus, h_e) for states calculated during screening.
Note
The Roskosch model calculates in kJ, while carbatpy uses SI units (J). Enthalpies are converted accordingly.
Based on the output enthalpy, the COP_comp is calculated. Mean temperatures are derived from enthalpies and entropies along the isobaric heat transfer for two cases:
Throttling at quality = 0.
Throttling after subcooling to T_low (identified by the suffix _lowT).
With these mean temperatures, the COPs for two reversible cases are calculated: * COP_rev80: For a fixed isentropic efficiency of 80%. * COP_rev_r: For the specific Roskosch ‘real’ case.
Finally, the (pseudo-)real COP is compared to the reversible COP to determine the second law efficiency (eff_sec_law_r and eff_sec_law_80). These efficiencies include compressor and throttling losses, but no heat transfer!
References
Roskosch piston compressor model: http://dx.doi.org/10.1016/j.ijrefrig.2017.08.011
- Parameters:
data (pandas.DataFrame) – Combined DataFrame containing fluid screening data and Roskosch model outputs.
file_out (str) – Path and filename where the resulting DataFrame will be stored.
- Returns:
The input DataFrame expanded by the calculated results.
- Return type:
pandas.DataFrame
- carbatpy.utils.property_eval_mixture.get_fluid(data)[source]
Extracts fluid names and compositions from screening data.
This method parses the column names of the provided DataFrame to identify the fluids and their respective mole fractions, formatted for REFPROP.
- Parameters:
data (pandas.DataFrame) – DataFrame from fluid screening containing mole fractions. The fluid names are extracted directly from the column headers.
- Returns:
fluids (list of str) – The plain names of the identified fluids.
fluid_col (list of str) – The actual column names (including the
x_prefix).fluid_str (str) – The fluid composition string formatted for compatibility with REFPROP.
- carbatpy.utils.property_eval_mixture.combine(filenames, filename_out='automatic')[source]
Combine two data frames out of two or more files with same number of lines
and fitting to each other. Can be used, when after fluid screening machine efficienceies, costs, etc. are calculated as post-processing. Can help in evaluation and plotting.
- Parameters:
filenames (list of strings) – all filenames (incl. directories), to be read.
filename_out (string, optional) – Where to store the result. The default is “automatic”. Then the first filename isxpanded vy “-combined”.
- Raises:
ValueError – If tgere is a problem with the files.
- Returns:
combined – the combined dataFrame.
- Return type:
pandas.dataFrame
- carbatpy.utils.property_eval_mixture.data_plot(filename, what, filename_out='automatic', fig_title='')[source]
Plot a DataFrame from a file using a configuration dictionary.
Imports a CSV file as a DataFrame and creates a plot based on the provided mapping for x, y, hue, and other aesthetic parameters. The resulting plot is saved to a file.
- Parameters:
filename (str) – Path to the CSV file containing the DataFrame to be imported.
what (dict) – Mapping of plot aesthetics to DataFrame column names. Supported keys include
"x","y","hue","style", and"size".filename_out (str, optional) – The full path and filename where the plot will be saved. If
"automatic", a name is generated based on the input. The default is “automatic”.fig_title (str, optional) – The title of the figure. The default is “”.
- Returns:
True if the plot was created and saved successfully, False otherwise.
- Return type:
bool