Error trying to link Matlab and Aspen Plus
조회 수: 23 (최근 30일)
이전 댓글 표시
I have error message while trying to link Matlab with my Aspen Plus simulation:
>> CHLC
Error using COM.Apwn_Document_37_0/invoke
Invoke Error, Dispatch Exception:
Source: Aspen Plus 37.0 OLE Services
Description: Unable to open file.
Error in CHLC (line 8)
Aspen.invoke('InitFromFile',[mess.Name '\' Simulation_Name '.apwz']);
This is the code im using:
%% Linking
Aspen = actxserver('Apwn.Document.37.0');
[stat,mess]=fileattrib; % get attributes of folder (Necessary to establish the location of the simulation)
Simulation_Name = 'CL_SCO2';% Aspeen Plus Simulation Name
Aspen.invoke('InitFromArchive2',[mess.Name '\' Simulation_Name '.bkp']);
Aspen.Visible = 1; % 1 ---> Aspen is Visible; 0 ---> Aspen is open but not visible
Aspen.SuppressDialogs = 1; % Suppress windows dialogs.
Aspen.Engine.Run2(1); % Run the simulation
while Aspen.Engine.IsRunning == 1 % 1 --> If Aspen is running; 0 ---> If Aspen stop.
pause(0.5);
end
Matlab version is R2022a (9.12.0.1884302) 64-bit and Aspen plus V11 (37.0.0395)
Already try saving Aspen simulation as .bkp and .apwz.
Yes, two files ( .m matlab code and .awpz / .bkp simulation) are in the same folder.
댓글 수: 0
답변 (3개)
UDAYA PEDDIRAJU
2024년 8월 29일
Hi Andres,
Ensure the file paths and extensions are correct. Check file permissions. Verify compatibility between MATLAB and Aspen Plus versions. The error is due to the file, otherwise no problem with code, check all file related posibilities, if nothing works you can change the paths and try, restart your system.
I hope you'll be able to figure out the issue.
Additional Reference: https://in.mathworks.com/matlabcentral/fileexchange/69464-aspen-plus-matlab-link/
댓글 수: 0
Saurabh
2024년 8월 29일
Hi Andres,
It seems to when to try to link MATLAB and Aspen plus, you are encountering an invoke error. I went through the MathWorks official documentations and found there are certain MATLAB COM Support Limitations. It says that Microsoft (assuming you have windows OS-32bit) does not support loading 32-bit DLLs or in-process COM servers into a 64-bit application, or conversely. So, you cannot use 32-bit DLL COM objects in 64-bit MATLAB and COM functions are available on Microsoft Windows systems only, if you have different OS, it will not work.
The same information can be found here:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Statics and Dynamics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!