필터 지우기
필터 지우기

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 CenterFile Exchange에서 Solver 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