Clear Filters
Clear Filters

How to connect a real-time target simultaneosly to a third-party calibration tool (CANape) for data streaming and to Matlab to control the real-time application?

8 views (last 30 days)
Hello,
I have been using Matlab 2019b, a Speedgoat Baseline (Targt Computer with Simulink Real-Time) and Vector CANape to visualize and record signals from the real-time model/application.
I used to connect Matlab to the target computer using a target object (tg = slrt()) and with the Matlab commands setparam(tg, ) and getsignal(tg, signal_name) I could control the SImulink Real-time model und display signals in a Matlab GUI. Simultaneously I connected CANape to the target computer.
This has worked well in Matlab 2019b, I have since updated to Matlab 2021b.
In Matlab 2021b, according to the Matlab documentation "Calibrate Parameters with Vector CANape", I have to start the real-time application in Matlab and disconnect matlab from the target machine (disconnect(tg)). Only after I disconnect, I can connect CANape to the target for data visualization and recording.
But if I disconnect Matlab I obviously can not control or interact with the real time application via setparam or get signal. However I need the matlab connection because I use a Matlab GUI as my main interface to the application.
To summarize my question: Is there a way to connect CANape and Matlab simultaneosly to a real-time target in Matlab 2021b like it was possible in R2019b?
Thanks for any help.

Answers (1)

Adithya
Adithya on 4 Sep 2023
Hello @Christian Seitz I understand from your question that you need assistance in generating the connecting both CANape and MATLAB simultaneously to a real-time target in MATLAB 2021b
In MATLAB 2021b, the process of connecting CANape and MATLABsimultaneously to a real-time target has changed compared to MATLAB 2019b. According to the documentation, you need to start the real-time application in MATLAB and then disconnect MATLAB from the target machine using the “disconnect function” (disconnect(tg)). After disconnecting, you can connect CANape to the target for data visualization and recording.
However, you mentioned that you still need the MATLAB connection because you use a MATLAB GUI as your main interface to the application, and you want to continue controlling and interacting with the real-time application using MATLAB commands like “setparam” and” getsignal”.
In this case, you may need to find an alternative approach to achieve simultaneous connectivity with both CANape and MATLAB. One possible solution is to use a separate computer or instance of MATLAB to connect to the target machine using CANape, while keeping your main MATLAB GUI connected to the target machine for control and interaction.
Here are the steps you can try:
1. Start the real-time application in MATLAB as usual.
2. Disconnect MATLAB from the target machine using disconnect(tg).
3. On a separate computer or a different instance of MATLAB, connect CANape to the target machine for data visualization and recording.
4. Keep your main MATLAB GUI connected to the target machine using the tg = slrt() command to maintain control and interaction with the real-time application.
By using this approach, you can have CANape connected for data visualization and recording while still being able to control and interact with the real-time application through your main MATLAB GUI.
you can refer to below documentation for further understanding :
For Simulink Real-Time documentation : https://www.mathworks.com/help/slrt/
I hope this helps you. Let me know if you have any further questions!

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!