simulink如何与CANoe实现联调

62 次查看(过去 30 天)
Xiaoning.Wang
Xiaoning.Wang 2025-7-8
1:整车录取整车报文,
2:需要将CAN报文在应用层(simulink)进行unpack 和pack
3:当点点击Simulink仿真运行时,数据来自CANoe,同时CANoe也在回放数据。

回答(1 个)

Xiaoning.Wang
Xiaoning.Wang 2025-7-8
回答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 个评论
Xiaoning.Wang
Xiaoning.Wang 2025-7-8
该方案的不足
1:需要matlab命令处理将.blf 文件转换为CAN Replay 需要的.mat 属性
通过CANoe直接直接另存为.mat,CAN Replay 是不识别。
2:CAN Replay, CAN Receive 都是有采样周期,采样周期需要设置为0.0001,相对较小,才可以回放出CANoe中数据的波形图,不然会失帧。

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!