Is there a way of streaming data from a real time target machine that is running a Simulink-Test test to an app designer GUI?
조회 수: 4 (최근 30일)
이전 댓글 표시
I am trying to create a GUI instrument panel with app designer that can start Simulink -Test test files etc.
However the app designer app doesnt seem to be able to get data from the target machine when it is running from simulink test.
So I can start a real time application on the target machine and stream data and view it on a guage for example or I can start simulink test from the app. But the streaming doesnt work with simulink Test.
This is the function to set up the instrumentation:
function setupInstrumentation(app)
app.hInst = SimulinkRealTime.prototype.Instrumentation(app.mdl);
app.hInst.connectScalar(app.MotorPositionGauge,[app.mdl '/PLANT/Subsystem/Bias1'],1);
end
and I call it in the startupFcn
function startupFcn(app)
app.setupInstrumentation;
end
Then when I press the button to start a test suite I run the test and start the instrument streaming:
function StartTestSuiteButtonPushed(app, event)
app.hInst.clearData;
% start instrumentation and target
tf = sltest.testmanager.load(app.TestFileDropDown.Value);
ts = getTestSuiteByName(tf,app.TestSuiteDropDown.Value);
run(ts);
start(app.hInst,app.tg);
end
But they dont work together one happens after the other. If I try to put the start(app.hInst,app.tg) before the run(ts) then an error occurs in simulink test.
Also commands like getsignal do not work when the taregt machine is being run from simulink test:
position = getsignal(app.tg,'PLANT/Subsystem/Bias1');
but they do work when you run the real time application seperatly from simulink test.
Is there anyway of streaming data from a real time target machine that is running a simulink Test test case to an app designer gui?
Note: I am able to stream the data in simulink real time explorer using the instrument panel during a simulink test test. However there is very litmited functionalitly with the instrument panel. For example I can not start the simulink test test case from the instrument panel.
댓글 수: 0
답변 (1개)
Jon Lobo
2020년 11월 24일
Hi Luke,
I haven't tried this yet, so it may or may not work. Simulink Test Manager is blocking in MATLAB. That means that while the test is executing, Simulink Test is owning the execution and so your App is not being updated until after the test execution is completed.
My thinking is that you could start the instrumentation object from within your test case through one of the callbacks (I think prestart callback). To do this, you'll need to open your app programmaticaly in the test case:
myAppInstance = myAppDesigner
and then call the various set up methods you need
myAppInstance.setupInstrumentation;
myAppInstance.StartTestSuiteButtonPushed;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Test Model Components에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!