I'm currently automating HYSYS via COM
So, I basically have two problems:
- 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?
- 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