diff --git a/include/CoolProp.h b/include/CoolProp.h index 00444191..8028225a 100644 --- a/include/CoolProp.h +++ b/include/CoolProp.h @@ -51,6 +51,14 @@ You might want to start by looking at CoolProp.h /// @param FluidName The fluid name /// @param z The mole or mass fractions depending on the requirements of the backend std::vector PropsSI(const std::string &Output, const std::string &Name1, const std::vector &Prop1, const std::string &Name2, const std::vector Prop2, const std::string &FluidName, const std::vector &z); + /// Return a value that depends on the thermodynamic state + /// @param Output The output parameter, one of "T","D","H",etc. + /// @param Name1 The first state variable name, one of "T","D","H",etc. + /// @param Prop1 The first state variable value + /// @param Name2 The second state variable name, one of "T","D","H",etc. + /// @param Prop2 The second state variable value + /// @param FluidName The fluid name + std::vector PropsSI(const std::string &Output, const std::string &Name1, const std::vector &Prop1, const std::string &Name2, const std::vector Prop2, const std::string &FluidName); /** \overload diff --git a/src/Backends/Helmholtz/VLERoutines.cpp b/src/Backends/Helmholtz/VLERoutines.cpp index df6fa103..a5ca1719 100644 --- a/src/Backends/Helmholtz/VLERoutines.cpp +++ b/src/Backends/Helmholtz/VLERoutines.cpp @@ -398,7 +398,7 @@ void SaturationSolvers::saturation_T_pure_Akasaka(HelmholtzEOSMixtureBackend *HE SatV = HEOS->SatV; long double rhoL,rhoV,JL,JV,KL,KV,dJL,dJV,dKL,dKV; - long double DELTA, deltaL=0, deltaV=0, tau, error, PL, PV, stepL, stepV; + long double DELTA, deltaL=0, deltaV=0, error, PL, PV, stepL, stepV; int iter=0; try @@ -434,7 +434,6 @@ void SaturationSolvers::saturation_T_pure_Akasaka(HelmholtzEOSMixtureBackend *HE deltaL = rhoL/reduce.rhomolar; deltaV = rhoV/reduce.rhomolar; - tau = reduce.T/T; } catch(NotImplementedError &) { diff --git a/src/CoolProp.cpp b/src/CoolProp.cpp index 02776101..7ebe8700 100644 --- a/src/CoolProp.cpp +++ b/src/CoolProp.cpp @@ -445,6 +445,10 @@ double PropsSI(const std::string &Output, const std::string &Name1, double Prop1 } #endif } +std::vector PropsSI(const std::string &Output, const std::string &Name1, const std::vector &Prop1, const std::string &Name2, const std::vector Prop2, const std::string &FluidName) +{ + return PropsSI(Output, Name1, Prop1, Name2, Prop2, FluidName, std::vector(1,1)); +} std::vector PropsSI(const std::string &Output, const std::string &Name1, const std::vector &Prop1, const std::string &Name2, const std::vector Prop2, const std::string &Ref, const std::vector &z) { std::vector out(Prop1.size(), _HUGE); diff --git a/src/DataStructures.cpp b/src/DataStructures.cpp index c58f675d..ba63207b 100644 --- a/src/DataStructures.cpp +++ b/src/DataStructures.cpp @@ -117,7 +117,7 @@ bool is_trivial_parameter(int key) } else { - throw ValueError(format("Unable to match the key [%d] in is_trivial_parameter",key)); + throw ValueError(format("Unable to match the key [%d: %s] in is_trivial_parameter",key, get_parameter_information(key, "short").c_str())); } } diff --git a/src/HumidAirProp.cpp b/src/HumidAirProp.cpp index f559f3ca..521bb62f 100644 --- a/src/HumidAirProp.cpp +++ b/src/HumidAirProp.cpp @@ -362,11 +362,9 @@ static double dC_m_dT(double T, double psi_w) { // dCm_dT has units of m^6/mol^2/K - double Tj,tau_Air,tau_Water,dC_dT_aaa,dC_dT_www,dC_dT_aww,dC_dT_aaw; + double Tj,dC_dT_aaa,dC_dT_www,dC_dT_aww,dC_dT_aaw; // NDG for fluid EOS for virial terms Tj=132.6312; - tau_Air=Tj/T; - tau_Water=Water->keyed_output(CoolProp::iT_reducing)/T; if (FlagUseVirialCorrelations) { dC_dT_aaa=-2.46582342273e-10 +4.425401935447e-12*T -3.669987371644e-14*pow(T,2) +1.765891183964e-16*pow(T,3) -5.240097805744e-19*pow(T,4) +9.502177003614e-22*pow(T,5) -9.694252610339e-25*pow(T,6) +4.276261986741e-28*pow(T,7); diff --git a/src/main.cxx b/src/main.cxx index 1f845c02..4f01ecf4 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -445,10 +445,12 @@ int main() { char ykey[] = "H"; double Ts, y, T2, dT = -1; - + double dd0 = CoolProp::Props1SI("Tmax","n-Propane"); + double dd1 = CoolProp::Props1SI("n-Propane","Tmax"); + double dd = PropsSI("D","Q",0,"P",0.5e-3,"n-Propane"); - shared_ptr Water(AbstractState::factory("REFPROP","water")); + shared_ptr Water(AbstractState::factory("HEOS","water")); Water->update(PT_INPUTS, 101325, 0); double ptt = Water->melting_line(iT, iP, 138.268e6); diff --git a/wrappers/Python/CoolProp/CoolProp.pxd b/wrappers/Python/CoolProp/CoolProp.pxd index 471fb2bf..ece8f06c 100644 --- a/wrappers/Python/CoolProp/CoolProp.pxd +++ b/wrappers/Python/CoolProp/CoolProp.pxd @@ -26,6 +26,7 @@ cdef extern from "DataStructures.h" namespace "CoolProp": cdef extern from "CoolProp.h" namespace "CoolProp": double _PropsSI "CoolProp::PropsSI"(string Output, string Name1, double Prop1, string Name2, double Prop2, string FluidName) vector[double] _PropsSI "CoolProp::PropsSI"(string Output, string Name1, vector[double] Prop1, string Name2, vector[double] Prop2, string FluidName, vector[double] fractions) + vector[double] _PropsSII "CoolProp::PropsSI"(string Output, string Name1, vector[double] Prop1, string Name2, vector[double] Prop2, string FluidName) string _get_global_param_string "CoolProp::get_global_param_string"(string ParamName) except + double _Props1SI "CoolProp::Props1SI"(string Ref, string Output) diff --git a/wrappers/Python/CoolProp/CoolProp.pyx b/wrappers/Python/CoolProp/CoolProp.pyx index a9b303b0..1458e40a 100644 --- a/wrappers/Python/CoolProp/CoolProp.pyx +++ b/wrappers/Python/CoolProp/CoolProp.pyx @@ -24,11 +24,15 @@ from libcpp.vector cimport vector from constants import * from constants_header cimport * -cpdef bint iterable(object a): +cdef bint iterable(object a): + """ + If numpy is supported, this function retuns true if the argument is a + numpy array or another iterable, otherwise just checks if list or tuple + """ if _numpy_supported: - return isinstance(a,(list,tuple, np.ndarray)) + return isinstance(a,(list, tuple, np.ndarray)) else: - return isinstance(a,(list,tuple)) + return isinstance(a,(list, tuple)) cpdef ndarray_or_iterable(object input): if _numpy_supported: @@ -128,13 +132,13 @@ cpdef get_global_param_string(string param): cpdef get_fluid_param_string(string_like fluid, string_like param): return _get_fluid_param_string(fluid, param) -# -# cpdef __Props_err1(in1,in2,errstr): -# if not len(errstr) == 0: -# raise ValueError("{err:s} :: inputs were :\"{in1:s}\",\"{in2:s}\"".format(err= errstr,in1=in1,in2=in2)) -# else: -# raise ValueError("Props failed ungracefully with inputs:\"{in1:s}\",\"{in2:s}\"; please file a ticket at https://github.com/CoolProp/CoolProp/issues".format(in1=in1,in2=in2)) -# + +cpdef __Props_err1(in1,in2): + errstr = _get_global_param_string('errstring') + if not len(errstr) == 0: + raise ValueError("{err:s} :: inputs were :\"{in1:s}\",\"{in2:s}\"".format(err= errstr,in1=in1,in2=in2)) + else: + raise ValueError("Props failed ungracefully with inputs:\"{in1:s}\",\"{in2:s}\"; please file a ticket at https://github.com/CoolProp/CoolProp/issues".format(in1=in1,in2=in2)) cpdef __Props_err2(in1, in2, in3, in4, in5, in6): errstr = _get_global_param_string('errstring') if not len(errstr) == 0: @@ -150,20 +154,32 @@ cpdef __Props_err2(in1, in2, in3, in4, in5, in6): # return _Props(in1, in2, in3, in4, in5, in6) # else: # return _Props(in1, in2, in3, in4, in5, in6, in7) + cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = None): """ $$PropsSI$$ """ cdef double val + + # Two parameter inputs if in3 is None and in4 is None and in5 is None and in6 is None and in7 is None: val = _Props1SI(in1, in2) - return val - elif in7 is None: - val = _PropsSI(in1, in2, in3, in4, in5, in6) - if not iterable(val) and not _ValidNumber(val): - __Props_err2(in1, in2, in3, in4, in5, in6) + if not _ValidNumber(val): + __Props_err1(in1, in2) else: return val + # Six parameter inputs + elif in7 is None: + if iterable(in3) and iterable(in5): + # This version takes iterables + return _PropsSII(in1, in2, in3, in4, in5, in6) + else: + # This version takes doubles + val = _PropsSI(in1, in2, in3, in4, in5, in6) + if not _ValidNumber(val): + __Props_err2(in1, in2, in3, in4, in5, in6) + else: + return val else: return _PropsSI(in1, in2, in3, in4, in5, in6, in7) diff --git a/wrappers/Python/CoolProp/Plots/Common.py b/wrappers/Python/CoolProp/Plots/Common.py index 65172481..48e99c43 100644 --- a/wrappers/Python/CoolProp/Plots/Common.py +++ b/wrappers/Python/CoolProp/Plots/Common.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import print_function +from __future__ import print_function, unicode_literals import matplotlib import numpy @@ -9,7 +9,6 @@ import CoolProp.CoolProp as CP SMALL = 1E-5 - class BasePlot(object): #TODO: Simplify / Consolidate dictionary maps AXIS_LABELS = {'T': ["Temperature", r"[K]"], @@ -27,6 +26,15 @@ class BasePlot(object): 'S': 'DarkOrange', 'Q': 'black'} + #: Scale factors to multiply SI units by in order to obtain kSI units + KSI_SCALE_FACTOR = {'T' : 1.0, + 'P' : 0.001, + 'H' : 0.001, + 'U' : 0.001, + 'D' : 1, + 'S' : 0.001, + 'Q' : 1.0} + SYMBOL_MAP_KSI = {'T' : [r'$T = ', r'$ K'], 'P' : [r'$p = ', r'$ kPa'], 'H' : [r'$h = ', r'$ kJ/kg'], @@ -52,7 +60,7 @@ class BasePlot(object): 'PT': ['D', 'P', 'S'], 'PU': []} - def __init__(self, fluid_ref, graph_type, **kwargs): + def __init__(self, fluid_ref, graph_type, unit_system = 'KSI', **kwargs): if not isinstance(graph_type, str): raise TypeError("Invalid graph_type input, expected a string") @@ -68,6 +76,7 @@ class BasePlot(object): self.graph_drawn = False self.fluid_ref = fluid_ref self.graph_type = graph_type.upper() + self.unit_system = unit_system self.axis = kwargs.get('axis', None) if self.axis is None: @@ -89,8 +98,8 @@ class BasePlot(object): name = 'temperature' min_key = 'Tmin' - fluid_min = CP.Props(self.fluid_ref, min_key) - fluid_crit = CP.Props(self.fluid_ref, ''.join([kind, 'crit'])) + fluid_min = CP.PropsSI(self.fluid_ref, min_key) + fluid_crit = CP.PropsSI(self.fluid_ref, ''.join([kind, 'crit'])) if smin is None: smin = fluid_min + SMALL @@ -126,13 +135,13 @@ class BasePlot(object): y_vals = [] x_vals = [] + # Calculate the values in SI units for i, p1_val in enumerate(prop1_vals): x_vals.append(prop2_vals[i]) - y_vals.append(CP.Props(req_prop, - prop1_name, p1_val, - prop2_name, prop2_vals[i], - self.fluid_ref)) - + y_vals.append(CP.PropsSI(req_prop, + prop1_name, [p1_val]*len(prop2_vals[i]), # Convert to an iterable the same size as second input array + prop2_name, prop2_vals[i], + self.fluid_ref)) return numpy.array([x_vals, y_vals]) def _get_sat_lines(self, kind='T', smin=None, @@ -169,6 +178,10 @@ class BasePlot(object): _, y_vals = self._get_fluid_data(self.graph_type[0], 'Q', x, kind, sat_mesh) + + if self.unit_system == 'KSI': + x_vals *= self.KSI_SCALE_FACTOR[self.graph_type[1]] + y_vals *= self.KSI_SCALE_FACTOR[self.graph_type[0]] # Merge the two lines, capital Y holds important information. # We merge on X values diff --git a/wrappers/Python/CoolProp/Plots/SimpleCycles.py b/wrappers/Python/CoolProp/Plots/SimpleCycles.py index 22b8f16d..621b0e93 100644 --- a/wrappers/Python/CoolProp/Plots/SimpleCycles.py +++ b/wrappers/Python/CoolProp/Plots/SimpleCycles.py @@ -1,9 +1,8 @@ import matplotlib,numpy -from CoolProp.CoolProp import Props +from CoolProp.CoolProp import PropsSI from scipy.optimize import newton - def SimpleCycle(Ref,Te,Tc,DTsh,DTsc,eta_a,Ts_Ph='Ph',skipPlot=False,axis=None): """ This function plots a simple four-component cycle, on the current axis, or that given by the optional parameter *axis* @@ -29,23 +28,23 @@ def SimpleCycle(Ref,Te,Tc,DTsh,DTsc,eta_a,Ts_Ph='Ph',skipPlot=False,axis=None): p=numpy.zeros_like(T) s=numpy.zeros_like(T) T[1]=Te+DTsh - pe=Props('P','T',Te,'Q',1.0,Ref) - pc=Props('P','T',Tc,'Q',1.0,Ref) - h[1]=Props('H','T',T[1],'P',pe,Ref) - s[1]=Props('S','T',T[1],'P',pe,Ref) - T2s=newton(lambda T: Props('S','T',T,'P',pc,Ref)-s[1],T[1]+30) - h2s=Props('H','T',T2s,'P',pc,Ref) + pe=PropsSI('P','T',Te,'Q',1.0,Ref) + pc=PropsSI('P','T',Tc,'Q',1.0,Ref) + h[1]=PropsSI('H','T',T[1],'P',pe,Ref) + s[1]=PropsSI('S','T',T[1],'P',pe,Ref) + T2s=newton(lambda T: PropsSI('S','T',T,'P',pc,Ref)-s[1],T[1]+30) + h2s=PropsSI('H','T',T2s,'P',pc,Ref) h[2]=(h2s-h[1])/eta_a+h[1] - T[2]=Props('T','H',h[2],'P',pc,Ref) - s[2]=Props('S','T',T[2],'P',pc,Ref) + T[2]=PropsSI('T','H',h[2],'P',pc,Ref) + s[2]=PropsSI('S','T',T[2],'P',pc,Ref) - sbubble_c=Props('S','P',pc,'Q',0,Ref) - sdew_c=Props('S','P',pc,'Q',1,Ref) - sbubble_e=Props('S','P',pe,'Q',0,Ref) - sdew_e=Props('S','P',pe,'Q',1,Ref) + sbubble_c=PropsSI('S','P',pc,'Q',0,Ref) + sdew_c=PropsSI('S','P',pc,'Q',1,Ref) + sbubble_e=PropsSI('S','P',pe,'Q',0,Ref) + sdew_e=PropsSI('S','P',pe,'Q',1,Ref) T[3]=Tc-DTsc - h[3]=Props('H','T',T[3],'P',pc,Ref) - s[3]=Props('S','T',T[3],'P',pc,Ref) + h[3]=PropsSI('H','T',T[3],'P',pc,Ref) + s[3]=PropsSI('S','T',T[3],'P',pc,Ref) h[4]=h[3] h[5]=h[1] s[5]=s[1] @@ -54,12 +53,12 @@ def SimpleCycle(Ref,Te,Tc,DTsh,DTsc,eta_a,Ts_Ph='Ph',skipPlot=False,axis=None): COP=(h[1]-h[4])/(h[2]-h[1]) COPH=(h[2]-h[3])/(h[2]-h[1]) - hsatL=Props('H','T',Te,'Q',0,Ref) - hsatV=Props('H','T',Te,'Q',1,Ref) - ssatL=Props('S','T',Te,'Q',0,Ref) - ssatV=Props('S','T',Te,'Q',1,Ref) - vsatL=1/Props('D','T',Te,'Q',0,Ref) - vsatV=1/Props('D','T',Te,'Q',1,Ref) + hsatL=PropsSI('H','T',Te,'Q',0,Ref) + hsatV=PropsSI('H','T',Te,'Q',1,Ref) + ssatL=PropsSI('S','T',Te,'Q',0,Ref) + ssatV=PropsSI('S','T',Te,'Q',1,Ref) + vsatL=1/PropsSI('D','T',Te,'Q',0,Ref) + vsatV=1/PropsSI('D','T',Te,'Q',1,Ref) x=(h[4]-hsatL)/(hsatV-hsatL) s[4]=x*ssatV+(1-x)*ssatL T[4]=x*Te+(1-x)*Te @@ -117,52 +116,52 @@ def TwoStage(Ref,Q,Te,Tc,DTsh,DTsc,eta_oi,f_p,Tsat_ic,DTsh_ic,Ts_Ph='Ph',prints= T[0]=numpy.NAN s[0]=numpy.NAN T[1]=Te+DTsh - pe=Props('P','T',Te,'Q',1.0,Ref) - pc=Props('P','T',Tc,'Q',1.0,Ref) - pic=Props('P','T',Tsat_ic,'Q',1.0,Ref) - Tbubble_c=Props('T','P',pc,'Q',0,Ref) - Tbubble_e=Props('T','P',pe,'Q',0,Ref) + pe=PropsSI('P','T',Te,'Q',1.0,Ref) + pc=PropsSI('P','T',Tc,'Q',1.0,Ref) + pic=PropsSI('P','T',Tsat_ic,'Q',1.0,Ref) + Tbubble_c=PropsSI('T','P',pc,'Q',0,Ref) + Tbubble_e=PropsSI('T','P',pe,'Q',0,Ref) - h[1]=Props('H','T',T[1],'P',pe,Ref) - s[1]=Props('S','T',T[1],'P',pe,Ref) - rho[1]=Props('D','T',T[1],'P',pe,Ref) + h[1]=PropsSI('H','T',T[1],'P',pe,Ref) + s[1]=PropsSI('S','T',T[1],'P',pe,Ref) + rho[1]=PropsSI('D','T',T[1],'P',pe,Ref) T[5]=Tbubble_c-DTsc - h[5]=Props('H','T',T[5],'P',pc,Ref) - s[5]=Props('S','T',T[5],'P',pc,Ref) - rho[5]=Props('D','T',T[5],'P',pc,Ref) + h[5]=PropsSI('H','T',T[5],'P',pc,Ref) + s[5]=PropsSI('S','T',T[5],'P',pc,Ref) + rho[5]=PropsSI('D','T',T[5],'P',pc,Ref) mdot=Q/(h[1]-h[5]) - rho1=Props('D','T',T[1],'P',pe,Ref) - h2s=Props('H','S',s[1],'P',pic,Ref) + rho1=PropsSI('D','T',T[1],'P',pe,Ref) + h2s=PropsSI('H','S',s[1],'P',pic,Ref) Wdot1=mdot*(h2s-h[1])/eta_oi h[2]=h[1]+(1-f_p)*Wdot1/mdot - T[2]=Props('T','H',h[2],'P',pic,Ref) - s[2]=Props('S','T',T[2],'P',pic,Ref) - rho[2]=Props('D','T',T[2],'P',pic,Ref) + T[2]=PropsSI('T','H',h[2],'P',pic,Ref) + s[2]=PropsSI('S','T',T[2],'P',pic,Ref) + rho[2]=PropsSI('D','T',T[2],'P',pic,Ref) T[3]=288 p[3]=pic - h[3]=Props('H','T',T[3],'P',pic,Ref) - s[3]=Props('S','T',T[3],'P',pic,Ref) - rho[3]=Props('D','T',T[3],'P',pic,Ref) - rho3=Props('D','T',T[3],'P',pic,Ref) - h4s=Props('H','T',s[3],'P',pc,Ref) + h[3]=PropsSI('H','T',T[3],'P',pic,Ref) + s[3]=PropsSI('S','T',T[3],'P',pic,Ref) + rho[3]=PropsSI('D','T',T[3],'P',pic,Ref) + rho3=PropsSI('D','T',T[3],'P',pic,Ref) + h4s=PropsSI('H','T',s[3],'P',pc,Ref) Wdot2=mdot*(h4s-h[3])/eta_oi h[4]=h[3]+(1-f_p)*Wdot2/mdot - T[4]=Props('T','H',h[4],'P',pc,Ref) - s[4]=Props('S','T',T[4],'P',pc,Ref) - rho[4]=Props('D','T',T[4],'P',pc,Ref) + T[4]=PropsSI('T','H',h[4],'P',pc,Ref) + s[4]=PropsSI('S','T',T[4],'P',pc,Ref) + rho[4]=PropsSI('D','T',T[4],'P',pc,Ref) - sbubble_e=Props('S','T',Tbubble_e,'Q',0,Ref) - sbubble_c=Props('S','T',Tbubble_c,'Q',0,Ref) - sdew_e=Props('S','T',Te,'Q',1,Ref) - sdew_c=Props('S','T',Tc,'Q',1,Ref) + sbubble_e=PropsSI('S','T',Tbubble_e,'Q',0,Ref) + sbubble_c=PropsSI('S','T',Tbubble_c,'Q',0,Ref) + sdew_e=PropsSI('S','T',Te,'Q',1,Ref) + sdew_c=PropsSI('S','T',Tc,'Q',1,Ref) - hsatL=Props('H','T',Tbubble_e,'Q',0,Ref) - hsatV=Props('H','T',Te,'Q',1,Ref) - ssatL=Props('S','T',Tbubble_e,'Q',0,Ref) - ssatV=Props('S','T',Te,'Q',1,Ref) - vsatL=1/Props('D','T',Tbubble_e,'Q',0,Ref) - vsatV=1/Props('D','T',Te,'Q',1,Ref) + hsatL=PropsSI('H','T',Tbubble_e,'Q',0,Ref) + hsatV=PropsSI('H','T',Te,'Q',1,Ref) + ssatL=PropsSI('S','T',Tbubble_e,'Q',0,Ref) + ssatV=PropsSI('S','T',Te,'Q',1,Ref) + vsatL=1/PropsSI('D','T',Tbubble_e,'Q',0,Ref) + vsatV=1/PropsSI('D','T',Te,'Q',1,Ref) x=(h[5]-hsatL)/(hsatV-hsatL) s[6]=x*ssatV+(1-x)*ssatL T[6]=x*Te+(1-x)*Tbubble_e @@ -257,25 +256,25 @@ def EconomizedCycle(Ref,Qin,Te,Tc,DTsh,DTsc,eta_oi,f_p,Ti,Ts_Ph='Ts',skipPlot=Fa T[0]=numpy.NAN s[0]=numpy.NAN T[1]=Te+DTsh - pe=Props('P','T',Te,'Q',1.0,Ref) - pc=Props('P','T',Tc,'Q',1.0,Ref) - pi=Props('P','T',Ti,'Q',1.0,Ref) + pe=PropsSI('P','T',Te,'Q',1.0,Ref) + pc=PropsSI('P','T',Tc,'Q',1.0,Ref) + pi=PropsSI('P','T',Ti,'Q',1.0,Ref) p[1]=pe - h[1]=Props('H','T',T[1],'P',pe,Ref) - s[1]=Props('S','T',T[1],'P',pe,Ref) - rho[1]=Props('D','T',T[1],'P',pe,Ref) - h2s=Props('H','S',s[1],'P',pi,Ref) + h[1]=PropsSI('H','T',T[1],'P',pe,Ref) + s[1]=PropsSI('S','T',T[1],'P',pe,Ref) + rho[1]=PropsSI('D','T',T[1],'P',pe,Ref) + h2s=PropsSI('H','S',s[1],'P',pi,Ref) wdot1=(h2s-h[1])/eta_oi h[2]=h[1]+(1-f_p[0])*wdot1 p[2]=pi T[2]=T_hp(Ref,h[2],pi,T2s) - s[2]=Props('S','T',T[2],'P',pi,Ref) - rho[2]=Props('D','T',T[2],'P',pi,Ref) + s[2]=PropsSI('S','T',T[2],'P',pi,Ref) + rho[2]=PropsSI('D','T',T[2],'P',pi,Ref) T[5]=Tc-DTsc - h[5]=Props('H','T',T[5],'P',pc,Ref) - s[5]=Props('S','T',T[5],'P',pc,Ref) - rho[5]=Props('D','T',T[5],'P',pc,Ref) + h[5]=PropsSI('H','T',T[5],'P',pc,Ref) + s[5]=PropsSI('S','T',T[5],'P',pc,Ref) + rho[5]=PropsSI('D','T',T[5],'P',pc,Ref) p[5]=pc p[6]=pi @@ -285,13 +284,13 @@ def EconomizedCycle(Ref,Qin,Te,Tc,DTsh,DTsc,eta_oi,f_p,Ti,Ts_Ph='Ts',skipPlot=Fa p[8]=pi p[6]=pi T[7]=Ti - h[7]=Props('H','T',Ti,'Q',1,Ref) - s[7]=Props('S','T',Ti,'Q',1,Ref) - rho[7]=Props('D','T',Ti,'Q',1,Ref) + h[7]=PropsSI('H','T',Ti,'Q',1,Ref) + s[7]=PropsSI('S','T',Ti,'Q',1,Ref) + rho[7]=PropsSI('D','T',Ti,'Q',1,Ref) T[8]=Ti - h[8]=Props('H','T',Ti,'Q',0,Ref) - s[8]=Props('S','T',Ti,'Q',0,Ref) - rho[8]=Props('D','T',Ti,'Q',0,Ref) + h[8]=PropsSI('H','T',Ti,'Q',0,Ref) + s[8]=PropsSI('S','T',Ti,'Q',0,Ref) + rho[8]=PropsSI('D','T',Ti,'Q',0,Ref) x6=(h[6]-h[8])/(h[7]-h[8]) #Vapor Quality s[6]=s[7]*x6+s[8]*(1-x6) rho[6]=1.0/(x6/rho[7]+(1-x6)/rho[8]) @@ -304,26 +303,26 @@ def EconomizedCycle(Ref,Qin,Te,Tc,DTsh,DTsc,eta_oi,f_p,Ti,Ts_Ph='Ts',skipPlot=Fa p[3]=pi h[3]=(m*h[2]+x*h[7])/(m+x) T[3]=T_hp(Ref,h[3],pi,T[2]) - s[3]=Props('S','T',T[3],'P',pi,Ref) - rho[3]=Props('D','T',T[3],'P',pi,Ref) - T4s=newton(lambda T: Props('S','T',T,'P',pc,Ref)-s[3],T[2]+30) - h4s=Props('H','T',T4s,'P',pc,Ref) + s[3]=PropsSI('S','T',T[3],'P',pi,Ref) + rho[3]=PropsSI('D','T',T[3],'P',pi,Ref) + T4s=newton(lambda T: PropsSI('S','T',T,'P',pc,Ref)-s[3],T[2]+30) + h4s=PropsSI('H','T',T4s,'P',pc,Ref) p[4]=pc wdot2=(h4s-h[3])/eta_oi h[4]=h[3]+(1-f_p[1])*wdot2 T[4]=T_hp(Ref,h[4],pc,T4s) - s[4]=Props('S','T',T[4],'P',pc,Ref) - rho[4]=Props('D','T',T[4],'P',pc,Ref) + s[4]=PropsSI('S','T',T[4],'P',pc,Ref) + rho[4]=PropsSI('D','T',T[4],'P',pc,Ref) p[9]=pe h[9]=h[8] T[9]=Te - hsatL_e=Props('H','T',Te,'Q',0,Ref) - hsatV_e=Props('H','T',Te,'Q',1,Ref) - ssatL_e=Props('S','T',Te,'Q',0,Ref) - ssatV_e=Props('S','T',Te,'Q',1,Ref) - vsatL_e=1/Props('D','T',Te,'Q',0,Ref) - vsatV_e=1/Props('D','T',Te,'Q',1,Ref) + hsatL_e=PropsSI('H','T',Te,'Q',0,Ref) + hsatV_e=PropsSI('H','T',Te,'Q',1,Ref) + ssatL_e=PropsSI('S','T',Te,'Q',0,Ref) + ssatV_e=PropsSI('S','T',Te,'Q',1,Ref) + vsatL_e=1/PropsSI('D','T',Te,'Q',0,Ref) + vsatV_e=1/PropsSI('D','T',Te,'Q',1,Ref) x9=(h[9]-hsatL_e)/(hsatV_e-hsatL_e) #Vapor Quality s[9]=ssatV_e*x9+ssatL_e*(1-x9) rho[9]=1.0/(x9*vsatV_e+(1-x9)*vsatL_e) @@ -335,10 +334,10 @@ def EconomizedCycle(Ref,Qin,Te,Tc,DTsh,DTsc,eta_oi,f_p,Ti,Ts_Ph='Ts',skipPlot=Fa Tbubble_e=Te Tbubble_c=Tc - sbubble_e=Props('S','T',Tbubble_e,'Q',0,Ref) - sbubble_c=Props('S','T',Tbubble_c,'Q',0,Ref) - sdew_e=Props('S','T',Te,'Q',1,Ref) - sdew_c=Props('S','T',Tc,'Q',1,Ref) + sbubble_e=PropsSI('S','T',Tbubble_e,'Q',0,Ref) + sbubble_c=PropsSI('S','T',Tbubble_c,'Q',0,Ref) + sdew_e=PropsSI('S','T',Te,'Q',1,Ref) + sdew_c=PropsSI('S','T',Tc,'Q',1,Ref) Wdot1=m*wdot1 Wdot2=(m+x)*wdot2 diff --git a/wrappers/Python/setup.py b/wrappers/Python/setup.py index d8e30f0d..21bfb505 100644 --- a/wrappers/Python/setup.py +++ b/wrappers/Python/setup.py @@ -2,14 +2,14 @@ from __future__ import print_function def copy_files(): import shutil - shutil.rmtree(os.path.join('CoolProp5','include'), ignore_errors = True) - shutil.copytree(os.path.join(CProot, 'include'), os.path.join('CoolProp5','include')) - shutil.copy2(os.path.join(CProot, 'CoolPropBibTeXLibrary.bib'), os.path.join('CoolProp5', 'CoolPropBibTeXLibrary.bib')) + shutil.rmtree(os.path.join('CoolProp','include'), ignore_errors = True) + shutil.copytree(os.path.join(CProot, 'include'), os.path.join('CoolProp','include')) + shutil.copy2(os.path.join(CProot, 'CoolPropBibTeXLibrary.bib'), os.path.join('CoolProp', 'CoolPropBibTeXLibrary.bib')) def remove_files(): import shutil - shutil.rmtree(os.path.join('CoolProp5','include'), ignore_errors = True) - os.remove(os.path.join('CoolProp5', 'CoolPropBibTeXLibrary.bib')) + shutil.rmtree(os.path.join('CoolProp','include'), ignore_errors = True) + os.remove(os.path.join('CoolProp', 'CoolPropBibTeXLibrary.bib')) if __name__=='__main__': @@ -120,10 +120,10 @@ if __name__=='__main__': ) CoolProp_module = Extension('CoolProp.CoolProp', - [os.path.join('CoolProp5','CoolProp.' + cy_ext)] + sources, + [os.path.join('CoolProp','CoolProp.' + cy_ext)] + sources, **common_args) constants_module = Extension('CoolProp.constants', - [os.path.join('CoolProp5','constants.' + cy_ext)], + [os.path.join('CoolProp','constants.' + cy_ext)], **common_args) if not pypi: