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

Hysys -matlab Communication!


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

#1 wjy

wjy

    Brand New Member

  • Members
  • 7 posts

Posted 07 May 2006 - 03:30 AM

Hi friends,
I've run across some problems when I transfer data from Matlab to HYSYS.I'm trying to send the composition for a material stream from Matlab through activex. I can send temperature and pressure and I can also recieve coposition data, but it doesn't seem to send vectors such as composition.
Besides,as we know,we can easily get and set a stream compositions to HYSYS from Excel using VBA code just like this:
---------------------------------------------------------------
Dim hyStrm As HYSYS.ProcessStream
Dim varComps As Variant
varComps = hyStrm.ComponentMolarFraction.Values
For i = 0 To UBound(varComps)
varComps(i) = 1 / (UBound(varComps) + 1)
Next i
hyStrm.ComponentMolarFraction.Values = varComps
---------------------------------------------------------------
But when I use Matlab(set HYSYS as a ActiveX server) to do the same thing,it's not success.
Any suggestions?

Thank you in advance!

#2 joerd

joerd

    Gold Member

  • ChE Plus Subscriber
  • 371 posts

Posted 08 May 2006 - 09:10 AM

Does it work when you use the GetValue and SetValue methods, like in varComps = hyStrm.ComponentMassFlow.GetValues("kg/h")

I have only used data transfer to/from Excel / Visio etc. so I have no experience with Matlab and there might be something really different going on. For some types of tasks the only thing I could come up with is to generate a script and play that in HYSYS.

Did you try sending a msg at support.aspentech.com ? They usually are very responsive.

#3 wjy

wjy

    Brand New Member

  • Members
  • 7 posts

Posted 09 May 2006 - 07:30 AM

I have successfully transfer/receive some type of data(such as temperatue,pressure and so on) from Matlab to HYSYS.Besides ,I can get the composition data from HYSYS.But when I try to set the composition data to HYSYS,there is a error.So I think the method and property of "composition" object are not so easy as other normal variables which can be modify directly.As we know,when we set the composition value in HYSYS, an "edit" dialog will be pop-up in which we can modify the composition data.When all data are prepared,we push the "OK" button exiting the edit mode and HYSYS receive the new data. So the key point is the mechanism of the composition value setting process and I don't know how to realize the process from Matlab.
But it's puzzling that we can set the composition value from EXCEL with VBA code and the same thing is failed in Matlab.

I want to try sending a msg at support.aspentech.com, but I have no username and password .It's unfortunate that I can't browse many useful resources and get a technical support.

Thank you very much! If you have some useful message, please mail me: wwjjyy456@hotmail.com

Best Wishes!

#4 joerd

joerd

    Gold Member

  • ChE Plus Subscriber
  • 371 posts

Posted 10 May 2006 - 09:48 AM

I did a search for you on the support.aspentech website. Unfortunately no results for Matlab. Searching for ActiveX only gives the followingj: - quote -

Problem Statement

I am using AutoPlant; however, it is quite tedious to transfer all the data into HYSYS. Does HYSYS interface with AutoPlant?

Solution

Unfortunately, HYSYS does not interface with AutoPlant.

If AutoPlant is an ActiveX compliant environment, however, you may be able to use a client such as MS Excel to access functions and variables in AutoPlant (functioning as an ActiveX server). Since HYSYS can also function as an ActiveX server, one could use MS Excel as an intermediary to transfer information from one application to another.

At this time, we do not have any examples, but the HYSYS to Excel side is fairly well documented on our support website (some solutions are cross-referenced above).

- unquote
No luck this time, I'm afraid.

#5 wjy

wjy

    Brand New Member

  • Members
  • 7 posts

Posted 10 May 2006 - 12:35 PM

Thank you very much. I have give up setting the composition value directly from Matlab to HYSYS. And I find a solution which has the same effect though a little bother. I mix several pure component with different proportion so that it is equivalent to the specific mixture. I can set the "massflow" value of each pure component using Matlab and I can gain the mixture with discretional composition. Anyway,Matlab is a very powerful tool, if HYSYS and Matlab can communication more friendly , it's wonderful.

I have another question that tranfer data from HYSYS to Excel. As we know , we can transfer many kinds of data to Excel. But I've run across a problem recently . I want to transfer some data of "PFR" unit. It's the data that the different parameter of every segments in the "profile" table(such as the temperature and pressure distribution in axial ). I can't get these data through the "PFReactor" object. As a result , I have to drag these data to the spreadsheet and get them in Excel. If I want to transfer large amount of data, it's a tiresome job. So I want to know whether I could get these data directly through the "PFReactor" object .

Thank you in advance!
Best wishes!

#6 joerd

joerd

    Gold Member

  • ChE Plus Subscriber
  • 371 posts

Posted 10 May 2006 - 03:31 PM

You probably need a backdoor variable. I'll try to look up a good example for you when I have time.

#7 wjy

wjy

    Brand New Member

  • Members
  • 7 posts

Posted 11 May 2006 - 03:26 AM

I am sorry that I don't understand what the "backdoor variable" means. I have learned HYSYS only for two months and there's no advanced tutorial in hand( only the software documents , some basic tutorial of Aspen Company and some basic tutorial of several Chemical Engineering department in US universities). Sometimes I feel that the HYSYS is like a black box and I don't what happen inside though I get the final results. So I think I should have a in-depth understand of HYSYS if I want to use it more effectively and neatly.

I am going on my graduate project that build a Naphtha Catalytic Reforming static process using HYSYS. I've encountered many difficulties and solved most of them. HYSYS is a general platform so that it's difficult to build some specific complicated models. The one problem is about reaction defination, HYSYS just provide several simple expression and we can't realize many complicated reaction mechanism. For example there is a reaction as following:
---------------------------------------------------------
reaction equation: aA+bB==dD
reaction rate expression: r=k*CA^a*PB^b
CA---the molar concentration of component A
PB---the partial pressure of component B
---------------------------------------------------------
It's difficult to realize this expression directly in HYSYS. May I have to use the Kinetic Reaction Extension? Do you have some advice?

There are some problems about hotmail these days. If you find some good examples or introduction about "backdoor variable" or building Catalytic Reforming process using HYSYS,please load the file just in this forum or send to my another mail address:
wangjunyan02@mails.tsinghua.edu.cn

I'm glad to meet you a enthusiasm people.Thank you very much!
Best Wishes!
---------------------------------------------------------
wjy

#8 joerd

joerd

    Gold Member

  • ChE Plus Subscriber
  • 371 posts

Posted 25 May 2006 - 11:16 AM

I have written a little excel workbook that connects to the Hysys case and reads PFR data. Examine the code, and update to suit. The way to get the moniker of the variable is to copy the data from Hysys, then paste as link in Excel. Look at how I did this, I hope you can figure it out (it is a bit sloppy). See my post in the forum for the workbook.

Cheers
Joerd

Attached Files






Similar Topics