필터 지우기
필터 지우기

Test Automation: Referenced models with C# and ASAM XIL API

조회 수: 3 (최근 30일)
Leonardo Ricupero
Leonardo Ricupero 2022년 7월 14일
답변: Chris Zhang 2022년 12월 19일
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.

답변 (1개)

Chris Zhang
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.

카테고리

Help CenterFile Exchange에서 Test Scripts에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by