Overview
SimWB supports a wide variety of COTS I/O boards. (List of supported I/O boards)
A SimWB I/O task is a dedicated process that read from or write to a specific hardware device.
SimWB I/O tasks are separated from models and scripts.(Please refer to the SimWB Scheduler Frame.)
Therefore, the user can write his application models and scripts transparently.
The peculiarities of the hardware devices connected to the system will not affect his application. This independence also allows for
the RTDB items to be remapped to different hardware devices without affecting the models and scripts running under SimWB.
When the corresponding hardware device can be run at the speed of the simulation loop (performing analog or digital input and output),
the associated process will run synchronously as part of the simulation loop. Synchronous I/O tasks typically read or write their inputs or outputs once per cycle.
They are divided into input and output tasks since those run during different cycles of the simulation loop.
When the device is too slow or asynchronous by its nature (ARINC, AFDX, etc.), the process runs at its own natural rate outside of the main simulation loop.
For more information about synchronous I/O task and asynchronous I/O tasks, please click here.
Prerequisites
We will continue using the autotrans_demo Simulink model and the autotrans_demo RTDB
(see more information about this model and the RTDB in here).
In this example, we will map RTDB items SWthrottle and SWbrake to a Logitech Joystick and control the the autotrans_demo model
at runtime with the joystick.
Add Hardware Device to SimWB
- Click I/O device button (
) in the toolbar to land on the I/O device tab.
- Select JOYSTICK from the list of the supported hardware devices and add to the configured device list.
![Image -- add hardware device](../../img/add_io_device_ori.png)
Map RTDB items to Hardware Device
Note: before mapping the RTDB items to a hardware device, make sure the right RTDB is loaded. In this case, it's RTDB autotrans_demo. Click here to learn how to load a RTDB in SimWB Control Center.
- Click I/O Mapping button (
) in the toolbar and land on the I/O Mapping tab.
- Select JOYSTICK-1 ("-1" means it's the first instance of JOYSTICK) the configured device list.
- Select channel x, channel y from list of Joystick channels and map them to SWthrottle and SWbrake
Run Test
Since the SimWB I/O task is independent of models and scripts, we do not need to create a new test. We can reuse the autotrans_demo test we created in Start from Simulink Model. Run another session for test autotrans_demo (click here to see how to start a test) and now you can control SWthrottle and SWbrake with the Joystick.