Simulink Real-Time 2020b. How do I monitor/log a signal in my application using App Designer?
11 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to monitor a signal in my real-time application on Speedgoat using App Designer. I am trying to recreate a similar function to the one included in slrtExplorer but so far I have been unsuccessful. I am not able to use the suggested fucntions such as ConnectScalar, getCallbackDataForSignal and so on.
Does anyone know how to do it? Is there an example that is not the invertedPendulum that I can use as a reference?.
Thanks for the help!
1 个评论
Hamidreza Kolbari
2022-4-14
Hi,
I am working an a project.
I am using below two different functions
function createInstrumentation(app)
% Create a new instrument object that will be linked to the application
app.Instrument = slrealtime.Instrument;
% Connect callback to signal
addSignal(app.Instrument, [app.modelName,'/ControlValue'], 1)
addSignal(app.Instrument, [app.modelName,'/Gain2'], 1)
connectCallback(app.Instrument, @app.instrumentCallback);
end
function instrumentCallback(app, instObj, eventData)
if ~isempty(eventData.AcquireGroupData.Time)
[~, ctrlValue] = instObj.getCallbackDataForSignal(eventData, [app.modelName,'/ControlValue:1']);
[~, valveValue] = instObj.getCallbackDataForSignal(eventData, [app.modelName,'/Gain2:1']);
end
end
pushed button>>>>>>>>>>>\
createInstrumentation(app)
but it is not working. do you know what the problem is?
回答(1 个)
Diego Kuratli
2021-10-4
In R2021b, the code required for binding signals and parameters have been reduced. There is a simple example in the documentation:
https://www.mathworks.com/help/slrealtime/ug/basic-app-designer-app-for-real-time-app-interface.html
If possible, I would recommend to move to R2021b.
For R2020b, this video might help:
2 个评论
Hamidreza Kolbari
2022-4-14
Hi,
I am working an a project.
I am using below two different functions
function createInstrumentation(app)
% Create a new instrument object that will be linked to the application
app.Instrument = slrealtime.Instrument;
% Connect callback to signal
addSignal(app.Instrument, [app.modelName,'/ControlValue'], 1)
addSignal(app.Instrument, [app.modelName,'/Gain2'], 1)
connectCallback(app.Instrument, @app.instrumentCallback);
end
function instrumentCallback(app, instObj, eventData)
if ~isempty(eventData.AcquireGroupData.Time)
[~, ctrlValue] = instObj.getCallbackDataForSignal(eventData, [app.modelName,'/ControlValue:1']);
[~, valveValue] = instObj.getCallbackDataForSignal(eventData, [app.modelName,'/Gain2:1']);
end
end
pushed button>>>>>>>>>>>\
createInstrumentation(app)
but it is not working. do you know what the problem is?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Target Computer Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!