Modelica_DeviceDrivers.Blocks.Examples

Executable usage examples for the provided device driver blocks

Information

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager TestSerialPackager Example for using the SerialPackager
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String TestSerialPackager_String Example for using the SerialPackager with the AddString and GetString block
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP TestSerialPackager_UDP Example for combining UDP and SerialPackager blocks
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackagerBitPack_UDP TestSerialPackagerBitPack_UDP Example for the PackUnsignedInteger and UnpackUnsignedInteger blocks from the SerialPackager
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SharedMemory TestSerialPackager_SharedMemory Example for combining SharedMemory and SerialPackager blocks
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SoftingCAN TestSerialPackager_SoftingCAN  
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SocketCAN TestSerialPackager_SocketCAN  
Modelica_DeviceDrivers.Blocks.Examples.TestInputSpaceMouse TestInputSpaceMouse Example for a 3Dconnexion SpaceMouse
Modelica_DeviceDrivers.Blocks.Examples.TestInputJoystick TestInputJoystick Example for a joystick/gamepad
Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboard TestInputKeyboard Example for keyboard input
Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboardKey TestInputKeyboardKey Example for keyboard input using the KeyboardKeyInput block
Modelica_DeviceDrivers.Blocks.Examples.TestHardwareIOComedi TestHardwareIOComedi Example for comedi daq support using USB-DUX D (http://www.linux-usb-daq.co.uk/)

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager

Example for using the SerialPackager

Information


The example demonstrates that pack and unpack blocks of the SerialPackager package can be connected directly.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_String

Example for using the SerialPackager with the AddString and GetString block

Information


Using Strings in input or output connectors is not very common in Modelica. There are currently no standard connectors for Strings available in the MSL. Nevertheless, the SerialPackager package provides blocks for Strings, too. The use of this blocks is demonstrated in this example.

Please note: The model should work with Dymola 2014, but seems not with Dymola 2013 FD01 (and probably previous versions).

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP

Example for combining UDP and SerialPackager blocks

Information


The uDPSend block sends to the local port 10002. The uDPReceive block starts a background process that listens at port 10002. Consequently, the uDPReceive block receives what the uDPSend block sends.

Note: There is no causality between the uDPSend block and the uDPReceive block. Therefore the execution order of the blocks is not determined. Additionally, the uDPReceive block starts an own receiving thread, so that the time the data was received is not equal to the time the external function within the uDPReceive block was called. This indeterminism may also show up in the plots.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackagerBitPack_UDP Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackagerBitPack_UDP

Example for the PackUnsignedInteger and UnpackUnsignedInteger blocks from the SerialPackager

Information


In particular this model demonstrates how integer values can be packed and unpacked at bit level using the PackUnsignedInteger and UnpackUnsignedInteger blocks.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SharedMemory Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SharedMemory

Example for combining SharedMemory and SerialPackager blocks

Information


The sharedMemoryWrite block writes to the memory partition with memoryID = "sharedMemory". The sharedMemoryRead block reads from that partition.

Note: There is no causality between the sharedMemoryWrite block and the sharedMemoryRead block. Therefore the execution order of the blocks is not determined. This indeterminism may also show up in the plots.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SoftingCAN Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SoftingCAN

Information


Support for Softing CAN bus

Please, read the package information for SoftingCAN first!

The example

The example is configured for the "CANusb" interface card from Softing (www.softing.com) (but, given that the deviceName parameter is set correctly, should work with all of their interface cards supporting their Softing CAN Layer 2 software API). Two messages are defined: txMessage for sending and rxMessage for receiving. The SerialPackager blocks are used to add/retrieve data to/from the messages.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SocketCAN Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_SocketCAN

Information


Example for Linux Socket CAN interface support

Will only work on Linux!

Please, read the package information for SocketCAN first!

The example

The example is configured to use the virtual CAN interface "vcan0". The SocketCAN package documentation describes briefly how to bring up such a virtual CAN interface in Linux.

Two sockets are opened in the example: One for sending messages, the other for receiving them. The SerialPackager blocks are used to add/retrieve data to/from the messages.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestInputSpaceMouse Modelica_DeviceDrivers.Blocks.Examples.TestInputSpaceMouse

Example for a 3Dconnexion SpaceMouse

Information


Basic example of using inputs from a 3Dconnexion SpaceMouse.

Important for Linux users: In order to work under Linux it is needed that the linux drivers provided by 3Dconnexion are installed and running.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestInputJoystick Modelica_DeviceDrivers.Blocks.Examples.TestInputJoystick

Example for a joystick/gamepad

Information


Basic example of using inputs from a joystick/gamepad device.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboard Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboard

Example for keyboard input

Information


Basic example of using a keyboard as input device.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboardKey Modelica_DeviceDrivers.Blocks.Examples.TestInputKeyboardKey

Example for keyboard input using the KeyboardKeyInput block

Information


Basic example of using a keyboard as input device. For this example the parameter keyCode is set to the "space" key. Therefore, pressing space while the simulation is running will turn the output of the block to true, otherwise it is false

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica_DeviceDrivers.Blocks.Examples.TestHardwareIOComedi Modelica_DeviceDrivers.Blocks.Examples.TestHardwareIOComedi

Example for comedi daq support using USB-DUX D (http://www.linux-usb-daq.co.uk/)

Information


Important: Works only under Linux. The reason for this is, that the interfaced Comedi device drivers are only available for Linux.

Example tested with USB-DUX D. Assuming input channels are electrical connected to corresponding output channels we should read what we wrote

Extends from Modelica.Icons.Example (Icon for runnable examples).
Automatically generated Tue Oct 1 14:26:57 2013.