time-triggered CAN simulation

3 views (last 30 days)
Ruoshi Zhang
Ruoshi Zhang on 27 Mar 2015
Edited: Dimitri MANKOV on 5 Sep 2023
Hi everyone,
I would like to build a model to test my time-triggered CAN communication. so for example I got 3 messages and I would like to transmit them in such way: message 1 transmit a 2.5s; message 2 transmit at 3.5s; message 3 transmit at 4.5s. overall their period is 5s (like message 1 is been transmitted at 2.5s, 7.5s and so on).
so I use 3 CAN transmitting blocks and set their period as 5s. now how can I change the time offset so the transmission time sync with my message?
and also, how can I execute simulation in real time?

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 5 Sep 2023
Edited: Dimitri MANKOV on 5 Sep 2023
Hi Ruoshi,
There are several approaches to real-time simulation, including Simulink Real-Time and Simulink Desktop Real-Time. Which one is best for your project will depend on your requirements and hardware available.
As to the sequencing of your CAN messages, maybe a modelling approach based on enabled subsystems containing your "CAN Transmit" blocks would be the easiest to implement. For example, you could build a state machine running at a higher frequency (e.g., every 0.5 second) that generates 3 pulses based on the current simulation time value, and use each of those pulses to enable the desired subsystem at the right time. Does this make sense?
Best,
Dimitri

Categories

Find more on Real-Time Simulation and Testing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!