How to do Interface between Aspen Hysys and Matlab and perform Hybrid optimization

18 views (last 30 days)
Hi
Is there anyone who can me help me please. I am doing LNG plant optimization. To perform the optimization I first did the simulation on Hysys and interface HYSYS with Matlab. The model is still now in steady-state condition. When I am using the compressor outlet pressure as the decision variables, The simulation is working and it can minimize the energy consumption.
But, when I am using the refrigerant mass flow rate or outlet pressure of throttle valves as decision variables, the simulation get's unconverged and the simulation stopped.
In addition to this, when I am using refrigerant mass fraction as decision variables and run the optimization it shows the following error "Invoke Error, Dispatch Exception: No such interface supported"
If I the convert the simulation into dynamic mode, the problem will be solved ?
whenever, i am trying to convert the model into dynamic it's showing that notification in this picture.
  14 Comments
Rasel Ahmed
Rasel Ahmed on 17 May 2021
Hi liang,
I am sharing the codes to interface hysys with matlab, and providing another link of the details code. Have you tried to use mixed refrigerant mass fraction / mass flow as decision variables ?. I am facing some problem that I couldn't change the mixed refrigerant mass fraction values.
MyObject=actxserver('Hysys.Application');
global MySimCase;
FileNamePath = 'C3MR7v6';
MySimCase = MyObject.SimulationCases.Open([cd,strcat('\',...
FileNamePath,'.hsc')]);
MySimCase.Visible = true;
MyOperations = MySimCase.Flowsheet.Operations; % Getting data from our simcase operations
MyFlowSheet = MySimCase.get('flowsheet'); %accessing to flowsheet
MyMaterialStreams = MyFlowSheet.get('MaterialStreams'); %accessing to simulated material streams
MyEnergyStreams = MyFlowSheet.get('EnergyStreams'); % Energy streams
Ting Liang
Ting Liang on 19 May 2021
Thanks a lot for your sharing.
Sorry, I am not working on mixed refrigerant, but on air, sorry that I cannot help with your problem now, but hope we can communicate with and help each other more later.
Thanks.
Best regards
Ting Liang

Sign in to comment.

Answers (1)

bilal kazmi
bilal kazmi on 24 Dec 2020
if you provide any help in this please share some file as iam also in search of specific file
  1 Comment
Rasel Ahmed
Rasel Ahmed on 17 May 2021
Hi kazmi,
I am sharing the codes to interface hysys with matlab, and providing another link of the details code. Have you tried to use mixed refrigerant mass fraction / mass flow as decision variables ?. I am facing some problem that I couldn't change the mixed refrigerant mass fraction values.
MyObject=actxserver('Hysys.Application');
global MySimCase;
FileNamePath = 'C3MR7v6';
MySimCase = MyObject.SimulationCases.Open([cd,strcat('\',...
FileNamePath,'.hsc')]);
MySimCase.Visible = true;
MyOperations = MySimCase.Flowsheet.Operations; % Getting data from our simcase operations
MyFlowSheet = MySimCase.get('flowsheet'); %accessing to flowsheet
MyMaterialStreams = MyFlowSheet.get('MaterialStreams'); %accessing to simulated material streams
MyEnergyStreams = MyFlowSheet.get('EnergyStreams'); % Energy streams

Sign in to comment.

Categories

Find more on Fluid Dynamics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!