0% found this document useful (0 votes)
41 views9 pages

Vector Control Induction Machine

Uploaded by

Damir Sumina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views9 pages

Vector Control Induction Machine

Uploaded by

Damir Sumina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Embedded

dx
Code Generation

DEMO MODEL

Vector Control of an Induction Machine

Control of an induction machine with embedded code generation for TI


C2000 MCUs

Last updated in C2000 TSP 1.0

www.plexim.com
Request a PLECS and PLECS Coder trial license

Get the latest TI C2000 and RT Box Target Support Package

Check the PLECS, RT Box and TI C2000 TSP documentation


Vector Control of an Induction Machine

1 Overview
This demo model shows the simulation of an induction motor drive system, and provides an expla-
nation of the typical workflow of the PLECS Embedded Coder, using Texas Instruments (TI) C2000
MCUs. Combined with a PLECS RT Box, the performance of the MCU can be verified directly.

Note This model contains model initialization commands that are accessible from:
PLECS Standalone: The menu Simulation + Simulation Parameters... + Initializations
PLECS Blockset: Right click in the Simulink model window + Model Properties + Callbacks +
InitFcn*

Analog Analog
Out Out
Probe
Vdc Is
Scope
Model
Settings
sw1
Vdc+ sw3
sw5

V IM
sw2
Vdc- sw4
sw6

Incr.
Probe
Encoder
θ
sw1
PWM sw2 Digital Digital Digital Digital
1 sw3
Capture sw4 In Out In Out
sw5
PWM sw6 Tz_i Tz_o En_i En_o

Digital Digital Digital Digital


NOT z-1
In Out Out Out
Trip zone NOT LED Blinking
Power Powerstage enabled
channel: 29 deactivated channel: 30
channel: 28

Figure 1: Power circuit of the induction machine drive system

2 Model
The demo model is composed of two subsystems: the “Plant” subsystem includes the power circuit and
the “Controller” subsystem includes the control loop.

2.1 Power Circuit


The power circuit includes an induction machine (IM) and a three-phase full bridge voltage-source in-
verter (VSI). The mechanical interface of the IM is loaded by a rotational damper block via a gear box
to emulate the linear friction. The VSI is supplied by a DC voltage source of Vdc = 400 V, and is repre-
sented by three IGBT Half Bridge power modules.
The six pulse-width modulated (PWM) switching signals are brought into the subsystem using a PWM
Capture block from the PLECS RT Box component library. The measurements of the DC voltage and
the AC current are exported out of the subsystem via Analog Output ports. The rotor angular po-
sition and rotational speed are converted into digital orthogonal pulses by an Incremental Encoder

www.plexim.com 1
Vector Control of an Induction Machine

block. The encoder pulses can be accessed on the corresponding port of the “Plant” subsystem mask.
Two Digital Output blocks forward the external digital input signals to two digital output pins of the
RT Box. These pins should be connected with the GPIOs of the MCU to enable/disable the PWM out-
puts via software or trip zones. The mechanism of the MCU’s PWM enable/disable will be elaborated
in Section 2.2.

2.2 Controls
In the “Controller” subsystem, rotor-field oriented control is applied to the drive system. The basic
structure is shown in Fig. 2, where the stator current is regulated in the dq frame.

QEP
ic ψr esti.
QEP i
c c θe
PWM
ωe ωe V*->d
Trigger abc
*
Is Idq Idq Vs* dq
/
i o PWM
ADC 20 ADC
Idq*
Task Id* PI rst
Id*
ADC 100 Te*
Iq*

Te Te->Iq* Digital Powerstage


en
In Protection
0.5
En Power

U(I)
Digital
z-1
Out
Scope NOT LED Blinking

Figure 2: Controller model of the induction machine drive system

Fig. 3 shows the equivalent circuit of the induction machine in the dq frame, which rotates syn-
chronously with the rotor flux. The values of LM , LσS and RR are calculated from the original machine
parameters, which can be found in the initialization commands of the model.

Rs

I Md
Vsd LM RR

Rs RR

Vsq

Figure 3: Equivalent circuit of the induction machine in the dq frame

The PI controllers for the d and q axis current are included in the subsystem “PI”, as shown in Fig. 4.
The proportional and integral gains are designed following the “magnitude optimum” method [2][3].

www.plexim.com 2
Vector Control of an Induction Machine

+ o i
− +
− K
d-axis Idq*
Kp +
* ωe K +
* Idq i o
Vs* Lσ
q-axis K +
− 1/s
+
+ o i
Ki
+
K −

Figure 4: PI controller in the dq frame

To avoid the use of an embedded flux sensor, a magnetic flux estimator introduced on page 322 of [1] is
employed in the subsystem “Ψr esti.”. Making use of the measured mechanical angular speed ωm , the
~ r,xy in the
stator current is transformed into the rotor rotational frame (“xy”) as I~s,xy . The rotor flux dΨ
rotor rotational frame is governed by the differential equation given below:

~ r,xy
dΨ ~ r,xy
−dΨ
= RR ( ) + I~s,xy (1)
dt LM

~ r,xy can be calculated using I~s,xy as an input. Using a “Rectan-


Following the differential equation, dΨ
gular to Polar” transformation block, we can processing the “x” and “y” components of the rotor flux in
the rotor rotational frame to yield the slip angular position. Summing up the slip angular position and
the mechanical angular position, the electrical angular position θ is obtained. θ is then used to trans-
form the stator current from the “abc” frame to “dq” frame. The structure of the rotor flux estimator is
demonstrated in Fig. 5.

+
+ p
ωe

C-Script

θe->ωe

+
+ 1/s p
θe ωm

dq
abc
Idq Is
abc K
dq
1/s


+ RR

Figure 5: Structure of the rotor flux estimator

Configuring TI C2000 Target library components

The measurements of the DC-link voltage and the stator currents are introduced to the model environ-
ment from the ADC block of the TI C2000 Target component library. In order to convert the detected
analog voltage into values with physical units to be used for the control algorithm, a scaling factor and
an offset factor are provided to each channel, via the parameter window of the ADC block. The ADC
unit and the Analog input channel parameters can be modified accordingly per available resources
of different MCUs.
The mechanical angular speed of the rotor is obtained from the Quadrature Encoder Counter (QEP)
block, which converts the orthogonal digital pulses into the rotational position-related counter value.
The Maximum counter value must be provided according to the configuration of the real encoder
hardware, along with the index of the GPIO numbers.

www.plexim.com 3
Vector Control of an Induction Machine

The gate signals are generated by the PWM block. The Carrier type, Carrier frequency and
Blanking time parameters can be configured in an intuitive way from the Main tab of the PWM
block parameters window. The input to the PWM block is obtained from the controller in the form of a
duty cycle, in the range of [0,1]. Please note that each duty cycle signal is fed to both A and B outputs
of an ePWM module, but with opposite polarity. From the Events tab of the PWM block parameter
window, the ADC Trigger parameter is configured as Underflow. This makes the first ePWM module
configured in the PWM generator of the Main tab generate a “start of conversion” impulse for the
ADCs, whenever the carrier value reaches its minimum. With this configuration, an additional output
port called “ADC” appears on the mask of the PWM block. This is connected to the input port called
“Trigger” of the ADC block, via the red dashed signal wire.
The control task is executed after each ADC conversion. This is configured by connecting the output
port called “Task” of the ADC block to a “Control Task Trigger” port from the TI C2000 Target compo-
nent library.
In order to quickly shut down the PWM gate signals in reaction to certain GPIO inputs under fault
condition, three “Trip Zone” events (Tz1 - Tz3) can be configured to the PWM output channels. The
behavior after each trip zone event can be chosen between “Disabled”, “Cycle-by-cycle” and “One-shot”
via the TZx mode parameter of the PWM block. The GPIOs to trigger the trip zone events Tz1 - Tz3
are defined by the TZx GPIO number parameter of the Powerstage Protection block. This block also
controls the software turn on/off of the PWM output and resetting the trip zone event, using its input
port.

3 Simulation
In addition to running a simulation of this demo model in offline mode on a computer, the “Controller”
subsystem can be directly converted into a target specific code for the TI 28069 LaunchPad [4], as con-
figured.
Follow the instructions below to upload the “Controller” subsystem to a TI MCU.
• Connect the MCU to the host computer through a USB cable.
• From the System tab of the Coder + Coder options... window, select “Controller”.
• Next, from the Target tab, select the appropriate target from the dropdown menu. Then under the
General subtab, select the desired Build type.
• Then, to Build and program the MCU directly from PLECS, choose either Run from Flash or Run
from RAM as the Build configuration to program the MCU either to flash memory or to RAM re-
spectively, then select LaunchPad as the Board type, and click Build.
If programmed correctly, LED “D9” (or the LED corresponding to GPIO “DO_DSP_LED” listed in the
model initilization commands) should blink.
For advanced users who are familiar with Code Composer Studio, there is an option to Generate code
into CCS project. Locate the appropriate cg folder from the CCS project (refer to [9] for step-by-step
instructions), enter its path into the CCS project directory field and click Build. The code of the
“Controller” subsystem will be automatically generated. Then, proceed to build and debug the project
as a normal CCS project.

Note If using the RT Box LaunchPad Interface board, make sure that the RST jumper is open
throughout the simulation.

Prior to controlling a real hardware prototype of the power stage with the programmed MCU, it is
highly recommended to first verify the behavior of the controller using a PLECS RT Box and perform
a hardware-in-the-loop (HIL) test. A typical hardware configuration is shown in Fig. 6, where the eval-
uation kit, a TI 28069 LaunchPad (the red board), is connected to the RT Box via an RT Box Launch-
Pad Interface (the green board).

www.plexim.com 4
Vector Control of an Induction Machine

PLECS RT Box

TI 28069
Launchpad
Breakout

Figure 6: Hardware setup of the HIL verification

Follow the instructions below to run a real-time model on the RT Box.


• From the System tab of the Coder + Coder options... window, select “Plant” and Build it onto the
RT Box.
• Once the model is uploaded, from the External Mode tab of the Coder options... window, Con-
nect to the RT Box and Activate autotriggering to observe the test results in real-time.
If programmed correctly, the LED corresponding to “DO-30” of the RT Box LaunchPad Interface board
should blink.
Within the “Plant” subsystem or the power circuit running on the RT Box, the simulated voltages and
currents are proportionally converted into analog signals, and delivered through Analog Out connec-
tors on the front panel of the RT Box. These analog signals are captured by the RT Box LaunchPad
Interface board and routed to the ADC input pins of the TI LaunchPad. The MCU then processes
these analog signals to generate PWM switching signals, which are delivered to the RT Box via the
Digital In pins. Toggle the switch “DI-29” on the RT Box LaunchPad Interface board from “High” to
“Low” and then back to “High” to reset the MCU and observe the real-time waveforms in the Scope
of the “Plant” subsystem. When the power stage is enabled, the LED corresponding to “DO-29” of the
LaunchPad interface board should turn on.
If switch “DI-28” on the RT Box LaunchPad Interface board is toggled to “Low”, a trip-zone event is
activated and disables the output of all the PWMs. When the trip-zone event is activated, the LED
corresponding to “DO-28” of the LaunchPad interface board is turned off. In order to resume the sys-
tem, toggle “DI-28” back to “High”, turning the LED corresponding to “DO-28” on, then toggle switch
“DI-29" from “High” to “Low”, and then back to “High” to reset the MCU. The LED corresponding to
“DO-29” should now turn on.

Note At this stage, verify that the LEDs corresponding to “DO-28” and “DO-29” on the RT Box
LaunchPad Interface board are turned on.

In order to tune the parameters of the control program in the MCU and observe any intermediate val-
ues, follow the instructions below to connect to the external mode of the TI MCU.
• First, Disconnect the “Plant” subsystem from the External Mode of the PLECS RT Box, if con-
nected.
• Then, from the System tab of the Coder + Coder options... window, select “Controller”.
• Next, from the External Mode tab, select the appropriate Target device and click Connect.
• Then, Activate autotriggering to observe the test results in the “Controller” subsystem Scope.

www.plexim.com 5
Vector Control of an Induction Machine

In this demo model, a step change to the reference torque can be configured by changing the value of
the Constant block “Te”, on the fly, in real-time, since it has been added to the Exceptions list in the
Parameter Inlining tab of the Coder options... window. The step response can be observed in real-
time, as shown in Fig. 7, by setting up an appropriate Trigger control from the External Mode tab.

Electrical torque (Te)


300
Te
Torque (Nm)

200

100

0
Stator currents in d-axis (Id)

40 Id*
Current (A)

Id
20

0
Stator currents in q-axis (Iq)
300
Iq*
Current (A)

200 Iq

100

0
Stator currents (Is)
400
Isa
Current (A)

200
Isb
0 Isc
-200
-400
0.0 0.5 1.0 1.5 2.0 × 1e-2
Time (s)

Figure 7: Transient response to a step change of the torque reference in the controller in real-time

Please note that the IO configuration of all the peripheral blocks (ADC, PWM) are configured by map-
ping to the TI 28069 LaunchPad [4]. For a TI MCU other than the TI 28069 LaunchPad, the IO config-
uration has to be adapted. In addition to the TI 28069 LaunchPad, this demo model also supports code
generation for other TI C2000 MCUs, such as the TI 28377S [5], 28379D [6] and 280049C LaunchPads
[7], and TI 28335 controlCARD [8]. From the Model initialization commands window of Simula-
tion Parameters... + Initializations tab from the Simulation menu, change the value of type_evm,
to choose the desired target. Also, remember to configure the corresponding Target in the Coder Op-
tions window accordingly.

4 Conclusion
This model demonstrates an induction machine drive system that supports embedded code generation
for TI C2000 MCUs.

References
[1] R. De Doncker, D. Pulle and A. Veltman, “Advanced Electrical Drives”, Springer, 2011.

www.plexim.com 6
Vector Control of an Induction Machine

[2] Konstantinos G. Papadopoulos, “PID Controller Tuning Using the Magnitude Optimum Crite-
rion”, Springer, 2015.
[3] Damir Vrancic, “Magnitude Optimum Techniques for PID Controllers”, 2012.

[4] TI C2000 Piccolo MCU F28069M LaunchPad Development Kit,


URL: http://www.ti.com/tool/LAUNCHXL-F28069M.
[5] TI C2000 Delfino MCUs F28377S LaunchPad Development Kit,
URL: http://www.ti.com/tool/LAUNCHXL-F28377S.

[6] TI C2000 Delfino MCUs F28379D LaunchPad Development Kit,


URL: http://www.ti.com/tool/LAUNCHXL-F28379D.
[7] TI C2000 Piccolo MCU F280049C LaunchPad Development Kit
URL: http://www.ti.com/tool/LAUNCHXL-F280049C.

[8] TI C2000 TMS320F28335 controlCARD


URL: http://www.ti.com/tool/TMDSCNCD28335.
[9] PLECS TI C2000 Target Support User Manual,
URL: https://www.plexim.com/download/documentation.

www.plexim.com 7
Revision History:

C2000 TSP 1.0 First release

How to Contact Plexim:

% +41 44 533 51 00 Phone


+41 44 533 51 01 Fax
) Plexim GmbH Mail
Technoparkstrasse 1
8005 Zurich
Switzerland
@ info@plexim.com Email
http://www.plexim.com Web

Embedded Code Generation Demo Model


© 2002–2020 by Plexim GmbH
The software PLECS described in this document is furnished under a license agreement. The software
may be used or copied only under the terms of the license agreement. No part of this manual may be
photocopied or reproduced in any form without prior written consent from Plexim GmbH.
PLECS is a registered trademark of Plexim GmbH. MATLAB, Simulink and Simulink Coder are regis-
tered trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered
trademarks of their respective holders.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy