hello everyone my name is Antone and i will present today how to control the
three face brushless motor using similar ink and a TI launch pad with a three
phase inverter booster back here is the hardware i have my ti launch pad here
with the booster pack on top im using the boost excel dash drv 8301 booster
pack which is a three phase inverter you can see the six mosfets here and i have
my three phase connector here which is connected to my motor you can also
notice here this is my position sensor cable and it's not connected today
because I will demonstrate how to do field oriented control with sensorless
let me start with the end and then i will show how I got there
this is my simulink model that will generate code from it by pressing this
button or pressing ctrl be on my keyboard you can follow the cogeneration
steps on the main map window notice on the side i have these variables that
have been automatically created when I opened my model i can set my cpu
frequency and I can also set my PWM frequency i'm using a PWM frequency of
20 kilohertz today this is also the frequency at which i'm going to run my
current loop so i'm running a new current loop and refreshing my pwm duty
cycles every 50 microseconds or 20 kilohertz i have an automated script
that will load the generated executable on my targets so I just connected to my
target loaded the code and if i go back to my camera I can see now my shaft is
spinning now that my motor spinning i can open this host model that will read
cereal messages coming from the USB cable connected to the launch pad so
here i have three messages coming over the serial port i have the desired speed
the actual speed and torque demand so if I around this model on the host it will
get the serial messages and I can see in real time what's happening on my target
using similar scopes this is my desired speed its per unit speed of 4.5 and this
is the actual measured speed and this is my torque demand coming out of the speed
control PID controller so if i try to slow down my shaft you can see that the
actual speed is slowing down and I need torque to maintain the speed if I
release the shaft then there's a spike of speed because it's catching up with
the with the amount of torque that that was needed to maintain the speed before
I can do that test again if i try to slow down my shaft I can see the Tour de
man climbing up as soon as I release the shaft the amount of torque that built up
created a spike positive speed
how did I get there so first of all let's go through a few installation
steps so i'm using matlab are 2013b everything i'm doing here can be done
also with 13a i wouldn't recommend going to an earlier version of 13a because we
made a lot of improvements for the people f-22 to 1713 a 430 is recommended
version in 13b our support for tis e2000 processor is coming now
yeah a support package that you have to download from the web so you have to
type this target installer command that will help you through that process type
this command it will open a GUI install the Support Package 40 i see two
thousand processors and follow the steps to link also the third party files that
you need ccsb five or before or even be three if that's what you prefer
once this is done you can also run the check
env set up Jackie and setup will help you validate your installation against
the third party tools use check and be setup CCS that's for ccs version 3.3 if
you want to use the five type CCS v5 then f 22 27 check make sure all these
items are pointing to the recommended versions
of the third body files there's another command that you can run also which is
target updater this will make sure that you have the latest version of the
support package and you can also use tools to validate that your third-party
files are configured correctly the paths are correct and similarly knows where to
find the third party tools so three commenced to remember targets installer
target the later check env set up the model I'm using today has been posted on
mass of central so you can find it by typing massive central.com and if you
look at the file exchange and if you type motor control with ti launch bad
you will find this motor control model so download this model it comes with the
installation script or an init script that will initialize my variables each
time i open the model so make sure you put all these files in the same folder
and make this folder your present working directory in matlab so this will
guarantee you have access to all the files there are two models provided
actually there are three models provided 14 CCSD 5 which is the ERT version 14
ccsb three and a host model that allows me to read serial data in real-time now
let's look what's inside one of these models i'm going to open sea 28 to 27
p.m. SFO see on the score ERT why on the score ERT because in my configset i am
using ertiga TLC as my system target file for the older CCS version 3.3 we
are using IE link brt which stands on the ID link automation that we have with
CCS version 3.3 in 13b you can use the generic ERT TLC you can see that you can
select your target hardware directly on the cogeneration pain
so this is new and 30b and you can select your TI processor here and also
your tool chain and that goes through a makefile approach and we also have an
automatic download that you can select here on the corner target pain so let's
look inside this model
let's start with scheduling so for this model i have enabled sample time colors
this is something you can do under display sometime colors and if i press
this control ji get this legend which tells me every discreet an asynchronous
time that I have in this model i have to its discreet x 110 million another one
at $TIME hundred milliseconds and i have one asynchronous time the asynchronous
time is this interrupt trigger here that is represented with this purple color so
this is my current loop this interrupt is coming from the ADC so at the end of
an ADC conversion i'm going to get an interrupt and this will trigger my
current loop so this will guarantee you will start the algorithm as soon as I
have fresh values coming from my analog-to-digital converter at 10
milliseconds i will have my speed control group so i have one PID that
reads the desired speed and the actual speed and the output of that PID is
going to be my torque demand and that will feed the desired torque for the
field oriented control algorithm i have another discreet sample time which is
hundred Millie and that i'm using to send cereal messages to that hosts model
i showed in the beginning of this example so now let's look at side the
FOC algorithm subsystem so first of all you can notice the thick boundaries of
this system this is typical to atomic subsystem and the difference with a
regular subsystem is the fact that in the generated code the boundaries have a
meaning you can define that meaning by right-clicking on the subsystem and go
to block parameters and assigned to specific subsystem to a function or a
separate see file given name to the function set that you
the function to be reusable and not reusable in which case it may take
adventure to stack or global variables and one thing which is important here is
the fact that i can also define the memory section for this subsystem in
this case this is my currently I want this to execute the fastest as possible
so i'm putting this subsystem in code round funks this section has been
defined in a package where we specify that it needs to be loaded in flash but
run from Run so this is what this section will do it will reside in flash
for standalone execution but it will run from round for faster execution and at
any time we're going to copy the code from flashed around to make sure that it
can execute from around the same can be done at the model level in the config
sent i can go to code generation memory section and if i select this ti c2000
demos package you can access it by clicking this refresh package button
then you will see this tis demos package this has the definitions for a few
sections that we have defined like this code round front section that I
described earlier you can select execution this will apply at the model
level and it will try to find all the functions that are being executed at
every time step and you can place them in the code ramp on section so let's
look inside the FOC algorithm subsystem so it is triggered on an ADC and dropped
and it starts with to ADC readings abcb1 and ADCB 3 East correspond to ia and IB
measurements on the hardware the second one which is b3 will trigger the
interrupt so it's using SOC 1y the first one is using SOC 0 so this will happen
after SOC 0 so this is the last one to convert at the end of the converter
I want to post my interrupt and i'm using a DC and one so now an important
thing to notice is the fact that we want to trigger the ADC based on a pwm event
this will guarantee that we launched the conversion outside pwm transition this
can be done using the pwm blog on this block we have an event trigger tab on
the event trigger i enable ABC start of conversion for modulating based on a .
event which means that when the counter reaches the . i will start by a DC
conversion in the general tab i have sent my counter to be up and down so
it's a symmetric moving up moving down counter if i launched my ADC conversion
in the middle is very less likely to launch the conversion when there will be
a pwm transition so I'm going to repeat this workflow pwm has a counter that's
counting up and down when it reaches the . it launches the ADC conversion ADC
converts ini be at the end of conversion i will trigger an interrupt
now i need to react on this interrupt so using that interrupt block i can select
cpu interrupt one pcie one so you have to read it vertically this is a matrix
that you can access in the help so you can view the sec 1 so this is sequence
or 14 the ADC which comes under cpu1 p IE 1 so here you can read pa1 cp1 this
is why I selected cp1 p iu 107 entice priority is said 230 you have to
remember that any synchronous task which is executed
yeah a similar example time will execute at a priority of 40 so 30 means the
priority of this interrupt is higher than the main simulink scheduler
apprehension flag is set to one which means that a higher priority i don't
have any in this model but let's imagine i had a higher priority it would be able
to preempt this particular interrupt so you can notice that this line is dotted
and the reason for this is because it's not data flow going through this line
it's an event so this Hardware interrupt is going to trigger this subsystem you
can also notice the presence of this gpio block the goal of this block is to
enable the DRV 8301 chip and it's using gpio six so i need to set this to one
otherwise my inverter is completely shut down
so let's look inside the store control algorithm have two major subsystem the
first one is input skating this will scale my ia and I be inputs into per
unit value one block that's important to know this is that minus one on the
hardware it's using an inverted often so to feed my main algorithm i need to do
that- one to go back into a positive value for positive
current on the second subsystem i generate myspace vectors and that is the
typical field oriented control algorithm using the park park here i have my PID
controllers for ID and IQ IQ is proportional to torque so it's coming
from my speed controller and then i feed my inverse park space vector generator
and this will feed the duty cycles of the pwm one thing good to notice here is
that sliding mode observer so this will define my position so this allows sensor
less field oriented control so it's using the alpha v beta alpha by beta and
this gets out a theta which is a position signal from 0 to 1 it will be
associated if we're moving at a constant speed and it's also outputting a speed
signal we can look inside the sm 0 subsystem and you can see that it's a
complicated subsystem you can take it out and tested in a unit test feed some
stimulus signals and and watch the output of this subsystem going back to
the root of the model i will show now the speed controller is a pretty simple
system there's just a PID controller that takes a desired speed in this
example is just a constant and feedback will be the measured speed and the
output will be the desired torque so the PID will work on the Delta between the
desired and the actual speed and we'll build up some desire toric depending on
the air measured this subsystem also contains a serial monitor subsystem i'm
going to be sending signals at 100 millisecond and i'm sending the speed
desire d actual speed and the torque command basically the two inputs and the
output of the PID controller i'm going to send the three variables every
hundred millisecond
now you're ready to generate code for this model the other model provided is
the exact same model for ccs version 3.3 it's using the ID link automation so if
i open the config set i will see that it is using ID and link on the score ERT
TLC for the system target file if you want to learn more
you have access to a list of examples if you open the simulink library browser
under embedded code or support package for TI c2000 processor you can click on
this blue example blog and it will point you to the list of examples provided for
this support package i recommend going through the simulation of FOC using pmsf
model this example shows how to test your algorithm using a plant model of
the motor so you can work purely in simulation before you go to the embedded
hardware
this requires some power system so you can use motor simulation i also
recommend going through the steps provided in the motor control example
this is a step-by-step example on how to create the full algorithm and how to
test components one-by-one also recommend going through this example
which provides pretty much the same as what i described today on different
types of hardware you can use the easy ESP from TI with the DM 550 we also have
demos using the DRV 8312 kids with piccolo f28 or 35 + / 69 we have support
for 28 33 528 Wade 2012
thanks for watching I hope you will be successful running your simulation
models and algorithms on the TI launchpad
good luck