Page 820 - Mechatronics with Experiments
P. 820

806   MECHATRONICS
                                   be added to MATLAB ®  to extend its function libraries for that purpose. Similar
                                                         ®
                                   toolboxes exist for Simulink , Stateflow, and other software components.
                                          ®
                                2. Simulink for graphical block diagram modeling of dynamic systems and control
                                   algorithms.
                                3. Stateflow for event-driven system and supervisory control logic modeling (also with
                                   graphical interface).
                                                                                                    ®
                                4. Simulink ®  Coder (SC) for auto-code generation in C-language from Simulink ,
                                   Stateflow, and MATLAB ®  files (formerly called Real Time Workshop (RTW) and
                                   Stateflow Coder (SFC)). The Embedded Coder tool generates auto-code in C for
                                                                           ®
                                   specific microcontrollers and DSPs. The MATLAB Coder tool generates auto-code
                                                      ®
                                   in C from the MATLAB text m-function files.
                                5. xPC-Target software for the PC-based embedded hardware tool called xPC-
                                   hardware. There are other embedded target microcontroller software and hardware
                                   combinations supported, such as Real-time Windows environment to run real-time
                                   code on a PC with relevant I/O cards. For other specific commercial ECMs (i.e., for
                                                                             ®
                                   engine control, transmission control etc.), MATLAB provides “target ECM hard-
                                                                        ®
                                   ware” specific tools which work with Simulink Coder (SC), Embedded Coder, and
                                           ®
                                   MATLAB Coder in order to generate C-code automatically for that target ECM.
                                6. C-Compiler to compile the generated code for the target embedded controller hard-
                                                ®
                                   ware. MATLAB installation includes the LCC C-Complier.
                                                                             ®
                                   Figure A.1 shows the relationship between MATLAB and its main “add-on” tools.
                                                                             ®
                                                                                         ®
                                                                                                  ®
                              In the discussion that follows, we used the term MATLAB or MATLAB /Simulink to
                                                                     ®
                              refer to this whole suite of tools in the MATLAB package. If testing on actual embedded
                              controller hardware is not needed and simulations are sufficient for a given purpose, then
                                                       ®
                                             ®
                              only the MATLAB , Simulink , and Stateflow package components are needed. It should
                                                                                                 ®
                              be noted that the supervisory and event driven logic can also be coded in MATLAB and
                                     ®
                              Simulink alone without the use of Stateflow. However, the Stateflow environment makes
                                                                                           ECM
                                  PC
                                              USB/CAN
                                                   Matlab development environment
                                              C-files             C-files
                                              (S-functions)



                                              Simulink
                                   Matlab               Simulink  C-files   C-Compiler  Executable
                                                        coder                        file
                                             Stateflow



                                               ®
                              FIGURE A.1: MATLAB , its add-on tools and their typical relationships in an embedded
                              control software development.
   815   816   817   818   819   820   821   822   823   824   825