Quantcast

Simulink Real-Time

Key Features

  • Automatic generation of real-time applications from Simulink models targeting dedicated CPUs, I/O and protocol hardware, and FPGAs (with HDL Coder™)
  • Multitasking and multicore real-time kernel with microsecond granularity and concurrent execution support
  • Speedgoat target computer hardware integration for turnkey desktop, lab, and field use
  • Driver blocks for I/O, including analog, digital, pulse train, encoders, transformers, passive components, serial, audio, shared memory, and reconfigurable FPGA
  • Driver blocks for protocols and data buses, including Raw Ethernet, real-time UDP, CAN, EtherCAT®, EtherNet/IP™, Lin, SAE J1939, FlexRay™, Camera Link®, USB video, ARINC 429, and MIL-STD-1553
  • Simulink Real-Time Explorer with gigabit Ethernet connection to multiple target computers for management, execution, and instrumentation of real-time applications
  • Standalone operation of real-time applications with high-resolution signal display
  • MATLAB® functions for test scripting, and APIs for developing standalone client applications and user interfaces (Visual Basic, C/C++, Java™, and .NET)

Setting Up the Real-Time Simulation and Testing Environment

Create real-time applications using a real-time simulation and testing environment with host computer, target computer, and hardware under test

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 development computer runs Simulink Real-Time plus a C compiler, and the required products MATLAB, MATLAB Coder™, Simulink, and Simulink Coder™.

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:

  • Interact with the real-time application on the target computer
  • Perform runs interactively or initiate automated runs and test sequences
  • Tune parameters during, before, or after a run
  • Acquire, view, and log signals on the development computer or target computer
  • Create and run instrument panels with graphical control and display elements for parameter tuning and signal viewing

Enlarge Typical real-time simulation and testing environment using Simulink Real-Time.

Selecting the Target Computer Hardware

Use target computer hardware on the desktop, in the lab, or in the field

For real-time simulation and testing, you use Simulink Real-Time with a dedicated 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:

  • CPU, RAM, disk, and I/O, protocol interface, and FPGA hardware installed and operational
  • A complete set of I/O cables, terminal boards, documentation, Simulink driver blocks, and a loopback wiring harness facilitating acceptance testing for each I/O module
  • Simulink Real-Time kernel preinstalled and the target computer system ready for power-up
  • Documentation of the overall target computer system including explanation of the multi-year warranty, support services, and upgrade paths for I/O, protocol interface, and FPGA hardware including custom FPGA bitstreams

Simulink Real-Time and Speedgoat target computer hardware support a comprehensive selection of I/O and protocol interfaces.

Simulink Real-Time provides native I/O drivers and functions for target computer hardware purchased directly from the respective hardware manufacturer, which provides backward compatibility for target applications built with xPC Target™.

Enlarge Selection of Speedgoat target computers and I/O and protocol interface hardware.

Enlarge Table of supported I/O and protocol interface types by Speedgoat I/O modules.

Creating and Controlling a Real-Time Application

Extend Simulink models with I/O and protocol interface driver blocks

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

Enlarge Simulink Real-Time and Speedgoat driver block library.

Enlarge Large range of selectable Simulink Real-Time application and kernel settings.

Enlarge Real-time application build log reporting C-code generation, compilation, linking, location, and download steps.

Instrumenting a Real-Time Application

Tune parameters and display signals using Simulink Real-Time Explorer and Simulink Real-Time scopes

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.

Enlarge Simulink Real-Time Explorer session with an integrated instrument panel serving as a user interface for the running real-time application.

Enlarge Target display showing signals traces and the performance of a running real-time application.

Defining Concurrent Execution for a Real-Time Application

Leverage the concurrent execution capabilities of Simulink, the code generated by Simulink Coder, the Simulink Real-Time kernel, and the multicore target hardware

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.

Concurrent Execution in Simulink Models

Simulink Real-Time supports Simulink concurrent execution capabilities, such as multitasking execution of multirate systems and concurrent task modeling.

Concurrent Execution in Generated Code

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 target computer system.

Concurrent Execution of the Simulink Real-Time Kernel

The Simulink Real-Time kernel can run models configured in the modes described above, both on single-core and multicore 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.

Concurrent Execution of Multicore Target Hardware

The Simulink Real-Time kernel executing the real-time application uses hardware resources provided by the 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.

Enlarge Simulink model with color-highlighted task partitioning ready for concurrent execution.

Enlarge Simulink Real-Time profiling tool showing task priority, execution, and preemption of a real-time application run with concurrent execution on a target computer with four CPU cores.

Enlarge Speedgoat Xilinx Spartan-6 (with Virtex-5 logic interface) for algorithm acceleration as a resource for concurrent execution.

Creating a Standalone Real-Time Application

Enable automatic start-up of a real-time application on the target computer

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

Enlarge Target display of a running standalone real-time application.

Enlarge Custom standalone Windows user interface program interacting with running standalone real-time application developed using Microsoft Visual .Net and the .NET API in Simulink Real-Time.

Using Reconfigurable FPGA I/O Modules

Accelerate parts of your real-time application

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.

Reconfigurable I/O

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.

Algorithm Acceleration

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.

Enlarge Speedgoat FPGA code modules for specialized I/O and protocol interface connectivity for Speedgoat FPGA I/O modules.

Enlarge Speedgoat FPGA I/O and acceleration modules for the expansion of a target computer system with FPGA power, ranging from Xilinx Virtex-II over Spartan-6 to Virtex-6.

Enlarge SPIMaster functionality as a Simulink block.

Enlarge Driver block and dialog box in a Simulink model of an FPGA code module, for the SPI protocol, for a real-time application build with Simulink Real-Time.

Enlarge HDL Coder Workflow Advisor showing selectable Speedgoat FPGA I/O modules for reconfigurable I/O and algorithm acceleration.

Ask the Technical Team

Simulink Real-Time News

Cochlear Ltd. Streamlines Development of Cochlear Implant Sound Processing Algorithms

“MATLAB, Simulink, and Simulink Real-Time provide a robust, flexible, and efficient means of integrating the many different technologies that cochlear implants require. We identify the best ideas faster, and our recipients experience the improvements in real-time tests, which are essential to our research” – Dr. John Heasman, Cochlear Limited

Latest from the Simulink Real-Time Community