Control Engineering I · Week 10 · DC Motor Disturbance Rejection

English translation

Edit the code and response fields in your own copy. Name: ⟦enter here⟧ / Student ID: ⟦enter here⟧

How to run

In Live Editor, click inside the code and run the current section with Run Section (Windows/Linux Ctrl+Enter, Mac ⌘+Enter). Run executes the entire document. Edit the explanations and response fields directly.
Initially run from the top, and rerun any section whose values you change. If an undefined-variable error occurs, run the preceding sections first. Outputs appear below or to the right of the code.
Environment: MATLAB Online and Control System Toolbox.

1. Derive the model and calculate gain

  • TdT_d (input): Disturbance Torque.
  • ω (output): Angular velocity deviation from the operating point [rad/s].
  • VaV_a: change in armature voltage.
  • i: Change in armature current.
  • Model assumption: Neglect armature inductance.
Symbol
Meaning
Value
RaR_a
Armature Resistance
1
KmK_m
Torque Constant
0.1
KbK_b
Back EMF Constant
0.1
J
Moment of Inertia
0.01
b
Viscous Friction Coefficient
0.001
KtK_t
Tachometer Gain
0.05
Motor equations:
  • Va=−KaKtωV_a=-K_aK_t\omega
  • i=Va−KbωRai=\frac{V_a-K_b\omega}{R_a}
  • Jdωdt+bω=Kmi+TdJ\frac{d\omega}{dt}+b\omega=K_mi+T_d
  1. Substitute the expression for VaV_a into the expression for current i. Then substitute the resulting expression for i into the equation of motion, and rearrange as a differential equation relating ω and TdT_d.
  2. Set the initial conditions to 0 and apply the Laplace transform to this differential equation. Collect terms containing Ω(s)\Omega(s) on one side, then find Ω(s)Td(s)\frac{\Omega(s)}{T_d(s)}.
  3. Record the numerator and denominator of your derived transfer function as separate coefficient arrays, in descending powers.
Find: The minimum amplifier gain satisfying the tolerance condition.
  • Constant disturbance: Td=D=0.2T_d=D=0.2.
  • Steady-state tolerance: |ωss|≤0.5|\omega_{ss}|\le0.5 rad/s.
  • Amplifier gain range: Ka≥0K_a\ge0.
  • Motor coefficients: values in the table above.
  1. Substitute Td=DT_d=D, dωdt=0\frac{d\omega}{dt}=0, and ω=ωss\omega=\omega_{ss} into the differential equation derived above. Divide both sides by the coefficient of ωss\omega_{ss} to express ωss\omega_{ss} as a function of KaK_a.
  2. Substitute that expression into the tolerance condition |ωss|≤ωlimit|\omega_{ss}|\le\omega_{\mathrm{limit}}. Insert D=0.2D=0.2, ωlimit=0.5\omega_{\mathrm{limit}}=0.5, and the motor coefficients from the table, and find the range of KaK_a that satisfies the condition.
  3. Record the smallest value in the range you found as Ka,minK_{a,\min}. Include the expression for ωss\omega_{ss}, the inequality with numerical values substituted, and the allowed range and minimum of KaK_a. Use this record for the later comparison with MATLAB calculations.
Before execution — Hand-calculated expressions and values: ⟦write calculations here⟧ After execution — MATLAB output values to compare: ⟦write output values here⟧

2. Open-loop Disturbance Step Response

The baseline is Ra=1,Km=Kb=0.1,J=0.01,b=0.001.
Prediction before running: ⟦enter here⟧
Ra=1;Km=.1;Kb=.1;J=.01;b=.001;D=.2;
Gd=tf(1,[J b+Km*Kb/Ra]);
finalValue=D*dcgain(Gd);disp(finalValue);
figure;step(D*Gd,0:.01:8);grid on;
Do it yourself:
Use Gd=tf(1,[J b+Km*Kb/Ra]) defined in the Open-loop Disturbance Step Response code. Keep Ra,Km,Kb,J,b at the values defined there.
Condition
D
1
0.1
2
0.2
3
0.3
  1. For each condition, calculate ωss=D⋅dcgain(Gd)\omega_{ss}=D\cdot\mathrm{dcgain}(G_d) [rad/s].
  2. Record the following three columns in one table.
  • D
  • ωss\omega_{ss} [rad/s]
  • ωss/D\omega_{ss}/D
  1. Compare ωss/D\omega_{ss}/D across the three rows. State whether the ratio is constant and how this result demonstrates proportionality between D and ωss\omega_{ss}.
% ✍ Your code: add your own code below.
Changed condition: ⟦enter here⟧
Observed result: ⟦enter here⟧
Differences from the prediction and their causes: ⟦enter here⟧

3. Disturbance rejection with tachometer feedback

Use the positive disturbance direction as the reference.
Prediction before running: ⟦enter here⟧
Ra=1;Km=.1;Kb=.1;J=.01;b=.001;Kt=.05;D=.2;Ka=20;
Go=tf(1,[J b+Km*Kb/Ra]);Gc=tf(1,[J b+Km/Ra*(Kt*Ka+Kb)]);
figure;step(D*Go,D*Gc,0:.005:8);legend('Open-loop disturbance','Feedback disturbance');grid on;
disp([D*dcgain(Go),D*dcgain(Gc)]);
Do it yourself:
Keep Ra,Km,Kb,J,b,Kt and D=0.2D=0.2 in the disturbance-rejection code with tachometer feedback unchanged; change only KaK_a.
Condition
KaK_a
1
10
2
20
3
40
  1. For each KaK_a, rebuild Gc and find dcgain(Gc).
  2. Multiply each DC gain by D to find ωss\omega_{ss} [rad/s].
  3. Record KaK_a, DC gain, and ωss\omega_{ss} in three columns.
  4. Compare the symbolic coefficient arrays derived in activity 1 with the coefficient expressions written in this activity’s code.
  5. Find the first and second arguments of the tf call defining Gc, and record them as the numerator and denominator coefficient arrays, respectively.
  6. For each representation, divide its entire numerator and denominator by its leading denominator coefficient so that this coefficient becomes 1.
  7. Use two rows (numerator and denominator) and three columns (derived array, code array, and whether they agree). Compare coefficients at the same power and mark any differing terms.
% ✍ Your code: add your own code below.
Changed condition: ⟦enter here⟧
Observed result: ⟦enter here⟧
Differences from the prediction and their causes: ⟦enter here⟧

4. Design the amplifier gain

If decimal values are allowed for Ka, use the calculated minimum. If only integers are allowed, use the smallest integer no smaller than that value.
Prediction before running: ⟦enter here⟧
Ra=1;Km=.1;Kb=.1;b=.001;Kt=.05;D=.2;limit=.5;
Ka_min=max(0,(abs(D)/limit-b-Km*Kb/Ra)/(Km*Kt/Ra));
disp([Ka_min,ceil(Ka_min)]);
Do it yourself:
Keep D=0.2D=0.2 and the motor coefficients from the preceding activity. Apply each of the two tolerances below.
  1. First calculate the minimum gain using D=0.2D=0.2 and limit=0.5 from your hand calculation. In the amplifier gain design code, Ka_min is the calculated value of Ka,minK_{a,\min}. Record this output beside the value found by hand in activity 1.
  2. Calculate the minimum KaK_a for each limit. The calculated Ka,minK_{a,\min} corresponds to Ka_min in the code; decimal gains are allowed.
Condition
limit [rad/s]
1
0.25
2
1
  1. Choose one KaK_a slightly below and one KaK_a above the minimum you found. Examples: 0.9Ka,min0.9K_{a,\min}, 1.1Ka,min1.1K_{a,\min}.
  2. Substitute each gain into the feedback model Gc, rebuild the model, and find ωss=D⋅dcgain(Gc)\omega_{ss}=D\cdot\mathrm{dcgain}(G_c).
  3. Record the calculations for all conditions in one table.
Tolerance [rad/s]
limit
Calculated minimum gain
Ka,minK_{a,\min}
Gain applied to the model
KaK_a
Steady-state angular velocity deviation [rad/s]
ωss\omega_{ss}
Tolerance satisfied?
|ωss|≤limit|\omega_{ss}|\le\mathrm{limit}: true/false
  1. Describe how gains below and above the minimum differ in meeting the tolerance. Use this table to judge whether the calculated minimum separates the two cases.
% ✍ Your code: add your own code below.
Changed condition: ⟦enter here⟧
Observed result: ⟦enter here⟧
Differences from the prediction and their causes: ⟦enter here⟧

Practice through repetition and check before submission

Summarize the three conditions compared in the preceding hands-on activities below. You do not need to repeat experiments already completed. Predictions may state increasing or decreasing trends instead of exact values.
Repetition 1 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Actual result: ⟦enter here⟧
Trial 2 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Observation: ⟦enter here⟧
Trial 3 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Observation: ⟦enter here⟧
Optional:
Example: treating the last simulation sample as a steady-state value
  1. Keep the motor coefficients Ra,Km,Kb,J,b,Kt at their values from the preceding activity. Set Ka=20 and D=0.2, create Gc=tf(1,[J b+Km/Ra*(Kt*Ka+Kb)]), then find the last value of step(D*Gc,0:0.005:0.05).
  2. Record that value beside D*dcgain(Gc) and calculate the difference. Determine whether convergence is sufficient at 0.05 s.
  3. For the same Gc, increase the end time from 0.05 s to 8 s, keeping the time step at 0.005 s. Run [y_long,t_long]=step(D*Gc,0:0.005:8), then find the difference between y_long(end) and D*dcgain(Gc). Compare it with the earlier difference at 0.05 s.
Include code, actual outputs and plots, and your own interpretation. Submit through KLAS; check the semester schedule and latest announcements for the deadline.
Filename: Name_StudentID_Week10.mlx.