猛犸论坛【以梦为马,不负韶华】

搜索
搜索附件  

1、选取工具栏里的工作薄.jpg

 

hysys物料输出EXCEL工具:
hysys物料输出EXCEL工具
下载来尝试一下,看看功能如何?
输出工具没法打开啊,楼主怎么回事呢?谢谢!
这个工具所有hysys版本都能用么?
好人,好坛,好贴。
好人,好坛,好贴。
好人,好坛,好贴。
温度(℃)演示版本,有限制
压力(kPa)演示版本,有限制


温度、压力等几个常用的量导不出,可能是hysys不是正版吧。
asw软件就可以到达这样的效果,不知道这个会怎么样
回复 1# Horse


    好东西,如果能有截图说明下使用方法就更棒了。支持。
会用vba的话,要用excel检索hysys结果实际上很简单,比如
Dim hyCase As Object

Sub ConnectHYSYS()
    On Error GoTo ErrorTrap
    Set hyApp = GetObject(, "HYSYS.Application")
    Set hyCase = hyApp.ActiveDocument
    If hyCase Is Nothing Then
        MsgBox "A HYSYS simulation case must be open."
        Exit Sub
    End If
    Clear
    GetStreamData
    Exit Sub
ErrorTrap:
    If Err = 429 Or Err = 483 Then
        MsgBox "HYSYS is not currently running."
    Else
        MsgBox "The following error (" & Err & ") occurred: " & Error(Err)
    End If
End Sub

Sub OpenHYSYS()
'    Set hyApp = GetObject(, "HYSYS.Application")
'    If Err = 483 Then MsgBox "HYSYS is not running."
    On Error GoTo ErrorTrap
    CaseName = Application.GetOpenFilename("HYSYS Simulation Case (*.hsc), *.hsc")
    If CaseName = "False" Then
        Exit Sub
    End If
    Set hyCase = GetObject(CaseName, "HYSYS.SimulationCase")
    GetStreamData
    hyCase.Close
    Exit Sub
ErrorTrap:
    MsgBox "The following error occurred:  " & Error(Err), Buttons:=48
End Sub

'Get HYSYS stream data
Sub GetStreamData()
    On Error GoTo ErrorTrap
    Dim hyStreams As Object
    Dim hyStream As ProcessStream
    Dim xlSheet As Worksheet
    Dim hyfluid As Fluid
    Dim OptionButtons As OptionButtons
    Dim OptionButton As OptionButton
    Dim SIValue As Boolean


    Set hyStreams = hyCase.Flowsheet.MaterialStreams
    Set xlSheet = Worksheets("Stream Data")
    Set OptionButtons = Worksheets("Main").OptionButtons
    Clear
    For Each OptionButton In OptionButtons
        If OptionButton.Value = xlOn Then Exit For
    Next

With xlSheet
    i = 0
    For Each hyStream In hyStreams

                .Cells(3 + i, 1) = hyStream.Name
                .Cells(3 + i, 2) = Format(hyStream.VapourFractionValue, "0.###")
                .Cells(3 + i, 3) = Format(hyStream.Temperature.GetValue("K"), "##.###")
                .Cells(3 + i, 4) = Format(hyStream.Pressure.GetValue("kg/cm2"), "0.###")
                .Cells(3 + i, 5) = Format(hyStream.Pressure.GetValue("bar"), "0.###")
                .Cells(3 + i, 6) = Format(hyStream.MolarFlow.GetValue("Nm3/h(gas)"), "0.##")
                .Cells(3 + i, 7) = Format(hyStream.ComponentMolarFraction.Values(0), "0.000000")
                .Cells(3 + i, 8) = Format(hyStream.ComponentMolarFraction.Values(1), "0.000000")
                .Cells(3 + i, 9) = Format(hyStream.ComponentMolarFraction.Values(2), "0.000000")
                .Cells(3 + i, 10) = Format(hyStream.ActualVolumeFlow.GetValue("m3/h"), "0.##")
                .Cells(3 + i, 11) = Format(hyStream.MassFlow.GetValue("kg/h"), "0.##")

                .Cells(3 + i, 12) = Format(hyStream.CpCv, "0.####")
                If hyStream.Compressibility > 0 Then
                    .Cells(3 + i, 13) = Format(hyStream.Compressibility, "0.#####")
                    Else
                    .Cells(3 + i, 13) = "N/A"
                End If
                If hyStream.Viscosity > 0 Then
                    .Cells(3 + i, 14) = Format(hyStream.Viscosity, "0.#####")
                    Else
                    .Cells(3 + i, 14) = "N/A"
                End If
               
                .Cells(3 + i, 15) = Format(hyStream.MassDensity.GetValue("kg/m3"), "0.###")

                Set hyfluid = hyStream.DuplicateFluid
               On Error Resume Next
               .Cells(3 + i, 17) = Format(hyfluid.BubblePointPressureValue / 100, "0.000")
    i = i + 1
    Next hyStream
    Set hyStreams = hyCase.Flowsheet.EnergyStreams
    For Each hyStream In hyStreams
            .Cells(3 + i, 1) = " " + hyStream.Name
            .Cells(3 + i, 4) = "kW"
            .Cells(3 + i, 3) = Format(hyStream.Power, "#.#")
            i = i + 1
    Next hyStream

    xlSheet.Select
    Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
        :=xlPinYin

    End With
    Exit Sub
ErrorTrap:
    MsgBox "The following error occurred:  " & Error(Err), Buttons:=48
End Sub

以上代码各个版本hysys都能使用,当然你需要先建立一个相应的excel页。
回复 1# Horse


    用过了 我的2004的用软件能导出 单v7.1的不行 不知道v7.1的有什么办法
回复 15# home1984


    您的程序怎么用啊 能不能说的详细点 谢谢
好东西,非常感谢:
好东西,非常感谢:
好东西,非常感谢:
好东西,非常感谢:
好东西,非常感谢:
最近正在研究excel的编程,又在做天然气凝液回收的论文,谢谢,呵呵~
炮网过生日的时候,兄弟我以前也为炮网编过一个小程序的,可是论坛出故障,把我的东西搞没了
如果大家需要什么hysys的扩展工具,哥们可以帮忙编编。
不知道新版HYSYS是否可以使用來去測試看看
感謝分享希望能受用
下载来尝试一下,看看功能如何?
不知道哪个版本,也没有截图,但还是要多谢楼主 ,学习了
是可以用HYSYS自带的输出工具输出物料表。上个截图和步骤。
啥也不说了,楼主就是给力啊!
V7.2以上的版本,可以直接输出到Excel。
楼主有没有什么HYSYS接口的资料,推荐一下,楼主有的话能不能发一些648683677@qq.com,非常感谢啊
最近在用VB调用做封装,结果发现自己的VB知识又还给老师了。。{:1106_363:}
1、选取工具栏里的工作薄.jpg

手机版|猛犸论坛【以梦为马,不负韶华】

GMT+8, 2025-7-9 03:26

Powered by 猛犸论坛【以梦为马,不负韶华】

© 2024-2099 Meng.Horse

返回顶部