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

Hysys-Python "premission Denied" Issue

hysys python vba

3 replies to this topic
Share this topic:
| More

#1 Milnesium

Milnesium

    Brand New Member

  • Members
  • 3 posts

Posted 05 June 2021 - 01:04 PM

Hi,

 

I am trying to write an interface between Python 3.7 and Hysys case. I managed to establish a connection between them, connect Hysys as COM.Object.

 

This gave me the ability to modify the data of streams using syntax like:

 

'HyCase.Flowsheet.MaterialStreams.Item(1).Temperature.SetValue(20, "C")'

 

In this case everything work fine, but wen im try to change, for example, condenser pressure of column K-1 using syntax:

 

'HyCase.Flowsheet.Operations.Item("K-1").ColumnFlowsheet.SeparationColumnStages.Item("Condenser").SeparationStage.Pressure.SetValue(2, "kPa")'

 

it gives me error "70 Premission denied". But i can change that value handly in column specifications directly in Hysys, also

 

'HyCase.Flowsheet.Operations.Item("K-1").ColumnFlowsheet.SeparationColumnStages.Item("Condenser").SeparationStage.Pressure.CanModify'

 

returns me "True" value.

 

I have tried doing all the same using VBA and the picture was the same. I can modify one values but can't modify the others although they "CanModify" attribute is "True". Maybe i using wrong syntax or something? I have no idea how can i solve this error.

 

Thanks.

 

P.S. Sorry for my English



#2 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 05 June 2021 - 04:27 PM

You will probably find that VBA and VB.Net work much better with HYSYS.

 

Bobby



#3 lnbsak

lnbsak

    Gold Member

  • Members
  • 53 posts

Posted 05 June 2021 - 07:06 PM

I don't have specific answer to your problem. But we were able to automate HYSYS and ASPEN PLUS following the website. Al input value from variable explorer can be manipulated.



#4 Milnesium

Milnesium

    Brand New Member

  • Members
  • 3 posts

Posted 06 June 2021 - 11:19 AM

Thanks for your advices, finally i can solve this problem by using a little bit different syntax:

 

' HyCase.Flowsheet.Operations.Item("K-1").ColumnFlowsheet.Pressures.Variables[0].SetValue(2, 'kg/cm2_g') '

 

In theory I was accessing the same parameter, and i have no idea why i can change it by this method, but can't by another.






Similar Topics