Target system!velocity control of In this section, we will design a PI controllerProportional-integral (PI) control for the target electromechanical system. The T1 target system has a current amplifier, so the analysis of Section 8.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 Chapter A).
The controller design requirements for the closed-loop system are:
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.
Design point Dominant poles The settling time requirement is associated with the second-order approximation \[ T_S = \frac{4}{\zeta \omega_n}. \] According to fig:pole-plot-second-order, 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 psiThe imaginary part of the design point is not determined by the requirements. Dominant poles Design point
Motors!models of!current sourceFrom Equation 5.17, 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).
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 TFThe unity feedback transfer function \(H\) can be defined as
H = tf([1], [1]); % feedback transfer functionMotors!models of!current source
The open-loop transfer function is \(G_P H\), so the root locusRoot locus can be generated withrlocus()
figure;
rlocus(GP * H); % root locus
xlim([-40, 0]);The root locus is shown in fig:root-locus-ye-P. Choosing the point at \(\Re(s) = -20\),
K1 = 0.062; % from root locusIntegral compensation [@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 8.16, 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 gainThe compensated root locus, shown in fig:root-locus-ye-PI, 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 locusThe continuous PI controller \(G_C\), then, is given by
GC = K1 * K2 * CI_sans;Integral compensation
DiscretizationTustins method@Tustin's method The closed-loop transfer function (Equation 8.4) can be defined with
GCL = GC * GP / (1 + GC * GP * H); % closed-loop tfA 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,c2d()c2d() 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. DiscretizationTustins method@Tustin's method
To evaluate the performance of the control system, we should simulate its step response. Let's use a command of \(500\) RPM:step()
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 fig:ye-step-response. 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.
Control effortIt 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 withstep()
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 fig:ye-step-response. 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 fig:ye-step-response. The maximum voltage required is less than \(8\) V, which is below the source voltage. Control effort
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 Exercise 8, 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/radThis returns
KP = 0.103540
KI = 2.070800
This completes the root locus controller design for the T1a specific target system.
Base set of controller gainsThe base set of controller gains for Lab Exercise 8 will be derived analytically in this section. The root locus technique described in 94,kb,al,ru,vm 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 Equation 8.21, repeated here:Closed-loop transfer function \[ \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 Equation 8.5, 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 Section 8.6.4), we will place the zero significantly leftward of the plant pole at \(-1/\tau\); that is, \[ Z \ll -\frac{1}{\tau}\quad, \] 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 Equation 8.21, we let \[ \tau' = -1/Z. \]
From the closed-loop transfer function of Equation 8.21, 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'. \] To coincide with the root locus design technique from 94,kb,al,ru,vm, we make the following assumption: \[ \Re(\psi) < -\frac{1}{\tau}. \]
With Equation 8.25, Equation 8.26, Equation 8.27, Equation 8.28 as design constraints on \(\tau'\), \(\omega_n'\), and \(\zeta'\), let us reexamine their definitions in terms of the system parameters and controller gains; from Equation 8.22, \[ \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 Equation 8.26 we have the relationship: \[ K_P = -\frac{1}{Z} K_I. \] 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 [@eq:dp-kpki2-kp;@eq:dp-kpki2-ki] into Equation 8.29 and solving the result simultaneously with the constraint in Equation 8.27, 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))}. \] Substituting these solutions for \(\omega_n'\) and \(\zeta'\) in Equation 8.30 into [@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} \] 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 Equation 8.31. 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 Section 8.6.6.
In Section 8.6.1, we established that the design point should have real part \[ \Re(\psi) = -4/T_S = -20\text{ rad/s}, \] which is based on a target settling time of \(0.2\) s. In Lab Exercise 8, the base set of gains will be Equation 8.31 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 Section 8.6.6 should be applied.
Closed-loop transfer function Base set of controller gains Proportional-integral (PI) control Target system!velocity control of Root locus