Real-Time Workshop | ![]() ![]() |
This section provides hands-on experience with the code generation, program building, data logging, and code validation capabilities of Real-Time Workshop.
Tutorial 1: Building a Generic Real-Time Program shows how to generate C code from a Simulink demonstration model and build an executable program.
Tutorial 2: Data Logging explains how to modify the demonstration program to save data in a MATLAB MAT-file, for plotting.
Tutorial 3: Code Validation demonstrates how to validate the generated program by comparing its output to that of the original model.
Tutorial 4: A First Look at Generated Code examines code generated from a very simple model, illustrating the effect of some of the Real-Time Workshop code generation options.
Tutorial 5: Getting Started with External Mode Using GRT acquaints you with the basics of using external mode on a single computer, and demonstrates the value of external mode to rapid prototyping.
These tutorials assume basic familiarity with MATLAB and Simulink. You should also read Building an Application before proceeding.
The procedures for building, running, and testing your programs are almost identical in UNIX and PC environments. The discussion notes differences where applicable.
Make sure that a MATLAB compatible C compiler is installed on your system before proceeding with these tutorials. See Supported Compilers of the Real-Time Workshop documentation or more information on supported compilers and compiler installation.
The f14 Demonstration Model
Tutorials 1-3 use a demonstration Simulink model, f14.mdl
, from the matlabroot
/toolbox/simulink/simdemos/aerospace
directory. (By default, this directory is on your MATLAB path; matlabroot
is the location of MATLAB on your system.) f14
is a model of a flight controller for the longitudinal motion of a Grumman Aerospace F-14 aircraft. Activate the F-14 model by typing f14
at the MATLAB prompt. The diagram below displays the top level of this model.
The model simulates the pilot's stick input with a square wave having a frequency of 0.5 (radians per second) and an amplitude of ± 1. The system outputs are the aircraft angle of attack and the G forces experienced by the pilot. The input and outputs are visually monitored by Scope blocks.
![]() | Basic Real-Time Workshop Concepts | Tutorial 1: Building a Generic Real-Time Program | ![]() |