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

0

Specifying Hysys Exchanger Ua Value From Excel - Permission Denied?

hysys vba excel exchanger

5 replies to this topic
Share this topic:
| More

#1 Engineer83

Engineer83

    Brand New Member

  • Members
  • 4 posts

Posted 23 June 2017 - 09:35 AM

Hi,

 

I am trying to write an Excel VBA which automates interaction between Excel and HYSYS. I want to be able to specify inlet temperatures and flows of an exchanger and UA of the exchanger from Excel, then retrieve the outlet temperatures calculated by HYSYS. Heat exchanger model I am using is Exchanger Design (End Point)

 

So far I have been able to write temperatures and flows into streams, and retrieve UA and Duty from the exchanger however I cannot specify UA for the exchanger from Excel VBA. When I try to do so I get "permission denied" error.

 

Below is the script I am trying to use:

 

' exchanger in HYSYS is called "HX1" and all variables have been declared Variant

' simCase (i.e. simulation case) has been defined previously

 

 

Set HX1 = simCase.Flowsheet.Operations.Item("HX1")

HX1.UA.SetValue 65000, "W/C"

 

The specific error I get is "Run-time error '70': Permission denied.

 

Is there another way apart from trying to set a value to do this? Any help greatly appreciated.



#2 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 23 June 2017 - 10:59 AM

Can you set it in the HYSYS case?

 

Bobby



#3 Engineer83

Engineer83

    Brand New Member

  • Members
  • 4 posts

Posted 23 June 2017 - 11:24 AM

Hi Bobby,

 

Thank you for your reply -yes I could set this up in HYSYS however I prefer to do it if in Excel if possible.

 

I'm producing a template tool which needs to be easily replicable by people with limited HYSYS experience and it would be good if they had to set things as little as possible within HYSYS.

Excel VBA part will be automatically populated based on a macro to customize the macro within the spreadsheet, therefore I don't have to worry about people setting wrong things to wrong places.

 

It's very convoluted, but would be really good if anyone knows a way to get around this "permission denied" error message...

 

Regards, E83

 



#4 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 23 June 2017 - 11:34 AM

Check the AspenTech support site. You might try to stop the solver while implementing all the changes, then start it when all the changes are finished.

 

You must set the exchanger to "Design" in order to input UA. And leave two outlet temperatures empty. You only have 3 degrees of freedom. Check this first.

 

Try UAValue As Double. You can find this with the object explorer.

 

HX1.UAValue.SetValue 65000, "W/C"

 

Bobby


Edited by Bobby Strain, 23 June 2017 - 08:40 PM.


#5 Engineer83

Engineer83

    Brand New Member

  • Members
  • 4 posts

Posted 29 June 2017 - 05:04 AM

Just closing out this conversation: Took Bobby's advice and contacted Aspentech support. Apparently the UA value as I specified is read-only value and the way to get around that is to write the value of HX specification as per below:

 

Dim UASpec as HYSYS.ExchangerSpecification

 

If UASpec.Goal.CanModify = True Then

   UASpec.Goal.SetValue 65000, "W/C"

End if

 

Thanks for your support Bobby.

 

Regards, Engineer83

 



#6 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 29 June 2017 - 09:03 AM

There are lots of hidden gems like this. But AspenTech provides excellent support. They have lots of "back door" properties, too.

 

Bobby






Similar Topics