Robust Control Toolbox

Using Parallel Computing to Accelerate the Tuning Process

This demo shows how to leverage the Parallel Computing Toolbox™ to accelerate multi-start strategies for tuning fixed-structure control systems.

Contents

Background

Both hinfstruct and looptune use local optimization methods for tuning the control architecture at hand. To mitigate the risk of ending up with a locally optimal but globally poor design, it is recommended to run several optimizations starting from different randomly generated initial points. If you have a multi-core machine or have access to distributed computing resources, you can significantly speed up this process using the Parallel Computing Toolbox.

This demo shows how to parallelize the tuning of an airframe autopilot with looptune. See the demo "Tuning of a Two-Loop Autopilot" for more details about this application of looptune.

Autopilot Tuning

The airframe dynamics and autopilot are modeled in Simulink.

open_system('rct_airframe1')
Warning: rct_airframe1.mdl, line 568: block_diagram does not have a parameter
named 'ExplicitPartitioning'

The autopilot consists of two cascaded loops whose tunable elements include two PI controller gains ("az Control" block) and one gain in the pitch-rate loop ("q Gain" block). The vertical acceleration az should track the command azref with a 1 second response time. Use slTunable to configure this tuning task (see "Tuning of a Two-Loop Autopilot" demo for details):

ST0 = slTunable('rct_airframe1',{'az Control','q Gain'});
ST0.addControl('delta fin');
ST0.addMeasurement({'az','q'});

% Design requirements
wc = [3,12];   % bandwidth
TrackReq = TuningGoal.Tracking('az ref','az',1);  % tracking

Parallel Tuning with LOOPTUNE

We are ready to tune the autopilot gains with looptune. To minimize the risk of getting a poor-quality local minimum, run 20 optimizations starting from 20 randomly generated values of the three gains. To enable parallel processing of these 20 runs, open the MATLAB pool and configure the looptune options to enable parallel processing:

rng('default')
matlabpool open
Options = looptuneOptions('RandomStart',20,'UseParallel',true);
Starting matlabpool using the 'local' configuration ... connected to 4 labs.

Next call looptune to launch the tuning algorithm. The 20 runs are automatically distributed across available computing resources:

[ST,gam,Info] = ST0.looptune(wc,TrackReq,Options);
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
05)
Final: Peak gain = 1.23, Iterations = 56
Final: Peak gain = 1.23, Iterations = 44
Final: Peak gain = 1.23, Iterations = 68
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
1)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
05)
Final: Peak gain = 1.23, Iterations = 115
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
05)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
05)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
06)
Final: Peak gain = 1.23, Iterations = 55
Final: Peak gain = 1.23, Iterations = 64
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
09)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
44)
Final: Peak gain = 61.8, Iterations = 25
       Spectral abscissa -1.8e-07 is close to bound -1e-07
Final: Peak gain = 1.23, Iterations = 127
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.07
45)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.05
23)
Final: Peak gain = 1.23, Iterations = 38
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
8)
Final: Failed to meet closed-loop stability constraint (spectral abscissa = 0.04
07)

Most runs return 1.23 as optimal gain value, suggesting that this local minimum has a wide region of attraction and is likely to be the global optimum. Use showBlockValue to see the corresponding gain values:

showBlockValue(ST)
Block "rct_airframe1/az Control" =

Value =

             1
  Kp + Ki * ---
             s

  with Kp = 0.00165, Ki = 0.00166

Name: rct_airframe1_az_Control
Continuous-time PI controller in parallel form.

-----------------------------------

Block "rct_airframe1/q Gain" =

Value =

  d =
          u1
   y1  1.985

Name: rct_airframe1_q_Gain
Static gain.

Plot the closed-loop response for this set of gains:

T = ST.getIOTransfer('az ref','az');
step(T,5)

You can now close the MATLAB pool to release the distributed computing resources used by looptune.

matlabpool close
Sending a stop signal to all the labs ... stopped.