Modelica external function interface to use the CAN socket interface of the Linux kernel (http://svn.berlios.de/wsvn/socketcan/trunk/kernel/2.6/Documentation/networking/can.txt).
So far only testet with the virtual CAN interface "vcan". However, in principle it should work similarly with an underlying "real" CAN-device which is supported by the Socket CAN interface.
Even if a Linux computer doesn't have a CAN device, it is possible to setup a virtual CAN device that can be used similarly to a physical device. This section discusses the necessary steps to bring up a virtual CAN device (tested with Ubuntu 12.04) which can be used with the SocketCAN example model. Note that this usually requires root rights. Also executing the Modelica example model might require root rights.
sudo modprobe vcan
sudo ip link add type vcan
sudo ifconfig vcan0 up
Please have a look in the respective documentation to Socket CAN. A physical CAN interface will require more configuration settings than the virtual interface (e.g., bitrate setting).
Extends from Modelica.Icons.Package (Icon for standard packages).Name | Description |
---|---|
![]() | Open socket to specified CAN interface |
![]() | Set up a message for receiving data |
![]() | Set up a message for transmitting data |
Please, read the package information for SocketCAN
first!
See TestSerialPackager_SocketCAN
.
Name | Description |
---|---|
ifr_name | CAN interface name (as displayed by ifconfig) |
Please, read the package information for SocketCAN
first!
See TestSerialPackager_SocketCAN
.
Name | Description |
---|---|
config | Socket CAN configuration (socket) to use for this block |
can_id | Identifier of CAN message (CAN Id) |
can_dlc | Data length code (payload of data in bytes, max=8) |
sampleTime | Period at which messages are written [s] |
startTime | First sample time instant [s] |
Name | Description |
---|---|
pkgOut |
Please, read the package information for SocketCAN
first!
See TestSerialPackager_SocketCAN
.
Name | Description |
---|---|
config | Socket CAN configuration (socket) to use for this block |
can_id | Identifier of CAN message (CAN Id) |
can_dlc | Data length code (payload of data in bytes, max=8) |
sampleTime | Sample period of component [s] |
startTime | First sample time instant [s] |
Name | Description |
---|---|
pkgIn |