carbatpy.models.fluids.fluid_props ================================== .. py:module:: carbatpy.models.fluids.fluid_props .. autoapi-nested-parse:: Created on Mon May 22 21:09:12 2023 @author: atakan Attributes ---------- .. autoapisummary:: carbatpy.models.fluids.fluid_props.VERBOSE carbatpy.models.fluids.fluid_props.trend_dll carbatpy.models.fluids.fluid_props._PROPS carbatpy.models.fluids.fluid_props._fl_properties_names carbatpy.models.fluids.fluid_props._THERMO_STRING carbatpy.models.fluids.fluid_props._TRANS_STRING carbatpy.models.fluids.fluid_props._TRANS_TREND carbatpy.models.fluids.fluid_props._TV_STRING carbatpy.models.fluids.fluid_props._T_SURROUNDING carbatpy.models.fluids.fluid_props._MODEL_ARGS carbatpy.models.fluids.fluid_props._UNITS carbatpy.models.fluids.fluid_props.rp_instance carbatpy.models.fluids.fluid_props.rp_instance carbatpy.models.fluids.fluid_props.FLUID Classes ------- .. autoapisummary:: carbatpy.models.fluids.fluid_props.FluidModel carbatpy.models.fluids.fluid_props.Fluid Functions --------- .. autoapisummary:: carbatpy.models.fluids.fluid_props.init_fluid Module Contents --------------- .. py:data:: VERBOSE :value: False .. py:data:: trend_dll .. py:data:: _PROPS :value: 'REFPROP' .. py:data:: _fl_properties_names :value: ('Temperature', 'Pressure', 'spec_Enthalpy', 'spec_Volume', 'spec_Entropy', 'quality',... .. py:data:: _THERMO_STRING :value: 'T;P;H;V;S;QMASS;E' .. py:data:: _TRANS_STRING .. py:data:: _TRANS_TREND .. py:data:: _TV_STRING :value: 'T;V' .. py:data:: _T_SURROUNDING :value: 288.15 .. py:data:: _MODEL_ARGS .. py:data:: _UNITS :value: 21 .. py:data:: rp_instance :value: '' .. py:data:: rp_instance .. py:class:: FluidModel(fluid, units=_UNITS, props=_PROPS, rp_inst=rp_instance, args=_MODEL_ARGS) Fluid model to be used Refprop or TREND Only model, chemical compunds units and for TREND some more values are set here. The mixture composition, state etc. is set in Fluid. .. py:method:: set_rp_fluid(modwf=REFPROPFunctionLibrary, name='RPPREFIX') A new instance of Refpropdll for the given fluid. It can then be called using fluid ="" :param fluid: fluid (mixture) name, as described in REFPROP. :type fluid: string :returns: **self.rp_instance** -- for further usage. :rtype: REFPROP Instance .. py:method:: set_tr_fluid() .. py:method:: fluid_to_list() conversts the fluid names string from Refprop to list for TREND :returns: the fluid names in a list. :rtype: List of strings .. py:class:: Fluid(fluidmodel, composition=None, option=1) The Fluid class is used to set, get, and print states of a fluid with a given model (e.g. RefProp). The compounds are set in the fluidmodel, while the composition is also set here. .. py:method:: set_composition(composition) Mainly for TREND mole fractions have to converted to mass fractions Sets the self.composition used in the Fluid settings and the self.comp_mass and self.comp_mole by calling calc_mass_fraction() :param composition: mole fractions must sum up to 1. :type composition: list/numpy.array :rtype: None. .. py:method:: calc_mass_fraction() mole to mass fractions for TREND .. py:method:: set_state(values, given='TP', wanted=_THERMO_STRING, composition=None, **kwargs) Sets the state of a fluid and calculates the wanted :param values: the two state parameter values. :type values: list[2] :param given: What are the two values (T,P,H,S,Q,V). The default is "TP". :type given: String, optional :param wanted: Which parameters shall be calculated? The default is _THERMO_STRING. :type wanted: String, optional :param composition: mole fraction of each compound, must sum up to 1. When empty, the last/actual value will be used. The default is []. :type composition: list, optional :param kwargs: Flags like iMass or iFlag can be passed to Refprop. with iMass=1 the input composition is taken as mass fraction, otherwise they are mole fractions. iMass is set to 1 if 'Q' is in wanted. :type kwargs: dictionary, optional :raises Exception: DESCRIPTION. :returns: DESCRIPTION. :rtype: TYPE .. py:method:: _update_composition(composition) .. py:method:: _set_state_refprop(values, given, wanted, composition, **kwargs) .. py:method:: _set_state_trend(values, given, wanted) .. py:method:: _adjust_trend_values(values, given) .. py:method:: _adjust_values_for_quality_pressure(values, quality_in, pressure_in) .. py:method:: _adjust_values_for_quality_temperature(values, quality_in, temp_in) .. py:method:: set_state_v(values, given='TP', wanted=_THERMO_STRING, **kwargs) set many Fluid states with the values given as array(vector) :param values: the N value pairs to fix the states. :type values: numpy.array((N,2)) :param given: what are the input values?(T,P, Q, S,...). The default is "TP". :type given: String, optional :param wanted: with all the outputs wanted. The default is _THERMO_STRING. :type wanted: String, optional :returns: **output** -- all the wanted properties for the N inputs. :rtype: numpy.array(N, n_wanted) .. py:method:: _set_fluid_properties(state, wanted, **kwargs) The thermodynamic state of a fluid is stored here .. py:method:: print_state() Print the actual state of the Fluid .. py:method:: calc_temp_mean(h_final) Calculate the thermodynamic mean temperature between the actual state and the final enthalpy along an isobaric (Delta h /Delta s) :param h_final: enthalpy of he final stat. :type h_final: float :returns: **temp_mean** -- the thermodynamic mean temperature. :rtype: float .. py:function:: init_fluid(fluid, composition, **keywords) short way to define a Fluid and a FluidModel :param fluid: The species within the fluid. :type fluid: string :param composition: mole fraction for each fluid. :type composition: List :param \*\*keywords: all keywords needed for the FluidModel, if non-defults shall be set. :type \*\*keywords: TYPE :returns: **actual_fluid** -- Instance of the actually set Fluid. :rtype: Fluid .. py:data:: FLUID :value: 'Propane * Pentane'