Is there an example Processor-in-the-loop (PIL) implementation for a Permanent Magnet Synchronous Machine Field Oriented Controller running on a Texas Instrument processor using Simulink and Embedded Coder?

31 views (last 30 days)
Problem Description:
I am interested in generating code for the Field-Oriented Control algorithm for a Permanent Magnet Synchronous Machine (PMSM) using Embedded Coder. I am also interested in verifying the implementation and execution time of the generated code using Processor-in-the-loop (PIL) testing.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 30 Aug 2012
A demo kit that contains an example model of a Field-Oriented Control algorithm for a Permanent Magnet Synchronous Machine is available. The kit also includes additional files that will help you to understand the basic workflow and Simulink APIs for generating C code from a motor control algorithm and for verifying its behavior and execution time using Processor-in-the-loop (PIL) testing on Texas Instrument’s (TI’s) F28335 eZdsp board.
The demo kit can be downloaded from the Related Documents section of this solution.
To run the demo and start the instructions, copy the files into a working directory and execute the “startDemo” command at the MATLAB command prompt. You will be able to then set up the simulation environment to model and verify the behavior of a closed-loop motor control system. Once the control system behavior is within specification, you can generate C code from the controller model using Embedded Coder. After inspecting the code, you can also use processor-in-the-loop (PIL) testing to gain confidence that the C code will perform as expected when you integrate it with embedded software that interfaces with the motor hardware.
To view instructions on Target setup please refer Target setup.pdf in the related documents section.
The intent of the demo kit is to provide a working example that end users can use as a base to create their own Processor-in-the-loop (PIL) solution using Embedded Coder and its PIL APIs shown below:
If you have questions on this solution or desire additional support, please e-mail:

More Answers (1)

Babak Parkhideh
Babak Parkhideh on 11 Feb 2021
There is an easy tutorial on Youtube for PIL simulation of a Buck converter that can be extended to your application.
Here is the link:
https://youtu.be/NGamSz657gA
  1 Comment
Hassan Abouobaida
Hassan Abouobaida on 13 May 2021
Hello,
I tried to use the same example in this vidéo but i obtain the result :
-----------------------------------------------------------------------------------------------
DSP : F28379D Launchpad
Matlab : 2019 & 2020
-----------------------------------------
### Starting build procedure for: Subsystem
Code generation utilizes device specific information (e.g., microprocessor word sizes) to reproduce a bit true representation of the diagram. This information is not specified in this model, it can be specified using the test hardware parameters in the Configuration Parameters dialog box. Code generation will use the host settings for the target.
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Users\hassan\Desktop\PIL1\Subsystem_ert_rtw
Connectivity configuration "ALTERASOCSIM" threw an error. Consequently, this connectivity configuration will be skipped. To avoid this warning, fix the following error:
Undefined function 'i_isConfigSetCompatible' for input arguments of type 'coder.connectivity.SimulinkConfig'. [2 similar]
Component:Simulink | Category:Model warning
### Build procedure for Subsystem aborted due to an error.
Cannot perform a processor-in-the-loop (PIL) simulation for "Subsystem".
The configuration parameters for this model do not support the following connectivity configurations: IBIS_AMI, ALTERASOCSIM, XILINXZYNQSIM, Texas Instruments C2000 Base, Texas Instruments Code Composer Studio (IDE), Texas Instruments Code Composer Studio (TCP/IP), Texas Instruments Code Composer Studio (Serial)
To fix this error, update the configuration parameters or create a supported connectivity configuration. See Configure a SIL or PIL Simulation, Create a Connectivity Configuration for a Target, and Processor-in-the-Loop (PIL) Simulation in your product help.
Component:Simulink | Category:Build error
??? Subsystem build failed

Sign in to comment.

Products


Release

R2011a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!