carbatpy ======== .. py:module:: carbatpy .. autoapi-nested-parse:: Top-level package for carbatpy. Subpackages ----------- .. toctree:: :maxdepth: 1 /autoapi/carbatpy/helpers/index /autoapi/carbatpy/models/index /autoapi/carbatpy/utils/index Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/carbatpy/cb_config/index Attributes ---------- .. autoapisummary:: carbatpy.__author__ carbatpy.__email__ carbatpy.__version__ Classes ------- .. autoapisummary:: carbatpy.Fluid carbatpy.FluidModel carbatpy.FlowDevice Functions --------- .. autoapisummary:: carbatpy.init_fluid Package Contents ---------------- .. py:data:: __author__ :value: 'Burak Atakan' .. py:data:: __email__ :value: 'burak.atakan@uni-due.de' .. py:data:: __version__ .. 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: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: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:class:: FlowDevice(fluid, p_out, m_dot, device_type='machine', **kwargs) Unified themodynamic calculations for single flow devices .. py:method:: compressor() compressor or expander output state calculation so far only for a constant isentropic efficiency, according to the pressure change an expansion or compression is detected and handled. :param p_out: output pressure. :type p_out: float :param eta_s: isentropic efficiency. :type eta_s: float :param fluid: entering fluid, including properties, composition, and model. :type fluid: fprop.Fluid :param m_dot: mass flow rate (in kg/s). Default is 1 :type m_dot: float, optional :param calc_type: how to calculate, so far, only one implemented. The default is "const_eta". :type calc_type: string, optional :param name: name of the device. The default is "compressor". :type name: string, optional :param plot_info: if not empty a Figure, an Axes, a list of What shall be plotted, a list with the colour/styles and a list with the labels must be passed. in "what", the two numbers coincide with the fluid THERMO order. The x-shift can be used in cycle calculations, to shift the curves, by the value (it will be added). The names in the dictionary are: "fig", "ax", "what","col", "label", "x-shift". Default is empty. :type plot_info: dictionary, optional :returns: * **state_out** (*array of float*) -- compressor output state containing [T,p,h,v,s,q]. * **work_specific** (*float*) -- work per kg of fluid, positive for compressor; units:J/kg. .. py:method:: pump() Calculate the exit state of a pump assuming an incompressible fluid. Only formulated for constant isentropic efficiency :param p_out: output pressure. :type p_out: float :param eta_s: isentropic efficiency. :type eta_s: float :param fluid: entering fluid, including properties, composition, and model. :type fluid: fprop.Fluid :param m_dot: mass flow rate (in kg/s). Default is 1 :type m_dot: float, optional :param calc_type: how to calculate, so far, only one implemented. The default is "const_eta". :type calc_type: string, optional :param name: name of the device. The default is "pump". :type name: string, optional :param plot_info: if not empty a Figure, an Axes, a list of What shall be plotted, a list with the colour/styles and a list with the labels must be passed. in "what", the two numbers coincide with the fluid THERMO order. The x-shift can be used in cycle calculations, to shift the curves, by the value (it will be added). The names in the dictionary are: "fig", "ax", "what","col", "label", "x-shift". Default is empty. :type plot_info: dictionary, optional :returns: * **state_out** (*array of float*) -- compressor output state containing [T,p,h,v,s,q]. * **work_specific** (*float*) -- work per kg of fluid, positive for compressor; units:J/kg. .. py:method:: throttle() throttle output state calculation so far only for a constant enthalpy :param p_out: output pressure. :type p_out: float :param fluid: entering fluid, including properties, composition, and model. :type fluid: fprop.Fluid :param m_dot: mass flow rate (in kg/s). Default is 1 :type m_dot: float, optional :param calc_type: how to calculate, so far, only one implemented. The default is "const_h". :type calc_type: string, optional :param name: name of the device. The default is "throttle". :type name: string, optional :param plot_info: if not empty a Figure, an Axes, a list of What shall be plotted, a list with the colour/styles and a list with the labels must be passed. in "what", the two numbers coincide with the fluid THERMO order. The x-shift can be used in cycle calculations, to shift the curves, by the value (it will be added). The names in the dictionary are: "fig", "ax", "what","col", "label", "x-shift". Default is empty. :type plot_info: dictionary, optional :returns: **state_out** -- compressor output state containing [T,p,h,v,s,q]. :rtype: array of float .. py:method:: plot_temp_h_flow() plotting a T-H-dot diagram for simple flows (compressor, throttle etc.) :param _state_in: entering state [T,p,h,v,s,...]. :type _state_in: np.array :param _state_out: exiting state. :type _state_out: np.array :param _m_dot: mass flow rate (kg/s). :type _m_dot: float :param _plot_info: if not empty a Figure, an Axes, a list of What shall be plotted, a list with the colour/styles and a list with the labels must be passed. in "what", the two numbers coincide with the fluid THERMO order. The x-shift can be used in cycle calculations, to shift the curves, by the value (it will be added). The names in the dictionary are: "fig", "ax", "what","col", "label", "x-shift". :type _plot_info: dictionary :rtype: None. .. py:method:: print_device() .. py:method:: state_w_p()