使用Python自动化读取HYSYS流股数据
如题,我目前已经在Google上找到了如何用Python自动化读取HYSYS物料流股的办法(就是调用win32com.client函数),但是这个方法仍然存在问题,就是无法读取流股的相态信息,同时当流股为两相流时,无法分别读取气相流股和液相流股的信息,想问一下有没有什么解决办法Python has become very popular recently, so here is simple code to integrate Python with Hysys.
You will see:
1- how to open a Hysys case using Python.
2- how to change some parameters in the Hsysy case using Python.
3- how to read data from Hysys.
The Code:
import win32com.client as win32 # Import COM
def openHysys(hyFilePath):
hyApp = win32.Dispatch('HYSYS.Application')
hyCase = hyApp.SimulationCases.Open(hyFilePath)
hyCase.Visible = True
#streamPress = hyCase.Flowsheet.MaterialStreams.Item("FeedStream").Pressure.setValue(3,"bar_g")
streamPress = hyCase.Flowsheet.MaterialStreams.Item("FeedStream").Pressure.setValue(400,"kPa")
streamPress = hyCase.Flowsheet.MaterialStreams.Item("FeedStream").Pressure.getValue("kPa")
print(streamPress," kPa")
streamPress = hyCase.Flowsheet.MaterialStreams.Item("FeedStream").Pressure.getValue("bar_g")
print(streamPress, " bar_g")
compEff = hyCase.Flowsheet.Operations.Item("K-100").CompPolytropicEff
exArea = hyCase.Flowsheet.Operations.Item("E-101").HeatTransferArea
print(compEff, " %")
print(exArea," m2")
return()
hyFilePath = r"C:\Users\HassanElbanhawi\Desktop\Pressure Relief Benchmark.hsc"
print('')
openHysysCase = openHysys(hyFilePath)
还不知道hysys怎么导出塔的水力学数据到excel ,希望管理员能指点一下,多谢。 tdl522 发表于 2023-8-28 18:36
Python has become very popular recently, so here is simple code to integrate Python with Hysys.
Yo ...
厉害啊,赶紧学习一下 {:1110_553:} 厉害了,有高人 楼主,可以向你学习或是交流,微信号码xunlin002
页:
[1]