The typical environment for real-time applications built using Simulink Real-Time consists of a development computer, Speedgoat target computer hardware, and your physical system, also called the hardware under test.
The CPU of the target computer hardware runs the Simulink Real-Time kernel with its microsecond granularity and support for concurrent execution. You connect the development computer to the target computer hardware via a direct (private local point-to-point network) or an indirect (LAN or WAN switched network) Ethernet link using the TCP/IP protocol. You connect the target computer hardware I/O and protocol interfaces to your physical system (the hardware under test).
Once you have set up this environment, you can create real-time applications from Simulink models on the development computer and download the real-time application onto the target computer system via the Ethernet link. After this application is downloaded, you can:
For real-time simulation and testing, you use Simulink Real-Time with a dedicated Speedgoat target computer system with CPU, I/O, and protocol interface hardware.
Speedgoat provides ready-to-use configurations, from which you can select a real-time target machine and I/O modules that meet your performance and I/O and protocol interface requirements.
Speedgoat offers a variety of form factors and I/O, protocol, and FPGA modules suitable for desktop, lab, or field use.
A Speedgoat target computer system is complete and ready to be connected to your development computer. It comes fully assembled with:
Simulink Real-Time and Speedgoat target computer hardware support a comprehensive selection of I/O and protocol interfaces.
A Simulink model forms the basis of the real-time application you create with Simulink Real-Time. The model can contain any block from the Simulink library for which Simulink Coder can generate C code, blocks from products such as Stateflow®, Simscape™, and related system toolboxes, and user code or third-party code in form of C code S-function blocks.
Before initiating the build process for a real-time application, you update your Simulink model by selecting a fixed-step solver and choosing Simulink Real-Time as the target environment. You then extend your Simulink model with driver blocks from either the Simulink Real-Time block library or the Speedgoat block library provided with each Speedgoat target computer system. You then make signal connections between these driver blocks and other blocks in your model. You then initiate the real-time application build. The build process automatically downloads the generated real-time application via the Ethernet link onto your target computer system.
Simulink Real-Time shows the status of the downloaded real-time application via its high-resolution target display. You can monitor the running real-time application and view signal values and traces.
Simulink Real-Time provides two ways to control the real-time application on the Speedgoat target computer. The Simulink Real-Time Explorer lets you define and manage target computer hardware, download real-time applications, and control real-time applications, including starting, stopping, or changing the fundamental sample time and displaying and retrieving status data on those runs.
Alternatively, you can use the MATLAB functions and objects in Simulink Real-Time to manage and control real-time applications via the MATLAB command line or within scripts and MATLAB files. To access the target computer system and control real-time applications from outside MATLAB, you can use the C API or .NET API.
You can use Simulink Real-Time Explorer to tune parameters and display or log signals of interest. Performing this instrumentation at runtime does not require a rebuild of the real-time application from the Simulink model.
You can tune scalar, vector, or matrix parameters and view signal values as numbers or as time-stamped traces using Simulink Real-Time scopes. You can identify parameters to tune or signals to observe either by navigating the model hierarchy or via preconfigured groups.
Simulink Real-Time Explorer lets you design and run graphical instrument panels. You select graphical elements such as knobs, sliders, and angular dials and gauges from the Instruments palette, and drag and drop them onto your panels. You make connections between each instrument and your real-time application by dragging parameters and signals from the model hierarchy window and dropping them onto the graphical controls and displays in your instrument panel. When you run an instrument panel, it interacts continuously with the real-time application and updates the associated parameters and signals.
Alternatively, you can instrument a real-time application via the MATLAB command line, either interactively or programmatically from scripts or MATLAB functions. You can use the Simulink Real-Time MATLAB functions and objects (for MATLAB applications) or the C and .NET APIs (for external executable programs).
Simulink Real-Time supports Simulink External Mode, enabling you to instrument real-time applications directly from the Simulink model from which the real-time application was built.
You can create high-performance real-time applications by using concurrent execution. Concurrent execution enables you to run more code within a specified sample time. It leverages the concurrent execution capabilities of Simulink, the code generated by Simulink Coder, the Simulink Real-Time kernel, and the multicore target hardware. With concurrent execution, there is no change to the overall dynamic behavior of a Simulink model and resulting real-time application when compared to their nonconcurrent execution.
Simulink Real-Time supports Simulink concurrent execution capabilities, such as multitasking execution of multirate systems and concurrent task modeling.
Real-time applications created from multirate Simulink models include concurrent-safe code, and can be executed on a multicore system to improve performance. For finer control, you can partition your model using referenced models and map these partitions to tasks in the generated code. This mapping definition and the resulting code enable you to divide subsystems with a single rate among tasks.
With Simulink Real-Time, the code generated and compiled for the real-time application is automatically distributed among the CPU cores available on your Speedgoat target computer system.
The Simulink Real-Time kernel can run models configured in the modes described above, both on single-core and multicore Speedgoat target computer systems. No additional Simulink Real-Time kernel configuration is required to run a multitasking model or one configured for concurrent execution. These applications can be executed in the same way as any other real-time application.
The Simulink Real-Time kernel executing the real-time application uses hardware resources provided by the Speedgoat target computer system, including a multicore CPU, advanced interrupt controller and chipset, and shared multilevel cache handling.
You can equip a Speedgoat target computer system with FPGA plug-in modules via its available PCI expansion bus slots. With Simulink Real-Time, you can leverage the FPGA’s capability to run HDL code as hardware and the capability of HDL Coder to generate HDL code from Simulink models. This combination enables you to use FPGA plug-in modules in target computer systems as an additional resource for concurrent execution.
Simulink Real-Time supports the use of multiple target computers connected to the development computer via an Ethernet network switch. Each target computer can execute a separate real-time application generated from a separate Simulink model. You define data communication and synchronization schemes in your Simulink models using I/O and protocol interface driver blocks representing target hardware, such as shared or reflective memory, real-time UDP, CAN, EtherCAT, and FlexRay.
Simulink Real-Time enables you to create standalone real-time applications for permanent installation on the target computer. As a result, you can use Simulink Real-Time during the design phase and the distribution phase of your project.
Early in the design phase, your development computer is usually permanently connected to the Speedgoat target computer via the Ethernet link to enable the continuous creation, downloading, and instrumentation of real-time applications. While this setup offers flexibility and allows for rapid iteration, it requires the presence of a development computer running MATLAB.
Later, you can create a standalone real-time application with an integrated Simulink Real-Time kernel. When the target computer is turned on, the real-time application starts executing automatically, enabling the permanent operation of an HIL simulator and the distribution of your real-time applications.
In standalone operation, the target display provides visual feedback on the status of the running real-time application, including displaying signal traces you may have configured.
You can connect your development computer to the target computer system at any time to control and instrument the running real-time application. Disconnecting the development computer does not affect the running real-time application.
You can use the C and .NET APIs in Simulink Real-Time to create your own Windows applications to access, control, and instrument real-time applications running on one or multiple target computers connected via Ethernet.
You can provide royalty-free distribution of your standalone real-time applications and associated Windows applications that use the Simulink Real-Time APIs.
Simulink Real-Time lets you leverage powerful FPGA hardware in the target computer system for specialized reconfigurable I/O or algorithm acceleration of parts of your real-time application.
Reconfigurable FPGA I/O modules from Speedgoat are available at various performance levels, such as Virtex-II, Spartan-6, Virtex-6, and Kintex-7 from Xilinx.
To bypass the bandwidth limitation of the PCI bus for the high clock rates typical of an FPGA implementation, the available FPGA I/O modules include their own local I/O, including digital and analog input and output channels. This local I/O is either an integral part of the module or it can be added as a plug-on module.
You don’t need to have specific FPGA, HDL, or synthesizing tool knowledge to use an FPGA I/O module as reconfigurable I/O. Speedgoat offers predefined FPGA code modules for specialized I/O, such as absolute encoder protocols, three-phase PWM, I2C, and SPI, which can be custom-combined in a bitstream programming the FPGA. The Simulink driver block library associated with the bitstream enables you to drag and drop this I/O functionality into your Simulink model in the same way that you add static I/O functionality.
The Speedgoat driver block library for Simulink Real-Time supports pulse-width modulation, encoder measurement and simulation, serial protocols, synchronization, and general-purpose digital I/O.
Simulink Real-Time, together with HDL Coder, enables you to use the FPGA I/O module to accelerate parts of the real-time application. The concurrent execution capability of Simulink enables you to select one or multiple FPGA I/O modules in the HDL Workflow Advisor. For the real-time application build, you can then identify subsystems of your Simulink model to be handled by HDL code generation instead of C-code generation. This capability enables you to design and create real-time applications that can run on both the target computer system’s CPU and the plugged-in FPGA I/O modules.