CANbus Access Tools Extension for Matlab and Simulink® on PCs
The CANbus Toolset enables the user to access, influence and monitor the data flow on the Canbus in realtime, directly from Matlab and/or from the Simulink simulation environment. Easy- to-use Canbus read and write functions integrate seemlessly into Matlab and easy-to-use Canbus read and write blocks integrate seamlessly into Simulink.
Find more in our DataSheet area.
CANbus Toolset Application Areas
The CANbus Toolset allows:
- the monitoring of physical signals available on the CANbus
- algorithm development, system identification, and control design and test in a "live" environment
(such as while sitting in test vehicle)
- providing practice-proven specifications of new microcontroller functionality; and
- function prototyping.
Highlights of The CANbus Toolset
- easy-to-learn and easy-to-use
- connects to industry-standard Canbus hardware
- connects to Canbus via USB (up to 10 channels)
- connects to Canbus via Vector Canbus hardware
- direct access from within Matlab
- real-time simulation directly from within Simulink
- a standard PC or Laptop may be used
Access Steps in Matlab
Basically there is four functions which may be called from the Matlab command level or from a Matlab program:
- read from the Canbus
- write to the Canbus
- stop the access to the hardware
Access and Modeling Steps in Simulink
There are four simple steps to access the CANbus via the CANbus Toolset:
1. Define all “To CANbus” activities
In order to make modeling in Simulink easy, the CANbus Toolset provides a definition menu (shown below). All signals are defined with respect to the CANbus identifier, the bits carrying the information, and a Simulink access name (SAN). The user defines the bits and the byte orientation information only once. These hardware-oriented details can thereafter be ignored while building the Simulink model and running the simulation. The simulation model simply writes to the CANbus via a user-defined variable name.
So in the above example, Identifier 3ba has 3 signals defined. Signal 1 uses bits 0 to 7, signal 2; bit 10, and signal 3 bits 22 to 25. By clicking on the "Define signal(s)" pushbutton, You are able to see and change the details of all the signals from the selected identifier, as shown below.
2. Build the Simulink model
The Simulink model contains CANbus-specific blocks taken from the CANbus Toolset block library. This library consists of five blocks:
- The ModelControlBlock, used only once per simulation model.
- The FromCanBlock, used as often as necessary within the simulation model to read signals.
- The ToCanBlock, used as often as necessary within the simulation model to write signals.
- The IDTrigToCanBlock, used as often as necessary within the simulation model to send triggers to Identifiers on the CANbus.
- The JoystickBlock, used as an input device to your Simulink model.
3. Define all “Canbus Read” and “Canbus Write” activities
CANbus read and write functionality are provided by the FromCAN Block and ToCAN Block respectively. These blocks allow you to select signals defined in step 1.
4. Run the simulation
Now you are ready to start the real-time simulation. The model shown below reads from and writes data to the CANbus and visualizes signals via the standard Simulink scope block.
Prerequisites for CANbus Access
Special hardware is required in order to use the CANbus Toolset functionality.
For example, the CANCard software and PCMCIA card, from Softing GmbH or Vector Informatik GmbH, may be used to couple a laptop computer running Simulink to the CANbus, enabling Simulink to access CANbus data. If the Canbus shall be linked to the computer via USB based Canbus hardware, the CANbus Toolset supports up to 10 channels at the same time. Please contact ExpertControl for further details.
Templates are also provided to enable the user to customize the CANbus Toolkit to access CANbus hardware made by other manufacturers.
Supported development environment
- MATLAB/Simulink: Release 12.1, 13 and 14, 2006a up to 2009b
CANbus ToolsetTM is a trademark of ExpertControl GmbH, Germany. MATLAB, Simulink, and Real-Time Workshop are trademarks or registered trademarks of The MathWorks, Inc., U.S.A.