carbatpy.models.fluids.fluid_props

Created on Mon May 22 21:09:12 2023

@author: atakan

Attributes

VERBOSE

trend_dll

_PROPS

_fl_properties_names

_THERMO_STRING

_TRANS_STRING

_TRANS_TREND

_TV_STRING

_T_SURROUNDING

_MODEL_ARGS

_UNITS

rp_instance

rp_instance

FLUID

Classes

FluidModel

Fluid model to be used Refprop or TREND

Fluid

The Fluid class is used to set, get, and print states of a fluid with a given

Functions

init_fluid(fluid, composition, **keywords)

short way to define a Fluid and a FluidModel

Module Contents

carbatpy.models.fluids.fluid_props.VERBOSE = False[source]
carbatpy.models.fluids.fluid_props.trend_dll[source]
carbatpy.models.fluids.fluid_props._PROPS = 'REFPROP'[source]
carbatpy.models.fluids.fluid_props._fl_properties_names = ('Temperature', 'Pressure', 'spec_Enthalpy', 'spec_Volume', 'spec_Entropy', 'quality',...[source]
carbatpy.models.fluids.fluid_props._THERMO_STRING = 'T;P;H;V;S;QMASS;E'[source]
carbatpy.models.fluids.fluid_props._TRANS_STRING[source]
carbatpy.models.fluids.fluid_props._TRANS_TREND[source]
carbatpy.models.fluids.fluid_props._TV_STRING = 'T;V'[source]
carbatpy.models.fluids.fluid_props._T_SURROUNDING = 288.15[source]
carbatpy.models.fluids.fluid_props._MODEL_ARGS[source]
carbatpy.models.fluids.fluid_props._UNITS = 21[source]
carbatpy.models.fluids.fluid_props.rp_instance = ''[source]
carbatpy.models.fluids.fluid_props.rp_instance[source]
class carbatpy.models.fluids.fluid_props.FluidModel(fluid, units=_UNITS, props=_PROPS, rp_inst=rp_instance, args=_MODEL_ARGS)[source]

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.

set_rp_fluid(modwf=REFPROPFunctionLibrary, name='RPPREFIX')[source]

A new instance of Refpropdll for the given fluid. It can then be called using fluid =””

Parameters:

fluid (string) – fluid (mixture) name, as described in REFPROP.

Returns:

self.rp_instance – for further usage.

Return type:

REFPROP Instance

set_tr_fluid()[source]
fluid_to_list()[source]

conversts the fluid names string from Refprop to list for TREND

Returns:

the fluid names in a list.

Return type:

List of strings

class carbatpy.models.fluids.fluid_props.Fluid(fluidmodel, composition=None, option=1)[source]

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.

set_composition(composition)[source]

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()

Parameters:

composition (list/numpy.array) – mole fractions must sum up to 1.

Return type:

None.

calc_mass_fraction()[source]

mole to mass fractions for TREND

set_state(values, given='TP', wanted=_THERMO_STRING, composition=None, **kwargs)[source]

Sets the state of a fluid and calculates the wanted

Parameters:
  • values (list[2]) – the two state parameter values.

  • given (String, optional) – What are the two values (T,P,H,S,Q,V). The default is “TP”.

  • wanted (String, optional) – Which parameters shall be calculated? The default is _THERMO_STRING.

  • composition (list, optional) – mole fraction of each compound, must sum up to 1. When empty, the last/actual value will be used. The default is [].

  • kwargs (dictionary, optional) – 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.

Raises:

Exception – DESCRIPTION.

Returns:

DESCRIPTION.

Return type:

TYPE

_update_composition(composition)[source]
_set_state_refprop(values, given, wanted, composition, **kwargs)[source]
_set_state_trend(values, given, wanted)[source]
_adjust_trend_values(values, given)[source]
_adjust_values_for_quality_pressure(values, quality_in, pressure_in)[source]
_adjust_values_for_quality_temperature(values, quality_in, temp_in)[source]
set_state_v(values, given='TP', wanted=_THERMO_STRING, **kwargs)[source]

set many Fluid states with the values given as array(vector)

Parameters:
  • values (numpy.array((N,2))) – the N value pairs to fix the states.

  • given (String, optional) – what are the input values?(T,P, Q, S,…). The default is “TP”.

  • wanted (String, optional) – with all the outputs wanted. The default is _THERMO_STRING.

Returns:

output – all the wanted properties for the N inputs.

Return type:

numpy.array(N, n_wanted)

_set_fluid_properties(state, wanted, **kwargs)[source]

The thermodynamic state of a fluid is stored here

print_state()[source]

Print the actual state of the Fluid

calc_temp_mean(h_final)[source]

Calculate the thermodynamic mean temperature between the actual state

and the final enthalpy along an isobaric (Delta h /Delta s)

Parameters:

h_final (float) – enthalpy of he final stat.

Returns:

temp_mean – the thermodynamic mean temperature.

Return type:

float

carbatpy.models.fluids.fluid_props.init_fluid(fluid, composition, **keywords)[source]

short way to define a Fluid and a FluidModel

Parameters:
  • fluid (string) – The species within the fluid.

  • composition (List) – mole fraction for each fluid.

  • **keywords (TYPE) – all keywords needed for the FluidModel, if non-defults shall be set.

Returns:

actual_fluid – Instance of the actually set Fluid.

Return type:

Fluid

carbatpy.models.fluids.fluid_props.FLUID = 'Propane * Pentane'[source]