本文整理汇总了Python中CoolProp.CoolProp.get_TTSESinglePhase_LUT_range方法的典型用法代码示例。如果您正苦于以下问题:Python CoolProp.get_TTSESinglePhase_LUT_range方法的具体用法?Python CoolProp.get_TTSESinglePhase_LUT_range怎么用?Python CoolProp.get_TTSESinglePhase_LUT_range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoolProp.CoolProp
的用法示例。
在下文中一共展示了CoolProp.get_TTSESinglePhase_LUT_range方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import get_TTSESinglePhase_LUT_range [as 别名]
def check(N=5000,param='D',fluid = 'R245fa'):
values = []
CP.enable_TTSE_LUT(fluid)
try:
CP.Props('D','P',CP.Props(fluid,'ptriple')+1,'Q',1,fluid)
except:
return []
#CP.set_TTSESinglePhase_LUT_size(fluid,500,500)
hmin,hmax,pmin,pmax = CP.get_TTSESinglePhase_LUT_range(fluid)
for i in range(N):
x1 = random.random()
h = x1*hmin+(1-x1)*hmax
x2 = random.random()
logp = x2*log(pmin)+(1-x2)*log(pmax)
p = exp(logp)
try:
CP.enable_TTSE_LUT(fluid)
value_withTTSE = CP.Props(param,'P',p,'H',h,fluid)
CP.disable_TTSE_LUT(fluid)
value_noTTSE = CP.Props(param,'P',p,'H',h,fluid)
values.append((h,p,value_withTTSE,value_noTTSE))
except ValueError:
pass
return values
示例2: check_Pother
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import get_TTSESinglePhase_LUT_range [as 别名]
def check_Pother(N=5000,param='T',other='S',fluid='R245fa'):
values = []
CP.enable_TTSE_LUT(fluid)
try:
CP.Props('D','P',CP.Props(fluid,'ptriple')+1,'Q',1,fluid)
except:
return []
#CP.set_TTSESinglePhase_LUT_size(fluid,500,500)
hmin,hmax,pmin,pmax = CP.get_TTSESinglePhase_LUT_range(fluid)
for i in range(N):
x1 = random.random()
h = x1*hmin+(1-x1)*hmax
x2 = random.random()
logp = x2*log(pmin)+(1-x2)*log(pmax)
p = exp(logp)
try:
try:
#Get the T,rho from the EOS directly without the LUT
CP.disable_TTSE_LUT(fluid)
s = CP.Props('S','P',p,'H',h,fluid)
T = CP.Props('T','P',p,'H',h,fluid)
rho = CP.Props('D','P',p,'H',h,fluid)
except:
print 'EOS failed: ', p,h
raise
#Now get p,h from the T,rho
CP.enable_TTSE_LUT(fluid)
if other =='S':
other_val = s
elif other =='T':
other_val = T
elif other == 'D':
other_val = rho
else:
raise ValueError
val = CP.Props(param,'P',p,other,other_val,fluid)
except ValueError:
print 'TTSE failed: ', p,other_val
values.append((p,other_val,0,0))
pass
return values
示例3: check_Trho
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import get_TTSESinglePhase_LUT_range [as 别名]
def check_Trho(N=5000,param='P',fluid='R245fa'):
values = []
CP.enable_TTSE_LUT(fluid)
try:
CP.Props('D','P',CP.Props(fluid,'ptriple')+1,'Q',1,fluid)
except:
return []
#CP.set_TTSESinglePhase_LUT_size(fluid,500,500)
hmin,hmax,pmin,pmax = CP.get_TTSESinglePhase_LUT_range(fluid)
for i in range(N):
x1 = random.random()
h = x1*hmin+(1-x1)*hmax
x2 = random.random()
logp = x2*log(pmin)+(1-x2)*log(pmax)
p = exp(logp)
try:
try:
#Get the T,rho from the EOS directly without the LUT
CP.disable_TTSE_LUT(fluid)
s = CP.Props('S','P',p,'H',h,fluid)
T = CP.Props('T','P',p,'H',h,fluid)
rho = CP.Props('D','P',p,'H',h,fluid)
except:
print 'EOS failed: ', p,h
raise
#Now get p,h from the T,rho
CP.enable_TTSE_LUT(fluid)
val = CP.Props(param,'T',T,'D',rho,fluid)
CP.disable_TTSE_LUT(fluid)
valREFPROP = CP.Props(param,'T',T,'D',rho,fluid)
#print T,rho,val,valREFPROP,(val/valREFPROP-1)*100
if abs(val-valREFPROP)>0.00001:
raise ValueError
except ValueError:
print 'TTSE failed: ', T,rho
values.append((T,rho,0,0))
pass
return values