how to make sending CAN data until end time in simulink?

1 回表示 (過去 30 日間)
みほ
みほ 2023 年 11 月 1 日
回答済み: Harimurali 2023 年 11 月 10 日
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?

採用された回答

Harimurali
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:
  • 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.
Please refer to the following documentation for more information about the “From Workspaceblock:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVehicle Network Toolbox についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by