SIMulation Workbench Toolkit
Contents
Overview
The SIMulation Workbench™ Toolkit for MATLAB provides support for integrating MATLAB/Simulink models seamlessly into the SimWB environment. The SimWB Toolkit is installed as a part of the MATLAB/Simulink environment and provides access to real-time host from within Simulink via the SimWB Toolkit GUI and within MATLAB via the SimWB API. This Toolkit GUI and the command line API provide an easy workflow which facilitates the generation of SimWB compliant code from Real-Time Workshop® (RTW) a.k.a. Simulink Coder(MATLAB R2011b and later). Simulink model parameters are automatically extracted from the RTW model and mapped into the RTDB so they can be accessed at run-time.
In order for a Simulink model to talk to external hardware, it needs hardware-specific S-function driver blocks in the model. This means that an engineer may have to maintain two different models: one for simulation and one for code generation. For code generation, Simulink source and sink blocks need to be replaced with Input and Output hardware specific S-function blocks.
SimWB alleviates the need for hardware-specific S-function blocks by providing complete I/O independence through the Real-Time DataBase(RTDB). The RTDB holds the information necessary to configure I/O boards and data bus protocols. I/O boards are configured outside of the model programs, and data acquisition is performed via external I/O tasks which store and retrieve data values through the RTDB.
The SimWB Toolkit GUI provides a workflow to easily create SimWB compliant RTW code from a Simulink model without having to insert hardware-specific S-function blocks in the model. SimWB-specific blocks are automatically inserted into the model during the code generation process to generate SimWB-complaint code. From the SimWB Toolkit GUI you can connect to the real-time host, select a System Target File, automatically create an RTDB for your model, generate SimWB-compliant RTW(Simulink Coder) code, and create an executable for your model on the real-time host.
SimWB Toolkit GUI for MATLAB
Simulator Access Tab
In the Simulink model, on the menu bar select SimWB > Toolkit GUI. This will open to the Simulator Access tab.
SimWB Toolkit GUI Simulator Access Tab
Host Name
Enter the real-time host name, i.e. a domain name or an IP address as a string in the form 192.168.0.1. If MATLAB/Simulink is running on the same computer as the real-time host, enter localhost to connect MATLAB/Simulink with SimWB. It is necessary that two way communication be possible between MATLAB and the real-time host. That is, each must be able to open ports on the other. VPN or firewall settings must not block the real-time host from opening transient ports listened to by the client programs.
User Name
Enter the user name of user authorized to access the SimWB real-time host. This is not the same as a Linux user on the real-time host.
Password
SIMulation Workbench user’s password.
Remember Me
Remembers the most recently used real-time host name, user name, and password across program invocations. These fields are only stored upon a successful connection to the real-time host. The saved password is cleared when this checkbox is unchecked.
Connect button
Connects to, and logs into, the real-time host using the supplied credentials. When the Simulink model is closed the connection between the SimWB Toolkit GUI and the real-time host is terminated. Upon successful connection to, and user authentication with, the real-time host the connection status icon will change from
RTDB Creator Tab
Create RTDB Variables
These options specify which blocks in the Simulink model will be mapped to RTDB variables. The Simulink models source and sinks blocks that have mappings to the RTDB variables can access external hardware via the RTDB on the real-time host. Two mechanisms are provided in order to map Simulink source and sink blocks to RTDB variables.
Using Block Names
This option specifies mapping all the supported source and sink blocks to RTDB variables having the same name.