Page 819 - Mechatronics with Experiments
P. 819
APPENDIX
®
®
MATLAB , SIMULINK , STATEFLOW,
AND AUTO-CODE GENERATION
®
®
MATLAB (and its tools such as Simulink , Stateflow) is the standard software
®
tool used for control system design by engineers. In addition to MATLAB , the following
tools are used as part of control system development, proto-type deployment, and testing:
®
Simulink , Stateflow, and an auto-code generator tool called Similink Coder (formerly Real
Time Workshop (RTW) and Stateflow Coder (SFC)). Programs for control and simulation
®
®
are written in MATLAB as text files using MATLAB script language, which is similar
to C language. Simulink ® and Stateflow are graphical tools to define the control logic.
Simulink ® Coder is the tool to automatically generate C-code (ANSI/ISO C and C++
code) for a target embedded hardware ECM (electronic control module).
®
Simulink is the main graphical modeling tool for control system design. Stateflow
is a complementary tool that is most suitable for modeling event-driven supervisory logic
®
aspects of a control software, whereas Simulink is more suitable for more mathematical
®
aspects of it, such as PID control algorithms. The Simulink Coder auto-code generation
®
tool is used to automatically convert Simulink , Stateflow, and MATLAB ® files to C-
language files, compiled with a C-compiler, and deployed on a target microcontroller
hardware. There are many, and growing, numbers of target microcontroller/DSP hardware
®
supported by MATLAB and its tools. One of the most general purposes of those is xPC
hardware. xPC is an industrial PC/104 bus based controller hardware architecture. It is
a flexible and general purpose real-time controller hardware platform for development
purposes, with a lesser degree of ruggedness compared to commercial ECMs. MATLAB ®
and its tools support the xPC hardware through the “xPC Target” software tool that allows
®
the Simulink Coder to generate C-code for the xPC target hardware. The xPC hardware
runs the DOS operating system and the xPC Target Kernel as its real-time operating system.
®
A.1 MATLAB OVERVIEW
MATLAB ® is a general purpose modeling and simulation software, widely used in the
world by control engineers. Students can use this introduction as a starting point, and
®
get more details on specific points using the online help for MATLAB . The MATLAB ®
software package is an integrated software tool with many components and new components
are being added continuously. These components are:
1. MATLAB ® being the main front end tool, text based programming environment.
®
In addition to these basic MATLAB components, there are Toolboxes that can be
added to increase its capabilities. For instance, the Control Systems Toolbox can
Mechatronics with Experiments, Second Edition. Sabri Cetinkunt.
© 2015 John Wiley & Sons, Ltd. Published 2015 by John Wiley & Sons, Ltd.
Companion Website: www.wiley.com/go/cetinkunt/mechatronics
805