simulink如何与CANoe实现联调

63 views (last 30 days)
Xiaoning.Wang
Xiaoning.Wang on 8 Jul 2025
Commented: Xiaoning.Wang on 8 Jul 2025
1:整车录取整车报文,
2:需要将CAN报文在应用层(simulink)进行unpack 和pack
3:当点点击Simulink仿真运行时,数据来自CANoe,同时CANoe也在回放数据。

Answers (1)

Xiaoning.Wang
Xiaoning.Wang on 8 Jul 2025
回答1:
该场景下是不需要CANoe,是纯simulink 仿真实现
但是需要做相对应的.mat处理。
canMsgTimetable = blfread('IPU_Ability.blf');
canMsgTimetable = canMsgTimetable{1};
startTime = seconds(canMsgTimetable.Time(1));
stopTime = seconds(canMsgTimetable.Time(end));
%Ts = 0.0001;
startTime = round(startTime, 2);
stopTime = round(stopTime, 2);
canMsgs = canMessageReplayBlockStruct(canMsgTimetable);
save demo.mat canMsgs
处理完成后, 在simulink的库中, CAN Replay中的属性Variable name: 将设置为canMsgs,
否则,运行simulink仿真时,会提醒File name 加载的.mat文件无法加载的问题。
  1 Comment
Xiaoning.Wang
Xiaoning.Wang on 8 Jul 2025
该方案的不足
1:需要matlab命令处理将.blf 文件转换为CAN Replay 需要的.mat 属性
通过CANoe直接直接另存为.mat,CAN Replay 是不识别。
2:CAN Replay, CAN Receive 都是有采样周期,采样周期需要设置为0.0001,相对较小,才可以回放出CANoe中数据的波形图,不然会失帧。

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!