Integrating Code with Simulink


register

 

Course Highlights

This one-day course presents multiple methods for integrating code into Simulink models. The focus will be on integrating C and MATLAB®. Topics discussed will include C MEX S-functions, Embedded MATLAB, and the Legacy Code Tool for wrapping external C functions into Simulink. This course is intended for intermediate to advanced Simulink users

Course Objectives

The aim of the course is to provide knowledge on writing M-file and C MEX S-functions, wrapping external C functions code using Legacy Code Tool and using Embedded Matlab.

Who Must Attend

Engineers, scientist and researchers who wish to integrate applications written in C into Simulink model

Course Benefits

Upon the completion of this course, the participants will be able to design integrated Simulink model with C and Embedded Matlab

Prerequisites

”Comprehensive SIMULINK” and “Comprehensive MATLAB“ or equivalent experience using MATLAB and SIMULINK, and knowledge of C programming.

Course Outline

Code Integration Methods
Objective: Become Familiar with the various code integration methods and discuss how a Simulink Model interacts with user-defined blocks.

  • Overview of all methods code intergration
  • Introduction to S Function

Transitioning from Matlab to Simulink
Objective: Integrate Matlab code into Simulink models

  • Writing Embedded MATLAB Functions
  • Converting MATLAB Function to an Embedded MATLAB Function
  • Embedded MATLAB coding rules

Calling External Routines
Objective: Intergrate C Code into a Simulink model using automated tools

  • Calling an external C routine with Legacy Code Tool
  • Calling an external C routing with an Embedded Matlab Function

Writing Wrapper S Functions
Objective: Integrate C code into Simulink model by manually writing C Mex functions

  • Writing C Mex Functions
  • Calling external Code from a C Mex S Function
  • Work Vectors
  • Inherting input and output port dimensions
  • Additionals Macros

Code Generation Considerations
Objective:Learn the procedures and limitations for automatically generating code with Real-Time workshop at when using the code integration methods described in the course:

  • Generating code from an Embedded Matlab Function
  • Generating code from C Mex S functions (Legacy code tool).

Code Integrating Methods Review
Objective:Review the code integration methods and discuss the pros and cons each

  • Review of all methods of code integration
  • How to choose a code integration method