This example shows the design of feedback and feedforward gains for a system, a common controller design technique. Here, you use an extremum seeking controller to track a given reference plant model by adapting feedback and feedforward gains for an uncertain dynamical system.
For this example, consider the following first-order linear system.
Here, and are the state and control input of the system, respectively. The constants and are unknown.
The goal of this example is to track the performance of the following reference plant model, which defines the required transient and steady-state behavior.
Here, is the state of the reference plant and is the reference signal.
The aim of the control signal is to make the states of the uncertain system track the reference states .
The designed controller contains a feedback term, , and a feedforward term, .
Substitute this control signal into the unknown linear system dynamics.
You can rewrite this expression as shown in the following equation.
In the ideal case, if the coefficients and of the nominal system dynamics are known, then you can determine the controller gain using pole-placement techniques. Doing so produces the following matching condition.
When you use a single gain value as both the feedforward and feedback gain, this matching condition might not be satisfied for all the possible values of and . For a more general solution, you can tune two different gain values (multiparameter tuning).
For this example, use the following unknown system and reference dynamics.
In this case, the ideal control gain is .
To implement an extremum seeking control (ESC) approach to the preceding problem, you define an objective function, which the ESC controller then maximizes to find the controller gain .
For this example, use the following objective function.
The following figure shows the setup for extremum seeking control.
The cost function is computed from the outputs of the reference system and the actual system.
The extremum seeking controller updates the gain parameter.
The control action is updated using the new gain value.
This control action is applied to the actual system.
firstOrderRefTracking_Esc Simulink model implements this problem configuration.
mdl = 'firstOrderRefTracking_Esc'; open_system(mdl)
In this model, you use the Extremum Seeking Control block to optimize the gain value.
The System Dynamics and Objective subsystem contains the reference model, the plant (including the actual system and control action), and the objective function computation. These elements are all implemented using MATLAB Function blocks.
open_system([mdl '/System Dynamics and Objective'])
Specify an initial guess for the gain value.
IC = 0;
The Extremum Seeking Control block perturbs the parameter value using a modulation signal. It then demodulates the resulting change in the objective function signal before computing the parameter update. Configure the extremum seeking control parameters for this block.
First specify the number of parameters to be tuned (
N) and the learning rate (
N = 1; lr = 0.55;
Configure the demodulation and modulation signals by specifying their frequency (
omega), phases (
phi_2), and their amplitudes (
omega = 5; % Forcing frequency a = 1; % Demodulation amplitude b = 0.1; % Modulation amplitude phi_1 = 0; % Demodulation phase phi_2 = 0; % Modulation phase
For this example, the Extremum Seeking Control block is configured to remove high-frequency noise from the demodulated signal. Set the cutoff frequency for the corresponding low-pass filter.
omega_lpf = 1;
Simulate the model.
To check the reference tracking performance, view the state trajectories from the simulation. The actual trajectory converges to the reference trajectory in less than five seconds.
open_system([mdl '/System Dynamics and Objective/State'])
To examine the behavior of the ESC controller, first view the objective function, which reaches its maximum value quickly.
open_system([mdl '/System Dynamics and Objective/Cost'])
By maximizing the objective function, the ESC controller optimizes the control gain value near its ideal value of –2. The fluctuations in the gain value are due to the modulation signal from the Extremum Seeking Control block.
open_system([mdl '/System Dynamics and Objective/Gain K'])