How can I solve the error of Aspen Hysys case opening "Invoke Error, Dispatch Exception: Access is denied."

28 ビュー (過去 30 日間)
Dear,
I am using MATLAB 2016a and Aspen HYSYS V9. I am trying to connect between two program and encounter the error as following:
>> hysys=actxserver('Hysys.Application')
hysys =
COM.Hysys_Application
>> simcase=hysys.SimulationCases.Open([cd,'\an.hsc']);
Error using Interface.HYSYS_9_Type_Library.SimulationCases/Open
Invoke Error, Dispatch Exception: Access is denied.
I tried to run MATLAB as Administrator but the result was still the same. I put the an.hsc file in MATLAB path.
Please kindly help me solve this error. Thank you very much for your help.
  2 件のコメント
Zain Javed
Zain Javed 2020 年 5 月 26 日
Hi! If you get your answer so please help the people like me so we can make this world a better place with our projects.
Thanks
Hossein Hanzali
Hossein Hanzali 2023 年 12 月 8 日
I have the same problem, the .m file and .hsc files are in the same folder. I tried a lot but not solved. please return the answer to me if the problem solved

サインインしてコメントする。

回答 (3 件)

Rasel Ahmed
Rasel Ahmed 2020 年 8 月 26 日
Put both files, Hysys simulation case (.hsc) & the following matlab script (.m) in the same folder. Matlab Code, please modify simulation name ("Distill_Example.hsc") accondingly:
Hysys=actxserver('Hysys.Application.V10.0'); %COM Technology
[stat,mess]=fileattrib; %getting actual folder name
simcase = Hysys.SimulationCases.Open([mess.Name '\Distill_Example.hsc']); %Opening HYSYS Simulation (Distill_Example.hsc)
simcase.invoke('Activate'); %Opening HYSYS Simulation (Distill_Example.hsc)
Typically, "Error using interface" can be generated due to lack of Hysys License, therefore the program cannot initialize.
If the error persists, you can send me the simulation and I will try to make the Matlab-Sim Hysys connection.
Regards,
Andrés Abril
for details discussion, please follow this link.

Francesco Catena
Francesco Catena 2022 年 9 月 28 日
Hi,
The .m file and the .hsc file have to be in the same folder. Then you can proceed as follow:
Hysys = actxserver('Hysys.Application.V11.0');
FileNamePath = 'File_name';
Simulation = Hysys.SimulationCases.Open([cd,strcat('\',FileNamePath,'.hsc')]);
Simulation.Visible = true;
Components = Simulation.Flowsheet.Operations;
Streams = Simulation.Flowsheet.MaterialStreams;
Fluxes = Simulation.Flowsheet.EnergyStreams;
Best regards,
Francesco

용
2023 年 11 月 20 日
Same Folder is solution

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by