main content

tune control systems using systune -凯发k8网页登录

the systune command can jointly tune the gains of your control system regardless of its architecture and number of feedback loops. this example outlines the systune workflow on a simple application.

head-disk assembly control

this example uses a 9th-order model of the head-disk assembly (hda) in a hard-disk drive. this model captures the first few flexible modes in the hda.

load rctexamples g
bode(g), grid

figure contains 2 axes objects. axes object 1 with title from: u to: y, ylabel magnitude (db) contains an object of type line. this object represents g. axes object 2 with ylabel phase (deg) contains an object of type line. this object represents g.

we use the feedback loop shown below to position the head on the correct track. this control structure consists of a pi controller and a low-pass filter in the return path. the head position y should track a step change r with a response time of about one millisecond, little or no overshoot, and no steady-state error.

figure 1: control structure

you can use systune to directly tune the pi gains and filter coefficient a subject to a variety of time- and frequency-domain requirements.

specify tunable elements

there are two tunable elements in the control structure of figure 1: the pi controller c(s) and the low-pass filter

f(s)=as a.

you can use the tunablepid object to parameterize the pi block:

c0 = tunablepid('c','pi');  % tunable pi

to parameterize the lowpass filter f(s), create a tunable real parameter a and construct a first-order transfer function with numerator a and denominator s a:

a = realp('a',1);    % filter coefficient
f0 = tf(a,[1 a]);    % filter parameterized by a

see the "building tunable models" example for an overview of available tunable elements.

build tunable closed-loop model

next build a closed-loop model of the feedback loop in figure 1. to facilitate open-loop analysis and specify open-loop requirements such as desired stability margins, add an analysis point at the plant input u:

ap = analysispoint('u');

figure 2: analysis point block

use feedback to build a model of the closed-loop transfer from reference r to head position y:

t0 = feedback(g*ap*c0,f0);  % closed-loop transfer from r to y
t0.inputname = 'r';
t0.outputname = 'y';

the result t0 is a generalized state-space model (genss) that depends on the tunable elements c and f.

specify design requirements

to specify the desired behavior of your system, you can define control design requirements using tuning goal objects.you can specify requirements such as the response time, deterministic and stochastic gains, loop shape, stability margins, and pole locations. here, we use two requirements to capture the control objectives:

  • tracking requirement : the position y should track the reference r with a 1 millisecond response time

  • stability margin requirement : the feedback loop should have 6db of gain margin and 45 degrees of phase margin

use the tuninggoal.tracking and tuninggoal.margins objects to capture these requirements. note that the margins requirement applies to the open-loop response measured at the plant input u (location marked by the analysis point ap).

req1 = tuninggoal.tracking('r','y',0.001);
req2 = tuninggoal.margins('u',6,45);

tune controller parameters

you can now use systune to tune the pi gain and filter coefficient a. this function takes the tunable closed-loop model t0 and the requirements req1,req2. use a few randomized starting points to improve the chances of getting a globally optimal design.

rng('default')
options = systuneoptions('randomstart',3);
[t,fsoft] = systune(t0,[req1,req2],options);
final: soft = 1.35, hard = -inf, iterations = 71
final: soft = 1.35, hard = -inf, iterations = 104
final: soft = 2.78e 03, hard = -inf, iterations = 179
       some closed-loop poles are marginally stable (decay rate near 1e-07)
final: soft = 1.35, hard = -inf, iterations = 63

all requirements are normalized so a requirement is satisfied when its value is less than 1. here the final value is slightly greater than 1, indicating that the requirements are nearly satisfied. use the output fsoft to see the tuned value of each requirement. here we see that the first requirement (tracking) is slightly violated while the second requirement (margins) is satisfied.

fsoft
fsoft = 1×2
    1.3461    0.6326

the first output t of systune is the "tuned" closed-loop model. use showtunable or getblockvalue to access the tuned values of the pi gains and filter coefficient:

getblockvalue(t,'c')  % tuned value of pi controller
ans =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.00104, ki = 0.0122
 
name: c
continuous-time pi controller in parallel form.
showtunable(t)  % tuned values of all tunable elements
c =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.00104, ki = 0.0122
 
name: c
continuous-time pi controller in parallel form.
-----------------------------------
a = 3.19e 03

validate results

first use viewgoal to inspect how the tuned system does against each requirement. the first plot shows the tracking error as a function of frequency, and the second plot shows the normalized disk margins as a function of frequency (see diskmargin). see the "creating design requirements" example for details.

clf, viewgoal([req1 req2],t)

figure contains 3 axes objects. axes object 1 contains 2 objects of type line. these objects represent tracking error, max error, effective bound. axes object 2 with ylabel gain margin (db) contains an object of type line. these objects represent required margins, stability margins. axes object 3 with ylabel phase margin (deg) contains an object of type line. these objects represent required margins, stability margins, tuned lower bound.

next plot the closed-loop step response from reference r to head position y. the response has no overshoot but wobbles a little.

clf, step(t)

figure contains an axes object. the axes object with title from: r to: y contains an object of type line. this object represents t.

to investigate further, use getlooptransfer to get the open-loop response at the plant input.

l = getlooptransfer(t,'u');
bode(l,{1e3,1e6}), grid
title('open-loop response')

figure contains 2 axes objects. axes object 1 with title from: u to: u, ylabel magnitude (db) contains an object of type line. this object represents l. axes object 2 with ylabel phase (deg) contains an object of type line. this object represents l.

the wobble is due to the first resonance after the gain crossover. to eliminate it, you could add a notch filter to the feedback loop and tune its coefficients along with the lowpass coefficient and pi gains using systune.

see also

| |

related topics

    网站地图