通过电子表格建立 Aspen HYSYS 与 Python 的连接,提供访问流程模拟变量、求解器、物料流和单元操作的接口,便于读取和修改仿真参数。
✓已通过基础校验
名称、分类、版本与作者信息完整,安装包与文档齐备。
✓可直接使用
提供 Markdown 文档与配置示例,下载后按文档说明使用即可。
This repo contains an Aspen HYSYS - Python connection using spreadsheets.
本仓库包含一个使用电子表格实现的 Aspen HYSYS 与 Python 连接方案。
Since accesing the variables paths in Aspen HYSYS is sometimes problematic. The use of spreadsheets is an easy and fast way to access the variables we want.
由于在 Aspen HYSYS 中访问变量路径有时会很麻烦。使用电子表格是一种简单快捷的方式来访问我们想要的变量。
Aspen_connection in HYSYS_python_spreadsheets.pyHYSYS_python_spreadsheets.py 中的函数 Aspen_connectionAspen_connection(File_name, Spreadsheet_name, Unit_operation_name, hy_visible=1, active=0)
1. File_name of the Aspen HYSYS file you are working with.
1. 你正在使用的 Aspen HYSYS 文件的 File_name。
E.g. 'Test_1.hsc'
例如: 'Test_1.hsc'
2. Spreadsheet_name is a list of names for the specific spreadsheets within the Aspen HYSYS file that we are connecting with Python.
2. Spreadsheet_name 是我们要与 Python 连接的 Aspen HYSYS 文件中特定电子表格的名称列表。
E.g. ('SS_Flash', 'SS_turbine', 'SS_Distillation')
例如: ('SS_Flash', 'SS_turbine', 'SS_Distillation')
3. Unit_operation_name is a list of the names of the unit operations present within the Aspen HYSYS file. This is useful for example when dealing with distillation columns and their specific flowsheet window.
3. Unit_operation_name 是 Aspen HYSYS 文件中存在的单元操作名称列表。例如,在处理精馏塔及其特定的流程图窗口时,这非常有用。
E.g. ('Cooler', 'Flash Drum', 'Heater', 'Valve', 'Reactor',
'Distillation Column', 'Turbine', 'Pump')
例如: ('Cooler', 'Flash Drum', 'Heater', 'Valve', 'Reactor',
'Distillation Column', 'Turbine', 'Pump')
4. hy_visible whether to make Aspen HYSYS visible or not. 1=visible, 0=No Visible. Default 1.
4. hy_visible 用于设置是否使 Aspen HYSYS 可见。1=可见,0=不可见。默认值为 1。
5. active whether the Aspen HYSYS file is currently active or not. 1=Active, 0=No Active. Default 0.
5. active 用于设置 Aspen HYSYS 文件当前是否处于活动状态。1=活动,0=非活动。默认值为 0。
The output is a class Hysys with the following methods:
输出是一个 Hysys 类,包含以下方法:
1. Hysys.HyCase is the complete Aspen HYSYS case. From here you can access all the variables usign the specific variable paths.
To find this paths you can use the "Object browser" from Excel VBA or Matlab and the "HYSYS Customization Guide" pdf file. As I said, this is sometimes problematic. So you can work directly on spreadsheets.
1. Hysys.HyCase 是完整的 Aspen HYSYS 案例。从这里你可以使用特定的变量路径访问所有变量。
要找到这些路径,你可以使用 Excel VBA 或 Matlab 中的“对象浏览器”以及“HYSYS 自定义指南”PDF 文件。正如我所说,这有时会很麻烦。因此你可以直接在电子表格上操作。
2. Hysys.SS is a dictionary with the connections to the spreadsheets.
2. Hysys.SS 是一个包含与电子表格连接的字典。
3. Hysys.Solver is the solver in Aspen HYSYS. This is specially useful to turn it ON/OFF when changing input values to the simulation.
3. Hysys.Solver 是 Aspen HYSYS 中的求解器。在更改模拟的输入值时,这对于打开/关闭求解器特别有用。
4. Hysys.MaterialStreams is the connection to material streams in case you want to use (and know) the full path to the variable of interest here.
4. Hysys.MaterialStreams 是与物料流的连接,以防你想使用(并且知道)此处感兴趣变量的完整路径。
5. Hysys.EnergyStreams is the connection to energy streams in case you want to use (and know) the full path to the variable of interest here.
5. Hysys.EnergyStreams 是与能量流的连接,以防你想使用(并且知道)此处感兴趣变量的完整路径。
6. Hysys.UO is a dictionary with the connection to the unit operations. With this you can access the specific options of each unit if you know the path.
6. Hysys.UO 是一个包含与单元操作连接的字典。如果你知道路径,就可以通过它访问每个单元的特定选项。
Test_1.pyTest_1.pyAn example of use is provided in the Test_1.py where I show the importance of waiting for the solver to finish when working with the Python connection. Enjoy!
在 Test_1.py 中提供了一个使用示例,我在其中展示了在使用 Python 连接时等待求解器完成的重要性。祝你使用愉快!
This repository contains a MIT LICENSE
本仓库包含一个 MIT 许可证
8d9d2bf6799e7c609eb098bf300ec16df4b85386fd77d9365dd8c43c74dafde1