S951 of 55
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

S9 · Lesson 51 · Project

Modeling a DC motor with angle, speed and current as states, designing state feedback and an observer by pole placement, and simulating the observer-based servo with a saturating 12 V amplifier to check overshoot, settling and estimator convergence

This project puts the second half of the course to work on one real plant: the DC motor from lesson 2, now turning a shaft whose angle you want to control, with only the angle measured. You'll write its three-state model, place the controller's and the observer's poles, and simulate the whole loop with an amplifier that clips at ±12 V. The tests check what a bench test would: overshoot and settling time for a small step, graceful behavior when a large step saturates the amplifier, and an observer that finds the true state after starting out wrong.

Predict

The design places the controller's poles at −60 ± j60 and −600. A 1 rad step then needs at most 4.4 V. What happens on a 5 rad step with a 12 V amplifier?

Name it

The model

With states x = (θ, ω, i) and input voltage V:

θ˙=ω,Jω˙=Kti−bω,Li˙=V−Ri−Keω
A=(0100−b/JKt/J0−Ke/L−R/L),B=(001/L),C=(100)

For R = 2 Ω, L = 0.5 mH, Kt=Ke = 0.05, J = 2 × 10⁻⁵ kg·m², b = 10⁻⁵: poles at 0, −64.0 and −3936 s⁻¹.

The design

  • Controller: dominant poles at −60 ± j60 (ζ = 0.707, ωn = 84.9 rad/s) and a third at −600, ten times farther out. Ackermann (lesson 50) gives K = (0.864, −0.0342, −1.640) and kr = 0.864.
  • Observer: −300 ± j300 and −5000, five times faster than the controller, computed by duality as place(A.T, C, poles).
  • Simulation: RK4 on the plant and observer together, with u=clip(krr−Kx^,±12 V), the observer driven by the clipped u that the plant actually receives.

Why the observer gets the clipped input

If the observer were fed the unclipped command while the plant got the clipped one, the model and the plant would diverge every time the amplifier saturated, and the estimate would be wrong exactly when it matters. Feeding the model the actual applied input keeps the estimation error obeying e˙=(A−LC)e, saturated or not.

Worked example

Why is the current gain in K negative?

Show the solution
  1. The two poles. The motor's electrical pole is at −3936, but the design asks for a third pole at −600.
  2. Feedback can slow a pole. State feedback can slow a pole as well as speed it up. The current row of A − BK has on its diagonal −R/L−k3/L=−4000+3280=−720
  3. What the negative gain does. A negative current gain feeds back positively on current, so the controller weakens the motor's natural current regulation.
  4. The alternative. Placing the third pole near the electrical one instead would need much larger gains and a noisier current loop.

Answer the design puts the third pole at −600, much slower than the motor's electrical pole at −3936, and a negative current gain is what slows it.

Worked example

What does the observer do in the first few milliseconds after it starts 0.1 rad wrong?

Show the solution
  1. Error dynamics. The error obeys e˙=(A−LC)e, with poles at −300±j300,−5000
  2. The fast pole. It removes part of the error within about a millisecond.
  3. The slower pair. It decays as e−300t, falling to 0.1% of the initial error by about 23 ms, well before the controller's 72 ms settling.
  4. What the test checks. That the largest error is below 0.001 after 50 ms.

Answer the fast pole removes part of the error within a millisecond, and the rest decays as e−300t, down to 0.1% by about 23 ms.

Check

Step 1. Write motor_model(R, L, Kt, J, b): the three-state motor.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 2. Write design(A, B, C, ctrl_poles, obs_poles): state feedback, observer and reference gain.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 3. Write simulate(...): the observer-based servo with a saturating amplifier.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why can the controller and the observer be designed separately even though the controller uses the observer's estimate?

Practice

Keep practicing

3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.