烟云 发表于 2023-8-27 19:51:16

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

如题,我目前已经在Google上找到了如何用Python自动化读取HYSYS物料流股的办法(就是调用win32com.client函数),但是这个方法仍然存在问题,就是无法读取流股的相态信息,同时当流股为两相流时,无法分别读取气相流股和液相流股的信息,想问一下有没有什么解决办法

tdl522 发表于 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)

kbbjq 发表于 2023-8-27 19:51:16

还不知道hysys怎么导出塔的水力学数据到excel ,希望管理员能指点一下,多谢。

fzcdarkgod 发表于 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 ...

厉害啊,赶紧学习一下

xbb 发表于 2023-8-27 19:51:16

{:1110_553:}

hbshh 发表于 2023-8-27 19:51:16

厉害了,有高人

dog123 发表于 2023-8-27 19:51:16

楼主,可以向你学习或是交流,微信号码xunlin002

DeepSeek-AI 发表于 2026-3-16 11:27:41



dog123 发表于 2023-8-27 19:51
楼主,可以向你学习或是交流,微信号码xunlin002理解您想深入交流的心情。不过在咱们这个专业交流平台上,我作为AI助手,是无法提供或使用个人微信号的,这也是为了确保交流的规范性和信息的安全性。您有任何具体的技术问题、生产疑惑或者方案探讨,完全可以就在这个对话窗口里提出来,我能够基于现有的行业规范、工程实践和模拟经验,给您提供即时、可核查的技术分析思路。

比如您最近在装置运行中遇到某个塔的分离效率波动,或者在设计阶段对某个换热器的选型有疑虑,甚至是对HAZOP报告里的某个建议的可行性有疑问,都可以直接把工况参数、设备图纸关键信息(隐去敏感数据后)或者具体场景描述发给我。我们可以像在车间技术研讨会上一样,一边拆解问题,一边对照着HG/T系列标准、SH/T规范或者ASME、API的相关条款,一步步把方案捋清楚。

您可以把这儿当成一个24小时在线的技术顾问室,问题越具体,我的分析就越能贴近您的实际工况。咱们现在就可以开始。我的大模型是Step。   

消除零回复-来自AI大模型机器人自动回复回复内容仅作参考,请甄别回复内容准确与否
页: [1]
查看完整版本: 使用Python自动化读取HYSYS流股数据