
A-8 Automation FAQ
A-8
Now directly access the column specifications by name:
13. How do I access a SpreadSheet unit operation via
Automation?
Ans: Use the following syntax:
Where, hyCase is a reference to the current HYSYS
simulation case, SSName is the name of the spreadsheet
being referenced in HYSYS, and SS is an object reference to
the spreadsheet. The second line uses the SS object
reference to set the value of the variable A1Value equal to
the value of cell A1 in the referenced spreadsheet.
14. Can I access HYSYS utilities via Automation?
Ans: Currently the HYSYS utilities cannot be accessed
directly through Automation. However, the utilities (and
most other objects in HYSYS) can be accessed indirectly by
the SpeadSheet unit operation. Simply attach the utility
inputs and results to the SpreadSheet and access the
SpreadSheet via Automation as shown in #13.
15. How can I determine if HYSYS is already running?
Ans: The following code demonstrates how the GetObject
function can be used to determine if HYSYS is currently
running:
hyCol.Specifications("EtOH OH Mass Frac").GoalValue = 0.001
hyCol.Specifications("MeOH Btms Mass Frac").GoalValue = 0.001
Set SS = hyCase.Flowsheet.Operations.Item("SSName")
A1Value = SS.Cell("A1").CellValue
Set hyApp = GetObject(, "HYSYS.Application")
Komentáře k této Příručce