Test Automation: Referenced models with C# and ASAM XIL API
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I am evaluating different strategies for test automation using SpeedGoat and Simulink Real Time. As a part of this, I've found at this link a useful example involving C# and the ASAM XIL API.
Unfortunately, when trying to replicate the script myRealTimeAppController.cs with our model, an exception is being thrown at line 85 MAPort.Configure(portConfig, false);:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Private.CoreLib.dll: 'Error using slrealtime.internal.xil.MAPort/getVariableInfo
No referenced model named 'my_referenced_model'
Note that the model is running perfectly with Simulink.
Since I've noticed that running the script is opening a new instance of Matlab, with working directory in C:\Program Files\MATLAB\R2022a\bin\win64, my guess is that Matlab is not finding the referenced model since the working directory is not in the path.
Any suggestions on how to solve this issue will be appreciated.
0 件のコメント
回答 (1 件)
Chris Zhang
2022 年 12 月 19 日
Hello, Leonardo,
You can open a MATLAB session and type the following commands:
comserver('register','User','current');
enableservice('AutomationServer', true);
These two commands will convert your currently running MATLAB session as a COM server so that XIL C# API can find this running MATLAB instead of opening a new one.
And then you can CD to your working directory before running your C# script.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Real-Time Simulation and Testing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!