Skip to content
LumenaryAcademy
Systems 75 min

Control of mechanical systems

Feedback from the machine designer's side — cruise control, positioning tables and hydraulic presses; PID tuned on a mass–spring–damper; what happens when the actuator runs out; and why stiffness, sensors and resonances decide how good a control loop can be.

Code tested · 5AI-draftedAwaiting review by a mechanical engineer

Your guides: Chloe · The Designer, Margaret · The Test Engineer, Gideon · The Checker

MotivationH

Machines that correct themselves

Set a van's cruise control to 90 km/h and drive onto a long hill. Nobody touches the accelerator, yet the engine opens up as the road climbs and eases off at the top. A milling machine moves its table to a position a few micrometres from where the program says, however hard the cutter pushes back. A hydraulic press lowers its ram quickly, slows as the die meets the sheet metal, and then squeezes with exactly the force the part needs, no more. Each machine measures what it is doing, compares it with what it should be doing, and corrects the difference. That is feedback.

Lumenary EE's feedback control and Lumenary Robotics' feedback and PID teach the theory in depth: transfer functions, root loci, stability margins, Ziegler–Nichols tuning and digital implementation. This lesson is the mechanical engineer's view. The machine being controlled, the plant, is what mechanical engineers design, and its mass, stiffness, friction and actuators decide what any controller can achieve. A brilliant controller on a flimsy machine is still a flimsy machine. A machine designed with its control loop in mind, stiff where it matters, light where it moves, measured in the right places, can be controlled fast and precisely with a quite ordinary controller.

IntuitionH

The loop around a machine

controlleractuator limitmachinesensorreuFdy−+
The feedback loop around a machine. The controller compares the set-point r with the measured output and commands the actuator, whose force is limited; disturbances d (a hill, a cutting force, a change of load) act on the machine directly. The negative sign at the first junction is what makes the loop correct errors rather than amplify them.

Why not simply work out the right command in advance? Because the world does not cooperate. Suppose the van's engine control is set, open loop, to the throttle that holds 90 km/h on a level road. On a 6 per cent climb the road asks for 2.1 kN of tractive force instead of 0.6 kN, and the van slows steadily, regardless of how carefully the flat-road setting was calibrated. Feedback measures the result instead of trusting the calculation, so it corrects for hills, headwinds, a full load and a worn engine alike: disturbances and modelling errors it was never told about.

It does this at a price, and the price is paid in the mechanical world. The correction needs an actuator that can deliver more than the steady force: an engine with power in reserve, a motor that can push hard for a moment, a pump that can supply flow quickly. It needs a sensor that measures the right thing in the right place. And it needs a machine whose response to the actuator is predictable enough that correcting harder does not make it shake. The rest of the lesson is about those three requirements.

DefinitionsH

PID and how a machine's loop is judged

Most machine loops are still PID loops. With error e=r−ye = r - y, the controller commands

u(t)=Kp e(t)+Ki∫0te dτ+Kd dedt.u(t) = K_p\,e(t) + K_i\int_0^t e\,\mathrm d\tau + K_d\,\frac{\mathrm de}{\mathrm dt}.

The proportional term pushes in proportion to the error, like a spring pulling the machine towards the set-point; the derivative term opposes motion, like a damper; the integral term keeps pushing harder for as long as any error remains. For a mechanical plant that analogy is almost literal: proportional and derivative feedback on a mass add a "virtual" spring KpK_p and damper KdK_d to the real ones. (In practice the derivative usually acts on the measurement −y˙-\dot y rather than on e˙\dot e, so that a sudden change of set-point does not kick the actuator.)

Definition— step-response measures

For a step change of set-point: the rise time is the time to go from 10 to 90 per cent of the way (here, from 0 to 90 per cent); the overshoot is how far the output passes its final value, as a percentage; the settling time is when it last enters a band (2 per cent here) around its final value; and the steady-state error is the difference that remains. The bandwidth is roughly the highest frequency at which the output can still follow the set-point; a faster loop has a higher bandwidth.

Theorem— Steady-state error with and without integral action

A mass–spring–damper mx¨+cx˙+kx=Fm\ddot x + c\dot x + kx = F under proportional control F=Kp(r−x)F = K_p(r - x) with a constant set-point rr settles, if it settles, at x=rKp/(k+Kp)x = rK_p/(k + K_p), a steady-state error of rk/(k+Kp)rk/(k + K_p). If the controller contains an integral term and the closed loop is stable, the steady-state error to any constant set-point and any constant disturbance force is zero.

Proof

At a steady state x˙=x¨=0\dot x = \ddot x = 0, so the spring force equals the controller force: kx=Kp(r−x)kx = K_p(r - x), which gives x=rKp/(k+Kp)x = rK_p/(k + K_p) and e=r−x=rk/(k+Kp)e = r - x = rk/(k + K_p). With integral action, a steady state requires every signal in the loop to be constant, including the integral ∫e dτ\int e\,\mathrm d\tau; its rate of change is ee, so e=0e = 0. Stability guarantees that a steady state is reached. A constant disturbance only changes how large the integral becomes, not the conclusion.

∎

The proportional controller must leave an error, because only an error makes it push, and something (here the flexure spring, in the van the air drag and the hill) must be pushed against. Integral action removes it by remembering. EE's lesson proves the general version with the final-value theorem; the mechanical meaning is that the integrator learns the force the machine needs.

Example— Proportional cruise control on a hill

A loaded van of 2500 kg (CdA=1.0C_dA = 1.0 m², rolling-resistance coefficient 0.010) cruises at 90 km/h. The engine control applies the flat-road force, 620 N, plus a proportional correction of Kp=970K_p = 970 N for every m/s below the set speed. On a long 3 per cent climb the van settles where the extra force Kp eK_p\,e balances the extra resistance, which is 2.6 km/h below the set speed; on a 6 per cent climb, 5.3 km/h below. Raising KpK_p shrinks the error but never removes it. Adding an integral term does, but integral action has its own failure mode, as the simulation below shows.

ComputationC

PID tuned on a mass–spring–damper

A precision positioning stage often hangs its carriage on flexures, thin metal blades that bend instead of sliding, so there is no friction and no wear. The flexures make the carriage a mass on a spring. Here the carriage is 2.0 kg, the flexures give k=8.0k = 8.0 kN/m, and the damping is very light, c=8c = 8 N·s/m, so the stage alone rings at 10.1 Hz with a damping ratio of 0.032. A voice-coil actuator, a linear motor like a loudspeaker's, pushes it, and a sensor measures its position. The task is to move 2 mm and hold.

How should the gains be chosen? With PID on this plant (derivative on the measurement), the closed loop's characteristic polynomial is

ms3+(c+Kd)s2+(k+Kp)s+Ki=0.m s^3 + (c + K_d)s^2 + (k + K_p)s + K_i = 0 .

Three gains, three coefficients: the designer can put the three closed-loop poles anywhere. A simple, robust choice is all three at s=−ωs = -\omega, which means matching (s+ω)3=s3+3ωs2+3ω2s+ω3(s + \omega)^3 = s^3 + 3\omega s^2 + 3\omega^2s + \omega^3:

Kd=3mω−c,Kp=3mω2−k,Ki=mω3.K_d = 3m\omega - c, \qquad K_p = 3m\omega^2 - k, \qquad K_i = m\omega^3 .

This is pole placement, the technique Lumenary Robotics generalises in state space and LQR. Notice that the stage's own spring and damper are simply subtracted: the controller supplies whatever stiffness and damping the machine lacks.

python
import numpy as np

# A flexure-guided positioning stage: a 2 kg carriage held by flexures (a spring), lightly damped,
# pushed by a voice-coil actuator, with a position sensor. Task: move 2 mm and hold it there.
m, k, c = 2.0, 8.0e3, 8.0                    # kg, N/m, N s/m
r, dt, t_end = 2e-3, 1e-4, 1.0               # set-point (m), time step and duration (s)
print(f"the stage alone: {np.sqrt(k / m) / (2 * np.pi):.1f} Hz, damping ratio {c / (2 * np.sqrt(k * m)):.3f}")

def step_response(Kp, Ki, Kd, F_ff=0.0):
    """Simulate F = F_ff + Kp e + Ki * integral(e) - Kd * dx/dt, with e = r - x. The derivative acts
    on the measured position, so the step in set-point does not kick the actuator."""
    n = int(round(t_end / dt))
    x = v = integ = 0.0
    xs, Fs = np.empty(n), np.empty(n)
    for i in range(n):
        e = r - x
        integ += e * dt
        F = F_ff + Kp * e + Ki * integ - Kd * v
        v += (F - c * v - k * x) / m * dt         # semi-implicit Euler with 0.1 ms steps
        x += v * dt
        xs[i], Fs[i] = x, F
    return xs, Fs

def report(name, xs, Fs, final):
    """Rise time to 90 %, overshoot and 2 % settling time, all relative to the final value."""
    t = dt * np.arange(1, xs.size + 1)
    outside = np.nonzero(np.abs(xs - final) > 0.02 * final)[0]
    settle = "  > 1 s" if outside[-1] == xs.size - 1 else f"{1000 * t[outside[-1] + 1]:4.0f} ms"
    rise = 1000 * t[np.argmax(xs >= 0.9 * final)]
    over = max(0.0, 100 * (xs.max() - final) / final)
    print(f"{name:20s}{rise:6.1f} ms  {over:5.0f} %   {settle}  {100 * (r - final) / r:6.1f} %  {np.abs(Fs).max():6.0f} N")

# Pole placement: with PID the closed loop is m s^3 + (c + Kd) s^2 + (k + Kp) s + Ki = 0.
# Ask for a triple pole at s = -w, i.e. (s + w)^3 = s^3 + 3w s^2 + 3w^2 s + w^3, and match terms.
def pid_for(f_hz):
    w = 2 * np.pi * f_hz
    return 3 * m * w**2 - k, m * w**3, 3 * m * w - c       # Kp, Ki, Kd

Kp, Ki, Kd = pid_for(20.0)
print(f"PID for a triple pole at 20 Hz: Kp = {Kp:.0f} N/m, Ki = {Ki:.3g} N/(m s), Kd = {Kd:.0f} N s/m")
print("\ncontroller             rise   overshoot  settles  final error  peak force")
report("open loop, F = k r", *step_response(0, 0, 0, F_ff=k * r), final=r)
report("P", *step_response(Kp, 0, 0), final=r * Kp / (k + Kp))
report("PD", *step_response(Kp, 0, Kd), final=r * Kp / (k + Kp))
report("PID", *step_response(Kp, Ki, Kd), final=r)
report("PID, poles at 40 Hz", *step_response(*pid_for(40.0)), final=r)
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Read the table from the top. Open loop, applying the 16 N that would hold 2 mm, the stage overshoots by 91 per cent and is still ringing a second later: its own damping is almost nil. P alone, with the 20 Hz proportional gain, reacts quickly but rings even more, and stops 8.4 per cent short, exactly the k/(k+Kp)k/(k + K_p) of the theorem. PD adds damping: no overshoot, settled in 20 ms, but still 8.4 per cent short. PID removes the error, settling in 61 ms. Its 19 per cent overshoot is the integrator's doing: during the rise it accumulates more error than the 16 N holding force needs, and the surplus can only be discharged by overshooting. Industrial controllers reduce it by adding a feedforward of the known holding force, or by filtering the set-point; the poles stay where they are.

ComputationC

When the actuator runs out: saturation and windup

Every real actuator has limits: an engine's maximum power, a motor's peak torque and top speed, a valve's maximum flow, a cylinder's maximum pressure. When the controller asks for more than the actuator can give, the actuator saturates: it delivers its maximum, and the loop is temporarily open, because the output no longer responds to the controller. Two things follow. The machine responds more slowly than the linear design predicted, which is unavoidable. And the integral term, which keeps accumulating the error it cannot correct, winds up to a huge value that takes a long time to unwind once the actuator comes out of saturation. That second effect is avoidable.

The program drives the van of the example with a PI cruise controller, tuned by placing both closed-loop poles at 0.2 rad/s on its linearised model (gentle, as passengers like). The road is flat for 1 km, climbs at 6 per cent for 3 km, then is flat again. The engine can deliver at most 50 kW to the wheels, which at 90 km/h is 2000 N, slightly less than the 6 per cent climb needs. Anti-windup by clamping is the simplest fix: stop integrating while the actuator is saturated and the error would drive it further into the limit.

python
import numpy as np

# Cruise control for a loaded van on a motorway with a long hill.
m, g, rho = 2500.0, 9.81, 1.2               # mass (kg), gravity, air density (kg/m^3)
CdA, Crr = 1.0, 0.010                        # drag area (m^2), rolling-resistance coefficient
P_max, F_brake = 50e3, -3000.0               # most power the engine can deliver to the wheels (W);
                                             # strongest retarding force the controller may use (N)
v_set = 25.0                                 # set speed: 90 km/h

def resistance(v, grade):
    """Rolling resistance + aerodynamic drag + the slope's component of weight (N)."""
    theta = np.arctan(grade)
    return Crr * m * g * np.cos(theta) + 0.5 * rho * CdA * v**2 + m * g * np.sin(theta)

def road(x):
    """Gradient at position x (m): flat, then 3 km climbing at 6 %, then flat again."""
    return 0.06 if 1000.0 <= x < 4000.0 else 0.0

# PI tuning on the linearised model m dv/dt = F - b v, with b = d(drag)/dv at the set speed:
# closed loop m s^2 + (b + Kp) s + Ki = 0; choose w = 0.2 rad/s and damping ratio 1.
b = rho * CdA * v_set
w = 0.2
Kp, Ki = 2 * w * m - b, w**2 * m
print(f"PI gains: Kp = {Kp:.0f} N per m/s, Ki = {Ki:.0f} N per m")
print(f"force needed to hold 90 km/h on the 6 % hill: {resistance(v_set, 0.06):.0f} N; "
      f"the engine can give {P_max / v_set:.0f} N at that speed")

def drive(anti_windup, dt=0.05, t_end=300.0):
    v, x, integ = v_set, 0.0, resistance(v_set, 0.0) / Ki      # start in steady cruise on the flat
    log = []
    for i in range(int(t_end / dt)):
        e = v_set - v
        F_cmd = Kp * e + Ki * integ
        F = min(max(F_cmd, F_brake), P_max / max(v, 1.0))        # the actuator's limits
        saturated = F != F_cmd
        if not (anti_windup and saturated and e * F_cmd > 0):    # clamping: stop integrating when
            integ += e * dt                                       # saturated and the error would
        v += (F - resistance(v, road(x))) / m * dt                # push further into the limit
        x += v * dt
        log.append((i * dt, x, v, F, saturated))
    return np.array(log)

for aw in (False, True):
    L = drive(aw)
    t, x, v = L[:, 0], L[:, 1], L[:, 2]
    crest = np.argmax(x >= 4000.0)
    after = slice(crest, None)
    print(f"\nanti-windup {'on ' if aw else 'off'}: slowest on the hill {3.6 * v[:crest].min():.1f} km/h, "
          f"full power for {L[:, 4].sum() * 0.05:.0f} s")
    print(f"   after the crest: fastest {3.6 * v[after].max():.1f} km/h, back within 1 km/h of the set speed "
          f"{t[crest + np.nonzero(np.abs(v[after] - v_set) > 1 / 3.6)[0][-1] + 1] - t[crest]:.0f} s after the crest")
    print("   time (s):   " + "  ".join(f"{s:5.0f}" for s in range(0, 300, 30)))
    print("   km/h:       " + "  ".join(f"{3.6 * v[int(s / 0.05)]:5.1f}" for s in range(0, 300, 30)))
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

On the hill both versions behave the same: the engine gives everything it has, and the van sags to about 86 km/h, because no controller can extract power the engine does not have. The difference comes at the top. Without anti-windup, the integrator spent two minutes accumulating an error of 3 to 4 km/h, and holds the engine at full power long after the road levels. The van surges to 111 km/h, 21 km/h over the set speed, before the integrator unwinds. With clamping, it overshoots to 92 km/h and is back within 1 km/h of the set speed 15 seconds after the crest. Every commercial cruise controller, servo drive and process controller has anti-windup for this reason; Lumenary Robotics' feedback and PID lesson compares the common schemes.

That last point is the mechanical engineer's contribution to the loop. The actuator must deliver the steady force (the hill, the holding force, the pressing force), the force to accelerate the moving mass at the required rate, and a margin for the controller to correct errors. Mechatronics and actuators sizes motors and cylinders to do exactly that.

ComputationC

Where mechanics limits control: resonance and sensors

The PID design above treated the stage as one rigid mass on a spring. Real drives are chains of masses joined by springs. A motor turns a pulley that pulls a belt attached to a table; or turns a ball screw through a coupling; a hydraulic cylinder pushes a ram through a column of oil that compresses. Each chain has a lowest drive resonance, where the motor and the load swing against each other through the compliant link, and that resonance, more than anything in the controller, sets how fast the loop can be.

m₁motor + pulleym₂ (table)belt k, c_bFencoderlinear scalex₁x₂
A belt-driven table as a two-mass model. The motor's rotor and pulley act like a mass m₁ at the belt (rotor inertia divided by pulley radius squared); the belt is a spring k with a little damping c_b; the table is m₂. The motor force F acts on m₁. A rotary encoder on the motor measures x₁; a linear scale on the table measures x₂.

The program takes a 2 kg motor side, an 8 kg table and a belt of 200 kN/m (then a four times stiffer one), and applies a PD controller designed as if the drive were rigid, with gains for a chosen bandwidth. It tries three sensor arrangements: the motor's own encoder for both position and velocity (sensor and actuator collocated, on the same mass), a linear scale on the table for both (non-collocated), and the dual loop used on precision machines, position from the table scale and damping from the motor encoder. For each it finds, from the closed-loop eigenvalues, the bandwidths at which every mode keeps a damping ratio of at least 0.1, and where the loop goes unstable.

python
import numpy as np

# A belt-driven positioning table. The motor's rotor and pulley act like a mass m1 at the belt
# (rotor inertia / pulley radius^2); the belt is a spring k with a little damping cb; the table is m2.
m1, m2, cb = 2.0, 8.0, 20.0                  # kg, kg, N s/m

def closed_loop(k, f_bw, pos_from, vel_from):
    """State matrix [x1, v1, x2, v2] under PD control tuned as if the drive were rigid:
    F = -Kp x_measured - Kd v_measured (set-point 0), Kp = M w^2, Kd = 1.4 M w, M = m1 + m2.
    pos_from / vel_from: 'motor' (encoder on the motor) or 'table' (linear scale on the table)."""
    M, w = m1 + m2, 2 * np.pi * f_bw
    A = np.array([[0, 1, 0, 0],
                  [-k / m1, -cb / m1, k / m1, cb / m1],
                  [0, 0, 0, 1],
                  [k / m2, cb / m2, -k / m2, -cb / m2]], float)
    A[1, 0 if pos_from == "motor" else 2] -= M * w**2 / m1     # the force acts on the motor side
    A[1, 1 if vel_from == "motor" else 3] -= 1.4 * M * w / m1
    return A

def zeta_min(A):
    """Smallest damping ratio of the closed-loop modes; negative means unstable."""
    return min(-l.real / abs(l) for l in np.linalg.eigvals(A))

schemes = [("motor encoder only", "motor", "motor"),
           ("table scale only", "table", "table"),
           ("dual loop", "table", "motor")]       # position from the table, damping from the motor
bandwidths = np.arange(1.0, 150.0, 0.5)
for k in (2e5, 8e5):
    f_res = np.sqrt(k * (m1 + m2) / (m1 * m2)) / (2 * np.pi)
    print(f"belt stiffness {k / 1e3:.0f} kN/m: drive resonance at {f_res:.0f} Hz")
    for name, p, v in schemes:
        z = np.array([zeta_min(closed_loop(k, f, p, v)) for f in bandwidths])
        good = bandwidths[z >= 0.1]                       # every mode damped at least 0.1
        bad = bandwidths[z < 0]
        print(f"   {name:19s}" + (f" well damped up to {good.max():5.1f} Hz;" if good.size else " never well damped;")
              + (f" unstable from {bad.min():5.1f} Hz" if bad.size else " never unstable"))
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Three lessons come out of the table, and every machine-tool and robot designer knows them.

Collocated control is safe. With the motor's encoder alone, the loop is never unstable, whatever the gain: a force and a velocity measured at the same point can only remove energy, like a damper. It is well damped up to about 35 Hz, roughly 0.6 of the 56 Hz resonance. But it controls the motor, not the table. When the table accelerates at 10 m/s², the belt must pull it with 8×10=808 \times 10 = 80 N, which stretches a 200 kN/m belt by 0.4 mm, an error the motor encoder cannot see.

Non-collocated control is fragile. With the table scale alone, the loop goes unstable from a bandwidth of 1.5 Hz: useless. In the resonance the table and the motor swing in opposite directions, so a damping force on the motor computed from the table's velocity pushes the motor along its own motion, feeding energy into the resonance instead of removing it; the belt's own slight damping is soon overwhelmed.

Stiffness buys bandwidth. The dual loop combines the motor's safe damping with the table's true position, and is well damped up to 19 Hz, about a third of the resonance. Making the belt four times stiffer doubles the resonance frequency, to 113 Hz, and doubles every usable bandwidth. That is the mechanical engineer's lever: a stiffer belt, a ball screw instead of a belt, a shorter and fatter shaft, a lighter table. The controller cannot change the resonance; the designer can.

Example— A hydraulic press and its column of oil

A press ram of 2000 kg (ram plus upper die) is driven by a cylinder of 200 mm bore, with a column of oil 0.50 m long above the piston. Oil is stiff but not rigid: with an effective bulk modulus β≈1.4\beta \approx 1.4 GPa (lower once hoses and trapped air are counted), the oil column acts as a spring of stiffness

kh=βAL=1.4×109×0.03140.50≈88 kN/mm,k_h = \frac{\beta A}{L} = \frac{1.4\times10^9 \times 0.0314}{0.50} \approx 88 \text{ kN/mm},

and the ram on this spring has a hydraulic resonance at 12πkh/m≈33\tfrac{1}{2\pi}\sqrt{k_h/m} \approx 33 Hz. The position loop that brings the ram down must therefore stay well below that, a few hertz, and press makers keep the oil columns short and the hoses rigid to raise it. When the die meets the work, the press switches from position control to force control, regulating the cylinder pressure: at 25 MPa on this piston area the ram presses with about 785 kN, some 80 tonnes-force. The controller's job in that phase is to reach the set force without overshoot, because an overshoot of force is a damaged die or part.

ExplanationH

Where control engineers and mechanical engineers meet

In industry the loop is designed by a team, and most of the decisions that decide its performance are mechanical.

Design for control. Keep moving masses light and drive paths stiff, so that the first resonance is high. Put the actuator's force through the centre of mass of what it moves, so that pushing does not also tip it. Avoid backlash (play in gears and couplings), which makes the plant's response depend on the direction of motion and causes small, persistent oscillations called limit cycles; and avoid stick–slip friction, which makes small moves jerky. Rolling bearings, preloaded ball screws, flexures and direct-drive motors are all ways of removing these nonlinearities in metal before anyone writes code.

Put sensors where the truth is. The best measurement is of the quantity the customer cares about, at the point where it matters: the table, the tool tip, the ram, the force on the die. When that point is far from the actuator, use a dual loop, as above, and keep the structure between them stiff.

Feedforward does most of the work. In a well-designed machine, the controller knows the planned motion, so it can command the force the motion needs, mass times acceleration plus friction plus gravity, before any error appears. Feedback then corrects only what the model got wrong. Good feedforward needs a good model, which is Modelling dynamic systems put to work.

Filters and tuning in the drive. Commercial servo drives from many manufacturers, in Japan, Germany, the USA, China and elsewhere, identify the load's inertia automatically and include notch filters that remove the drive resonance's frequency from the loop. They work, within limits; a notch tuned to a resonance that shifts as the load changes can do more harm than good, so the mechanical fix comes first.

Safety is a separate system. A press, a robot cell or a machine tool can crush, cut or trap a person, and no PID loop is trusted to prevent that. Machines are guarded, light curtains and two-hand controls keep hands out of the danger zone, and the safety functions (stopping, limiting speed, preventing an unexpected start) are built as separate, verified systems following standards such as ISO 13849 and IEC 62061, after a risk assessment according to ISO 12100. Anyone working on a machine isolates and locks off its energy sources first, and that includes the stored pressure in a hydraulic system.

History & global context

From governors to servo drives

The centrifugal governor, a pair of spinning weights that rise as an engine speeds up and close its steam valve, was adapted from windmills by James Watt for his engines around 1788, and became the emblem of automatic control. Governors sometimes hunted, oscillating instead of settling, and James Clerk Maxwell's paper "On Governors" (1868) explained why, in terms of the roots of the system's characteristic equation, the first stability analysis of a feedback machine. Nicolas Minorsky's analysis of ship steering (1922) set out the three-term PID law, and John Ziegler and Nathaniel Nichols published their tuning rules in 1942. The Second World War's gun directors and radar mounts, many developed at MIT's Servomechanisms Laboratory, created servo theory as a discipline, and the same laboratory demonstrated numerical control of a milling machine in 1952, the ancestor of every CNC machine. Ralph Teetor, an engineer who was blind, invented the cruise controller, first offered on Chrysler cars in 1958. Since the 1980s, cheap microprocessors have moved controllers from pneumatic and analogue hardware into software running thousands of times a second inside servo drives.

Common misconceptionsH

Common misconceptions

Misconception

"Higher gain always means a better loop." Higher gain means faster response and smaller errors only while the actuator stays out of saturation and the loop stays well below the structure's resonances. Beyond that, it means saturation, noise amplification and, with non-collocated sensors, instability. The achievable gain is set by the machine.

Misconception

"A good controller can make up for a flimsy machine." A controller can add damping and stiffness at low frequencies, but it cannot move a resonance it is trying to control through, nor see an error its sensor cannot measure. Stiffness, low mass and well-placed sensors are designed in, not tuned in.

Misconception

"Integral action guarantees zero error." Only in a steady state, with a constant set-point and constant disturbances, and only if the actuator can supply the force needed. On the 6 per cent hill no integrator could hold 90 km/h, because the engine could not; and while it tried, it wound up.

Exercises

Exercises

Use g=9.81g = 9.81 m/s². Two exercises ask for Python functions; run them in the editor before submitting.

1. Control of mechanical systems

Warm-upHuman

A machine slide is held by springs of total stiffness k=5.0k = 5.0 kN/m and positioned by a proportional controller with Kp=45K_p = 45 kN/m. It is commanded to move 10 mm. Once it has settled, what percentage of the 10 mm step remains as error?

2. Control of mechanical systems

CoreHuman

A 4.0 kg carriage on flexures has k=1.0k = 1.0 kN/m and c=4.0c = 4.0 N·s/m. You want a PID controller (derivative on the measurement) that puts all three closed-loop poles at s=−50s = -50 rad/s. What proportional gain KpK_p does that need, in kN/m?

3. Control of mechanical systems

CoreHuman

A positioning stage's PID loop, tuned by pole placement, needs a peak actuator force of 150 N for a given step. The customer wants the response three times faster (all poles three times further from the origin). Roughly what peak force will the same step need now, in newtons? (Assume the flexure stiffness is small compared with KpK_p, so that the peak force is about KpK_p times the step.)

4. Control of mechanical systems

CoreHuman

In the lesson's simulation, a van's cruise control without anti-windup reached 111 km/h just after the crest of a long hill, with the set speed at 90 km/h. What caused the overshoot?

Choose one

5. Control of mechanical systems

CoreHuman

A belt drive has a motor-side equivalent mass of 1.5 kg, a table of 6.0 kg, and a belt of stiffness 300 kN/m. At what frequency, in hertz (to the nearest whole number), is its drive resonance, with the motor and table swinging against each other?

6. Control of mechanical systems

StretchHuman

A designer wants a belt-driven table to hold its position to a few micrometres while accelerating hard. Which arrangement does the lesson's analysis support?

Choose one

7. Control of mechanical systems

CoreComputational

Write pid_gains(m, c, k, f_hz) returning (Kp, Ki, Kd) for a mass–spring–damper mx¨+cx˙+kx=Fm\ddot x + c\dot x + kx = F under PID control (derivative on the measurement), so that all three closed-loop poles sit at s=−ωs = -\omega with ω=2πfhz\omega = 2\pi f_\text{hz}.

The starter forgets something about the machine. Run the tests to see it fail, then fix it.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

8. Control of mechanical systems

StretchComputational

Write pi_step(integral, e, dt, Kp, Ki, u_min, u_max), one update of a PI controller with output limits and clamping anti-windup. It returns (u, new_integral): u is the command limited to [u_min, u_max]; the integral is updated by e * dt except when the output is saturated and the error would drive it further into the limit.

The starter limits the output but lets the integral wind up. Run the tests, then fix it.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources