Phase-lead and phase-lag compensators with pre-fiter usign Bode and root-locus approaches

Phase-lead and Phase-lag compensator with pre-filters

The first part is the design of a phase-lead compensator using the Bode analysis in the frequency domain. The second part is the design of a phase-lead compensator, and a phase-lag compensator in series with the first phase-lead compensator using root-locus approach.

Pre-requisites

  • Control Systems theory.
  • Bode and root-locus analysis theory
  • Jupyter Notebook with Matlab-kernel.
  • Matlab.

Source code

Version PDF/HTML. Matlab and LaTex source code on GitHub.

Design requirements: phase-lead compensator

For the plant, \begin{align*} G(s) &= \dfrac{K}{s(s+2.5)(s+27)} \end{align*}

  • Using the frequency domain approach, determine the gain K required to give an overshoot, in response to a step input, of no more than 10%.
  • Using frequency domain approach, design a phase-lead compensator to achieve a velocity error constant no less than 25 and a step response overshoot of no greater than 10%.
  • Plot the response of the control system, to a unit ramp, showing both system output and ramp input, and evaluate the percentage steady state error to the ramp input signal.
  • Evaluate the performance in the time and frequency domain.

Phase-lead compensator

The aim of this task is to design a Phase-lead compensator using the Bode analysisin the frequency domain, and evaluate it on Matlab. Although the plant $G(s)$ is a third-order system (1), the design requirements can be approximated in terms of the natural frequency ($\omega_n$) and damping ratio ($\zeta$) of a second-order system.

\begin{align} G(s) & =\dfrac{K}{s(s+a)(s+b)} \tag{1}\\ G(s) &= \dfrac{K}{s(s+2.5)(s+27)} \nonumber \end{align}

Determine the gain $K$ for a step response overshoot no more than 10%

There are two steps to follow in order to obtain the required gain $K$, the first one uses the second-order performance approximation in the frequency domain, and the second step uses the gain and angle condition.

The relation between the Percentage Overshoot ($PO$) in response to a unity step input of a second-order system in the $\textbf{time domain}$, and the Phase Margin ($PM$) of the Bode analysis in the $\textbf{frequency domain}$, can be written as follows, \begin{align} PO &= 100~e^{-\zeta\pi/\sqrt{1-\zeta^2}} \tag{2} \\ PM &\approx 100 ~\zeta \tag{3} \end{align} applying the requirement of $PO\leq10\%$, \begin{align} \zeta &= \dfrac{ \ln\left(\frac{100}{P.O.}\right) }{\sqrt{\pi^2+\left[ \ln \left( \frac{100}{P.O.}\right)\right]}} \tag{4} \\ \zeta &= 0.59 \approx 0.60 \nonumber \end{align}

Using (3), the desired Phase Margin ($PM_d$) the system should have in order to satisfy the $PO$ is defined as, \begin{align*} PM_d = 100\times 0.6 = 60° \end{align*}

Now, it is necessary to obtain the new crossover frequency ($\omega_c^\prime$) where the $PM_d$ is satisfied. Using the $PM_d$ equation and the phase angle condition ($\phi(\omega_c^\prime)$) as follows,

\begin{align} &\phi(\omega_c^\prime) = -180° + PM_d \tag{5} \end{align}

applying the rule of angles into the (1), \begin{align} &\phi(\omega_c^\prime) = -90° - \arctan \frac{\omega_c^\prime}{a} - \arctan \frac{\omega_c^\prime}{b} \tag{6}\\ \end{align} and after some algebraic operations $\omega_c^\prime$, \begin{align*} & PM_d - 180° = -90° - \arctan \frac{\omega_c^\prime}{a} - \arctan \frac{\omega_c^\prime}{b} \\ & \frac{\omega_c^\prime(a+b)}{a~b} = \left(1-\frac{\omega_c^{\prime 2}}{a~b}\right) \tan(180° - 90° -PM_d) \\ \end{align*} solving the quadratic equation with the corresponding values $a$, $b$, and $PM_d$, and using the high value of the solution, \begin{align} & \omega_c^{\prime 2} + \frac{a+b}{\tan(180° - 90° -PM_d)} \omega_c^\prime - a~b = 0 \tag{7}\\ & \omega_c^\prime = 1.29 ~rad/sec \nonumber \end{align}

Finally, the gain $K$ can be obtained from the $\textbf{gain condition}$, where it is established that the new crossover frequency $\omega_c^\prime$ should be at $0~dB$ of magnitude, in other words, \begin{align} & \arrowvert G(j\omega_c^\prime) \arrowvert = 1 \tag{8}\\ \end{align} applying into the plant $G$ (1), and replacing the values, \begin{align*} &\dfrac{K}{\omega_c^\prime \sqrt{\omega_c^{\prime 2}+a^2} \sqrt{\omega_c^{\prime 2}+b^2 }} = 1 \\ & K = \omega_c^\prime \sqrt{\omega_c^{\prime 2}+a^2} \sqrt{\omega_c^{\prime 2}+b^2 } \\ & K = 97.96 \nonumber \end{align*} therefore, the plant becomes, \begin{align*} & G(s)=\dfrac{97.96}{s(s+2.5)(s+27)} \end{align*}

Matlab script

In [2]:
% Paulo Loma Marconi
clear variables;

% plant G parameters
s = tf('s');
a = 2.5; b = 27;

%% a) Gain K for PO=10
PO = 10; % percentage overshoot
zeta = log(100/PO)/sqrt(pi^2+ (log(100/PO))^2 ); % damping ratio
PM_d = round(100*zeta)+1; % PM desired at the nearest round value
h = tand(180-90-PM_d); 
omega_c = roots([1 (a+b)/h -a*b]); % new omega_c
K = omega_c(2)*sqrt(omega_c(2)^2+a^2)*sqrt(omega_c(2)^2+b^2); % new gain K
G = K/( s*(s+a)*(s+b) ); % Plant G

figure;
margin(G);

In [3]:
figure;
step(feedback(G,1));
stepinfo(feedback(G,1))
ans = 

  struct with fields:

        RiseTime: 1.0050
    SettlingTime: 3.1834
     SettlingMin: 0.9147
     SettlingMax: 1.0836
       Overshoot: 8.3592
      Undershoot: 0
            Peak: 1.0836
        PeakTime: 2.1523


The results show the desired $PM_d = 60°$ is satisfied with the new gain, and step response has an $PO = 8.36$.

Design of the Phase-lead compensator

The Phase-Lead compensator has the following transfer function, \begin{align} Gc = \dfrac{s+z}{s+p} \tag{9} \end{align} where the location of the zero is to the left of the pole, $|z|<|p|$.

The design requirements are the velocity error constant $K_v\leq 25$, and the step response $PO\leq 10\%$

The first step is to calculate the loop gain that satisfies the $K_v$ is calculated as follows, \begin{align*} K_v &= \lim\limits_{s \rightarrow 0} s \dfrac{K}{s(s+2.5) (s+27)} \tag{10}\\ K_g &= 1687 \end{align*} therefore, the new plant is,} \begin{align*} G(s) &= \dfrac{K_g}{s(s+a)(s+b)} \tag{11}\\ G(s) &= \dfrac{1687}{s(s+2.5)(s+27)} \end{align*}

Using (2), (3), and (4), for an overshoot of $PO=10 \%$, the damping ratio is $\zeta = 0.6$, and the desired phase margin is $PM_d=60°$.

In order to obtain the $\omega_c$ that satisfies the gain condition with the new gain $K$, (8) is applied as follows, \begin{align*} &\arrowvert G(j\omega_c) \arrowvert = 1 \nonumber\\ &\left| \dfrac{K_g}{j\omega_c(j\omega_c+a)(j\omega_c+b)} \right| = 1 \nonumber\\ \end{align*} after some algebraic operation, \begin{align*} &\omega_c^2(\omega_c^2+a^2)(\omega_c^2+b^2)-K_g^2 = 0 \nonumber \\ &\omega_c = 7.55 ~rad/sec \nonumber \end{align*}

Now, the actual phase margin $PM_{act}$ is needed to calculate the additional phase ($\phi_m$) required from the compensator, \begin{align*} PM_act &= 180° + \phi(\omega_c) \tag{12}\\ PM_act &= 180° - 90° -\arctan \frac{\omega_c}{a} - \arctan \frac{\omega_c}{b} \nonumber \\ PM_act &= 2.65 \nonumber \end{align*} so, the additional phase angle is, \begin{align} \phi_m &= PM_d+\theta-PM_act \tag{13} \end{align} where $\theta$ is a factor of correction.

If $\theta=0$, \begin{align*} \phi_m &= 60° + 0° - 2.65 \nonumber\\ \phi_m &= 57° \nonumber \end{align*}

The additional phase margin is related with the zero and the pole of the Phase-Lead compensator, \begin{align*} \alpha &= \dfrac{\sin \phi_m+1}{1-\sin \phi_m} \tag{14}\\ \alpha &= 11 \nonumber \end{align*} where $\alpha$ is, \begin{align} \alpha &= \dfrac{p}{z} \tag{15} \end{align}

The next step is to determine the new $\omega_c^\prime$ using the following logarithm gain condition, \begin{align} &20\log|G(j\omega_c^\prime)| = -10 \log \alpha \tag{16}\\ &\dfrac{K_g}{\omega_c^\prime \sqrt{\omega_c^{\prime 2}+a^2} \sqrt{\omega_c^{\prime 2}+b^2 }} = \dfrac{1}{\sqrt{\alpha}} \tag{17}\\ \end{align} after some operations, \begin{align*} &\omega_c^{\prime 2}(\omega_c^{\prime 2}+a^2)(\omega_c^{\prime 2}+b^2)-K_g^2~\alpha = 0 \nonumber \\ &\omega_c^\prime = 13.50 ~rad/sec \nonumber \end{align*} now, calculating the zero of the compensator, \begin{align} \omega_c^\prime &= \sqrt{p~z} \tag{18}\\ z &= \dfrac{\omega_c^\prime}{\alpha} \nonumber\\ z &= 4.07 \nonumber\\ \end{align} and the pole of the compensator using (15) is, \begin{align} p &= \alpha ~z \nonumber\\ p &= 44.78 \nonumber \end{align}

The last step is to obtain the new gain of the $\textbf{compensated system}$, \begin{align} K_{new} &= \sqrt{\alpha} K_g \tag{19} \\ K_{new} &= 5596.80 \nonumber\\ \end{align} therefore, the compensated open-loop transfer function is as follows, \begin{align} G_{ol} &= \dfrac{s+z}{s+p} \quad \dfrac{K_{new}}{s(s+a)(s+b)} \tag{20} \\ G_{ol} &= \dfrac{s+4.07}{s+44.78} \quad \dfrac{5596.80}{s(s+2.5)(s+27)} \nonumber \end{align}

Phase-Lead compensator Matlab script

In [4]:
%% b) Phase-lead compensator
Kv = 25; % velocity error
Kg = Kv*a*b; % loop gain to satisfy Kv
G = Kg/( s*(s+a)*(s+b) ); % Plant G

% omega_c for the uncompensated system
omega_c = real( sqrt( roots([1 a^2+b^2 a^2*b^2 -Kg^2]) ) );

% obtaining actual PM
PM_act = 180-90-atand(omega_c(3)/a)-atand(omega_c(3)/b);

% additional phase angle from the compensator PM
theta = 0; % factor of correction
PM_c = round(PM_d+theta-PM_act);

% calculating alpha
alpha = round( (sind(PM_c)+1)/(1-sind(PM_c)) );

% Determine the new cross over frequency
omega_c_new = real( sqrt( roots([1 a^2+b^2 a^2*b^2 -Kg^2*alpha]) ) );

% Calculating the zero of the compensator
z = omega_c_new(3)/sqrt(alpha);

% Calculating the pole of the compensator
p = alpha*z;

% lead compensator
Gc = (s+z)/(s+p);

% new gain of the compensated system
K_new = sqrt(alpha)*Kg

% compensated open-loop 
Gol = K_new*Gc*G/Kg;

% closed-loop 
Gcl = feedback(Gol,1);
K_new =

   5.5968e+03


Evaluation of the compensated system to a unit ramp input

The unit ramp in the LaPlace domain has the following equation, \begin{align} R(s) &= \frac{1}{s^2} \tag{21} \end{align} and the steady-state error to that unit ramp is, \begin{align} ess_v &= \frac{1}{K_v} \tag{22} \end{align} where, \begin{align} K_v &= \lim\limits_{s\rightarrow 0} s~G(s) \tag{23} \end{align} evaluating $K_v$ for the compensated system $G_{ol}$, \begin{align*} K_v &= \lim\limits_{s\rightarrow 0} s~ \left[\dfrac{s+z}{s+p} \quad \dfrac{K_{new}}{s(s+a)(s+b)} \right] \nonumber\\ K_v &= 7.53 \nonumber \end{align*}

Therefore, \begin{align*} ess_v &= 0.13 \\ \end{align*} which is a relatively small steady-state error.

Evaluation the performance of the compensated system

Using the Matlab script below, we obtaint the Bode plot, the unit step response, and the unit ramp response, where you can see the desired $PM_d=60°$ and the $PO=10\%$ are satisfied, and the system has an improved the settling time to $t_s=1.04$.

Matlab script

In [5]:
%% c) evaluating the system to unit step and unit ramp
figure(2);
margin(Gol);

In [6]:
figure(3);
subplot(2,1,1);
step = 1/s; % step input
impulse(step,Gcl*step); 
title('Step response');
subplot(2,1,2);
ramp = 1/s^2; % ramp input
impulse(ramp,Gcl*ramp);
title('Ramp response');

% evaluating Kv for the new compensated system
Kv_new = (z/p)*K_new/(a*b);

% steady-state error to a unity ramp
ess_ramp = 1/Kv_new;
stepinfo(Gcl)

% bandwidth of Gcl
BW = bandwidth(Gcl);

% resonant frequency
omega_r = 4/(0.6*1.03) *sqrt(1-2*0.6^2);
ans = 

  struct with fields:

        RiseTime: 0.2395
    SettlingTime: 1.0357
     SettlingMin: 0.9079
     SettlingMax: 1.1038
       Overshoot: 10.3821
      Undershoot: 0
            Peak: 1.1038
        PeakTime: 0.5700


Table 1: Performance evaluation
Quantity Value
Steady state error to a unit ramp 0.13
Rise Time 0.24
Settling Time 1.04
Percentage Overshoot 10.38
Phase Margin 60.20
Gain Margin 22.90
Bandwidth 8.19
Peak Magnitude 0.57
Resonant frequency 3.42

Conclusion

Comparing the uncompensated system, and the Phase-Lead compensated system, the desired phase margin $PM_d=60°$ and the overshoot $PO\leq10 \%$ were satisfied. Moreover, the settling time $t_s$ was improved three times in the Phase-lead compensated, which demonstrates this compensator improves the transient response without altering the desired phase margin.

Design requirements: phase-lead and phase-lag compensator

For the plant, \begin{align*} & G(s)=\dfrac{K}{s^2(s+9)(s+50)} \end{align*}

  • Determine the location of the dominant poles of the closed-loop transfer function in order to achieve the following performance specification for a unit step input:
    • The settling time for a step input should be less than $2.9~[s]$.
    • The overshoot should be no more than 20%.
  • Demonstrate analytically that the desired poles do not belong to the uncompensated root-locus.
  • Use the root-locus approach to design a cascaded phase-lead compensator with the zero placed in $-1$, to yield the desired specifications. If specifications are not met, perform additional design iterations.
  • Design a phase-lag compensator in series with the previous phase-lead compensator such that the steady-state error for a parabolic input $0.5~At^2$ is less than $2.5%$ of $A$.
  • Evaluate the performance of your final design in the time and frequency domain.

Phase-lead and phase-lag compensator

The objective of this task is to design a Phase-Lead compensator, and a Phase-Lag compensator in series with the first Phase-Lead compensator using two different approaches.

The plant to be studied is, \begin{align} & G(s)=\dfrac{K}{s^2(s+a)(s+b)} \tag{24}\\ & G(s)=\dfrac{K}{s^2(s+9)(s+50)} \nonumber \end{align}

Determine the location of closed-loop dominant poles

The design requirements are the settling time $t_s\leq 2.9~ sec$, and the overshoot $PO\leq 20\%$. Although the plant is a fourth-order system, the compensator can be designed using the properties of a second-order system.

The settling time is, \begin{align} t_s &= \frac{4}{\zeta\omega_n} \tag{25} \end{align} where $\zeta$ is the damping ration and $\omega_n$ is the natural frequency.

Using (4), and (25), \begin{align*} \zeta &= 0.45, \quad \omega_n = 3.06 ~rad/sec \end{align*}

Therefore, the desired closed-loop dominant poles are, \begin{align*} r_{1,2} &= -\omega_n\zeta\pm j~\omega_n\sqrt{1-\zeta^2} \tag{26}\\ r_{1,2} &= -1.38\pm j~2.73 \end{align*}

Matlab script

In [7]:
clear variables;
%% plant G parameters
s = tf('s');
a = 9; b = 50;

%% a) Location of the dominant poles for PO=20 and ts=2.9
PO = 20; % percentage overshoot
ts = 2.9; % settling time
zeta = log(100/PO)/sqrt(pi^2+ (log(100/PO))^2 ); % damping ratio
zeta = round(zeta,2)-0.01;
omega_n = 4/(zeta*ts);

% desired location of dominant poles
s1 = -omega_n*zeta+omega_n*sqrt(1-zeta^2)*1i;

Demonstrate the desired poles do not belong to the root-locus

In order to demonstrate that the desired dominant poles $r_{1,2}$ do not belong to the root locus of the plant $G(s)$, the angle condition must not be satisfied.

Choosing the pole, $r_1=-1.38\pm j~2.73$, \begin{align} &\measuredangle(G(r_1)) = -180° \tag{27}\\ &\measuredangle \left( \dfrac{K}{r_1^2(r_1+9)(r_1+50)} \right) = 180° \nonumber\\ &-\measuredangle r_1 -\measuredangle r_1 - \measuredangle(r_1+9) - \measuredangle (r_1+50) = -80° \nonumber\\ &- 2~ \arctan \frac{2.73}{-1.38} - \arctan \frac{2.73}{9-1.38} - \arctan \frac{2.73}{50-1.38} = -180° \nonumber\\ &103.44 \neq -180° \nonumber \end{align} if the second pole $r_2$ is evaluated, \begin{align} &-103.44 \neq -180° \nonumber \end{align}

Design of the Phase-Lead compensator

The Phase-Lead compensator has the following transfer function, \begin{align} G_{lead} = \dfrac{s+z_{lead}}{s+p_{lead}}, \quad |z_{lead}| < |p_{lead}| \tag{28} \end{align}

The design requirement is that the location of the compensator's zero is 1. Once again, the angle criteria is applied with the desired pole $r_1$ as follows, \begin{align} &\measuredangle \left( \dfrac{s+z_{lead}}{s+p_{lead}} \quad \dfrac{K}{s^2(s+a)(s+b)} \right) = -180° \tag{29} \\ &\measuredangle \left( \dfrac{r_1+z_{lead}}{r_1+p_{lead}} \quad \dfrac{K}{r_1^2(r_1+a)(r_1+b)} \right) = -180° \nonumber \\ &\measuredangle z_{lead} -\measuredangle p_{lead}- 2~\measuredangle s -\measuredangle a - \measuredangle b = -180° \nonumber\\ \end{align} if $r_1 = -x+j~y$ \begin{align} &\left( 180°-\arctan\dfrac{y}{x-z_{lead}} \right) - \arctan\dfrac{y}{p_{lead}-x} - 2\left( 180° -\arctan\dfrac{y}{x} \right) ... \nonumber\\ &\quad -\arctan\dfrac{y}{a-x}-\arctan\dfrac{y}{b-x} = 180° \nonumber \end{align} after some operations, \begin{align} p_{lead} &= 8.36 \nonumber\\ \end{align} so, the Phase-Lead compensator is, \begin{align} G_{lead} &= \dfrac{s+1}{s+8.36} \nonumber \end{align}

Now, the gain $K$ of the compensated system can be found using the gain condition, \begin{align} &\left| \dfrac{s+z_{lead}}{s+p_{lead}} \quad \dfrac{K}{s^2(s+9)(s+50)} \right| = 1 \nonumber\\ &\left| \dfrac{r_1+1}{r_1+8.38} \quad \dfrac{K}{r_1^2(r_1+9)(r_1+50)} \right| = 1 \nonumber\\ &K = 10047 \nonumber \end{align}

Therefore, evaluating the following open-loop compensated system, \begin{align} G_{ol} &= G_{lead} ~G(s) \tag{30}\\ G_{ol} &= \dfrac{s+1}{s+8.36}~ \dfrac{10047}{s^2(s+9)(s+50)} \nonumber \end{align}

Matlab script

In [8]:
%% c) Phase lead compensator
z_lead = 1; % location of the desired zero
% using the angle condition to determine the location of the pole
x = -real(s1); y = imag(s1);
h = 180 + 180 - atand(y/(x-z_lead))-2*( 180-atand(y/x) )-atand(y/(a-x))...
-atand(y/(b-x));
p_lead = y/tand(h)+x;

% Gc compensator TF
Gc_lead = (s+z_lead)/(s+p_lead);

% obtaining the gain K with the gain condition equation
K = ((-x)^2+y^2)*sqrt((-x+a)^2+y^2)*sqrt((-x+b)^2+y^2)*...
sqrt((-x+p_lead)^2+y^2)/sqrt((-x+z_lead)^2+y^2);

% the open-loop system
G = K/(s^2*(s+a)*(s+b));% plant G
Gol_lead = Gc_lead*G; % open-loop with the Lead compensator
Gcl_lead = feedback(Gol_lead,1); % closed-loop with the Lead compensator

In [9]:
fig = figure(1);
rlocus(Gcl_lead);
hold;
% ploting the s1 and zeta in the rlocus
n = 0:1:160; m = n*sqrt(zeta^2/(1-zeta^2));
axis ([ -4 1 -4 4]);
plot (-m,n,'--'); % zeta
plot (-x,y,'rd');
Current plot held

In [10]:
fig = figure(2);
step(Gcl_lead);
stepinfo(Gcl_lead)
ans = 

  struct with fields:

        RiseTime: 0.3741
    SettlingTime: 2.7890
     SettlingMin: 0.9447
     SettlingMax: 1.5146
       Overshoot: 51.4599
      Undershoot: 0
            Peak: 1.5146
        PeakTime: 1.1018


In [11]:
fig = figure(3);
margin(Gcl_lead);
BW_lead = bandwidth(Gcl_lead) % bandwidth
BW_lead =

    4.8699


It can be seen that the close-loop desired poles belong to the root locus of the compensated system, but the overshoot is too high, so, it is recommended to use a Pre-filter to reduce the overshoot.

Adding a Pre-filter

The use of a Pre-filter in series with the closed-loop systems can reduce the overshoot canceling the effect of the Phase-Lead's zero.

The Pre-filter is written as follows, \begin{align} G_{pf} &= \dfrac{p}{s+p} \tag{31} \end{align} where $p$ can be at the exact point of the $z_{lead}=1$, \begin{align} G_{pf} &= \dfrac{1}{s+1} \nonumber \end{align} applying to the closed-loop Phase-Lead compensated system and evaluating it, \begin{align} G_{lead+prefilter} &= G_{pf}~ \dfrac{G_{ol}}{1+G_{ol}} \nonumber\\ G_{lead+prefilter} &= \dfrac{1}{s+1} ~\dfrac{10047~(s+1)}{(s+50)(s+13.07)(s+1.64)(s^2+2.76~s+9.40)}\nonumber \end{align}

Matlab script

In [12]:
%% Using prefilter to reduce the overshoot
pf = z_lead; % selecting the zero of the lead compensator (z_lead)
Gpf = pf/(s+pf);

fig = figure(3);
step(Gpf*Gcl_lead);
stepinfo(Gpf*Gcl_lead)
ans = 

  struct with fields:

        RiseTime: 1.0081
    SettlingTime: 3.0813
     SettlingMin: 0.9039
     SettlingMax: 1.0007
       Overshoot: 0.0749
      Undershoot: 0
            Peak: 1.0007
        PeakTime: 4.2068


In [13]:
fig = figure(4);
margin(Gpf*Gcl_lead);
BW_lead_prefilter = bandwidth(Gpf*Gcl_lead) % bandwidth
BW_lead_prefilter =

    2.3106


The result on implementing a Pre-filter decreases the overshoot dramatically with a small change in the settling time.

Design of the Phase-Lag compensator

The Phase-Lag compensator has the following transfer function, \begin{align} G_{lag} = \dfrac{s+z_{lag}}{s+p_{lag}}, \quad |p_{lag}|< |z_{lag}| \tag{32} \end{align}

This compensator will be used in series with the Phase-Lead compensator designed in the previous task. And now, the design requirement is the steady-state error ($ess_a$) for a parabolic input $0.5At^2\leq2.5\%$.

First, obtaining the LaPlace transform of the parabolic input, \begin{align} r(t) &= 0.5 A t^2, \quad R(s) = \frac{A}{s^3} \nonumber \end{align} according to the final value theorem, \begin{align} ess &= \lim\limits_{s\rightarrow 0}~ s~\dfrac{A}{s^3} \dfrac{1}{1+G} \tag{33} \end{align} if $K_a = \lim\limits_{s\rightarrow 0} s^2~G$, the steady-state error is, \begin{align} ess_a &= \dfrac{A}{K_a} \tag{34} \end{align} where $K_a$ is the acceleration error constant.

If $ess_a=0.025$ and $A=1$, the $\textbf{desired}$ acceleration error constant ($K_{a_d}$) is obtained using (34), \begin{align} K_{a_d} &= \frac{1}{ess_a} \nonumber\\ K_{a_d} &= 40 \nonumber \end{align} and again, with $A=1$ and $G=G_{ol}$ from (30), the $\textbf{actual}$ acceleration error constant $K_{a_{act}}$ is, \begin{align} K_{a_{act}} &= \lim\limits_{s\rightarrow 0} s^2~ G_{ol} \\ K_{a_{act}} &= 2.67 \nonumber \end{align}

The relation between the zero $z_{lag}$ and the pole $p_{lag}$ of the Phase-Lag compensator can be written as follows, \begin{align} \alpha &= \dfrac{K_{a_d}}{K_{a_{act}}} = \dfrac{z_{lag}}{p_{lag}} \tag{35} \\ \alpha &= 14.97 \nonumber \end{align} choosing a $z_{lag}$ ten times smaller than the real part of the desired dominant pole $r_1$, \begin{align} z_{lag} &= \left| \dfrac{-1.38}{10} \right| \nonumber\\ z_{lag} &= 0.14 \nonumber \end{align} and the pole should be, \begin{align} p_{lag} &= \dfrac{z_{lag}}{\alpha} \nonumber\\ p_{lag} &= 0.0092 \nonumber \end{align} therefore, the Phase-Lag compensator becomes, \begin{align} G_{lag} &= \dfrac{s+0.14}{s+0.0092} \nonumber \end{align}

Matlab script

In [14]:
%% d) Phase-lag compensator
ess_a = 0.025; % steady-state error for a parabolic input 0.5At^2
Ka_d = 1/ess_a; % Ka desired
Ka_act = (z_lead/p_lead)*(K/(a*b));

% calculating the zero and pole of the compensator
alpha = Ka_d/Ka_act;
z_lag = abs(x)/10;
p_lag = z_lag/alpha;

% Gc phase-lag compensator
Gc_lag = (s+z_lag)/(s+p_lag);

Evaluation of the performance

Finally, the open-loop of the Phase-Lead compensator in series with the Phase-Lag compensator is written as follows, \begin{align} G_{ol1} &= G_{lag}~G_{lead} ~G(s) \tag{36} \\ G_{ol1} &= \dfrac{s+0.14}{s+0.0092}~ \dfrac{s+1}{s+8.36}~ \dfrac{10047}{s^2(s+9)(s+50)} \nonumber \end{align} and the Pre-filter with the closed-loop systems is, \begin{align} G_{lag+lead+prefilter} &= G_{pf}~ \dfrac{G_{ol1}}{1+G_{ol1}} \tag{37} \\ G_{lag+lead+prefilter} &= G_{pf}~ \dfrac{10047(s+1)(s+0.14)}{(s+50)(s+13.05)(s+1.78)(s+0.14)(s^2+2.51~s+8.75)} \nonumber \end{align}

Matlab script

In [15]:
%% Evaluating the performance with the phase-lead, phase-lag and prefilter
Gol_lead_lag = Gc_lead*Gc_lag*G;
Gcl_lead_lag = feedback(Gol_lead_lag,1);

fig = figure(5); 
rlocus(Gcl_lead_lag);
hold;
% ploting the s1 and zeta in the rlocus
n = 0:1:160; m = n*sqrt(zeta^2/(1-zeta^2));
axis ([ -4 1 -4 4]);
plot (-m,n,'--'); % zeta
plot (-x,y,'rd');
Current plot held

In [16]:
fig = figure(6);
step(Gcl_lead,Gpf*Gcl_lead,Gcl_lead_lag,Gpf*Gcl_lead_lag)
legend('Lead','Pre-filter + Lead','Lead + Lag','Pre-filter + Lead + Lag'...
,'Location','southeast');
stepinfo(Gpf*Gcl_lead_lag)
ans = 

  struct with fields:

        RiseTime: 0.9398
    SettlingTime: 3.3125
     SettlingMin: 0.9033
     SettlingMax: 1.0179
       Overshoot: 1.7873
      Undershoot: 0
            Peak: 1.0179
        PeakTime: 1.9419


In [17]:
fig = figure(7);
margin(Gcl_lead_lag);
BW_lead_lag = bandwidth(Gcl_lead_lag); % bandwidth

In [18]:
fig = figure(8);
margin(Gcl_lead_lag);
BW_lead_lag_prefilter = bandwidth(Gpf*Gcl_lead_lag); % bandwidth

In [19]:
%% Verifing Ka = 40
Ka = (z_lag/p_lag) * (z_lead/p_lead) * ( K/(a*b) )
ess_parabolic = a/Ka
Ka =

    40


ess_parabolic =

    0.2250


Performance results

The step response plot of the system with and without the Pre-filter shows that the Pre-filter reduces the overshoot in both cases with good settling time. On the other hand, the root-locus plot shows that the desired dominant poles are slightly out of the target , it is recommended to add a second Phase-lead compensator in series in order correct that gap.

Table 2: Performance results
Quantity Lead Prefilter+Lead Lead+Lag Prefilter+Lead+Lag
Rise Time 0.37 1.00 0.36 0.94
Settling Time 2.79 3.08 3.59 3.31
Percentage Overshoot 51.46 0.07 57.96 1.79
Phase Margin 40.80 -180 36.60 36.60
Gain Margin 8.96 7.07 8.51 8.51
Bandwidth 4.87 2.31 4.89 2.58
Peak Magnitude 1.51 1.00 1.58 1.02

New Phase-Lead compensator

The previous root-locus plot demonstrates that the desired dominant closed-loop poles have moved slightly from the root-locus, therefore, a new Phase-Lead compensator is calculated to correct that shift.

This time, the location of the zero is exactly below the real part of the desired pole, $z_{lead~2}=1.38$. Applying the angle condition with the desired pole $r_1$ as follows, \begin{align} &\measuredangle \left( \dfrac{s+z_{lead~2}}{s+p_{lead~2}} \quad \dfrac{s+z_{lag}}{s+p_{lag}} \quad \dfrac{s+z_{lead}}{s+p_{lead}} \quad \dfrac{K}{s^2(s+a)(s+b)} \right) = -180° \tag{38} \\ &\measuredangle \left( \dfrac{r_1+z_{lead~2}}{r_1+p_{lead~2}} \quad \dfrac{r_1+z_{lag}}{r_1+p_{lag}} \quad \dfrac{r_1+z_{lead}}{r_1+p_{lead}} \quad \dfrac{K}{r_1^2(r_1+a)(r_1+b)} \right) = -180° \nonumber \\ &\measuredangle z_{lead~2} +\measuredangle z_{lag} +\measuredangle z_{lead} - \measuredangle p_{lead~2} -\measuredangle p_{lag} - \measuredangle p_{lead} - 2~\measuredangle s -\measuredangle a - \measuredangle b = -180° \nonumber \end{align} if $r_1 = -x+j~y$, \begin{align} & \arctan\dfrac{y}{x-z_{lead~2}} + \left( 180° - \arctan\dfrac{y}{x-z_{lag}} \right) + \left( 180°-\arctan\dfrac{y}{x-z_{lead}} \right) ... \nonumber\\ & \quad - \arctan\dfrac{y}{p_{lead~2}} - \left( 180°-\arctan\dfrac{y}{x-p_{lag}} \right) -\arctan\dfrac{y}{p_{lead}-x} - 2\left( 180° -\arctan\dfrac{y}{x} \right) ... \nonumber\\ &\qquad -\arctan\dfrac{y}{a-x}-\arctan\dfrac{y}{b-x} = 180° \nonumber \end{align} after some operations, \begin{align} p_{lead~2} &= 1.48 \nonumber \end{align} so, the second Phase-Lead compensator is, \begin{align} G_{lead~2} &= \dfrac{s+1.38}{s+1.48} \nonumber \end{align}

Now, the new gain $K_{new}$ of the compensated system can be found using the gain condition, \begin{align} %&\left| \dfrac{r_1+1}{r_1+8.38} \quad \dfrac{K}{r_1^2(r_1+9)(r_1+50)} \right| = 1 \nonumber\\ &\left| K_{new} \quad \dfrac{s+z_{lead~2}}{s+p_{lead~2}} \quad \dfrac{s+z_{lag}}{s+p_{lag}} \quad \dfrac{s+z_{lead}}{s+p_{lead}} \quad \dfrac{K}{s^2(s+a)(s+b)} \right| = 1 \tag{39} \\ &\left| K_{new} \quad \dfrac{r_1+z_{lead~2}}{r_1+p_{lead~2}} \quad \dfrac{r_1+z_{lag}}{r_1+p_{lag}} \quad \dfrac{r_1+z_{lead}}{r_1+p_{lead}} \quad \dfrac{K}{r_1^2(r_1+a)(r_1+b)} \right| = 1 \nonumber\\ &K_{new} = 1 \nonumber \end{align} which means that the gain has not changed.

In [20]:
%% New phase-lead compensator
z_lead2 = x; % given zero lead right below the desired pole
f = 180 + atand(y/(x-z_lead2))+(180-atand(y/(x-z_lag)))...
+(180-atand(y/(x-z_lead))) - (180-atand(y/(x-p_lag)))-atand(y/(p_lead-x))...
-2*(180-atand(y/x))-atand(y/(a-x))-atand(y/(b-x));

% p_lead2 = y/tand(180+f) - x;
p_lead2 = y/tand(f) + x;
Gc_lead2 = (s+z_lead2)/(s+p_lead2);

% Calculating the new gain K with the lead 2 compensator
K_new = sqrt((-x+p_lead2)^2+y^2)*sqrt((-x+p_lag)^2+y^2)*...
sqrt((-x+p_lead)^2+y^2)*((-x)^2+y^2)*sqrt((-x+a)^2+y^2)*sqrt((-x+b)^2+y^2)/...
( sqrt((-x+z_lead)^2+y^2)*sqrt((-x+z_lag)^2+y^2)*sqrt((-x+z_lead)^2+y^2)*K )
Gol_lead2_lead_lag = K_new*Gc_lead2*Gol_lead_lag;
Gcl_lead2_lead_lag = feedback(Gol_lead2_lead_lag,1);

%% Verifing Ka = 40 
Ka_new = K_new*(z_lead2/p_lead2)*(z_lag/p_lag)*(z_lead/p_lead)*(K/(a*b));
ess_parabolic_new = a/Ka_new;
K_new =

    1.0095


Evaluation of the performance with the second Phase-Lead compensator

The open-loop of the new Phase-Lead compensator in series with the previous compensators is written as follows, \begin{align} G_{ol2} &= G_{lead~2}~G_{lag}~G_{lead} ~G(s) \tag{40}\\ G_{ol2} &= \dfrac{s+1.38}{s+1.48}\quad \dfrac{s+0.14}{s+0.0092} \quad \dfrac{s+1}{s+8.36} \quad \dfrac{10047}{s^2(s+9)(s+50)} \nonumber\\ \end{align} and the Pre-filter with the closed-loop systems is, \begin{align} G_{lag+lead+prefilter} &= G_{pf}~ \dfrac{G_{ol2}}{1+G_{ol2}} \tag{41} \\ G_{lag+lead+prefilter} &= G_{pf}~ \dfrac{10047(s+1.38)(s+1)(s+0.14)}{(s+8.36)(s+1.48)(s+0.009)s^2(s+9)(s+50)} \nonumber \end{align}

Matlab script

In [21]:
%% Comparing the new compensator of the previous designs.
fig = figure(9);
rlocus(Gcl_lead2_lead_lag)
hold on;
% ploting the s1 and zeta in the rlocus
n = 0:1:160; m = n*sqrt(zeta^2/(1-zeta^2));
axis ([ -4 1 -4 4]);
plot (-m,n,'--'); % zeta
plot (-x,y,'rd');

In [22]:
fig = figure(10);
% step(Gcl_lead2_lead_lag,Gpf*Gcl_lead2_lead_lag)
step(Gcl_lead,Gpf*Gcl_lead,Gcl_lead_lag,Gpf*Gcl_lead_lag,...
Gcl_lead2_lead_lag,Gpf*Gcl_lead2_lead_lag)
legend('Lead','Pre-filter+Lead','Lead+Lag','Pre-filter+Lead+Lag'...
,'Lead 2+Lead+Lag','Pre-filter+Lead2+Lead+Lag','Location','southeast');
stepinfo(Gpf*Gcl_lead2_lead_lag)
ans = 

  struct with fields:

        RiseTime: 0.9670
    SettlingTime: 1.6766
     SettlingMin: 0.9081
     SettlingMax: 1.0125
       Overshoot: 1.2543
      Undershoot: 0
            Peak: 1.0125
        PeakTime: 2.0002


In [23]:
fig = figure(11);
margin(Gcl_lead2_lead_lag);
BW_lead2_lead_lag = bandwidth(Gcl_lead2_lead_lag); % bandwidth

In [24]:
fig = figure(12);
margin(Gpf*Gcl_lead2_lead_lag);
BW_lead2_lead_lag_prefilter = bandwidth(Gpf*Gcl_lead2_lead_lag); % bandwidth

Performance results

From the root-locus plot, it can be seen that the desired closed-loop poles are exactly in the root locus. Also, the Bode plot shows that the $PM$ has changed a little with respect of the previous compensated system, from $36.60°$ to $39.50°$. On the other hand, the step response has been improved with the Pre-filter and the new Phase-Lead compensator, see Table 3.

Table 3: Performance results
Quantity Lead Prefilter+Lead Lead+Lag Prefilter+Lead+Lag Lead_2+Lead+Lag Prefilter+Lead_2+Lead+Lag
Rise Time 0.37 1.00 0.36 0.94 0.37 0.97
Settling Time 2.79 3.08 3.59 3.31 2.87 1.68
Percentage Overshoot 51.46 0.07 57.96 1.79 55.00 1.25
Phase Margin 40.80 -180 36.60 36.60 39.50 -180
Gain Margin 8.96 7.07 8.51 8.51 8.79 6.79
Bandwidth 4.87 2.31 4.89 2.58 4.88 2.42
Peak Magnitude 1.51 1.00 1.58 1.02 1.55 1.01

Conclusion

The settling time requirement $t_s\leq2.9$ was satisfied by three of the six compensators, and only the last one with the Pre-filter achieved the desired overshoot $PO\leq 20 \%$. It is clear that the use of the Pre-filter reduces the overshoot drastically.

Comentarios

Comments powered by Disqus