Modelica_DeviceDrivers.Blocks.Communication.SocketCAN

ALPHA feature. Support for the Linux Controller Area Network Protocol Family (aka Socket CAN)

Information


Support for Linux Socket CAN interface

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.

Setup of a virtual 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.

Setup of a physical CAN interface

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).

Package Content

NameDescription
Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.SocketCANConfig SocketCANConfig Open socket to specified CAN interface
Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.ReadMessage ReadMessage Set up a message for receiving data
Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.WriteMessage WriteMessage Set up a message for transmitting data

Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.SocketCANConfig Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.SocketCANConfig

Open socket to specified CAN interface

Information


Support for Linux Socket CAN bus

Please, read the package information for SocketCAN first!

Example

See TestSerialPackager_SocketCAN.

Extends from Modelica_DeviceDrivers.Utilities.Icons.SocketCANRecordIcon (Icon for Socket CAN (Tux from JZA placed into the public domain, http://openclipart.org/detail/168653/tux-enhanced-by-jza).).

Parameters

NameDescription
ifr_nameCAN interface name (as displayed by ifconfig)

Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.ReadMessage Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.ReadMessage

Set up a message for receiving data

Information


Support for Linux Socket CAN interface

Please, read the package information for SocketCAN first!

Example

See TestSerialPackager_SocketCAN.

Extends from Modelica_DeviceDrivers.Utilities.Icons.BaseIcon (Base icon for blocks providing access to external devices), Modelica_DeviceDrivers.Utilities.Icons.SocketCANBlockIcon (Icon for (Linux) Socket CAN blocks).

Parameters

NameDescription
configSocket CAN configuration (socket) to use for this block
can_idIdentifier of CAN message (CAN Id)
can_dlcData length code (payload of data in bytes, max=8)
sampleTimePeriod at which messages are written [s]
startTimeFirst sample time instant [s]

Connectors

NameDescription
pkgOut 

Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.WriteMessage Modelica_DeviceDrivers.Blocks.Communication.SocketCAN.WriteMessage

Set up a message for transmitting data

Information


Support for Linux Socket CAN interface

Please, read the package information for SocketCAN first!

Example

See TestSerialPackager_SocketCAN.

Extends from Modelica_DeviceDrivers.Utilities.Icons.BaseIcon (Base icon for blocks providing access to external devices), Modelica_DeviceDrivers.Utilities.Icons.SocketCANBlockIcon (Icon for (Linux) Socket CAN blocks).

Parameters

NameDescription
configSocket CAN configuration (socket) to use for this block
can_idIdentifier of CAN message (CAN Id)
can_dlcData length code (payload of data in bytes, max=8)
sampleTimeSample period of component [s]
startTimeFirst sample time instant [s]

Connectors

NameDescription
pkgIn 

Automatically generated Tue Oct 1 14:26:57 2013.