<< Chapter < Page Chapter >> Page >

Closing the current loop

The purpose of this step is to close the current loop and to set the PI regulators correctly to get a stable system while the motor is still running in speed open-loop.

Current Sensing

Key Modules:

In addition to the modules already used, we use the PI module:

  • PIDREG3 (Proportional Integrator Derivative regulator): This module regulates the two currents id and iq, generated in the Park module.
  • Open the PMS_Motor_level3.mdl Simulink model.
Figure 11: Closing the Loop with the PI

Vd Testing

  1. Run the model and double-click the “Stator Current” and “Rotor Speed” (same as previous section) and “Vd/Vq” scopes.
Stator Current

Rotor Speed
Ramp GeneratorVq Testing


For ease of use, the default PID parameters are already tuned. You can still play with them and observe the results. Within the watch windows, the PID coefficients are displayed for both iq and id. Using the following picture will help you to interpret the variables.

The speed measurement-encoder

During this step we will check the encoder feedback and we will align the calculated angle with the shaft angle.

The Speed Measurement Encoder


In addition to the modules already used, we use:

  • QEP (Quadrature encoder pulse module): instance qep1. This module initializes the QEP DSP unit. This involves the associted timer (T2) set-up, the QEP DSP pins set-up and so on. Calling the initialization routine of the QEP module, the dedicated DSP registers are automatically configured with no waste of time for the user in reading through the documentation. This module outputs an electrical angle stored into the qep1.theta_elec variable which is then passed into the speed calculator module. The encoder mounted on the motor is a 2000 lines encoder. In addition to the traditional QEP signals (QEP1 and QEP2), it provides an index pulse, which toggles every complete mechanical round. This index is connected to the capture interrupt 3 of the DSP. In the corresponding served interrupt, we clear the timer 2 counter ensuring to keep it between 0 and 8000: this way we have a precise information on the rotor position. The QEP module also takes care of the capture unit initialization.
  • SPEED_MEAS_QEP (Speed measurement based on QEP information): instance speed1. Based on system information (number of poles pairs for instance), this module outputs the motor speed information.
  • Open the PMS_Motor_level4 Simulink model.
    Figure 16: Using the QEP
  1. Run the model and double-click the “PWM dutycycles” and “Rotor Speed” scopes.
PWM Duty Cycles
Rotor Speed

Align the sensed angle we the motor shaft.

Until now, the magnetic field in the motor was generated without taking care of the shaft position. Even if our motor is a synchronous motor, with no load and at load speed, it was easy to expect the shaft to start and to catch the magnetic field without problem. Now, if we want to close the speed loop, we need to know the shaft angle at every moment. The shaft position is given by the encoder but we still have to align the initial sensed position with the shaft.

For this, we use the Data Log module to display in real time the rmp_out variable (angle we used until now to create the magnetic field) and theta_elec (sensed angle).

Speed closed loop

Speed Closed Loop

The purpose of this step is to verify the speed regulator, close the speed loop and tune up the gains for the speed regulator if necessary. All the modules previously described are used in this final step.

Real time

The real-time software will run in the following hardware:

  • eZdsp F2812 (DSP control board based on the F2812)
  • DMC 550 (power stage board for BLDC and PMSM from Spectrum Digital®)
  • PMSM from Applied Motion Product ®

For safety reason it is mandatory that you strictly respect the following picture to connect the DMC 550.

Hardware Setup

During this build, the speed reference will be given to the DSP through a potentiometer placed on the DMC 550 (R66). To start with, please put the potentiometer around its midle position.

  1. MAKE SURE that the potentiometer is around its midle position
  2. Generate the code in Simulink
  3. Turn ON the PSU and set the voltage to 10V.

The motor should have good response time now thanks to the speed closed loop. As usual the PID controller is already tuned. Using the same graphical display we used during the lab 4 you can see the impact of the PID parameters.

Since all the kits are different, the default settings for the current and speed PID may not be suitable and the maximum command may be instable

Moving the speed potentiometer, you can appreciate the fast and smooth response time!

To stop the system properly

  1. Turn OFF the PSU
  2. Halt the DSP: From the pull-down menu, “Debug” → “Halt”;
  3. Close the Model

Questions & Answers

how can chip be made from sand
Eke Reply
are nano particles real
Missy Reply
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
Application of nanotechnology in medicine
has a lot of application modern world
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
Nasa has use it in the 60's, copper as water purification in the moon travel.
nanocopper obvius
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
analytical skills graphene is prepared to kill any type viruses .
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now

Source:  OpenStax, From matlab and simulink to real-time with ti dsp's. OpenStax CNX. Jun 08, 2009 Download for free at http://cnx.org/content/col10713/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'From matlab and simulink to real-time with ti dsp's' conversation and receive update notifications?