carbatpy.utils.property_eval_mixture ==================================== .. py:module:: carbatpy.utils.property_eval_mixture .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: carbatpy.utils.property_eval_mixture.FLUIDS_ACTUAL Functions --------- .. autoapisummary:: carbatpy.utils.property_eval_mixture.mixture_search carbatpy.utils.property_eval_mixture.eval_is_eff_roskosch carbatpy.utils.property_eval_mixture.get_fluid carbatpy.utils.property_eval_mixture.combine carbatpy.utils.property_eval_mixture.data_plot carbatpy.utils.property_eval_mixture.plot_cycle carbatpy.utils.property_eval_mixture.get_cycle_points Module Contents --------------- .. py:function:: mixture_search(fluids_all, temp_both, p_both, res_dir, d_temp_superheating=5, resolution=21, temp_limit=False, **kwargs) 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. :param fluids_all: Up to 4 fluid names (REFPROP). :type fluids_all: list of str :param temp_both: Min (low pressure) and max (high pressure) dew point temperatures in K. :type temp_both: list of float :param p_both: Allowed min and max pressure in Pa. :type p_both: list of float :param res_dir: Directory for storing results. :type res_dir: str :param d_temp_superheating: Superheating in K. Default is 5. :type d_temp_superheating: float, optional :param resolution: Inverse of the interval for mole fraction screening. Default is 21. :type resolution: int, optional :param temp_limit: If True, filters values where bubble point at p_h is above temp_both[0]. Default is False. :type temp_limit: bool, optional :param kwargs: Additional parameters. Currently supported: * **fig_title** (str): "std" for default title, "" for none. :type kwargs: dict :rtype: None .. py:function:: eval_is_eff_roskosch(data, file_out) 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: a) Throttling at quality = 0. b) 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**! .. rubric:: References Roskosch piston compressor model: `http://dx.doi.org/10.1016/j.ijrefrig.2017.08.011 `_ :param data: Combined DataFrame containing fluid screening data and Roskosch model outputs. :type data: pandas.DataFrame :param file_out: Path and filename where the resulting DataFrame will be stored. :type file_out: str :returns: The input DataFrame expanded by the calculated results. :rtype: pandas.DataFrame .. py:function:: get_fluid(data) 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. :param data: DataFrame from fluid screening containing mole fractions. The fluid names are extracted directly from the column headers. :type data: pandas.DataFrame :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. .. py:function:: combine(filenames, filename_out='automatic') 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. :param filenames: all filenames (incl. directories), to be read. :type filenames: list of strings :param filename_out: Where to store the result. The default is "automatic". Then the first filename isxpanded vy "-combined". :type filename_out: string, optional :raises ValueError: If tgere is a problem with the files. :returns: **combined** -- the combined dataFrame. :rtype: pandas.dataFrame .. py:function:: data_plot(filename, what, filename_out='automatic', fig_title='') 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. :param filename: Path to the CSV file containing the DataFrame to be imported. :type filename: str :param what: Mapping of plot aesthetics to DataFrame column names. Supported keys include ``"x"``, ``"y"``, ``"hue"``, ``"style"``, and ``"size"``. :type what: dict :param filename_out: 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". :type filename_out: str, optional :param fig_title: The title of the figure. The default is "". :type fig_title: str, optional :returns: True if the plot was created and saved successfully, False otherwise. :rtype: bool .. py:function:: plot_cycle(filename, dataset) .. py:function:: get_cycle_points(data, index) .. py:data:: FLUIDS_ACTUAL :value: ['Propane', 'Isobutane', 'Pentane', 'Ethane']