in this video we will see how you can
automatically fine tune controller loop
gains
for your moto control application using
the field oriented control auto tuner
block
in the closed loop simulation model here
we have the plant model
containing the motor and the inverter
model blocks
then we have the inner dq axis current
pi controller loops
on the outer speed pi controller loop
in traditional tuning methods you would
have to tune one loop at a time manually
which tends to be a difficult and time
consuming process
field oriented control auto tuner
simplifies and speeds up
this process by automatically tuning dq
axis current and speed loops of your
application
based on the bandwidth and the phase
margin you specify for each loop
this block can be used to tune the
field-oriented controller gains in
desktop simulation
essentially it runs autotuning
experiments for each of the loops
by injecting perturbations recording the
output
estimating the plant frequency response
and tuning the pi controller parameters
let's see how this model is set up to
automatically fine tune the gains
using the field-oriented control audit
unit block
first we set up the speed reference
profile for the motor
we will let the motor ramp up its speed
to reach a steady state of around 2500
rpm
using initial controller gains then
we will raise the speed reference to
4500 rpm
followed by a reverse in the direction
of spin to 4000 rpm
to see how the controller performs
initially
then we will bring the motor speed back
to steady state
at 2500 rpm and use the field oriented
control auto tuner block
to run those alternating experiments for
the inner eq
current loops and then the outer speed
loop
after the block has tuned the gains we
will run the same transients in the
motor speed reference
and check the controller performance
with the fine tuned gains
with the speed reference profile set we
will set up the field-oriented control
auto-tuner block
and tailor the auto-tuning experiment
settings
the initial pi gains for the control
loops have been set up here
using datastore memory blocks and the
field oriented control autotuner block
is set up in this subsystem named the
foc autotuner
this block in the subsystem outputs
current and speed loop perturbations to
the controllers
and measures the resulting controller
outputs motor currents
and speed to tune the gains
to tailor the auto tuning experiment
settings we will look at the block
dialog of the field oriented control
auto tuner block
under the parameters we see the loops
that will be tuned
as we do not have a flux loop we have
unchecked this
we have this option checked to use the
same settings for the dq axis
current loops under the tuning tab
let's set the controller requirements
for the dq axis
current loops for these loops we will
set
a target bandwidth of 3000 radians per
second
with a phase margin of 80 degrees
the outer speed loop will run at least
10 times lower than the current loops
so we'll put in a bandwidth of 100
radians per second
let's set a target phase margin of 60
degrees
the experiment tab lets us choose the
amplitude of the perturbations being
injected
and the duration of the experiments
based on the speed reference profile we
set earlier on we will set an experiment
start time of 6 seconds
with the duration of 0.5 seconds for the
d-axis current loop
likewise let's start the second
experiment for the q axis
at 7 seconds which allows enough time
for the transients from the first
experiment to die down
for the duration again let's set 0.5
seconds
for the speed loop let's set the start
to 8 seconds and the duration to be 3
seconds
now under the loop experiment settings
for the current loops
the plant type is stable with the
positive sign
the sinusoidal perturbations here would
represent the perturbations
of vd and vq for this
we will set a normalized value of 0.15
there is no science to choosing this
value it has to be small enough not to
change the operating point of the model
and is sufficiently large to accelerate
motor dynamics
for the speed loop again the plant type
and sine
are stable and positive respectively the
perturbations for this loop
will be the perturbations in the q-axis
reference current
for which we will set a sign amplitude
to a normalized value of 0.1
under the block tab we have selected the
start stop of the auto tuning process
to output experiment times that will
allow us to update pi gains after each
experiment
finally the entire control runs in
single precision data type
so we'll match that here then click ok
now that everything is set up we can
just run the model
the experiments will run and the
field-oriented control auto-tuner block
will update the loop gains for all the
three loops
let us now go check how the controller
performance has changed
with the initial controller gains we see
the motor response
while tracking the speed reference is
slow with a significant overshoot
and has a large settling time then the
three experiments for the current and
speed loops were run between
6 and 11 seconds fine tuning the gains
these gains are then automatically
updated to the pi blocks
with these tuned gains we see the
controller brings about a better
reference tracking performance
with better rise and settling time know
that you can still modify these
autotuning experiment settings
and further fine-tune these gains for
your application
so in closing we saw how to use the
field-oriented control
auto-tuner block to tune the gains of a
field oriented control algorithm
in the desktop simulation model you can
also generate core from this block and
deploy it to a speed code real-time
machine
you can then auto tune the gains of your
field-oriented control algorithms
in real time against the modern hardware