- Load the data to the base workspace from the .mat file using the “load” function in MATLAB.
- Open a blank Simulink model and add the following blocks to the workspace:
- “From Workspace” block from the “Simulink -> Sources” library
- “CAN Pack” block from the “Vehicle Network Toolbox -> CAN Communication” library
- “CAN Transmit” block from the “Vehicle Network Toolbox -> CAN Communication” library
- “CAN Configuration” from the “Vehicle Network Toolbox -> CAN Communication” library
- Open the block parameter dialog box for the “From Workspace” block and set the following parameters:
- Provide the variable name from the base workspace that is to be used as the data for CAN communication
- Set the desired sample time
- Uncheck the “Interpolate data” option
- From the “Form output after final data value by” dropdown, choose “cyclic repetition”
- Connect the “From Workspace” block to the input of the “CAN Pack” block.
- Connect the output of the “Can Pack block” to input of the “Can Transmit” block.
- Set the parameters according to the CAN device and channel.
- In the Simulink toolbar, set the "Stop Time" to the desired end time of your simulation.
- Click the "Run" button. The model will send the CAN data continuously until the simulation end time is reached.
how to make sending CAN data until end time in simulink?
조회 수: 1 (최근 30일)
이전 댓글 표시
do you happen to know how to make sending CAN data until end time in simulink?
I make sending CAN data using .mat file but it has onaly 30sec.
I'd like to make sending CAN data around 70sec.
Could you please teach me how to make repeating .mat file untill end time?
댓글 수: 0
채택된 답변
Harimurali
2023년 11월 10일
Hi みほ,
I understand that you want to send CAN data using .mat file until the simulation ends in Simulink.
Please follow the below steps to implement a CAN communication Simulink model that sends CAN data using a .mat file till simulation end time:
Please refer to the following documentation for more information about the “From Workspace” block:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vehicle Network Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!