Using MATLAB with CANoe
Copyright © 2017 - Vector Informatik GmbH 3
Contact Information: www.vector.com or +49-711-80 670-0
Network Management Layer
The availability of the CAN bus is handled by network management. Typical features of an OSEK NM
include:
> Identifies the network configuration at start-up
> Monitors the network configuration while the bus system is running
> Synchronizes transition of all network nodes to bus sleep mode (power saving mode if network is
not needed)
> Controls peripheral hardware (CAN Controller and Bus Transceiver)
> Provides network-relevant status information
> Error recovery after bus-off
Each ECU is identified by a unique station number and has a special message identifier for
exchanging network-relevant information. This message contains identification of the transmitting
node (encoded in the CAN identifier), the address of the receiving node as well as the message type
and additional sleep flags.
Other Network Management types such as AUTOSAR NM may work differently but are also available
as a component for CANoe.
Transport Layer
Some information to be transmitted over the CAN bus does not fit into a single data frame because the
data length exceeds 8 bytes. In such cases the sender has to split up the data into several CAN
messages with the same identifier. Additional information is necessary to re-assemble the data in the
receiver.
This is performed by the transport layer:
> Segmentation and reassembly of data that is larger than the underlying data link layer
> Flow control for single messages
> Error recognition
A transport layer is not only needed for diagnostics purposes but also for any large data which must
be exchanged between different nodes, e.g. text information to be displayed on a dashboard.
2.2 Interface Concept
The interface consists of a block set for MATLAB
®
/Simulink
®
and the Simulink
®
Coder. It provides data
exchange with CANoe for simulations running inside Simulink
®
and assures time synchronization
between both tools. There are two different approaches of time synchronization with co-simulation:
1. The Simulink
®
time base is used for the CANoe simulation. This will be referred to as the Offline
Mode.
2. The (real-time) time base of CANoe is used for the Simulink
®
simulation, which is called the
Synchronized Mode.
The interface also provides a target file for the Simulink
®
Coder. Using this target file a Simulink
®
model will be compiled as a DLL which runs in the CANoe environment (called HIL Mode). Except
setting the CANoe target file and compiling the model no other action is needed to create a DLL which
provides best runtime behaviour and exactness of timings. Although the model is compiled,
parameters of Simulink
®
blocks can be changed from within CANoe. For debugging purposes
Simulink
®
signals can be easily analysed in CANoe. The Simulink
®
model can be viewed using
CANoe’s built in model explorer. No MATLAB
®
/Simulink
®
license is needed for running or viewing a
compiled model.
Besides sample applications the interface comes up with integration to the MATLAB
®
/Simulink
®
Model
Advisor. The Model Advisor allows checking the model for proper configuration with the current
CANoe simulation. This assures that sources and sinks provided by CANoe exist and will work
properly.