以梦为马,不负韶华

搜索
查看: 1007|回复: 6
收起左侧

使用Python自动化读取HYSYS流股数据

[复制链接]
 楼主| 发表于 2023-8-27 19:51:16 显示全部楼层 |阅读模式
如题,我目前已经在Google上找到了如何用Python自动化读取HYSYS物料流股的办法(就是调用win32com.client函数),但是这个方法仍然存在问题,就是无法读取流股的相态信息,同时当流股为两相流时,无法分别读取气相流股和液相流股的信息,想问一下有没有什么解决办法

 成长值: 67885

发表于 2023-8-27 19:51:16 显示全部楼层
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)

点评

厉害啊,赶紧学习一下  详情 回复 发表于 2023-10-18 13:47
回复 支持 1 反对 0

使用道具 举报

 成长值: 6355

发表于 2023-8-27 19:51:16 显示全部楼层
还不知道hysys怎么导出塔的水力学数据到excel ,希望管理员能指点一下,多谢。
回复 支持 反对

使用道具 举报

发表于 2023-8-27 19:51:16 显示全部楼层
tdl522 发表于 2023-8-28 18:36
Python has become very popular recently, so here is simple code to integrate Python with Hysys.
Yo ...

厉害啊,赶紧学习一下
[发帖际遇]: 一个袋子砸在了 fzcdarkgod 头上,fzcdarkgod 赚了 1 个 韶华币. 幸运榜 / 衰神榜
回复 支持 反对

使用道具 举报

发表于 2023-8-27 19:51:16 显示全部楼层
厉害了,有高人
[发帖际遇]: hbshh 屌丝逆袭成功,获得白富美女神垂青,赚了 1 个 韶华币. 幸运榜 / 衰神榜
回复 支持 反对

使用道具 举报

发表于 2023-8-27 19:51:16 显示全部楼层
楼主,可以向你学习或是交流,微信号码xunlin002
[发帖际遇]: dog123 捡到一块切糕,卖给了小马,赚了 3 个 韶华币. 幸运榜 / 衰神榜
回复 支持 反对

使用道具 举报

不想打字就选择快捷回复吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|以梦为马,不负韶华

GMT+8, 2025-4-21 13:47

Powered by 以梦为马,不负韶华

© 2024-2099 Meng.Horse

快速回复 返回顶部 返回列表