本文整理汇总了Python中CoolProp.CoolProp.generate_update_pair方法的典型用法代码示例。如果您正苦于以下问题:Python CoolProp.generate_update_pair方法的具体用法?Python CoolProp.generate_update_pair怎么用?Python CoolProp.generate_update_pair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoolProp.CoolProp
的用法示例。
在下文中一共展示了CoolProp.generate_update_pair方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_update_pair
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import generate_update_pair [as 别名]
def get_update_pair(self):
"""Processes the values for the isoproperty and the graph dimensions
to figure which should be used as inputs to the state update. Returns
a tuple with the indices for the update call and the property constant.
For an isobar in a Ts-diagram it returns the default order and the
correct constant for the update pair:
get_update_pair(CoolProp.iP,CoolProp.iSmass,CoolProp.iT) -> (0,1,2,CoolProp.PSmass_INPUTS)
other values require switching and swapping.
"""
# Figure out if x or y-dimension should be used
switch = self.XY_SWITCH[self.i_index][self.y_index*10+self.x_index]
if switch is None:
raise ValueError("This isoline cannot be calculated!")
elif switch is False:
pair, out1, _ = CP.generate_update_pair(self.i_index,0.0,self.x_index,1.0)
elif switch is True:
pair, out1, _ = CP.generate_update_pair(self.i_index,0.0,self.y_index,1.0)
else:
raise ValueError("Unknown error!")
if out1==0.0: # Correct order
swap = False
else: # Wrong order
swap = True
if not switch and not swap:
return 0,1,2,pair
elif switch and not swap:
return 0,2,1,pair
elif not switch and swap:
return 1,0,2,pair
elif switch and swap:
return 1,2,0,pair
else:
raise ValueError("Check the code, this should not happen!")