Jump to content



Featured Articles

Check out the latest featured articles.

File Library

Check out the latest downloads available in the File Library.

New Article

Product Viscosity vs. Shear

Featured File

Vertical Tank Selection

New Blog Entry

Low Flow in Pipes- posted in Ankur's blog

Exception Handling For Hysys Automation

hysys automation

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic
Share this topic:
| More

#1 peter317

peter317

    Junior Member

  • Members
  • 17 posts

Posted 09 February 2017 - 01:52 AM

I'm currently automating HYSYS via COM

So, I basically have two problems:

 

  1. Manipulating Solver mode (Active/On Hold):

According to the customization guide, If I pass a bool, I can change it while migrating my data to avoid consistency errors, but unfortunately when I try to do that, The status never change (I set simulation case visible to see what is happening). It appears that the property "CanSolve" is just good for checking whether the solver is on or not but not for changing its status at will....

 

The question is: How can I change the solver mode?

 

  1. Checking for errors when they happen inside my case:

I'm manipulating the case by changing some variables and checking their effect on others via an objective function. Naturally, I wanna discard (or specially treat) faulty cases where errors happen, the case couldn't be solved or the case is underspecified. The only way I could think of to achieve that was using "HYSYS.SimulationCase.GetFlowsheetStatus (enum)" which as described inside the object browser does ( Get the count of flowsheet objects with the given status or combined given statuses in the case) but the function shows really strange behavior since it sometimes return more than 1 flowsheet with the specified status (I don't have any sub-flowsheets) and most of the time returns 1  for flag_OK even though that the case is obviously not converged.

 

The question is: How can I check for the case conversion and errors through automation?

 

PS. my client is in C++ but If you have idea but in other language, I would also appreciate it very much



#2 serra

serra

    Gold Member

  • Members
  • 310 posts

Posted 09 February 2017 - 03:36 AM

you may wish to contact aspen assistance cause API (functions exposed) may change  in different versions of a software,

in this forum you may find several VBA snippets which may result useful,

however, in my  opinion, COM is not that easy and may require specific tricks,

for my applications I prefer a different approach based on libraries (see the products of PRODE, PROSIM etc.)

these provides a quick and fast access to almost all data,

of course there may be (or not) advantages depending from specific flieds of application.



#3 Nikolay_

Nikolay_

    Gold Member

  • Members
  • 162 posts

Posted 10 February 2017 - 10:58 PM

Could you please tell me what is the objective this manipulations with COM,VB etc? Do you need any special function?

#4 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 11 February 2017 - 03:17 PM

In addition to assistance, you should login to the AspenTech support site. You will probably find what you need there, including examples.

 

Bobby



#5 peter317

peter317

    Junior Member

  • Members
  • 17 posts

Posted 12 February 2017 - 09:45 PM

Thank you everyone for your replies.

I'm building an exergoeconomic optimizer. All what I need is just get a flag for the cases with errors or not converged status so I can specially treat them.

I also logged in to Aspen website, they give little examples for automation but I couldn't find anything for faulty cases checking...



#6 Nikolay_

Nikolay_

    Gold Member

  • Members
  • 162 posts

Posted 16 February 2017 - 04:07 PM

Hello, 

Did you try "Сase Study" function in HYSYS? Usually, it shows the cases with errors (not converged).



#7 Nikolay_

Nikolay_

    Gold Member

  • Members
  • 162 posts

Posted 16 February 2017 - 04:11 PM

In addition, you can use "Spreadsheet" function to expand functionality. You can calculate, and then set your own variable or objective.






Similar Topics