Navigation

  • index
  • modules |
  • next |
  • previous |
  • carbatpy 0.3.2 documentation »
  • Fluid Mixture search

Fluid Mixture search¶

This utility script searches for mixture compositions, which evaporate at a given temperture and condense at a second given temperature, while having pressures within given limits. The idea is to find fluid mixtures for heat pumps (and later Carnot Batteries) which work between two pairs of storages. Each of them start at room temperature, one is heated up, the other cooled down. Thus room temperature is one posssible restriction.

heat pump with storage

As states are also checked after isentropic compression, throtteling saturated liquid or checking the temperature of the saturated liquid at low pressure. It works well for quaternary mixtures. As programmed, 21 mole fractions between 0 and 1 are tried for each compund, but checking that the sum is 1 for all compounds. The results are plotted, stored as a csv file with further thermodynamic properties of the two evaluated states, and a jason file with the compunds, temperatures (in K) and pressures (Pa) is written into a given directory.

heat pump with storage

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 dew: the properties for the saturated liquid 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.

It is found at: carbatpy.utils.property_eval_mixture. The results are stored in a directory, which is set in config.py. Best is to set the environment variable CARBATPY_RES_DIR to an appropriate path. As an alternative results are stored in TEMP.

p-ratio vs. T-glide plot

Example

fluids_all = ["Ethane","Propane","Hexane","Butane"]
T_low = 285.00
T_high = 363.00
p_low = 10e4
p_high = 22e5
dir_name = r"C:\Users\atakan\sciebo\results\optimal_hp_fluid"

mixture_search(fluids_all, [T_low, T_high], [p_low, p_high],
               dir_name, resolution = 21)

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

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]¶

Plotting a dataframe from a file using a dictionary with the keys

being the plotted parameters “x”, “y”, “hue” etc. and storing it to a file.

Parameters:
  • filename (string) – csv-file with the data-frame to be imported.

  • what (dictionary) – keys “y”,”x”,”hue”, “style”, size etc. values must be some column names. .

  • filename_out (string, optional) – where to store the plot, including directory. The default is “automatic”.

  • fig_title (string, optional) – Title of the figure to be plotted, default is “”.

Returns:

success?

Return type:

bool

carbatpy.utils.property_eval_mixture.eval_is_eff_roskosch(data, file_out)[source]¶

Evalutes the data in the combined dataFrame with the initial fluid screening

and the output of the Roskosch compressor model (h_aus, s_aus, h_e) for exactly the states calculated along the screening. The column names are quite special and one has to know that the Roskosch model calculates in kJ, while carbatpy uses SI units (J). With the output enthalpy of the Roskosch model, the COP_comp is calculated. Using the enthalpies and entropies along the isobaric heat ransfer, mean temperatures are calculated.Here are again two cases

a) for throttling at quality=0
b) throttling after subcooling to T_low (names: _lowT).

With these mean temperatures, the COPs for two reversible cases are calculated: for the isentropic efficieciecy of 80% COP_rev80 and for the Roskosch ‘real’ case COP_rev_r. Finally, the (pseudo-)real COP is compared to the reversible COP, giving a second law efficiency eff_sec_law_r for the Roskosch efficiencies and eff_sec_law_80 for the fixed 80% efficiency, which include the compressor and the throttling, but no heat transfer!

The Roskosch piston compressor model is described here: http://dx.doi.org/10.1016/j.ijrefrig.2017.08.011

Is part of carbatpy.

Parameters:
  • data (pandas.dataFrame) – as calculated by combining the fluid screening dataFrame with the ouput of the Roskosch model (as dataFrame).

  • file_out (string) – name of the file (incl. directory) where the resulting dataFrame shall be stored.

Returns:

data – input expanded by the results.

Return type:

pandas.dataFrame

carbatpy.utils.property_eval_mixture.get_cycle_points(data, index)[source]¶
carbatpy.utils.property_eval_mixture.get_fluid(data)[source]¶

find the fluids used in the screening

Parameters:

data (pandas.dataFrame) – dataFrame from fluid screening with mole fractions. In the column names the names of the fluids are found.

Returns:

  • fluids (list of strings) – names of the fluids.

  • fluid_col (list of strings) – List with the column names (includes a sarting”x_”.

  • fluid_str (string) – Fluid composition string as accepted by RefProp.

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 mixtures with a given temperature glide in a certain pressure range. For all possible mixture compositions first the saturated vapor pressure at the given low temperature and composition is evaluated, if it is in the allowed regime, the saturated vapor pressure (p_h) of the mixture at the high temperature is evaluated. If this is below the allowed high pressure, the saturated liquid temperature at this p_h is evaluated and the temperature difference is taken as temperature glide. The pressure ratio is plotted as a function of temperature glide. The plot, the states (as csv-file) and the input parameters (as .json-file) are stored. in the csv-File first the mole fractions are given followed by the properties of the low temperature sat.vapor, after superheating, for thehigh temperature sat. vapor, the isentropic state after compression, high pressure sat.liquid, low pressuer isenthalpic (throtteling) state to the high pressure sat. liquid, and the low pressure saturated liquis state. For each of them: T,p,h,v,s,q,u in SI units(mass base)

Parameters:
  • fluids_all (list of strings) – up to 4 fluid names of the mixture, as defined in the fluid model (REFPROP).

  • temp_both (List of two floats) – the minimum (at low pressure) and the maximum (at high pressure) saturated vapor temperature (both dew points) in K.

  • p_both (List of two floats) – allowed min and max pressure in Pa.

  • res_dir (string) – Directory name, where the results are stored.

  • d_temp_superheating (float. optional) – super heating temperature in K. The default is 5.

  • resolution (integer, optional) – inverse is the interval for the mole fraction screening (21 means every 0.05 a value is calculated). The default is 21.

  • temp_limit (Boolean, optional) – selects only values, where the temperature of the saturated liquid at high pressure is above temp_both[0]. The default is False.

  • kwargs (dict) – is not implemented yet, but can be used later to select another fluid model, instead of REFPROP.

Return type:

None.

carbatpy.utils.property_eval_mixture.plot_cycle(filename, dataset)[source]¶

Scripts for the evaluation of the results of the fluid search, e.g. finding

pareto optimal compositions.

Created on Sun Feb 4 17:38:19 2024

@author: atakan part of carbatpy

carbatpy.utils.optimize.pareto(filename, objectives)[source]¶

Compute the Pareto (non-dominated) set from the data stored in filename

Parameters:
  • filename (string) – directory/file of the csv-file to analyze. The column names will be used to find the objectives.

  • objectives (list of strings, length [2, number_of_objectives]) – the first list in the list are the column names to search for optima. the second list indicates for each optimization, whether a “max” or “min” is searched. Here “diff” can be in a column to indicate a column with categories, which are analyzed separately.

Returns:

results – with the whole pandas dataFrame (key:”all_values”) and a list of booleans if True, this line of the set is pareto optimal (key:”optimal_mask”). Also, the “objectives” are returned.

Return type:

dictionary

Table of Contents

  • Fluid Mixture search
    • combine()
    • data_plot()
    • eval_is_eff_roskosch()
    • get_cycle_points()
    • get_fluid()
    • mixture_search()
    • plot_cycle()
    • pareto()

Previous topic

Heat Pump and Organic Rankine Cycles

Next topic

Utilities

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • carbatpy 0.3.2 documentation »
  • Fluid Mixture search
© Copyright 2024, Burak Atakan. Created using Sphinx 6.2.1.