RTC Website

The target controller design

TX

In this section, we will design a PI controller for the target electromechanical system. The T1 target system has a current amplifier, so the analysis of subsection 7.5.2 holds. We will use the parameters of the T1a specific target system for concreteness, but the design process is similar for any T1 system (see appendix A).

The controller design requirements for the closed-loop system are:

  • A settling time \(T_S\) of around \(0.2\) s
  • Zero steady-state error for a step command
  • The control effort required to step from \(0\) to \(500\) revolutions per minute (RPM) is within the capabilities of the current amplifier

A PI controller is a good candidate for these requirements because a proportional controller can be used to design for the transient response requirement, and an integral compensator can be used to design for the steady-state error.

Setting the design point

The settling time requirement is associated with the second-order approximation \[ T_S = \frac{4}{\zeta \omega_n}. \] According to , the denominator \(\zeta \omega_n\) is the negative of the real part of the design point \(\psi\), that is, \[ \Re(\psi) = -\zeta \omega_n. \] So we would like to have a dominant closed-loop pole at \(\psi\) such that \[ \Re(\psi) = -\frac{4}{T_S} = -20\text{ rad/s}. \]

In MATLAB,

Ts = 0.2;                     % s ... design settling time
psi_r = -4 / Ts;              % real part of design point psi

The imaginary part of the design point is not determined by the requirements.

Defining the continuous system model

From eq. ¿eq:motor-tf-is?, the electromechanical system transfer function \(G_P(s) = \Omega_J(s)/U_a(s)\), including the amplifier gain \(K_a\) (A/V), is \[ G_P(s) = K_a K_M \frac{1}{J s + B}\ , \] where \(K_M\) is the motor constant (N\(\cdot\)m/A), \(B\) is the damping coefficient (N\(\cdot\)m\(\cdot\)s/rad), and \(J\) is the moment of inertia (N\(\cdot\)m\(\cdot\)s\(^2\)/rad).

Getting the T1a Parameters

The T1a specific target system parameters are available in a .mat file at the Uniform Resource Locator (URL) https://github.com/rtc-book/source/blob/085ae7ff3676306939b105a3ca169985b25395c6/matlab/elmech_params/elmech_params_T1a.mat Load the file filename with

load(filename);

Variable p, a structure, will be loaded into the current workspace. The parameters can be accessed with, for instance, p.R for the motor winding resistance. See the variable p_doc for documentation of the parameters.

For other target system parameters, see the following repository: https://github.com/rtc-book/source/tree/main/matlab/elmech_params

With the parameters loaded into the struct p, the transfer function can be defined as

GP = tf([p.Ka * p.Km], [p.J, p.B]);  % electromech. system TF

The unity feedback transfer function \(H\) can be defined as

H = tf([1], [1]);               % feedback transfer function

Proportional controller design

TX

The open-loop transfer function is \(G_P H\), so the root locus can be generated with

figure;
rlocus(GP * H);                 % root locus
xlim([-40, 0]);

The root locus is shown in . Choosing the point at \(\Re(s) = -20\),

K1 = 0.062;                     % from root locus

Integral compensation

TX

Eq. ¿eq:motor-tf4? shows that the electromechanical system has no integrators and no differentiators, so an integral compensator should make the steady-state error zero. Considering figure 7.20, we observe that, if the PI compensator zero \(Z_I\) is between the plant pole and the origin, the root locus is significantly different than if the zero is left of the plant pole. The plant pole, which is at \(-B/J\), depends on the damping \(B\), which is not a well-known parameter (and can vary with temperature). This means that designs for which the compensator zero and the plant pole are in close proximity are not very robust. However, if we place the compensator zero sufficiently far left of the plant pole, uncertainties and variations in \(B\) will have little effect on the control system. Therefore, we place \(Z_I\) at \(-20\) and construct the compensator transfer function without the gain:

ZI = -20;                       % compensator zero
s = tf([1, 0], [1]);            % s as tf object
CI_sans = (s - ZI) / s;         % compensator sans gain

The compensated root locus, shown in , is given by

figure;
rlocus(CI_sans * K1 * GP * H);
xlim([-40, 0]);

The root locus has been significantly affected by the compensator. However, the desired \(\Re(s) = -20\) can still be achieved with another gain \(K_2\):

K2 = 1.67;                      % from root locus

The continuous PI controller \(G_C\), then, is given by

GC = K1 * K2 * CI_sans;

Closing the loop and discretization

TX

The closed-loop transfer function (eq. ¿eq:gcl?) can be defined with

GCL = GC * GP / (1 + GC * GP * H); % closed-loop tf

A discrete model can be developed by discretizing each of the loop transfer functions. With a sample rate of \(T = 5\) ms and Tustin’s method, we get the following:

T = 5e-3;                                 % s ... sample period
GCd = c2d(GC, T, 'Tustin');               % using Tustin's method
GPd = c2d(GP, T, 'Tustin');
Hd = c2d(H, T, 'Tustin');
GCLd = GCd * GPd / (1 + GCd * GPd * Hd);  % discrete closed-loop tf

The discrete controller transfer function GCd can be made into a difference equation for programming purposes. Let us first predict its performance.

Simulation and evaluation

To evaluate the performance of the control system, we should simulate its step response. Let’s use a command of \(500\) RPM:

R_rpm = 500;                      % RPM ... command angular velocity
R_rads = R_rpm * 2 * pi / 60;     % rad/s
t = 0:T:0.3;                      % time array
Omega = R_rads * step(GCL, t);    % continuous step response
Omegad = R_rads * step(GCLd, t);  % discrete step response

The results are shown in the upper plot of figure 7.22. We see that the discrete controller performs similarly to the continuous controller. The steady-state error is zero and the settling time can be verified with stepinfo() to be \(T_S \approx 0.177\) s, close to the design requirement. The overshoot is about \(20\) percent, which is reasonable for this application.

It is important to ensure that the required control effort is within the capabilities of the current amplifier. The transfer function for the control effort \(U\) over command \(R\) is \[ \frac{U(s)}{R(s)} = \frac{G_C(s)}{1 + G_C(s) G_P(s) H(s)}. \] Using the discrete versions and defining the transfer function as U_R, we can simulate the control effort with

U_R = GCd / (1 + GCd * GPd * Hd);  % V, control effort cl tf, ampl. in.
u = R_rads * step(U_R, t);         % V, amplifier input voltage
u_c = u * p.Ka;                    % amplifier output current

The scaling by R_rads uses superposition to give the amplifier input voltage. Recall that the amplifier gain is included in the model, so to compute the amplifier output, we must scale u by the amplifier gain Ka to get the amplifier output current u_c. This is shown in the lower plot of figure 7.22. The required current is well below the maximum current of the amplifier.

The amplifier’s output voltage is limited by its power supply voltage, so we should also compute the required voltage. This is given by the loop equation \[ v_S = v_R + v_L + v_M = I_S R + L \frac{d I_S}{d t} + K_M \Omega_J. \] In MATLAB, we can estimate the derivative with the diff() function such that

u_v = p.R * u_c(1:end - 1) + ...   % V, amplifier output voltage
      p.L * diff(u_c)/T +  ...
      p.Km * Omegad(1:end - 1);

The amplifier output voltage u_v is also shown in the lower plot of figure 7.22. The maximum voltage required is less than \(8\) V, which is below the source voltage.

Therefore, all the controller design requirements have been achieved with our design for the T1a specific target system. While the particulars of the design differ for different specific T1 systems, the design process should proceed in a similar manner.

In lab 7, we will implement this controller. The proportional and integral gains \(K_P\) and \(K_I\) are easily computed from the design given here as follows:

KP = K1 * K2;                      % V/(rad/s)
KI = -ZI * KP;                     % V/rad

This returns

KP = 0.103540
KI = 2.070800

This completes the root locus controller design for the T1a specific target system.

The base set of controller gains

The base set of controller gains for lab 7 will be derived analytically in this section. The root locus technique described in subsection 7.6.2, subsection 7.6.3, subsection 7.6.4, subsection 7.6.5, subsection 7.6.6 is recommended for most PI controller designs; however, the first-order plant model allows us to design analytically, based on the closed-loop transfer function of eq. ¿eq:vel-i-cl-tf?, repeated here: \[ \frac{\Omega_J}{\Omega_R} = \frac{K_a G_C G_P}{1 + K_a G_C G_P H} = \omega_n'^{\,2} \frac{\tau' s + 1}{s^2 + 2 \zeta' \omega_n' s + \omega_n'^2} \]

From eq. ¿eq:GCL-root-locus-num-den?, we can see that the closed-loop zero will equal the open-loop zero \(Z\). For a PI controller, the zero is typically placed near the origin to cancel the effects of the integrator pole. However, to ensure the robustness of the design (see subsection 7.6.4), we will place the zero significantly leftward of the plant pole at \(-1/\tau\); that is, \[ Z \ll -\frac{1}{\tau}\quad, \qquad{(1)}\] where \(\tau = J/B\) is the plant’s time constant and \(-1/\tau\) is the plant’s pole location. In terms of the closed-loop transfer function of eq. ¿eq:vel-i-cl-tf?, we let \[ \tau' = -1/Z. \qquad{(2)}\]

From the closed-loop transfer function of eq. ¿eq:vel-i-cl-tf?, the closed-loop poles are \[ p_1, p_2 = -\zeta'\omega_n' \pm \omega_n' \sqrt{\zeta'^2-1}. \] Let us restrict the closed-loop system design to be underdamped, \(\psi \in (0,1)\). Then \[ \Re(\psi) = -\zeta'\omega_n'. \qquad{(3)}\] To coincide with the root locus design technique from subsection 7.6.2, subsection 7.6.3, subsection 7.6.4, subsection 7.6.5, subsection 7.6.6, we make the following assumption: \[ \Re(\psi) < -\frac{1}{\tau}. \qquad{(4)}\]

With eqns. 1-4 as design constraints on \(\tau'\), \(\omega_n'\), and \(\zeta'\), let us reexamine their definitions in terms of the system parameters and controller gains; from eq. ¿eq:vel-i-cl-tf-params?, \[ \tau' = \frac{K_P}{K_I}, \quad \omega_n' = \sqrt{\frac{K_a K_M K_I}{J}},\text{ and} \quad \zeta' = \frac{B + K_a K_M K_P}{2 \sqrt{J K_a K_M K_I}}. \]

From the definition of \(\tau'\) and the constraint in eq. 2 we have the relationship: \[ K_P = -\frac{1}{Z} K_I. \qquad{(5)}\] From the definitions of \(\omega_n'\) and \(\zeta'\), we can solve for gains \(K_P\) and \(K_I\): \[\begin{align} K_P &= \frac{2 J \zeta' \omega_n' - B}{K_a K_M}\quad\text{and} \label{eq:dp-kpki2-kp}\\ K_I &= \frac{J \omega_n'^2}{K_a K_M}. \label{eq:dp-kpki2-ki} \end{align}\] What remains is to express \(\omega_n'\) and \(\zeta'\) in terms of \(\psi\) and \(Z\).

Substituting the solutions for \(K_P\) and \(K_I\) in eqns. ¿eq:dp-kpki2-kp?, ¿eq:dp-kpki2-ki? into eq. 5 and solving the result simultaneously with the constraint in eq. 3, we obtain the solution \[ \omega_n' = \sqrt{Z \left(B/J + 2 \Re(\psi)\right)} \quad\text{and}\quad \zeta' = \frac{-\Re(\psi)}{Z(B/J + 2 \Re(\psi))}. \qquad{(6)}\] Substituting these solutions for \(\omega_n'\) and \(\zeta'\) in eq. 6 into eqns. ¿eq:dp-kpki2-kp?, ¿eq:dp-kpki2-ki? yields the design equations \[ \begin{aligned} K_P &= -\frac{B + 2 J \Re(\psi)}{K_a K_M}\text{ and} \\ K_I &= \frac{Z \left(B + 2 J \Re(\psi)\right)}{K_a K_M}. \end{aligned} \qquad{(7)}\] Specifying the real part of the design point \(\Re(\psi) < -1/\tau\) and the controller zero \(Z \ll -1/\tau\) determines the gains \(K_P\) and \(K_I\) in eq. 7. This is a more general result than that of the root locus design procedure above, which resulted in the \(K_P\) and \(K_I\) given in subsection 7.6.6.

In subsection 7.6.1, we established that the design point should have real part \[ \Re(\psi) = -4/T_S = -20\text{ rad/s}, \qquad{(8)}\] which is based on a target settling time of \(0.2\) s. In lab 7, the base set of gains will be eq. 7 with \(\Re(\psi) = -20\) rad/s and \(Z = -20\) rad/s.

We do not have a guarantee that the closed-loop transfer function will yield the target settling time of \(T_S = 200\) ms because the presence of the zero makes the equality \(T_S = 4/\Re(\psi)\) an approximation, and perhaps a poor one at that given that the zero is near the poles. To check the quality of the approximation and estimate the rise time, the simulation techniques of subsection 7.6.6 should be applied.

Online Resources for Section 7.6

No online resources.