simulink如何与CANoe实现联调

조회 수: 71 (최근 30일)
Xiaoning.Wang
Xiaoning.Wang 2025년 7월 8일
댓글: 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!