0% found this document useful (0 votes)
114 views

HW 4 - Matlab Exercise

This document provides instructions for using Simulink and Real Time Workshop to generate real-time code from a Simulink model. It describes how to: 1. Open an example F-14 flight control Simulink model. 2. Configure simulation parameters and select a real-time target. 3. Generate real-time code from the model. 4. View the generated C code files in the specified output directory.

Uploaded by

GebBerhe
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views

HW 4 - Matlab Exercise

This document provides instructions for using Simulink and Real Time Workshop to generate real-time code from a Simulink model. It describes how to: 1. Open an example F-14 flight control Simulink model. 2. Configure simulation parameters and select a real-time target. 3. Generate real-time code from the model. 4. View the generated C code files in the specified output directory.

Uploaded by

GebBerhe
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SYS 595 Home Work 4.

Fall 06
Simulink and Real Time Workshop Tool

Due:

Objective: To familiarize with Simulink, Matlab and Real Time Workshop tool features.
Analyze any demo; generate its real time code. Submit plots and code.

1. Launch MATLAB 7.0.4 Application


2. In the command window, create directory say, f14example by!mkdir c:\f14example
cd c:/f14example
3. Type f14 on command window
- A Simulink model on F14 Flight- control opens. Save this file as f14rtw.mdl
under directory f14example.
4. F14 block diagram has subsystems Controller, Aircraft Dynamics Model, Dryden
Wind Gust models and Nz pilot calculation. If we click on each of these subsystems,
we get detail block diagrams of these subsystems.
5. Go to Simulation -> Configuration Parameters (or Ctrl + E). Click the solver tab.
In solver options set type to fixed step. Choose Solver method to ode3.
6. To specify the desired target configuration, we have to choose a system target file,
a template make file, and a make command. For this, go to Simulation->
Configuration Parameters. Click the Real time Workshop tab. Default configurations
are: System target file grt.tlc; Make command make_rtw; Template makefile
grt_default_tmf. Maintain this configuration, since we are doing simulation on PC.
Click OK. (If we want to connect a target to PC, we have to click on Browse and
select the appropriate system target file)
7. Go to Tools->Real time workshop->Build. The Real time code is generated. In the
Matlab command window, the build messages appear when we click on Build.
8. Go to directory f14example/f14rtw_grt_rtw. Source code (.c files and .h files have
been generated):

f14rtw.c--
f14rtw_data.c--
f14rtw.h-
f14rtw_types.h--
f14rtw_private.h -- a header file containing common include definitions
rtmodel.h -- a master header file for including generated code in the static main
program (its name never changes, and it simply includes f14rtw.h).

9. Run the f14rtw model, click on Pilot G force scope and Angle of attack.

Other similar demos can be run by:


Go to Matlab -> Help ->Demos.
Click on Simulink -> Automotive Applications. Open any model, say Engine
Timing Model. Repeat the same steps as above for generating real time code.
Objective: To get familiarize with Simulink and Real Time Workshop tool features.
Analyze any demo; generate its real time code. Submit plots and code.

You might also like