好友
阅读权限10
听众
最后登录1970-1-1
|
繁华转眼
发表于 2020-5-14 08:33
coolprop调用refprop计算流体的物性环境:
Windows64位
Python3.6.8
CoolProp6.3.0
refprop9.1
安装:
[Python] 纯文本查看 复制代码 pip install coolprop
refprop9.1
1、纯流体
例子:
[Python] 纯文本查看 复制代码 from CoolProp.CoolProp import PropsSI
pressure = 101325 # 压力 Pa
temperature = 373.15 # 温度 K
# fld为纯流体计算文件,可在refprop安装目录下C:\Program Files (x86)\REFPROP\fluids(默认安装路径)找到
fld = ['acetone.fld', 'ammonia.fld', 'argon.fld', 'benzene.fld', 'butane.fld', '1butene.fld', 'co2.fld', 'co.fld', 'cos.fld']
# 根据压力和温度计算比焓
H = PropsSI('H', "P", pressure, "T", temperature, "REFPROP::"+fld[0])
# 根据压力和比焓计算比熵
S = PropsSI('S', "P", pressure, "H", H, "REFPROP::"+fld[0])
# ...
完整的代码,已部署在服务器,功能由微信小程序物性计算实现
[Python] 纯文本查看 复制代码 import json
from CoolProp.CoolProp import PropsSI
paras = [
{'name': '压力', 'mark': 'P', 'unit': 'Pa', 'id': 1},
{'name': '温度', 'mark': 'T', 'unit': 'K', 'id': 2},
{'name': '比焓', 'mark': 'H', 'unit': 'J/kg', 'id': 3},
{'name': '比熵', 'mark': 'S', 'unit': 'J/kg/K', 'id': 4},
{'name': '恒压比热', 'mark': 'C', 'unit': 'J/kg/K', 'id': 5},
{'name': '恒容比热', 'mark': 'CVMASS', 'unit': 'J/kg/K', 'id': 6},
{'name': '密度', 'mark': 'D', 'unit': 'kg/m^3', 'id': 7},
{'name': '比内能', 'mark': 'U', 'unit': 'J/kg', 'id': 8},
{'name': '黏度', 'mark': 'V', 'unit': 'Pa s', 'id': 9},
{'name': '干度', 'mark': 'Q', 'unit': 'mol/mol', 'id': 10},
{'name': '声速', 'mark': 'A', 'unit': 'm/s', 'id': 11},
{'name': '导热系数', 'mark': 'L', 'unit': 'W/m/K', 'id': 12},
{'name': '热膨胀系数', 'mark': 'ISOBARIC_EXPANSION_COEFFICIENT', 'unit': '1/K', 'id': 13},
{'name': '普朗特数', 'mark': 'PRANDTL', 'unit': '[-]', 'id': 14},
{'name': '压缩系数', 'mark': 'Z', 'unit': '[-]', 'id': 15},
{'name': '摩尔密度', 'mark': 'DMOLAR', 'unit': 'mol/m^3', 'id': 16},
{'name': '摩尔比焓', 'mark': 'HMOLAR', 'unit': 'J/mol', 'id': 17},
{'name': '摩尔比熵', 'mark': 'SMOLAR', 'unit': 'J/mol/K', 'id': 18},
{'name': '摩尔比内能', 'mark': 'UMOLAR', 'unit': 'J/mol', 'id': 19},
{'name': '摩尔比恒压比热', 'mark': 'CPMOLAR', 'unit': 'J/mol/K', 'id': 20},
{'name': '摩尔比恒容比热', 'mark': 'CVMOLAR', 'unit': 'J/mol/K', 'id': 21},
{'name': '等压膨胀系数', 'mark': 'ISOBARIC_EXPANSION_COEFFICIENT', 'unit': '1/K', 'id': 22},
{'name': '等温压缩率', 'mark': 'ISOTHERMAL_COMPRESSIBILITY', 'unit': '1/Pa', 'id': 23},
{'name': '表面张力', 'mark': 'I', 'unit': 'N/m', 'id': 24},
{'name': '第二维里系数', 'mark': 'BVIRIAL', 'unit': '[-]', 'id': 25},
{'name': '第三维里系数', 'mark': 'CVIRIAL', 'unit': '[-]', 'id': 26},
{'name': '吉布斯能量', 'mark': 'GMOLAR', 'unit': 'J/mol', 'id': 27},
{'name': '亥姆霍兹能量', 'mark': 'HELMHOLTZMOLAR', 'unit': 'J/mol', 'id': 28},
]
def fluid_PT(pressure, temperature, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "P", pressure, "T", temperature, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ph(pressure, enthalpy, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "P", pressure, "H", enthalpy, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ps(pressure, entropy, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "P", pressure, "S", entropy, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Px(pressure, dryness, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "P", pressure, "Q", dryness, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Th(temperature, enthalpy, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "T", temperature, "H", enthalpy, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ts(temperature, entropy, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "T", temperature, "S", entropy, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Tx(temperature, dryness, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "T", temperature, "Q", dryness, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_hs(enthalpy, entropy, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "H", enthalpy, "S", entropy, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_hx(enthalpy, dryness, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "H", enthalpy, "Q", dryness, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_sx(entropy, dryness, fld):
article_info = {}
data = json.loads(json.dumps(article_info))
for str in paras:
try:
result = PropsSI(str["mark"], "S", entropy, "Q", dryness, "REFPROP::"+fld)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
2、混合物
例子
[Python] 纯文本查看 复制代码 from CoolProp.CoolProp import PropsSI
# 空气
refprop = 'REFPROP::nitrogen[0.7556999999999999]&argon[0.0127]&oxygen[0.2316]'
pressure = 101325 # 压力 Pa
temperature = 373.15 # 温度 K
# 根据压力和温度计算比焓
H = PropsSI('H', "P", pressure, "T", temperature, refprop)
# 根据压力和比焓计算比熵
S = PropsSI('S', "P", pressure, "H", H, refprop)
# ...
服务器代码
[Python] 纯文本查看 复制代码
import json
import CoolProp.CoolProp as CP
refprop = ['REFPROP::nitrogen[0.7556999999999999]&argon[0.0127]&oxygen[0.2316]', 'REFPROP::R22[0.53]&R152a[0.13]&R124[0.34]', 'REFPROP::R22[0.61]&R152a[0.11]&R124[0.28]', 'REFPROP::R22[0.33]&R152a[0.15]&R124[0.52]', 'REFPROP::R125[0.6]&Propane[0.02]&R22[0.38]', 'REFPROP::R125[0.38]&Propane[0.02]&R22[0.6]', 'REFPROP::Propane[0.05]&R22[0.75]&R218[0.2]', 'REFPROP::Propane[0.05]&R22[0.56]&R218[0.39]', 'REFPROP::R125[0.44]&R134a[0.04]&R143a[0.52]', 'REFPROP::R22[0.45]&R152a[0.07]&R142b[0.055]&RC318[0.425]', 'REFPROP::R22[0.55]&Isobutan[0.04]&R142b[0.41]', 'REFPROP::R32[0.2]&R125[0.4]&R134a[0.4]', 'REFPROP::R32[0.1]&R125[0.7]&R134a[0.2]', 'REFPROP::R32[0.23]&R125[0.25]&R134a[0.52]', 'REFPROP::R32[0.15]&R125[0.15]&R134a[0.7]', 'REFPROP::R32[0.25]&R125[0.15]&R134a[0.6]', 'REFPROP::R32[0.3]&R125[0.3]&R134A[0.4]', 'REFPROP::R125[0.07]&R143a[0.46]&R22[0.47]', 'REFPROP::R22[0.6]&R124[0.25]&R142b[0.15]', 'REFPROP::R22[0.65]&R124[0.25]&R142b[0.1]', 'REFPROP::R32[0.5]&R125[0.5]', 'REFPROP::R32[0.45]&R125[0.55]', 'REFPROP::propylen[0.015]&R22[0.875]&R152a[0.11]', 'REFPROP::propylen[0.03]&R22[0.94]&R152a[0.03]', 'REFPROP::R22[0.7]&R218[0.05]&R142b[0.25]', 'REFPROP::R218[0.09]&R134a[0.88]&Isobutan[0.03]', 'REFPROP::R22[0.51]&R124[0.285]&Isobutan[0.04]&R142b[0.165]', 'REFPROP::R22[0.5]&R124[0.39]&Isobutan[0.015]&R142b[0.095]', 'REFPROP::R22[0.82]&R152a[0.18]', 'REFPROP::R22[0.25]&R152a[0.75]', 'REFPROP::R134a[0.59]&R124[0.395]&Butane[0.015]', 'REFPROP::R125[0.466]&R134a[0.5]&Butane[0.034]', 'REFPROP::Propane[0.015]&R22[0.96]&R152a[0.025]', 'REFPROP::R125[0.77]&R134a[0.19]&DME[0.04]', 'REFPROP::R134a[0.88]&R142b[0.12]', 'REFPROP::R125[0.58]&R134a[0.42]', 'REFPROP::R125[0.85]&R134a[0.15]', 'REFPROP::R125[0.851]&R134a[0.115]&Isobutan[0.034]', 'REFPROP::R125[0.55]&R134a[0.42]&Isobutan[0.03]', 'REFPROP::R125[0.82]&R134a[0.15]&Isobutan[0.03]', 'REFPROP::R125[0.6509999999999999]&R134a[0.315]&Isobutan[0.034]', 'REFPROP::R134a[0.525]&R227ea[0.475]', 'REFPROP::R125[0.505]&R134a[0.479]&Isobutan[0.01]&Butane[0.006]', 'REFPROP::R32[0.185]&R134a[0.695]&R227ea[0.12]', 'REFPROP::R125[0.051]&R134a[0.93]&Butane[0.013000000000000001]&ipentane[0.006]', 'REFPROP::R32[0.15]&R125[0.25]&R143a[0.1]&R134a[0.5]', 'REFPROP::R125[0.775]&R143a[0.2]&Propane[0.006]&Isobutan[0.019]', 'REFPROP::dme[0.6]&R152a[0.1]&Isobutan[0.3]', 'REFPROP::R152a[0.76]&Isobutan[0.24]', 'REFPROP::Propane[0.71]&R152a[0.29]', 'REFPROP::propylen[0.8]&dme[0.2]', 'REFPROP::propylen[0.3]&Propane[0.7]', 'REFPROP::R125[0.632]&R143a[0.18]&R134a[0.16]&Isobutan[0.027999999999999997]', 'REFPROP::dme[0.8]&R152a[0.2]', 'REFPROP::Propane[0.56]&Isobutan[0.44]', 'REFPROP::Propane[0.52]&Isobutan[0.48]', 'REFPROP::R125[0.195]&R134a[0.785]&Butane[0.013999999999999999]&Pentane[0.006]', 'REFPROP::R32[0.085]&R125[0.45]&R134a[0.442]&Butane[0.017]&ipentane[0.006]', 'REFPROP::Ethane[0.031]&Propane[0.5479999999999999]&Isobutan[0.06]&Butane[0.361]', 'REFPROP::R32[0.31]&R125[0.31]&R134a[0.3]&R152a[0.03]&R227ea[0.05]', 'REFPROP::propylen[0.55]&Propane[0.4]&Isobutan[0.05]', 'REFPROP::R32[0.12]&R152a[0.05]&R1234ze[0.83]', 'REFPROP::R12[0.738]&R152a[0.262]', 'REFPROP::R22[0.75]&R12[0.25]', 'REFPROP::R22[0.488]&R115[0.512]', 'REFPROP::R23[0.401]&R13[0.599]', 'REFPROP::R32[0.48200000000000004]&R115[0.518]', 'REFPROP::R125[0.5]&R143a[0.5]', 'REFPROP::R23[0.39]&R116[0.61]', 'REFPROP::R23[0.46]&R116[0.54]', 'REFPROP::R22[0.44]&R218[0.56]', 'REFPROP::dme[0.88]&Isobutan[0.12]', 'REFPROP::R134a[0.05]&R152a[0.95]']
fluid = ['air',
'R401A',
'R401B',
'R401C',
'R402A',
'R402B',
'R403A',
'R403B',
'R404A',
'R405A',
'R406A',
'R407A',
'R407B',
'R407C',
'R407D',
'R407E',
'R407F',
'R408A',
'R409A',
'R409B',
'R410A',
'R410B',
'R411A',
'R411B',
'R412A',
'R413A',
'R414A',
'R414B',
'R415A',
'R415B',
'R416A',
'R417A',
'R418A',
'R419A',
'R420A',
'R421A',
'R421B',
'R422A',
'R422B',
'R422C',
'R422D',
'R423A',
'R424A',
'R425A',
'R426A',
'R427A',
'R428A',
'R429A',
'R430A',
'R431A',
'R432A',
'R433A',
'R434A',
'R435A',
'R436A',
'R436B',
'R437A',
'R438A',
'R441A',
'R442A',
'R443A',
'R444A',
'R500',
'R501',
'R502',
'R503',
'R504',
'R507A',
'R508A',
'R508B',
'R509A',
'R510A',
'R512A'
]
paras = [
{'name': '压力', 'mark': 'P', 'unit': 'Pa', 'id': 1},
{'name': '温度', 'mark': 'T', 'unit': 'K', 'id': 2},
{'name': '比焓', 'mark': 'H', 'unit': 'J/kg', 'id': 3},
{'name': '比熵', 'mark': 'S', 'unit': 'J/kg/K', 'id': 4},
{'name': '恒压比热', 'mark': 'C', 'unit': 'J/kg/K', 'id': 5},
{'name': '恒容比热', 'mark': 'CVMASS', 'unit': 'J/kg/K', 'id': 6},
{'name': '密度', 'mark': 'D', 'unit': 'kg/m^3', 'id': 7},
{'name': '比内能', 'mark': 'U', 'unit': 'J/kg', 'id': 8},
{'name': '黏度', 'mark': 'V', 'unit': 'Pa s', 'id': 9},
{'name': '干度', 'mark': 'Q', 'unit': 'mol/mol', 'id': 10},
{'name': '声速', 'mark': 'A', 'unit': 'm/s', 'id': 11},
{'name': '导热系数', 'mark': 'L', 'unit': 'W/m/K', 'id': 12},
{'name': '热膨胀系数', 'mark': 'ISOBARIC_EXPANSION_COEFFICIENT', 'unit': '1/K', 'id': 13},
{'name': '普朗特数', 'mark': 'PRANDTL', 'unit': '[-]', 'id': 14},
{'name': '压缩系数', 'mark': 'Z', 'unit': '[-]', 'id': 15},
{'name': '摩尔密度', 'mark': 'DMOLAR', 'unit': 'mol/m^3', 'id': 16},
{'name': '摩尔比焓', 'mark': 'HMOLAR', 'unit': 'J/mol', 'id': 17},
{'name': '摩尔比熵', 'mark': 'SMOLAR', 'unit': 'J/mol/K', 'id': 18},
{'name': '摩尔比内能', 'mark': 'UMOLAR', 'unit': 'J/mol', 'id': 19},
{'name': '摩尔比恒压比热', 'mark': 'CPMOLAR', 'unit': 'J/mol/K', 'id': 20},
{'name': '摩尔比恒容比热', 'mark': 'CVMOLAR', 'unit': 'J/mol/K', 'id': 21},
{'name': '等压膨胀系数', 'mark': 'ISOBARIC_EXPANSION_COEFFICIENT', 'unit': '1/K', 'id': 22},
{'name': '等温压缩率', 'mark': 'ISOTHERMAL_COMPRESSIBILITY', 'unit': '1/Pa', 'id': 23},
{'name': '表面张力', 'mark': 'I', 'unit': 'N/m', 'id': 24},
{'name': '第二维里系数', 'mark': 'BVIRIAL', 'unit': '[-]', 'id': 25},
{'name': '第三维里系数', 'mark': 'CVIRIAL', 'unit': '[-]', 'id': 26},
{'name': '吉布斯能量', 'mark': 'GMOLAR', 'unit': 'J/mol', 'id': 27},
{'name': '亥姆霍兹能量', 'mark': 'HELMHOLTZMOLAR', 'unit': 'J/mol', 'id': 28},
]
def fluid_PT(pressure, temperature, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'P', pressure, 'T', temperature, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ph(pressure, enthalpy, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'P', pressure, 'H', enthalpy, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ps(pressure, entropy, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'P', pressure, 'S', entropy, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Px(pressure, dryness, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'P', pressure, 'Q', dryness, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Th(temperature, enthalpy, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'T', temperature, 'H', enthalpy, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Ts(temperature, entropy, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'T', temperature, 'S', entropy, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_Tx(temperature, dryness, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'T', temperature, 'Q', dryness, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_hs(enthalpy, entropy, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'H', enthalpy, 'S', entropy, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_hx(enthalpy, dryness, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'H', enthalpy, 'Q', dryness, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
def fluid_sx(entropy, dryness, name):
article_info = {}
data = json.loads(json.dumps(article_info))
i = fluid.index(name)
re = refprop[i]
for str in paras:
try:
result = CP.PropsSI(str['mark'], 'S', entropy, 'Q', dryness, re)
if len(str['mark']) > 10:
x = {'name': str['name'], 'mark': '...', 'value': round(result, 6), 'unit': str['unit']}
else:
x = {'name': str['name'], 'mark': str['mark'], 'value': round(result, 6), 'unit': str['unit']}
data[str['id']] = x
except:
pass
return json.dumps(data, ensure_ascii=False)
print(fluid_PT(101325,100, 'Air')) |
免费评分
-
查看全部评分
|