Error trying to link Matlab and Aspen Plus
22 次查看(过去 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!