Automatic Control: Theory, Analysis, Design, and Practice

Automatic Control: Theory, Analysis, Design, and Practice
QR code for this page

Comprehensive course notes on automatic control covering feedback, physical modeling, transfer functions, stability, PID, root locus, frequency response, state space, and advanced control methods.

Introduction — scope and approach. Control is the problem of changing a system's behavior in a desired direction.

In everyday life, people continuously perform control actions without consciously thinking about them. When keeping a car in its lane, bringing a glass to the mouth, riding a bicycle, or balancing an object, three basic operations are repeated:

Consider the desired state.
Observe the actual state.
Apply an action that reduces the difference.

This loop is also the essence of automatic control.

A person trying to keep a ship on a specified course continuously repeats the chain:

desired course
      ↓
comparison
      ↓
course error
      ↓
decision
      ↓
rudder movement
      ↓
new heading of the ship
      └────────────── feedback measurement

When a sensor, processor, control algorithm, and actuator replace the person, the same function becomes an automatic control system.

Automatic control is therefore not merely:

Calculating a PID gain.

The broader engineering problem is:

Designing a feedback structure that drives the measurable behavior of a physical or numerical system toward the desired behavior despite disturbances, uncertainty, noise, and physical constraints.

A good control system does more than reach the target.

It should also:

  • remain stable,
  • be sufficiently fast,
  • avoid excessive oscillation,
  • limit steady-state error,
  • reject disturbances,
  • avoid excessive response to measurement noise,
  • tolerate modeling errors,
  • respect actuator limits,
  • be computable in real time,
  • behave safely under faults.

Automatic control is approached along the following progression:

Intuition
↓
Definition
↓
Physical model
↓
Differential equation
↓
Transfer function
↓
Time response
↓
Stability
↓
Steady state
↓
PID and compensation
↓
Root locus
↓
Frequency response
↓
State space
↓
Digital control
↓
Modern control
↓
Real-system validation

Unit 1: Control Foundations and Physical System Modeling

1.1. Definition and Scope of Control

Control is the process of changing a system input so that its output follows the desired behavior.

For a DC motor, for example:

input  → motor voltage
output → angular speed

The objective is to determine the motor voltage such that:

ω(t) → ω_ref(t)

Similarly:

Oven:
input  → heater power
output → temperature

Robot arm:
input  → motor torques
output → joint positions

Vehicle:
input  → steering angle
output → lateral position

Server cooling:
input  → fan speed
output → processor temperature

are control problems.


1.2. Automatic Control

Automatic control is control performed by a system without continuous human intervention.

A typical structure is:

Reference
   ↓
Controller
   ↓
Actuator
   ↓
Plant
   ↓
Output

In a closed loop, measurement feedback is added:

             +--------------------------+
             |                          |
             |                       Sensor
             |                          |
             |                          ↓
Reference → (+) → Error → Controller → Actuator → Plant → Output
           (-) ↑_____________________________________________|

1.3. Basic Terminology

1.3.1. Controlled System — Plant

The mechanism, process, or physical system to be controlled.

Examples:

  • motor,
  • robot,
  • oven,
  • chemical process,
  • aircraft,
  • magnetic-levitation system.

1.3.2. Output

The variable to be controlled.

It may be denoted by:

y(t)

1.3.3. Reference

The desired value or trajectory for the output.

It is denoted by:

r(t)

1.3.4. Error

For negative feedback:

e(t) = r(t) - y(t)

1.3.5. Controller

The controller generates the control signal from the error and, when necessary, other measurements.

u(t) = C(e, ...)

1.3.6. Actuator

The actuator converts the controller's low-power decision signal into a physical effect.

Examples include:

  • electric motor,
  • valve,
  • servo,
  • hydraulic cylinder,
  • heater,
  • power electronics.

1.3.7. Sensor

A sensor converts the physical output into measurable electrical or digital information.

1.3.8. Disturbance

An external influence that affects system behavior in an undesired way.

It may be denoted by:

d(t)

1.3.9. Measurement Noise

An unwanted component added to sensor data.

It may be denoted by:

n(t)

1.4. Open-loop Control

In an open-loop system, the output is not measured and fed back into the control decision.

Reference
   ↓
Controller
   ↓
Plant
   ↓
Output

For example, a washing machine command such as:

run the motor for 20 minutes

is open-loop if it is applied without measuring the actual cleaning result.

Advantages:

  • simple,
  • inexpensive,
  • fewer feedback-related stability concerns,
  • may not require a sensor.

Disadvantages:

  • cannot correct disturbances,
  • cannot compensate for model errors,
  • cannot adapt to changes in the system.

1.5. Closed-loop Control

A closed-loop system measures the output and compares it with the reference.

e(t) = r(t) - y(t)

The controller generates a new input according to this error.

For example:

Room temperature target = 22 °C
Measured temperature    = 19 °C

Error = 3 °C

The heater power is increased.

As the temperature approaches the target, the error decreases and the control action changes.


1.6. Feedback

Feedback means including the system output again in the control decision.

The fundamental purpose of negative feedback is to achieve:

error ↓
disturbance effect ↓
parameter sensitivity ↓

Feedback has a cost, however.

Poor design can produce:

oscillation
instability
noise amplification
excessive actuator use

Therefore:

Feedback is useful not simply because it is strong, but because it is designed correctly.


1.7. Positive and Negative Feedback

1.7.1. Negative Feedback

e = r - y

An increase in output reduces the error.

This is used in most regulation problems in control engineering.

1.7.2. Positive Feedback

e = r + y

It can produce behavior that reinforces the output.

Positive feedback is not always an error.

For example:

  • oscillators,
  • regenerative circuits,
  • some threshold and switching structures

use intentional positive feedback.

In classical regulation systems, however, it generally increases the risk of instability.


1.8. Servo and Regulator

Two control objectives can be distinguished.

1.8.1. Servo Problem

Track a changing reference:

y(t) ≈ r(t)

Examples:

  • a robot arm following a path,
  • an antenna tracking a satellite,
  • a vehicle following the lane center.

1.8.2. Regulation Problem

Keep the output at a fixed operating point:

y(t) → y*

Examples:

  • maintaining a temperature of 80 °C,
  • maintaining a constant tank level,
  • maintaining motor speed despite load changes.

1.9. Main Historical Line of Control

Automatic control is not a new field.

Ancient water clocks and mechanical devices provide early examples of the feedback idea.

With the Industrial Revolution, control theory began to develop into an engineering discipline.

Important milestones include:

Antiquity
→ water-level and clock mechanisms

18th century
→ Watt-type centrifugal speed governor

1868
→ Maxwell, governors, and stability

1877-1895
→ Routh-Hurwitz stability approach

1922
→ Minorsky and the PID concept

1930s
→ Black and negative feedback
→ Nyquist stability

1940s
→ Bode frequency-domain approach
→ block diagrams and transfer functions

1948-1950
→ Evans root locus

1950s-1960s
→ state space
→ Kalman, controllability, observability
→ optimal control and state estimation

After 1970
→ robust, adaptive, digital, and nonlinear control

After 1980
→ widespread industrial adoption of model predictive control

Today
→ embedded, networked, cyber-physical,
   multivariable, and constrained control

This history also shows the direction in which control engineering evolved:

Mechanical intuition
→ differential equations
→ transfer functions
→ frequency domain
→ state space
→ optimization
→ real-time digital control

1.10. Three Fundamental Objectives of a Control Problem

From the perspective of classical linear control, three basic requirements dominate.

1.10.1. Stability

The system must not grow without bound because of its own dynamics.

1.10.2. Transient Response

How the system reaches the target matters:

  • how fast,
  • how much overshoot,
  • how much oscillation.

1.10.3. Steady State

What happens to the error after sufficient time?

e_ss = lim(t→∞) e(t)

These three aspects must be considered together.

A fast but unstable system is not good.

A stable system that never reaches its target is not good either.


1.11. Modern Control Objectives

In real engineering, the classical criteria are supplemented by:

  • disturbance rejection,
  • noise attenuation,
  • robustness,
  • energy consumption,
  • actuator limits,
  • input rate limits,
  • safety constraints,
  • computational delay,
  • model uncertainty.

The real problem is therefore to construct a system that is:

fast
+ stable
+ accurate
+ robust
+ implementable

1.12. Modeling Physical Systems

Before designing a controller, the dynamic relationship between system input and output must be understood.

The basic process is:

Physical system
↓
Conservation laws
↓
Differential equations
↓
Mathematical model
↓
Analysis and control design

A model is:

not reality itself, but a representation sufficient for a particular purpose.


1.13. Mechanical-system Model

For translational motion, Newton's law gives:

ΣF = m * ẍ

Spring:

F_k = kx

Viscous damping:

F_b = b ẋ

The mass-spring-damper equation:

m ẍ + b ẋ + kx = F(t)

is one of the fundamental examples in automatic control.


1.14. Rotational Mechanical System

For rotational systems:

ΣT = J θ̈

where:

T → torque
J → moment of inertia
θ → angle

A rotational spring may satisfy:

T_k = kθ

and viscous friction:

T_b = b θ̇

1.15. Electrical Systems

Basic equations are:

Resistor:
v = Ri

Capacitor:
i = C dv/dt

Inductor:
v = L di/dt

Using Kirchhoff's laws, electrical circuits can be modeled as differential equations.

An important advantage of control theory is that:

Mechanical and electrical systems can be analyzed using the same differential-equation structures.


1.16. Electromechanical System

A DC motor is a classical example.

Electrical equation:

v = L di/dt + Ri + k_e ω

Motor torque:

T_m = k_t i

Mechanical equation:

J dω/dt + bω = T_m - T_L

This structure shows the energy-conversion chain:

voltage
↓
current
↓
torque
↓
speed
↓
position

1.17. Linear and Nonlinear Models

A linear model may have the form:

a_n y^(n) + ... + a_1 ẏ + a_0 y
=
b_m u^(m) + ... + b_0 u

A nonlinear system contains nonlinear terms, for example:

ẍ + sin(x) = u

Most real physical systems are not exactly linear.

Linear models are used as approximations:

  • over a small operating region,
  • around a specified operating point,
  • within a limited input range.

1.18. Operating Point and Linearization

For the nonlinear system:

ẋ = f(x,u)
y  = g(x,u)

let an equilibrium point satisfy:

f(x*,u*) = 0

Define small deviations:

δx = x - x*
δu = u - u*

A first-order Taylor approximation gives:

δẋ ≈ A δx + B δu
δy  ≈ C δx + D δu

where:

A = ∂f/∂x
B = ∂f/∂u
C = ∂g/∂x
D = ∂g/∂u

are evaluated at the equilibrium point.


1.19. Region of Model Validity

A linearized model may be sufficiently accurate only near its operating point.

For a magnetic-levitation system, for example:

small position deviation
→ linear model may be sufficient

large position deviation
→ nonlinear model may be required

Therefore, the complete form of the question:

Is the model correct?

should be:

Over which operating region, at which frequencies, and to what accuracy is the model sufficient?


1.20. System Identification

If the model is not known from physical equations, it can be obtained from measurement data.

A general process is:

Known input u(t)
↓
Apply it to the system
↓
Measure output y(t)
↓
Select a model structure
↓
Estimate parameters
↓
Validate with separate data

This is called system identification.


1.21. Experiment Design

For good identification, the input signal must excite the system sufficiently.

Possible signals include:

  • step,
  • impulse,
  • sine sweep,
  • chirp,
  • PRBS,
  • multisine.

The input signal must not only contain enough information mathematically; it must also be physically safe.


Unit 2: Transfer Functions, Time Response, Stability, and Error

Before calculating a control system's time response, define input type and initial conditions. Poles offer an initial stability indication, but saturation, delays, and model uncertainty also require attention. Evaluate rise time, overshoot, settling time, and steady-state error under consistent conditions. Study sensitivity to parameter changes so that tuning for one nominal model is not assumed universally valid.

2.1. From Differential Equation to Transfer Function

Consider a linear time-invariant system:

a_n y^(n) + ... + a_1 ẏ + a_0 y
=
b_m u^(m) + ... + b_1 u̇ + b_0 u

Under zero initial conditions, the Laplace transform gives:

(a_n s^n + ... + a_0)Y(s)
=
(b_m s^m + ... + b_0)U(s)

The transfer function is:

        Y(s)
G(s) = ----
        U(s)

or:

G(s) =
(b_m s^m + ... + b_0)
/
(a_n s^n + ... + a_0)

2.2. Limits of the transfer-function Representation

A transfer function:

  • represents input-output behavior,
  • does not directly expose internal states,
  • is classically defined for zero initial conditions,
  • is used primarily for LTI systems.

Different internal structures may have the same transfer function.

State-space models therefore have separate importance in modern control.


2.3. Poles and Zeros

Let:

       N(s)
G(s) = ----
       D(s)

2.3.1. Zeros

They are roots of:

N(s) = 0

2.3.2. Poles

They are roots of:

D(s) = 0

Poles are fundamental determinants of natural dynamics.


2.4. Physical Meaning of Poles

A real pole:

s = -a

produces the component:

e^(-at)

If:

a > 0

it decays with time.

A right-half-plane pole:

s = +a

produces:

e^(at)

which grows.

Therefore, a continuous-time LTI system is asymptotically stable when:

Re(p_i) < 0

for all poles.


2.5. First-order System

Standard form:

        K
G(s) = ------
       τs + 1

Its step response is:

y(t) = K(1 - e^(-t/τ))

where τ is the time constant.

Approximately:

t = τ   → 63.2%
t = 2τ  → 86.5%
t = 3τ  → 95%
t = 4τ  → 98%
t = 5τ  → 99.3%

of the final value is reached.


2.6. Second-order System

The standard transfer function is:

             ω_n²
G(s) = --------------------
       s² + 2ζω_n s + ω_n²

where:

ω_n → natural angular frequency
ζ   → damping ratio

2.7. Damping Ratio

2.7.1. Overdamped

ζ > 1

There is no oscillation; the response is generally slow.

2.7.2. Critically Damped

ζ = 1

This is the classical fastest boundary behavior without oscillation.

2.7.3. Underdamped

0 < ζ < 1

Produces an oscillatory transient response.

2.7.4. Undamped

ζ = 0

Produces sustained oscillation under ideal conditions.

2.7.5. Unstable

Negative equivalent damping or right-half-plane poles produce a growing response.


2.8. Transient-response Measures

Second-order step response for several damping ratios with overshoot and pole locations
Damping ratio and step response

Common measures for a step response include:

2.8.1. Rise Time

The time for the output to rise through a specified range toward the target.

t_r

2.8.2. Peak Time

The time to reach the first maximum.

t_p

2.8.3. Maximum Overshoot

M_p

2.8.4. Settling Time

The time after which the output enters and remains within a specified tolerance band.

t_s

Typical bands are:

±2%
or
±5%

2.9. Approximate second-order Relationships

For a standard underdamped second-order system:

ω_d = ω_n sqrt(1-ζ²)

Peak time:

t_p = π / ω_d

Percentage overshoot:

M_p(%) =
100 * exp(
    -ζπ / sqrt(1-ζ²)
)

Approximate 2% settling time:

t_s ≈ 4/(ζω_n)

These relationships are meaningful under assumptions such as:

  • dominant second-order behavior,
  • standard form,
  • limited influence from additional zeros.

2.10. Dominant Poles

In high-order systems, not all poles have equal influence.

Slow poles closer to the imaginary axis often dominate the transient response.

If the fast poles are sufficiently far to the left, the approximation:

high-order system
≈
low-order model

may be used.

Pole-zero proximity and the influence of zeros must nevertheless be checked.


2.11. Pole-zero Cancellation

In theory, a controller zero can cancel a plant pole:

(s+a)/(s+a)

In a real system, however, parameters are never known exactly.

Relying on exact cancellation is particularly risky for unstable or slow poles.

If the model is believed to contain:

s + 1.00

while the real system contains:

s + 0.93

the cancellation is incomplete.

Therefore:

Pole-zero cancellation is an algebraic convenience, not a physical guarantee.


2.12. Step, Ramp, and Parabolic Inputs

Control systems are commonly examined using standard reference signals.

2.12.1. Step

r(t) = A
R(s) = A/s

This may represent a position reference.

2.12.2. Ramp

r(t) = At
R(s) = A/s²

A reference changing at constant velocity.

2.12.3. Parabola

r(t) = (A/2)t²
R(s) = A/s³

Represents a reference with constant acceleration.


2.13. Final Value Theorem

Under appropriate stability conditions:

lim(t→∞) y(t)
=
lim(s→0) sY(s)

may be used.

This theorem is important for calculating steady-state error.

It must not be applied mechanically if right-half-plane poles or inappropriate imaginary-axis behavior are present.


2.14. Block Diagram

Control-system components can be represented with blocks.

Basic elements include:

  • block,
  • summing junction,
  • takeoff point.

Series connection:

G_eq = G1 G2

Parallel connection:

G_eq = G1 + G2

Negative feedback:

        G
T = ----------
     1 + GH

2.15. Open-loop and closed-loop Transfer Functions

The loop gain can be written as:

L(s) = G(s)H(s)

The closed-loop transfer function is:

        G(s)
T(s) = -----------
        1 + G(s)H(s)

The characteristic equation is:

1 + G(s)H(s) = 0

The roots of this equation are the closed-loop poles.


2.16. Stability

Stability is a fundamental requirement in a control system.

Intuitively:

Small initial deviations or bounded inputs should not cause system behavior to grow uncontrollably.

For LTI systems, several notions of stability exist:

  • internal stability,
  • BIBO stability,
  • asymptotic stability.

For a minimal continuous-time rational transfer function, all poles lying in the open left half-plane provides BIBO stability.


2.17. Marginal Stability

Simple poles on the imaginary axis:

s = ±jω

can produce sustained oscillation.

Repeated poles on the imaginary axis can produce growing terms.

Therefore:

Re(p)=0

should not automatically be labeled “stable.”

The type of stability should be stated explicitly.


2.18. Routh-Hurwitz Criterion

The number of sign changes in the first column of the Routh array giving the number of roots in the right half plane, two for the fourth degree example and none for the stable cubic
Routh-Hurwitz sign changes

Consider the characteristic polynomial:

a_n s^n + a_(n-1)s^(n-1) + ... + a_0

The Routh array helps determine the number of right-half-plane roots without directly computing the roots.

The central result is:

The number of sign changes in the first column of the Routh array equals the number of right-half-plane roots.

This method is particularly useful for finding the range of a gain parameter that preserves stability.


2.19. Stability Alone Is Not Performance

Two systems can both be stable.

The first may have:

settling = 0.5 s
overshoot = 5%

and the second:

settling = 30 s
overshoot = 70%

Although both are mathematically stable, their engineering quality is not the same.

Control design therefore considers:

stability
+
performance

together.


2.20. Steady-state Error

Let:

e(t) = r(t) - y(t)

The steady-state error is defined as:

e_ss = lim(t→∞) e(t)

This quantity is meaningful when the system is stable and the limit exists.

A common control objective is:

e_ss → 0

2.21. System Type

For a unity-feedback system, the number of integrators at the origin in the open-loop transfer function is called the system type.

If:

L(s) = K / [s^N * ...]

then:

Type = N

The general intuition is:

more integrators
→ higher low-frequency gain
→ lower steady-state error for some references

but also:

phase lag ↑
stability margin ↓

can become a risk.


2.22. Static Error Constants

For unity feedback:

2.22.1. Position Constant

K_p = lim(s→0) L(s)

Step error:

e_ss = 1/(1+K_p)

2.22.2. Velocity Constant

K_v = lim(s→0) sL(s)

For a unit ramp:

e_ss = 1/K_v

2.22.3. Acceleration Constant

K_a = lim(s→0) s²L(s)

For a unit parabola:

e_ss = 1/K_a

These relationships assume appropriate closed-loop stability.


2.23. Fundamental Role of Integral Action

An integral controller:

u_I(t) = K_i ∫ e(t) dt

continues accumulating as long as the error is nonzero.

It is therefore powerful for eliminating steady-state error under a constant reference or constant disturbance.

The integral term, however:

  • introduces an additional pole,
  • adds phase lag,
  • can increase overshoot,
  • can produce windup under saturation.

Therefore:

Integral action removes error, but it is not free.

Connecting pole locations to transient behavior. In a unity negative-feedback system with open-loop transfer function G(s) = K/[s(s+2)], the closed-loop characteristic polynomial is s² + 2s + K. For K > 0, the second-order Routh-Hurwitz conditions hold and the poles lie in the left half-plane. Comparing with s² + 2ζω_n s + ω_n² gives ω_n = √K and ζ = 1/√K. At K = 4, ω_n = 2 rad/s and ζ = 0.5. The ideal second-order unit-step response then has approximately M_p = exp[−πζ/√(1−ζ²)] ≈ 16.3% overshoot. A common 2% settling-time approximation gives T_s ≈ 4/(ζω_n) = 4 s. Increasing gain may improve some tracking properties while reducing damping. These results omit delay, saturation, and measurement noise; the design must be checked again when those effects are introduced.


Unit 3: PID, Feedforward, Disturbance Rejection, and Noise

PID tuning begins by defining safe controlled-variable limits and actuator constraints. Vary proportional, integral, and derivative actions to observe their effects while checking integral windup and derivative sensitivity to measurement noise. Measure reference tracking and disturbance rejection in separate experiments. Tuning should satisfy transient-response goals without producing unacceptable behavior under saturation or sensor delay.

3.1. Proportional Control

A proportional controller is:

u(t) = K_p e(t)

Advantages:

  • simple,
  • fast,
  • stronger action for larger error.

Increasing K_p can often lead to:

response speed ↑
steady-state error ↓

but may also cause:

overshoot ↑
oscillation ↑
risk of instability ↑

The effect of gain should not be memorized independently of the plant.


3.2. Derivative Control

The ideal derivative term is:

u_D(t) = K_d de/dt

The derivative responds:

not only to how large the error is, but also to how fast it is changing.

This can provide damping.

The ideal derivative has:

|G_D(jω)| = K_d ω

and therefore amplifies high-frequency measurement noise.

In real implementations, the derivative is filtered.


3.3. Filtered Derivative

High-frequency noise amplification in differentiation versus filtered derivative sensing

A practical derivative can be written as:

        K_d s
D(s) = --------
       1 + T_f s

or within the PID form:

                  K_d s
C(s)=K_p+K_i/s+------------
                 1+T_f s

Selecting T_f is a tradeoff between:

noise attenuation
↔
preserving derivative action

3.4. Derivative Kick

If the derivative is calculated from error, an abrupt step in the reference:

r(t)

can create a very large short-duration derivative term.

This is called derivative kick.

For this reason, derivative action is often applied to:

the measurement

in practical systems.

For example:

u_D = -K_d dy/dt

This prevents the reference step from being differentiated directly.


3.5. PI Controller

C(s) = K_p + K_i/s

or:

C(s) = K_p(1 + 1/(T_i s))

PI control is widely used in:

  • process control,
  • motor-speed control,
  • current loops.

Because no derivative term is required, it can be simpler than PID with respect to noise.


3.6. PD Controller

C(s) = K_p + K_d s

A PD controller can:

  • improve transient response,
  • increase damping,
  • be useful for fast position control.

Because it contains no integral action, however, it cannot by itself eliminate steady-state error under constant load or disturbance.


3.7. PID Controller

P PI and PID step responses
PID step response

The ideal parallel form is:

u(t) =
K_p e(t)
+
K_i ∫e(t)dt
+
K_d de(t)/dt

The transfer function is:

C(s) = K_p + K_i/s + K_d s

A derivative filter is added in practice.

The effectiveness of PID combines three intuitions:

P → present error
I → accumulated past error
D → error trend

3.8. Effects of PID Gains on Controller Behavior

A common starting intuition is:

3.8.1. Kp

speed ↑
error ↓

but overshoot and oscillation may increase.

3.8.2. Ki

Removes steady-state error.

However, it can increase:

  • overshoot,
  • settling time,
  • windup.

3.8.3. Kd

Can increase damping.

However, it:

  • is sensitive to measurement noise,
  • requires filtering.

These are useful starting intuitions, not universal laws.


3.9. PID Tuning

Ziegler-Nichols PID tuning for the plant 1 over s plus 1 cubed with ultimate gain 8 and period 3.63 s giving Kp 4.8, Ti 1.81 s, Td 0.45 s and about 52 percent overshoot
Ziegler-Nichols PID tuning

PID tuning appears to be the problem of finding three numbers:

Kp
Ki
Kd

but the design targets must first be defined.

Example requirements:

t_r < 0.5 s
M_p < 10%
t_s < 2 s
e_ss = 0
phase margin > 45°
|u| < 10 V

The gains should satisfy these requirements jointly.


3.10. Trial-and-error PID Tuning

For a simple, low-risk setup:

  1. Start with Ki = 0, Kd = 0.
  2. Increase Kp.
  3. Approach the desired speed of response.
  4. Add Kd if more damping is needed.
  5. Add Ki if steady-state error remains.
  6. Measure the complete response again.

This method can be educational.

Blind trial and error is not suitable, however, for systems that are:

  • unstable,
  • hazardous,
  • high-energy,
  • expensive.

3.11. Ziegler-Nichols

The rules published by Ziegler and Nichols in 1942 are an important milestone in the history of PID tuning.

Two classical approaches are:

  • open-loop reaction curve,
  • closed-loop ultimate gain.

These methods provide a rapid initial estimate.

In many modern applications, however, they are better regarded as:

an initial tuning

rather than:

the final design.

The resulting response can be aggressive and exhibit high overshoot.


3.12. Model-based PID Tuning

When the model is known, PID gains can be selected through:

  • pole placement,
  • root locus,
  • frequency-domain design,
  • optimization,
  • robustness objectives.

Current tools can perform automatic PID tuning while targeting a balance among:

stability
performance
robustness

rather than only a “fast response.”


3.13. Integrator Windup

A real actuator has limits.

For example:

-10 V ≤ u ≤ +10 V

Even if the controller calculates:

u_cmd = 40 V

the actuator can apply only:

u_actual = 10 V

Meanwhile, the integral:

∫e dt

may continue accumulating.

When the system approaches the target, the integrator can still contain a very large value and may take a long time to unwind in the opposite direction.

This is called integrator windup.


3.14. Anti-windup

Integrator windup in a saturated PI loop and its removal by conditional integration
Integrator windup and anti-windup

Common anti-windup methods include:

3.14.1. Clamping

When the output is saturated and the error would drive the integrator farther in the wrong direction, integration is stopped.

3.14.2. Back-calculation

The difference between the applied and calculated control is fed back to the integrator:

u_sat - u

This helps unwind the integrator faster.

3.14.3. Tracking

The controller's internal state is arranged to track the control signal actually applied.

Anti-windup is:

not a cosmetic feature added to PID afterward, but part of control design whenever the physical actuator is limited.


3.15. Saturation

Saturation is not only a PID problem.

Every actuator is limited:

motor torque
valve opening
PWM
current
voltage
heater power
steering angle

A linear model may assume:

u ∈ (-∞,+∞)

while the real system operates under:

u_min ≤ u ≤ u_max

Saturation makes the closed-loop system nonlinear.


3.16. Rate Limiting

Not only actuator magnitude but also its rate of change may be limited:

|du/dt| ≤ r_max

For example:

  • large valves,
  • steering systems,
  • mechanical servos,
  • thermal power systems

cannot move instantaneously from one value to another.

Rate limits must be considered in controller design.


3.17. Two-degree-of-freedom PID

In a one-degree-of-freedom structure, the same PID determines both:

  • reference tracking,
  • disturbance rejection

through the same error signal.

A two-degree-of-freedom structure can add weighting for the reference.

For example:

u =
K_p(br - y)
+
K_i ∫(r-y)dt
-
K_d dy/dt

Here b can adjust the influence of the reference on the proportional term.

The objective is to tune:

reference response

and:

disturbance rejection

with some degree of independence.


3.18. Feedforward

Feedback corrects an error after it appears.

Feedforward produces an appropriate action in advance from a known reference or disturbance.

u = u_ff + u_fb

For example, in a robot arm the gravity torque calculated from the model can be compensated in advance using:

u_ff = g(q)

Feedback then corrects the remaining model error.


3.19. Feedback + Feedforward

A good architecture often combines:

model knowledge
+
feedback
Reference → Feedforward ─────┐
                            ↓
                       (+) → Plant
                            ↑
              Feedback ← Output

Feedforward is fast and anticipatory.

Feedback corrects uncertainty.


Feedforward and feedback address different uncertainty channels. Feedforward anticipates an expected load or trajectory from a model, while feedback corrects observed deviation. On an axis that must resist gravity, a feedforward estimate of holding torque can prevent the integral term from carrying the steady load; feedback is still required when the payload changes or the friction estimate is inaccurate. If feedforward alone saturates the actuator, the remaining authority available to feedback must be included in the design.

3.20. Disturbance Rejection

A disturbance:

d(t)

can enter the system at different points.

For example, in a motor system:

load torque

is a disturbance.

A good controller seeks:

d ↑
→ y changes as little as possible

Disturbance rejection should be measured separately from reference tracking.


3.21. The Noise Problem

A sensor measures:

y_m = y + n

Because the controller uses this measurement, high loop gain can transfer high-frequency noise into the control signal.

Therefore:

high bandwidth

is not always better.

There is a tradeoff between speed and noise sensitivity.


3.22. Saturation, anti-windup, and Actuator Limits

Linear controller design can implicitly assume unlimited actuator authority. Real motors, valves, and thrust commands saturate. If the integral state keeps accumulating error during saturation, integral windup delays recovery.

Anti-windup strategies constrain or back-calculate the integral state using the difference between requested and applied control.

Rate limits matter as well as amplitude limits. If an actuator cannot change instantaneously, the model should include slew-rate constraints or simulation will be overly optimistic.

Unit 4: Root Locus, Frequency Response, Delay, and Robustness

4.1. Root Locus

Pole movement along root-locus branches
Root locus

The root locus shows how closed-loop poles move in the complex plane as the open-loop gain changes.

Consider the characteristic equation:

1 + K G(s)H(s) = 0

As K varies over:

0 → ∞

the paths traced by the roots of this equation form the root locus.


4.2. Purpose of the Root Locus

The root locus visualizes the question:

How does the closed-loop dynamics change if I change the gain or the controller poles and zeros?

It is therefore a powerful design tool for:

  • stability,
  • damping,
  • speed,
  • pole placement.

4.3. Basic root-locus Rules

General rules include:

  1. The number of branches equals the number of open-loop poles.
  2. Branches start at open-loop poles.
  3. They terminate at open-loop zeros or at infinity.
  4. Real-axis segments are determined by the angle condition.
  5. Asymptotes exist for excess poles.
  6. Breakaway and break-in points may be found.
  7. Imaginary-axis crossings may be calculated with Routh analysis.

The angle condition is:

∠G(s)H(s) = (2k+1)180°

and the magnitude condition is:

K |G(s)H(s)| = 1

4.4. Design with Root Locus

A desired pole location:

s_d = -σ ± jω_d

may be selected from requirements such as:

  • damping ratio,
  • natural frequency,
  • settling time.

Controller poles, zeros, and gain are then added so that the root locus passes through this point.


4.5. Lead Compensator

Lead compensator and phase margin with computed steps and state transitions
Lead compensator and phase margin

A lead compensator typically has the form:

        s + z
C(s)=K -------
        s + p

with:

|p| > |z|

Aims include:

  • increasing phase margin,
  • speeding up the response,
  • moving poles to the left.

It provides positive phase contribution in the frequency domain.


4.6. Lag Compensator

A lag compensator may be written as:

        s + z
C(s)=K -------
        s + p

and generally uses:

|z| > |p|

to increase low-frequency gain.

The objective is to:

  • reduce steady-state error,
  • avoid unnecessarily disturbing high-frequency behavior.

The cost can be:

  • slower response,
  • additional phase lag.

4.7. Lead-lag

When both transient-response and steady-state-error requirements must be met, lead and lag compensation can be combined:

C(s)=C_lead(s) C_lag(s)

This is one of the important tools of classical control design.


4.8. Frequency Response

If:

u(t) = A sin(ωt)

is applied to an LTI system, the steady-state output at the same frequency is:

y(t) =
A |G(jω)| sin(ωt + ∠G(jω))

Therefore:

|G(jω)| → amplitude ratio
∠G(jω) → phase shift

defines the system's frequency response.


4.9. Significance of the Frequency Domain

Real signals consist of components at different frequencies.

A control system may need to:

at low frequency
track the reference and reject disturbances well

at high frequency
avoid amplifying sensor noise

The frequency domain makes this distinction directly visible.


4.10. Bode Plot

Bode magnitude and phase response
Bode response

A Bode plot consists of two graphs.

4.10.1. Magnitude

20 log10 |G(jω)|

in dB.

4.10.2. Phase

∠G(jω)

in degrees.

The horizontal axis is logarithmic frequency.


4.11. Decibel

If the gain is:

M = |G(jω)|

then:

M_dB = 20 log10(M)

For example:

M = 10   → +20 dB
M = 1    → 0 dB
M = 0.1  → -20 dB

The logarithmic representation converts products into sums.


4.12. Break Frequencies

A first-order pole:

1/(1+s/ω_p)

approximately changes the slope as:

ω < ω_p → 0 dB/dec
ω > ω_p → -20 dB/dec

A zero:

1+s/ω_z

contributes:

+20 dB/dec

The Bode plot is therefore a visual language for the pole-zero structure of a system.


4.13. Resonance

An underdamped second-order system can produce a large amplitude around a particular frequency.

Near this frequency:

|G(jω)|

has a peak.

In flexible mechanical systems, resonance can cause:

  • vibration,
  • noise,
  • fatigue,
  • behavior close to instability.

Controller bandwidth should be designed together with the system resonances.


4.14. Nyquist Criterion

Nyquist locus relative to the critical point minus one
Nyquist criterion

The Nyquist criterion is used to:

determine closed-loop stability from the open-loop frequency response.

Let the loop transfer function be:

L(s)=G(s)H(s)

The characteristic equation is:

1 + L(s)=0

so the critical point is:

L(s) = -1

The number of encirclements of the -1 point by the Nyquist curve, together with the number of open-loop right-half-plane poles, determines closed-loop stability.


4.15. Sign Convention in the Nyquist Relation

The sign convention can be written differently in the literature depending on contour orientation.

One common convention is:

N = Z - P

or an equivalent signed form according to the selected direction.

Here:

P → open-loop right-half-plane poles
Z → closed-loop right-half-plane poles
N → net encirclements of -1

It is more important to state the chosen contour and direction convention clearly than to memorize one formula in isolation.


4.16. Gain Margin

Gain margin indicates how far the open-loop gain is from the instability boundary at the frequency where the phase is approximately:

-180°

In general, a larger positive gain margin means:

more tolerance to gain uncertainty

but it is not by itself a guarantee of robustness.


4.17. Phase Margin

At the gain-crossover frequency:

|L(jω_gc)| = 1

if the phase is:

φ

then the phase margin is approximately:

PM = 180° + φ

Phase margin provides practical information about tolerance to:

  • delay,
  • model error,
  • additional dynamics.

4.18. Bandwidth

Closed-loop bandwidth indicates the frequency range over which the system can adequately follow inputs.

The general intuition is:

bandwidth ↑
→ response speed ↑

but it can also cause:

noise sensitivity ↑
sensitivity to model uncertainty ↑
control effort ↑

Bandwidth is a performance-robustness tradeoff.


4.19. Delay

A pure time delay:

e^(-Ls)

contributes the phase:

-ωL

without changing magnitude.

The phase becomes increasingly negative as frequency rises.

Therefore delay:

  • reduces phase margin,
  • limits the maximum practical bandwidth,
  • makes fast control more difficult.

Delay can be critical in networked and distributed control systems.


4.20. Padé Approximation

Pade approximations of a time delay with computed steps and state transitions
Pade approximations of a time delay

When a delay cannot be represented directly by a classical rational transfer function, a Padé approximation may be used.

The first-order approximation is:

e^(-Ls)
≈
(1 - Ls/2)/(1 + Ls/2)

This is useful for analysis but does not reproduce the exact high-frequency behavior of a true delay.


4.21. Sensitivity Function

Sensitivity S and complementary sensitivity T with computed steps and state transitions
Sensitivity S and complementary sensitivity T

For a unity-feedback structure, let:

L(s) = C(s)P(s)

Sensitivity:

        1
S(s)=-------
       1+L(s)

Complementary sensitivity:

        L(s)
T(s)=-------
       1+L(s)

and:

S(s)+T(s)=1

4.22. Interpretation of S and T Transfer Functions

At low frequency, if:

|L| >> 1

then:

S ≈ 0
T ≈ 1

This indicates:

  • good reference tracking,
  • good rejection of some disturbances.

At high frequency, if:

|L| << 1

then:

S ≈ 1
T ≈ 0

which can reduce the transfer of measurement noise to the closed-loop output.

Good loop shaping often targets:

high gain at low frequency
low gain at high frequency

4.23. Robustness

The real plant:

P_real(s)

is never exactly identical to the design model:

P_model(s)

Differences may result from:

  • parameter tolerances,
  • load changes,
  • temperature,
  • friction,
  • aging,
  • neglected dynamics.

Robust control aims to preserve closed-loop properties despite these uncertainties.


4.24. Nominal and Robust Performance

4.24.1. Nominal Performance

Performance when the model is assumed to be exactly correct.

4.24.2. Robust Stability

Does the system remain stable in the presence of uncertainty?

4.24.3. Robust Performance

Are the performance requirements also maintained under uncertainty?

For a production system, nominal simulation alone is insufficient.


4.25. Nonminimum-phase System

A right-half-plane zero or certain delays can create nonminimum-phase behavior.

A right-half-plane zero imposes fundamental constraints such as:

  • an initial response in the opposite direction,
  • bandwidth limitations,
  • greater difficulty in aggressive control.

Such dynamics are not defects that can simply be “removed” by a controller; they are physical design constraints.


4.26. Bode's Fundamental Limitation Idea

Feedback cannot reduce undesirable sensitivity to zero at every frequency simultaneously.

Reducing:

|S| ↓

in one region can have the cost of increasing:

|S| ↑

in another.

This phenomenon is often described as the waterbed effect.

Control design is therefore not about:

maximizing everything at the same time,

but about:

selecting the right priorities across frequency regions.


4.27. Taking Control Design Beyond the Nominal Model

Stability in simulation does not guarantee the same behavior in the physical system. Sensor delay, actuator saturation, sampling, quantization, and model uncertainty can change closed-loop dynamics.

Verification can proceed in stages: analytical stability checks, nominal simulation, parameter sweeps, saturation/noise scenarios, and controlled hardware experiments where practical. Each stage tests a different assumption.

Performance metrics are application-specific. Overshoot, settling time, energy use, and disturbance rejection may trade against one another. The design should make the accepted trade-off explicit.

4.28. Stability and Performance Are Different Questions

A stable closed-loop system is not necessarily a well-performing one. Stability asks whether states remain bounded and return toward an equilibrium after a disturbance; performance is judged through quantities such as rise time, overshoot, settling time, steady-state error, and control effort. A very slow system may be stable, and a system with substantial overshoot may still be mathematically stable.

A dominant second-order model makes the distinction visible. Increasing damping generally reduces overshoot, but excessive damping can produce an unnecessarily slow response. Increasing natural frequency may speed up the response while making actuator limits, noise sensitivity, or unmodelled high-frequency dynamics more important. Moving poles into the left half-plane is therefore not the complete design task.

PID terms should not be treated as independent knobs either. Proportional action responds directly to error; integral action can remove steady-state error but may accumulate during actuator saturation; derivative action responds to rate of change and can amplify measurement noise. Changing one coefficient changes the behaviour of the closed loop as a whole.

When solving a control problem, first separate the requirement being tested: Is the system stable? How accurately does it track the reference? How fast is the transient? How strongly are disturbances rejected? What actuator limits apply? A controller may improve one of these objectives while degrading another. Practical control design is therefore an explicit treatment of trade-offs rather than a search for one universally better gain set.

Unit 5: State Space, Observers, Kalman, LQR, and Multivariable Control

5.1. State-space Approach

A transfer function represents input-output behavior.

State space represents the internal dynamics as:

ẋ = Ax + Bu
y  = Cx + Du

where:

x → state vector
u → input
 y → output
A → system matrix
B → input matrix
C → output matrix
D → direct-feedthrough matrix

5.2. Definition and Scope of a State

A state is the smallest set of variables needed, together with future inputs, to determine a system's future behavior.

For a mass-spring-damper system, for example:

x1 = position
x2 = velocity

can be selected.

Then:

ẋ1 = x2

ẋ2 =
-(k/m)x1
-(b/m)x2
+(1/m)u

or in matrix form:

[ẋ1]   [ 0      1  ][x1]   [  0 ][u]
[ẋ2] = [-k/m -b/m ][x2] + [1/m]

5.3. Advantages of State Space

State space is a natural framework for systems that are:

  • multiple-input,
  • multiple-output,
  • subject to initial conditions,
  • time-varying,
  • extendable to nonlinear formulations.

Compared with a transfer function, it carries more information about internal dynamics.


5.4. State-transition Matrix

For the homogeneous system:

ẋ = Ax

we have:

x(t) = e^(At)x(0)

With an input:

x(t)
=
e^(At)x(0)
+
∫₀ᵗ e^[A(t-τ)] B u(τ)dτ

e^(At) is the state-transition matrix.


5.5. Stability in State Space

For the continuous-time LTI system:

ẋ = Ax

if all eigenvalues:

λ_i(A)

lie in the left half-plane:

Re(λ_i) < 0

the system is asymptotically stable.

For a minimal state-space realization, these eigenvalues represent the same dynamics as transfer-function poles.


5.6. Controllability

A system is controllable if its state can be moved to a desired point using a suitable input.

The controllability matrix is:

C =
[B  AB  A²B ... A^(n-1)B]

If:

rank(C) = n

then the system is completely controllable.


5.7. Significance of Controllability

If a dynamic mode cannot be influenced by the input:

the controller cannot move that mode to a desired location.

Controllability should therefore be checked before pole placement.

Finding a mathematical controller formula does not by itself mean that the physical system is controllable.


5.8. Observability

A system is observable if its internal state can be reconstructed from measured inputs and outputs.

The observability matrix is:

O =
[C
 CA
 CA²
 ...
 CA^(n-1)]

If:

rank(O) = n

then the system is completely observable.


5.9. Limits on State-Variable Measurement

In a real system:

position may be measurable
velocity may not be measured directly
current may be measurable
load torque may not be measurable

Measuring every state with sensors can therefore be:

  • expensive,
  • physically difficult,
  • noisy.

The solution is to use a:

state observer

5.10. State Feedback

If the full state is available, a control law such as:

u = -Kx + Nr

may be used.

The closed-loop system becomes:

ẋ = (A-BK)x + BNr

The objective is to place the eigenvalues of:

A-BK

at desired locations.


5.11. Pole Placement

If the system is controllable, an appropriate K can place the closed-loop poles at specified locations.

For example, for desired poles:

-3
-4

one can calculate K such that:

eig(A-BK) = {-3,-4}

Moving the poles as far left as possible is not necessarily good design.

Very fast poles can cause:

  • high control effort,
  • sensitivity to sensor noise,
  • saturation,
  • excitation of neglected fast dynamics.

5.12. State Observer

The estimation error of a Luenberger observer for a second-order plant with only the output measured decaying quickly with observer poles at minus 6 and minus 8
Luenberger observer convergence

A Luenberger-type observer is:

x̂̇ =
Ax̂ + Bu
+ L(y-Cx̂)

where:

x̂ → estimated state
L  → observer gain

For estimation error:

e_x = x - x̂

we obtain:

ė_x = (A-LC)e_x

L is selected so that the observer-error dynamics are stable and sufficiently fast.


A state observer does not make an unobservable state observable; it requires the hidden state to be distinguishable from available measurements. For a discrete system with A=diag(0.8, 0.5) and C=[1,0], the second state never affects the measured output, so the observability matrix has rank one. Selecting another observer gain cannot repair this structural limitation. Sensor placement or model coupling must change. When a camera measures position alone, estimating velocity similarly depends on whether position–velocity dynamics supply sufficient information across measurement instants.

5.13. Observer Poles

Observer poles are often selected faster than controller poles.

An excessively fast observer, however, can:

  • amplify measurement noise,
  • become sensitive to model error.

There is therefore a tradeoff between:

fast estimation
↔
noise robustness

5.14. Separation Principle

For a linear system, the:

state-feedback gain K

and:

observer gain L

can, under suitable conditions, be designed separately.

The closed-loop eigenvalues:

eig(A-BK)

and observer-error eigenvalues:

eig(A-LC)

together determine system behavior.

This result is known as the separation principle.


5.15. Kalman Filter

The Kalman filter is a fundamental method for state estimation in noisy linear dynamic systems.

Model:

x_(k+1) = A x_k + B u_k + w_k
y_k     = C x_k + v_k

where:

w_k → process noise
v_k → measurement noise

The Kalman filter forms a statistical balance between:

model prediction
+
measurement correction

5.16. Definition and Scope of a Kalman Filter Not

A Kalman filter:

  • does not eliminate every kind of noise,
  • does not magically correct an incorrect model,
  • is not directly sufficient for every nonlinear problem.

Its performance depends on the selected:

model
Q
R

where:

Q → process-noise covariance
R → measurement-noise covariance

5.17. LQR

LQR weighting trade-off on a double integrator with computed steps and state transitions
LQR weighting trade-off on a double integrator

The Linear Quadratic Regulator — LQR determines a state-feedback gain through an optimal-control problem.

The objective is to minimize:

J =
∫₀∞
(xᵀQx + uᵀRu)
dt

where:

Q → penalty on state deviations
R → penalty on control effort

The resulting feedback law is:

u = -Kx

5.18. Intuition for Q and R

In general:

Q ↑
→ state error is more costly
→ more aggressive control

R ↑
→ control effort is more costly
→ gentler control

The scales of these matrices are affected by physical units.

Choosing Q=I, R=1 is only a starting point.


5.19. LQG

If all states are not measured, one can combine:

LQR
+
Kalman filter

This structure is known as:

Linear Quadratic Gaussian — LQG

Nominal optimality of LQG does not mean that it:

automatically provides strong robustness margins.

Robustness must be evaluated separately.


5.20. Multivariable Systems

A system with multiple inputs and outputs can be written as:

u ∈ R^m
y ∈ R^p

For a drone, for example:

inputs:
4 motor thrust commands

outputs:
roll
pitch
yaw
altitude

are strongly coupled.

Designing independent SISO loops is not always sufficient.


5.21. Cross Coupling

In a multivariable system:

u1

may influence not only:

y1

but also:

y2, y3...

This is treated as:

  • interaction,
  • coupling.

Decoupling or MIMO design may be necessary.


5.22. Nested Control Loops

Practical systems often use multiple loops.

A servo motor, for example, may have:

innermost loop:
current / torque

middle loop:
speed

outer loop:
position

The general design intuition is:

inner loop faster
outer loop slower

so the outer loop can approximately regard the inner loop as an ideal actuator.


5.23. Separation of Loop Bandwidths

An approximate separation may be:

current loop  → 1 kHz
speed loop    → 100 Hz
position loop → 10 Hz

These values are not universal.

The principle is:

the inner loop should be sufficiently faster than the outer loop.


5.24. Cascade Control

The same idea is used in process industries.

For example:

outer:
temperature controller

inner:
steam-flow controller

The inner loop rejects fast disturbances.

The outer loop regulates the primary quality variable.


5.25. Nonlinear and non-Gaussian Estimation

The standard Kalman filter updates conditional means and covariances in closed form under linear state and observation equations with appropriate Gaussian-noise assumptions. The EKF uses local linearization; the UKF uses deterministic sigma points to approximate certain nonlinear transformations. These approaches can be limited by strong nonlinearities, multimodal state uncertainty and outlying measurements. Representing a non-Gaussian distribution only by its mean and covariance may hide competing state hypotheses.

A particle filter approximates p(x_k | y_1,…,y_k) with weighted samples. During prediction, particles propagate through the dynamics model; during measurement update, they receive weights based on observation likelihood. For normalized weights w̃_i, the diagnostic

N_eff ≈ 1 / Σ_i (w̃_i)²

indicates when only a few particles dominate. Resampling can reduce weight degeneracy, but it may also eliminate many distinct candidates and hence reduce sample diversity. The resampling threshold, particle count and support of the transition model must therefore be evaluated together.

A state-estimation algorithm does not replace the stability argument for a controller. Rare large estimation errors may cause constraint violations in closed-loop operation even when average tracking error appears satisfactory. Estimation accuracy, worst-case closed-loop behavior and computational delay require separate validation criteria.

5.26. Testing Observability with a two-state Example

Consider the state x = [p, v]ᵀ with dp/dt = v and dv/dt = u. Measuring position alone yields A = [[0,1],[0,0]] and C = [1,0]. The observability matrix O = [C; CA] = [[1,0],[0,1]] has full rank, so velocity can be recovered from the history of position under the ideal model. Direct numerical differentiation nevertheless amplifies noise; observer design still requires an appropriate sampling period and measurement-noise model.

If only velocity is measured, C = [0,1] and O = [[0,1],[0,0]] has rank one. A constant offset in position cannot be inferred from velocity observations. Choosing more aggressive observer poles or altering Kalman covariances does not supply the missing information. Observability should therefore be checked against the sensor architecture before tuning an estimator. Unmodeled friction, sensor bias, and measurement latency also mean that full theoretical rank is necessary but not sufficient for satisfactory estimation in hardware.

5.27. UKF Observers and Parameter Observability in Nonlinear Systems

With transition x_(k+1)=f(x_k,u_k)+q_k and observation z_k=h(x_k)+r_k, an EKF uses local derivatives whereas a UKF propagates selected sigma points through nonlinear functions to approximate moments. A standard scaled UKF uses 2n+1 sigma points for an n-dimensional state; preserving positive semidefinite covariance and numerical stability remains essential. Augmenting the state with unknown physical parameters changes observability and excitation requirements.

Treating a neural prediction used as a measurement as if its error covariance were zero creates unwarranted confidence. Measurement latency, outliers, and the learned model's out-of-domain behavior belong in the validation protocol.

Unit 6: Digital, Predictive, Adaptive, and Safe Control

6.1. Digital Control

Most modern controllers run digitally on:

  • microcontrollers,
  • PLCs,
  • DSPs,
  • FPGA-assisted processors,
  • industrial computers.

Although the physical system may be continuous-time, the controller samples at:

t = kT_s

6.2. Sampling

The sampling period is:

T_s

and the sampling frequency is:

f_s = 1/T_s

A digital loop is:

read sensor
↓
compute control
↓
apply output
↓
wait T_s
↓
repeat

In a real-time controller, the nominal sampling period and the elapsed execution interval are distinct. A loop designed for T_s = 10 ms may execute its next step after 14 ms because of scheduling delay, affecting derivative and discrete-time updates. If the control law assumes a constant step, timing variation must be measured against an explicit tolerance. A variable-step implementation should use measured elapsed time in its difference equations and guard against implausibly short or long intervals. Average loop duration alone does not reveal these failures.

6.3. The Nyquist Sampling Theorem and Control Bandwidth Are Not the Same Thing

In signal theory:

f_s > 2 f_max

is the fundamental lower bound for avoiding aliasing.

In control applications, merely satisfying this lower bound is generally not enough.

The controller sampling frequency is often selected substantially above the desired closed-loop bandwidth.

A practical initial rule of thumb may be:

f_s ≈ 10...20 × target bandwidth

but:

  • delay,
  • computational load,
  • sensor behavior,
  • actuator behavior,
  • filtering

must also be examined.


6.4. Zero-order Hold

A digital controller holds its output constant between successive commands.

This behavior is modeled as a zero-order hold — ZOH.

ZOH is a real dynamic element introduced into the continuous plant by digital control.


6.5. Discrete-time Model

A discrete linear system can be written as:

x[k+1] = A_d x[k] + B_d u[k]
y[k]   = C_d x[k] + D_d u[k]

For the continuous model:

ẋ = Ax + Bu

ZOH discretization gives:

A_d = e^(A T_s)

and:

B_d =
∫₀^Ts e^(Aτ)B dτ

6.6. z-transform

The z-transform plays a role for discrete-time systems analogous to the Laplace transform for continuous-time systems.

A discrete transfer function is:

G(z) = Y(z)/U(z)

While the continuous-time stability region is:

Re(s) < 0

in discrete time it is the interior of the unit circle:

|z| < 1

6.7. Relationship Between the s-plane and z-plane

Sampling is related through:

z = e^(sT_s)

If a continuous-time pole is stable:

Re(s) < 0

then:

|z| < 1

The imaginary axis:

s = jω

maps onto the unit circle.


6.8. Discrete PID

PID can be implemented directly with difference equations.

For example, the integral may be approximated as:

I[k] =
I[k-1] + K_i T_s e[k]

and the derivative as:

D[k] =
K_d (e[k]-e[k-1])/T_s

A practical implementation should account for:

  • filtered derivative action,
  • anti-windup,
  • output limits,
  • sampling jitter.

6.9. Tustin Transformation

Euler and Tustin maps from s-plane to z-plane with computed steps and state transitions
Euler and Tustin maps from s-plane to z-plane

The bilinear transformation can be used to discretize a continuous controller:

s ≈ (2/T_s) (z-1)/(z+1)

This method is known as the Tustin / bilinear transform.

Because it produces frequency warping, prewarping may be used for critical frequencies.


6.10. Euler Methods

Simple discretization methods include:

6.10.1. Forward Euler

s ≈ (z-1)/(T_s z)

with an equivalent finite-difference interpretation.

6.10.2. Backward Euler

This has different stability properties.

Despite their simplicity, the effect of the selected discretization method should be analyzed in high-performance control design.


6.11. Computational Delay

The controller samples the sensor at:

t = kT_s

If the control calculation takes:

T_c

the actuator command is delayed.

This delay creates phase loss.

In a high-bandwidth system:

T_c / T_s

should be kept small.


6.12. Jitter

If a real-time task is intended to run with:

T_s = 1 ms

but its cycles occur at:

0.8 ms
1.4 ms
0.9 ms
1.2 ms

then the sampling contains jitter.

Jitter can cause:

  • phase uncertainty,
  • variable delay,
  • numerical derivative error.

This is why real-time guarantees matter in control software.


6.13. Priority Inversion and Control

In a real-time operating system, a high-priority control task may be delayed by a low-priority task while waiting for a lock.

This is more than a software-performance issue.

In a high-speed control system:

a scheduling error can become a physical-behavior error.

Control software should therefore be designed with respect to:

  • bounded execution time,
  • priority policy,
  • lock usage,
  • watchdogs,
  • deadline monitoring.

6.14. Sensor Quantization

ADC measurements have finite resolution.

For example, for a:

12-bit ADC
0-5 V

the resolution is approximately:

5/4096 ≈ 1.22 mV

Small changes in error may remain below this quantization level.

This can cause:

  • limit cycles,
  • noisy derivative estimates,
  • low-speed vibration.

6.15. Actuator Quantization

If PWM is 8-bit over:

0...255

then the control command can take only one of 256 levels.

Small control differences cannot be applied.

This is particularly important in:

  • low-speed motion,
  • precise positioning,
  • mechanisms with friction.

6.16. Measurement Filtering

A low-pass filter can be used for sensor noise.

For example:

          1
F(s)=-----------
      τ_f s + 1

However, filtering produces the tradeoff:

noise ↓
phase lag ↑

Making a filter as aggressive as possible is therefore not good design.


6.17. Anti-aliasing Filter

An analog anti-aliasing filter is required before the ADC to suppress high-frequency components.

A digital filter:

cannot undo aliasing that has already occurred during sampling.

This distinction is especially important in vibration and high-speed sensing systems.


6.18. Model Predictive Control — MPC

Model Predictive Control predicts future system behavior from a model at every sampling instant and solves an optimization problem.

The general process is:

measure/estimate current state
↓
predict the next N steps
↓
optimize the control sequence
↓
apply only the first control action
↓
obtain a new measurement
↓
optimize again

This is the receding-horizon approach.


6.19. MPC Objective Function

A simple example is:

J =
Σ ||y(k+i)-r(k+i)||²_Q
+
Σ ||Δu(k+i)||²_R

The objective balances:

tracking error ↓
control variation ↓

A major strength of MPC is its ability to include physical constraints directly in the optimization problem.


6.20. MPC Constraints

For example, constraints such as:

-10 ≤ u ≤ 10
|Δu| ≤ 1
0 ≤ y ≤ 100

can be defined explicitly.

In PID, saturation is often a nonlinear limit added after the main design; in MPC, constraints can be part of the optimization problem itself.


6.21. Conditions Favoring Model Predictive Control

MPC is a strong candidate when the system has:

  • multiple variables,
  • strong input-output interaction,
  • explicit physical constraints,
  • slow or medium-speed dynamics,
  • known future reference information.

This is an important reason for its historical adoption in chemical and process industries.


6.22. Cost of MPC

An optimization problem is solved at every sampling instant.

Therefore the following matter:

  • computational cost,
  • optimization time,
  • infeasibility,
  • model error,
  • solver behavior.

In a real-time system:

solver_time < T_s

must hold not merely on average, but at the required reliability level.


6.23. Nonlinear MPC

If the model:

ẋ = f(x,u)

is nonlinear, Nonlinear MPC — NMPC may be used.

The optimization then also becomes nonlinear.

Advantages:

  • wider operating region,
  • better representation of real physical constraints.

Costs:

  • higher computational load,
  • local minima,
  • sensitivity to the initial guess.

6.24. Adaptive Control

Recursive least squares with forgetting factor for tracking time-varying parameters

If system parameters change during operation, a fixed controller may become inadequate.

For example, in an aircraft:

speed
altitude
fuel
aerodynamic parameters

and in a motor:

load
temperature
friction

may change.

Adaptive control aims to adjust controller parameters during operation.


6.25. Gain Scheduling

A simpler alternative to a fully adaptive system is:

determine the operating region
↓
select the appropriate controller gains

For example:

low speed  → K1
medium speed → K2
high speed → K3

This structure is called gain scheduling.

Transitions between controllers should consider:

  • continuity,
  • stability,
  • hysteresis.

6.26. Model Reference Adaptive Control

In MRAC, the desired behavior is defined by a:

reference model

The difference between the actual plant output and reference-model output is used to update controller parameters.

The objective is:

y(t) → y_m(t)

Stability of the adaptation law must be established separately.


6.27. Nonlinear Control

In nonlinear systems:

superposition

does not hold.

A linear controller that performs well near one operating point may fail over a wider region.

Methods include:

  • feedback linearization,
  • Lyapunov-based control,
  • sliding mode,
  • backstepping,
  • passivity-based control,
  • nonlinear MPC.

6.28. Lyapunov Approach

For an equilibrium point, an energy-like function satisfying:

V(x) > 0

is selected.

If:

V̇(x) < 0

then the system can be shown to move toward equilibrium.

The Lyapunov method can provide:

a stability proof without finding the complete solution of the differential equation.


6.29. Sliding-mode Control

Sliding-mode reaching, sliding and chattering with computed steps and state transitions
Sliding-mode reaching, sliding and chattering

Sliding-mode control defines a sliding surface:

s(x)=0

The state is driven toward this surface and then follows the desired dynamics on it.

Advantage:

  • strong robustness to certain matched uncertainties.

Challenges:

  • chattering,
  • high-frequency switching,
  • real actuator limitations.

6.30. Robust Control

Robust control explicitly models uncertainty and seeks stability and performance for:

the entire admissible family of models

Tools include:

  • H∞,
  • μ-synthesis,
  • mixed sensitivity,
  • robust loop shaping.

These methods are particularly important in areas such as:

  • flight control,
  • precision servos,
  • flexible structures,
  • high-performance mechanical systems.

6.31. H∞ Intuition

The H∞ approach can roughly be viewed as the problem of:

bounding a selected input-output gain under the worst frequency and disturbance direction.

For example, a condition such as:

||T_zw||∞ < γ

may be imposed.

The objective is to limit worst-case gain rather than average behavior.


6.32. Control Effort

How much energy the controller uses can matter as much as whether it reaches the target.

Measures may include:

∫u² dt

or:

Σ u[k]²

An excessively aggressive controller can cause:

  • motor heating,
  • mechanical wear,
  • power loss,
  • battery drain.

6.33. Tracking and Disturbance Rejection Are Not the Same Objective

Reference tracking:

r → y

Disturbance rejection:

d → y

Measurement-noise transfer:

n → y

should be evaluated through different transfer functions.

Declaring the entire system “good” from a single step response is incomplete.


6.34. Physical Constraints in a Control System

A real system may have limits such as:

u_min ≤ u ≤ u_max
Δu_min ≤ Δu ≤ Δu_max
y_min ≤ y ≤ y_max
x ∈ safe region

These constraints should be known from the beginning of the design.

In a critical system, an independent safety layer may be required rather than relying on the controller alone.


6.35. Safety Layer

Suppose the normal controller tracks:

T_ref = 90 °C

An independent hardware safety limit can enforce:

T > 120 °C
→ physically disconnect heater power

This separates the functions of:

control

and:

safety

6.36. Functional Safety

IEC 61508 provides a general functional-safety framework for safety functions in electrical, electronic, and programmable electronic systems.

An important distinction for control engineering is:

A normal control function and a safety function are not the same thing.

The normal controller provides performance.

The safety system is designed to bring the plant to a safe state under a specified hazardous condition.


6.37. Cyber-physical Control

A modern control system is not only a physical loop.

It may include:

sensor
network
PLC
controller
SCADA
remote maintenance
historian data
actuator

A cybersecurity vulnerability can therefore become a physical control failure.


6.38. Cyber Threats to Control Systems

Examples include:

  • sensor spoofing,
  • changing setpoints,
  • modifying actuator commands,
  • replay attacks,
  • inducing network delay,
  • denial of service,
  • modifying PLC logic,
  • manipulating measurement packets.

Control-system design must consider together:

availability
integrity
safety
timeliness

6.39. Distinctive Properties of OT Security

In an information system, actions such as:

stop the service
patch
restart

may sometimes be routine.

In an industrial control system, an abrupt shutdown can cause:

  • production loss,
  • physical damage,
  • safety risk.

NIST SP 800-82 Rev. 3 emphasizes that OT security must be considered together with reliability, performance, and safety requirements.


6.40. Time in Control Communication

Correct packet contents are not sufficient.

Control requires:

correct value
+
value at the correct time

For a fast system, correct sensor information arriving 100 ms late can be as harmful as an incorrect decision.

Therefore:

  • latency,
  • jitter,
  • packet loss,
  • clock synchronization

are part of control-system reliability.


6.41. Fault Tolerance

A sensor fault may appear as:

stuck value
bias
drift
disconnection
outlier

An actuator fault may include:

stuck
loss of effectiveness
saturation

Fault-tolerant control:

  • detects the fault,
  • isolates it,
  • reconfigures the system when possible.

6.42. Sensor Validation

A single sensor value should not be trusted blindly.

Methods include:

  • physical-range checks,
  • rate-of-change limits,
  • comparison of two sensors,
  • model-based residuals,
  • majority voting.

For example, if:

|y_measured - y_predicted| > threshold

then a fault candidate may be flagged.


6.43. Watchdog

If a real-time controller fails to complete its cycle within the specified time, a watchdog may:

  • reset the system,
  • enter a safe mode,
  • switch to a backup controller.

A watchdog:

does not replace a stability proof; it is an additional safety layer against software or hardware failures.


6.44. Fail-safe and fail-operational

6.44.1. Fail-safe

On failure, the system moves to a safe state.

For example:

heater → off

6.44.2. Fail-operational

A specified function continues even after a failure.

A critical flight-control system, for example, may switch to a redundant channel.

The choice depends on:

  • risk analysis,
  • physical process,
  • mission requirements.

6.45. From the Control Loop to System Safety

In classical control theory, a controller is a mathematical or computational mechanism that changes plant behavior according to measurements and a reference. In system safety, control can also be used in a broader sense: software, an operator, a procedure, a maintenance process, or a management function can constrain which behaviors are allowed in the physical process.

These meanings are not equivalent. PID, LQR, and MPC are mathematical control methods; systems-theoretic safety approaches such as STAMP/STPA examine hazards through control structure, constraints, feedback, and interaction. Their common concept is feedback, while the analytical level and objective are different.

A safety control structure can be represented abstractly as:

controller
  | control action
  v
controlled process
  | feedback
  ^
sensor / observation

A hazardous action can occur even when no component has failed in the conventional sense if the controller's internal process model no longer matches physical reality.

For example:

actual actuator state = active
controller model      = inactive

A new command may then be issued under the wrong physical context. Safe control therefore requires more than transfer-function stability; data age, operating mode, command ordering, and feedback integrity can all determine system behavior.

At system level, a control action can be examined by asking whether:

  • a required action is omitted,
  • an action is issued under an unsafe context,
  • the correct action is issued at the wrong time or in the wrong order,
  • the action lasts too long, too briefly, or terminates at the wrong time.

This classification does not replace classical stability analysis. It complements physical control verification with system-level behavioral constraints.

For cyber-physical systems the design chain consequently becomes:

physical model
+ controller dynamics
+ actuator/sensor limits
+ timing
+ operating modes
+ system safety constraints
+ verification evidence

A stable controller and a safe system should therefore not be treated as synonyms. Controller stability is an essential property, but it is not by itself proof of system safety.

6.46. Control of Switching and Time-Varying Systems

In temporal networks, when an edge occurs is part of the structure, not merely metadata. In control systems whose communication or coupling topology changes over time, aggregating all links into one static graph can imply reachability through links that never coexisted and can hide brief disconnections that materially affect stability or observability. Time-respecting paths, temporal reachability, edge persistence, burstiness, and time-dependent centrality therefore complement static degree and one-shot community partitions.

  • Show where a fixed-A-matrix assumption fails in switching systems.
  • State how topology changes affect observability and controllability analysis.
  • Model control latency as part of the system dynamics.

6.47. Timing Jitter and Measurement Age in sampled-data Control

The sampling period \(T_s\) in a digital controller does not imply that every real execution cycle occurs at precisely that interval. Scheduler delay, sensor acquisition, communication queues, and actuator updates separate sampling time from the time at which a computed command takes effect. The duration between a physical sample and its use by the control action can be measured as measurement age. Low CPU execution time by itself does not guarantee low measurement age.

A simple discrete integral controller has the form \(I[k]=I[k-1]+K_i T_s e[k]\). If actual cycle durations vary materially, the fixed-\(T_s\) assumption changes the integral action per unit of physical time. Using a measured interval \(\Delta t_k\) is possible, but does not automatically preserve the stability analysis made for the original periodic model. An anti-windup mechanism limiting integral accumulation under actuator saturation must be validated together with the sampling and saturation semantics.

A sound experiment measures nominal period, cycle-time distribution, worst observed measurement age, command-to-actuator delay, and closed-loop error. Hardware-in-the-loop testing should include injected latency, dropped measurements, and late commands. Numerical correctness of the discrete control law is not sufficient evidence of correct real-time execution.

Unit 7: Design Process, HIL, Physical Experiments, and Software

7.1. Practical Sequence for Controller Design

A sound automatic-control project can follow:

1. Define the control objective
2. Identify inputs and outputs
3. State physical limits
4. Select sensors and actuators
5. Build a model
6. Validate the model experimentally
7. Define the operating point
8. Quantify performance requirements
9. Select an appropriate control architecture
10. Design the controller
11. Add saturation and noise effects
12. Simulate
13. Perform robustness analysis
14. Validate the real-time implementation
15. Test safety and fault scenarios
16. Commission the hardware gradually

This sequence turns control from merely solving equations into a systems-engineering problem.


7.2. Limits of Simulation-Based Validation

Simulation is:

  • fast,
  • repeatable,
  • safe for testing hazardous scenarios.

But simulation remains inside the model.

The real system contains details such as:

sensor noise
cable resistance
friction
backlash
saturation
dead zone
power-supply limits
timing delay
quantization
mechanical flexibility

Therefore:

A controller that works in simulation is evidence that it can work on the real system, not proof that it will.


7.3. Model-in-the-Loop

At the first stage:

controller model
+
plant model

run in the same simulation environment.

This can be called:

Model-in-the-Loop — MIL

The objective is to evaluate rapidly:

  • the control architecture,
  • initial gains,
  • performance targets.

7.4. Software-in-the-Loop

The actual controller code or production-near software is run against:

the simulated plant

The objective is to validate:

  • differences between algorithm and implementation,
  • numerical precision,
  • software logic.

7.5. Processor-in-the-Loop

The controller code runs on the target processor while the physical process remains simulated.

This stage is valuable for evaluating:

  • execution time,
  • floating- versus fixed-point effects,
  • target compiler behavior,
  • numerical behavior.

7.6. Hardware-in-the-Loop

Real control hardware is connected to a:

real-time process simulator

HIL allows conditions such as:

  • faults,
  • excessive inputs,
  • sensor disconnection,
  • communication delay,
  • boundary conditions

to be tested without damaging the physical process.


7.7. Commissioning

Transition to the real system should be gradual.

An example sequence is:

1. Monitor sensors only
2. Verify scaling
3. Test the actuator open-loop at low power
4. Verify sign conventions
5. Enable safety limits
6. Enter closed-loop operation with low gain
7. Use a small reference
8. Perform a disturbance test
9. Gradually expand the operating range
10. Perform final performance tests

Sign errors are particularly dangerous.

A loop intended to provide negative feedback can become positive feedback because of incorrect wiring or a software sign error.


7.8. DC Motor Speed Control

A DC motor is a powerful experimental platform for teaching automatic control.

Input:

motor voltage / PWM

Output:

ω

Disturbance:

load torque

An initial objective may be:

ω → ω_ref

7.9. DC Motor Speed Experiment

A practical exercise:

  1. Drive the motor open-loop.
  2. Measure the PWM-speed relationship.
  3. Apply step inputs.
  4. Obtain an approximate first-order model.
  5. Design a PI controller.
  6. Test a reference step.
  7. Add mechanical load.
  8. Measure disturbance rejection.

Measures can include:

rise time
settling time
overshoot
e_ss
peak current

7.10. DC Motor Position Control

Because motor position satisfies:

θ̇ = ω

an integrator is added to the speed dynamics.

For position control, the following approaches can be compared:

  • P,
  • PD,
  • PID,
  • state feedback.

The role of integral action becomes particularly clear under constant load torque.


7.11. Observing Derivative Action on a Motor

If position control uses only a high Kp, it can produce:

  • fast motion,
  • overshoot,
  • oscillation.

Adding velocity feedback or derivative action:

-K_d θ̇

can create behavior similar to mechanical damping.

This experiment provides a strong intuitive demonstration of P and D action.


7.12. Flexible Mechanism

Flexibility between two masses or two shafts creates resonance.

A simple servo model may appear sufficient while the real system:

motor
↓
flexible coupling
↓
load

can produce high-frequency oscillation.

This experiment demonstrates:

  • resonance,
  • flexible modes,
  • bandwidth limits,
  • risks of model reduction.

7.13. Poor Design in a Flexible System

If an aggressive PID is designed using only a low-frequency motor model, the controller can excite:

the neglected resonant mode

The result may be:

  • vibration,
  • noise,
  • instability,
  • mechanical damage.

The frequency range used for system identification should therefore extend beyond the intended control bandwidth.


7.14. Magnetic Levitation

A magnetic-levitation system is a classical nonlinear and open-loop unstable system.

Electromagnetic force may approximately follow a nonlinear relation such as:

F_m ∝ i²/x²

and is balanced against gravity:

mg

The system can be linearized around an equilibrium point and a controller designed for that region.


7.15. Why Magnetic Levitation Is Instructive

This setup combines:

  • open-loop instability,
  • operating point,
  • linearization,
  • fast sensing,
  • inner current loop,
  • outer position loop.

The fact that the object cannot remain balanced when the controller is disabled directly demonstrates the physical importance of feedback.


7.16. Ball-and-beam System

The position of a ball on a beam is controlled through:

beam angle

There are nested dynamics between ball position and the servo.

The system is useful for teaching:

  • multi-loop control,
  • unstable or weakly damped behavior,
  • position measurement,
  • nonlinear modeling.

7.17. Inverted Pendulum

An inverted pendulum has an open-loop unstable equilibrium.

The objective is:

θ → 0

and, in many setups, simultaneously:

x → x_ref

This is a classical laboratory system for:

  • state space,
  • controllability,
  • LQR,
  • observers,
  • nonlinear swing-up.

7.18. Furuta Pendulum

A Furuta pendulum consists of a rotary arm and pendulum.

Input:

arm motor torque

Possible states are:

arm angle
arm angular velocity
pendulum angle
pendulum angular velocity

Although the system has a single input rather than being MIMO, its internal dynamics are strongly coupled.


7.19. Swing-up and Stabilization

An inverted pendulum contains two different control problems.

7.19.1. Swing-up

Inject energy to move the pendulum from the downward position to the upright region.

7.19.2. Stabilization

Suppress small deviations around the upright equilibrium.

A single linear controller generally cannot solve both tasks over the full range.

A hybrid structure may use:

energy-based swing-up
↓
enter the balance region
↓
LQR / state feedback

7.20. Temperature Control

Thermal systems are generally slower than mechanical systems.

A simple model:

C_th dT/dt
=
P_heater
-
(T-T_amb)/R_th

can approximate first-order behavior.

Such a system provides a safe, slow experiment for teaching PI/PID control.


7.21. Important Realities of Thermal Systems

  • a heater may provide only positive power,
  • cooling may be passive,
  • delay may be large,
  • sensor location matters,
  • thermal inertia may be high.

The symmetric assumption u ∈ (-∞,+∞) is therefore often incorrect.


7.22. Level Control

A tank can be modeled as:

A dh/dt = q_in - q_out

If the outflow satisfies:

q_out ∝ sqrt(h)

then the system is nonlinear.

It can be linearized around an operating point.

Level control is suitable for teaching:

  • process dynamics,
  • integral behavior,
  • valve saturation,
  • cascade control.

7.23. Basic Loop for Control Software

A minimal embedded-controller structure is:

every Ts:
    measurement = read_sensor();

    filtered = filter(measurement);

    error = reference - filtered;

    control = controller(error);

    control = apply_limits(control);

    write_actuator(control);

    monitor_faults();

The parts that are as important as the mathematical controller itself are:

filter
limits
timing
fault monitoring

7.24. PID Pseudocode

error = reference - measurement

P = Kp * error

integral += Ki * Ts * error

derivative =
    filtered_derivative(measurement)

u_raw =
    P
    + integral
    - Kd * derivative

u =
    clamp(u_raw, u_min, u_max)

anti_windup(u, u_raw)

This structure illustrates the transition from ideal textbook PID to production PID.


7.25. Data Logging in the Control Loop

At minimum, the following should be logged:

timestamp
reference
measurement
error
control_raw
control_applied
integral_state
saturation_flag
fault_flags

An advanced system may also log:

  • estimated state,
  • raw sensor data,
  • delay,
  • cycle execution time.

Without data logging, tuning a real system becomes largely guesswork.


7.26. Plots for Control Performance

A single output plot is insufficient.

An experiment should show at least:

7.26.1. Reference and Output

r(t), y(t)

7.26.2. Error

e(t)

7.26.3. Control Signal

u(t)

7.26.4. Saturation

u_raw vs u_applied

A controller that tracks the target well while remaining continuously saturated may not be well designed.


7.27. Step Test

A step response rapidly reveals:

  • speed,
  • damping,
  • steady-state error,
  • saturation,
  • nonlinearity.

By itself, however, it provides insufficient information about:

  • noise robustness,
  • frequency limits,
  • different operating points.

7.28. Disturbance Test

Keep the reference constant and apply a known disturbance.

For a motor:

add mechanical load

For a heater:

open the door / create airflow

Measure:

maximum deviation
recovery time
steady-state error

This test demonstrates actual regulation performance.


7.29. Noise Test

As control bandwidth increases, the influence of sensor noise on:

u(t)

should be observed.

Especially with derivative action, one may evaluate:

control RMS

and the power spectrum.


7.30. Parameter-variation Test

Simulation can vary model parameters by:

±10%
±20%

On the real system one can vary:

  • load,
  • supply voltage,
  • temperature.

The purpose is to determine how robust the nominal design is.


7.31. Worst-case Approach

Only evaluating:

average performance

may be insufficient.

In a critical system, combinations such as:

maximum delay
minimum voltage
maximum load
sensor tolerance
worst friction

should be considered together.

The controller must remain safe under the worst valid operating condition.


7.32. Basic Linear Model in MATLAB

Example:

s = tf('s');

P = 1/(s^2 + 2*s + 5);

step(P);
grid on;

Poles and zeros:

pole(P)
zero(P)

Frequency response:

bode(P);
margin(P);

Root locus:

rlocus(P);

7.33. PID in MATLAB

C = pid(Kp,Ki,Kd);

T = feedback(C*P,1);

step(T);

Automatic initial tuning:

C = pidtune(P,'PID');

The current Control System Toolbox also supports methods such as:

  • PID/PIDF,
  • 2-DOF PID,
  • Bode loop shaping,
  • root locus,
  • LQR/LQG,
  • Kalman design.

An automatically tuned result should not be deployed before physical limits are incorporated.


7.34. State Space in MATLAB

A = [0 1; -5 -2];
B = [0; 1];
C = [1 0];
D = 0;

sys = ss(A,B,C,D);

Controllability:

rank(ctrb(A,B))

Observability:

rank(obsv(A,C))

Pole placement:

K = place(A,B,[-3 -4]);

7.35. LQR in MATLAB

Q = diag([10 1]);
R = 0.5;

K = lqr(A,B,Q,R);

Then:

Acl = A - B*K;

and the closed-loop eigenvalues can be examined.

At this point, not only eig(Acl) but also:

  • control effort,
  • saturation,
  • step response,
  • model variation

should be tested.


7.36. Control Analysis with Python

The Python ecosystem supports basic analysis with python-control, SciPy, and NumPy.

Example:

import control as ct

P = ct.tf([1], [1, 2, 5])

ct.poles(P)
ct.zeros(P)
ct.step_response(P)
ct.bode_plot(P)

Closed loop:

C = ct.pid(1, 1, 0.1)  # The method may differ by API version
T = ct.feedback(C * P, 1)

The current API of the library version in use should be verified.


7.37. Tools Do Not Eliminate Theory

Software can calculate the results of:

pidtune
place
lqr
margin
rlocus

But it does not automatically decide:

  • which model is correct,
  • which operating point matters,
  • which bandwidth is safe,
  • whether sensor noise is acceptable,
  • what actuator limits apply,
  • which performance metric matters,
  • whether failure is safe.

Control engineering is the complete set of these decisions.


Unit 8: Learning-Based Control, Digital Twins, and Simplicity

8.1. Artificial Intelligence and Control Engineering

Artificial intelligence can:

  • help derive model equations,
  • generate code,
  • analyze logs,
  • suggest parameter sweeps,
  • summarize experimental results,
  • compare control literature.

In a critical control loop, however:

“the model suggested it”

is not a proof of stability or safety.

The control law must be validated mathematically and experimentally.


8.2. Learning-based Control

Machine learning can be incorporated into control systems for:

  • system identification,
  • estimation of unknown dynamics,
  • gain scheduling,
  • estimation,
  • policy learning.

But learning-based control increases challenges such as:

  • out-of-distribution operation,
  • stability guarantees,
  • safe exploration,
  • explainability,
  • computation time.

8.3. Reinforcement Learning and Control

In reinforcement learning, a policy:

u = π(x)

can be learned to maximize a reward.

This approach can be powerful in some high-dimensional tasks.

The distinction from classical control matters.

Classical design generally proceeds from:

model
+ stability
+ performance requirement

whereas RL learns a policy from:

experience
+ reward
+ optimization

Safe training is a separate problem for critical physical systems.


8.4. Safe Use of learning-based Control

A safer hybrid architecture may be:

verified safe baseline controller
+
learning-based improvement layer
+
hard safety limits

For example, the learning layer may perform:

  • feedforward adaptation,
  • model-error compensation,
  • parameter estimation,

while fundamental stabilization remains in a verified controller.


8.5. Digital Twin

In a control context, a digital twin can be viewed as:

physical system
+
computational model updated with current data

Possible uses include:

  • state monitoring,
  • prediction,
  • controller testing,
  • fault scenarios,
  • maintenance planning.

Its control value depends on how current and well validated the model remains against the real system.


8.6. Simplicity in Automatic Control

Unnecessary complexity often adds no value in control design.

If a simple PI:

meets the requirements

then using MPC is not technical superiority.

A sound sequence is:

simplest sufficient model
↓
simplest sufficient controller
↓
measure
↓
increase complexity only when necessary

8.7. Conditions Favoring Simple Controllers

PI/PID is often the best engineering solution when there is:

  • a well-understood process,
  • few inputs and outputs,
  • weak constraints,
  • low interaction,
  • generous robustness margin,
  • easy maintenance.

In production:

a simple, understandable, verified system

is often more valuable than:

a theoretically more advanced but fragile system.


8.8. Justification of Complex Control Methods

MPC, robust control, or nonlinear methods may be justified when:

  • classical PID cannot meet the objectives,
  • multivariable interactions are strong,
  • constraints dominate the problem,
  • the operating range is wide,
  • model uncertainty is large,
  • safety constraints need to be incorporated in optimization.

The method should be only as complex as the problem requires.


8.9. Thinking of the Control System in Layers

A practical architecture may be:

Mission / planning
↓
Reference generation
↓
Outer control loop
↓
Inner control loop
↓
Actuator control
↓
Power electronics
↓
Physical system
↓
Sensor
↓
State estimation

Alongside it may run:

safety monitor
fault detection
telemetry
watchdog

This structure more closely reflects real modern mechatronic systems.


8.10. Main Questions for a Control Engineer

When examining a system, ask in order:

What is being controlled?
What is being measured?
What can be actuated?
What is the reference?
What are the disturbances?
What is the model?
What is the operating region?
How will stability be demonstrated?
How will performance be measured?
What are the physical limits?
How large are noise and delay?
What happens if the model is wrong?
What happens if a sensor fails?
What happens if the controller misses its deadline?

If these questions have no answers, discussing PID gains is premature.


8.11. Separate the Learned Model from the Control Model

Three objects should remain distinct:

plant model
≠
learned estimator
≠
control law

A neural network may estimate unmodeled residual dynamics while a verified controller uses that estimate as feed-forward compensation. The network is not automatically the controller.

8.12. Out-of-distribution Operation and the Safe Envelope

A learned component may only be validated in the operating region represented by its training data. Outside that region, a high model score does not guarantee small error. Critical systems need explicit fallback or safe-state behavior.

8.13. Learning Is Not a Stability Proof

Low training loss or high reward does not establish closed-loop stability. Lyapunov analysis, robustness margins, and closed-loop experiments remain relevant after a learned component is introduced.

Unit 9: Applied Exercises

9.1. Exercise 1 — first-order System

Given:

        2
G(s)=-------
       3s+1
  1. find the time constant,
  2. find the DC gain,
  3. write the unit-step response,
  4. estimate the 2% settling time,
  5. compare the unity-feedback system for Kp=1, 5, 20.

9.2. Exercise 2 — second-order System

For:

             25
G(s)=----------------
       s²+4s+25

calculate:

  1. ω_n,
  2. ζ,
  3. ω_d,
  4. overshoot,
  5. peak time,
  6. settling time.

Compare the approximate relationships with simulation.


9.3. Exercise 3 — Routh

Let the characteristic equation be:

s³ + 4s² + 3s + K = 0

Construct the Routh array.

Find the stable range of K.

Verify the same range by numerically computing the poles.


9.4. Exercise 4 — Root Locus

For:

          K
L(s)=--------------
       s(s+2)(s+5)
  1. show the poles,
  2. identify the real-axis segments,
  3. find the asymptotes,
  4. find the imaginary-axis crossing using Routh analysis,
  5. select an operating point near the ζ=0.7 line.

9.5. Exercise 5 — PI

Use the DC motor speed model:

        K
P(s)=-------
       τs+1

Design a PI controller:

C(s)=Kp+Ki/s

Test separately:

reference step
load-torque disturbance
measurement noise

Do not rely on a single plot.


9.6. Exercise 6 — anti-windup

Consider the first-order system:

P(s)=1/(10s+1)

with saturation:

-1 ≤ u ≤ 1

Run the same PID:

  1. without anti-windup,
  2. with clamping,
  3. with back-calculation.

Compare:

integral state
overshoot
recovery time

9.7. Exercise 7 — Frequency Domain

For the open-loop system:

L(s)=10/[s(s+1)(0.1s+1)]

plot the Bode diagram.

Find:

  • gain crossover,
  • phase crossover,
  • phase margin,
  • gain margin.

Explain how the margins change when the gain is doubled.


9.8. Exercise 8 — Delay

Add the delay:

e^(-Ls)

to the same system.

Compare phase margin for:

L = 0
0.05
0.1
0.2 s

Explain why delay can degrade stability without changing magnitude.


9.9. Exercise 9 — State Feedback

For:

A = [[0,1],[-2,-3]]
B = [[0],[1]]
  1. test controllability,
  2. place the poles at {-4,-5},
  3. find K,
  4. measure the peak control signal,
  5. move the poles to {-20,-25} and demonstrate why faster is not always better.

9.10. Exercise 10 — Observer

For the same system, let:

C = [1,0]
  1. test observability,
  2. select observer poles {-8,-9},
  3. introduce an initial estimation error,
  4. add sensor noise,
  5. move the observer poles far to the left and inspect the noise effect.

9.11. Exercise 11 — LQR

For a mass-spring-damper system, try the combinations:

Q1 = diag(1,1)
Q2 = diag(100,1)
R1 = 1
R2 = 10

For each design, measure:

  • settling time,
  • position error,
  • maximum control effort,
  • ∫u²dt.

Demonstrate that the word “optimal” depends on the chosen cost function.


9.12. Exercise 12 — Sampling

Discretize the continuous controller with:

Ts = 1 ms
10 ms
50 ms
100 ms

On the same physical process, examine changes in:

  • stability,
  • overshoot,
  • phase margin,
  • control signal.

9.13. Exercise 13 — MPC

Construct a two-input, two-output system.

Let the constraints be:

-2 ≤ u1,u2 ≤ 2
|Δu| ≤ 0.2

Using MPC, compare:

  1. the unconstrained solution,
  2. the constrained solution,
  3. a shorter prediction horizon,
  4. a longer prediction horizon.

9.14. Exercise 14 — Safety

For a temperature-control system, define:

normal target = 80 °C
warning = 100 °C
critical limit = 120 °C

Handle the following cases separately:

  • PID control,
  • sensor stuck-at fault,
  • actuator stuck-on fault,
  • controller-software lockup.

Design the distinction between normal control and an independent safety interlock.


9.15. Exercise 15 — cyber-physical Attack

Add a bias attack to sensor data in the closed-loop model:

y_attack = y + b

Then simulate:

replay
delay
packet loss

Measure:

  • error,
  • control signal,
  • safe-limit violations,
  • residual-based detection time.

9.16. Quick Reference and Conclusion

9.17. Quick Reference

When designing an automatic-control system, ask:

1. What is the plant?
2. What is the output?
3. What is the manipulated input?
4. What is the reference?
5. What are the disturbances?
6. What does the sensor measure and with what accuracy?
7. What are the actuator limits?
8. Over which operating region is the model valid?
9. Is the open-loop system stable?
10. How will closed-loop stability be verified?
11. Are transient-response objectives quantitative?
12. What is the steady-state error requirement?
13. What should the bandwidth be?
14. Are gain and phase margins sufficient?
15. How much noise is present?
16. How much delay and jitter are present?
17. Have saturation and anti-windup been addressed?
18. Has model uncertainty been tested?
19. Is safe behavior under faults defined?
20. Has the real system been tested in addition to simulation?

9.18. Quick Formula Reference

Error:
e(t)=r(t)-y(t)

Negative feedback:
T(s)=G(s)/(1+G(s)H(s))

First order:
G(s)=K/(τs+1)

Second order:
G(s)=ωn²/(s²+2ζωn s+ωn²)

Damped frequency:
ωd=ωn√(1-ζ²)

Peak time:
tp=π/ωd

2% settling time:
ts≈4/(ζωn)

Overshoot:
Mp=exp[-ζπ/√(1-ζ²)]

PID:
C(s)=Kp+Ki/s+Kd s

Sensitivity:
S=1/(1+L)

Complementary sensitivity:
T=L/(1+L)

State space:
ẋ=Ax+Bu
y=Cx+Du

State feedback:
u=-Kx

Observer:
x̂̇=Ax̂+Bu+L(y-Cx̂)

Discrete system:
x[k+1]=Ad x[k]+Bd u[k]

Continuous-discrete pole relation:
z=e^(sTs)

9.19. Conclusion

The fundamental idea of automatic control is simple:

Know the desired behavior.
Measure the actual behavior.
Reduce the difference.
Measure again.

Turning this simple loop into a reliable engineering system requires a combination of:

physics
+
mathematics
+
signal processing
+
electronics
+
software
+
real-time engineering
+
safety

The classical chain of control theory:

differential equation
→ transfer function
→ poles and zeros
→ stability
→ time response
→ root locus
→ frequency response

has expanded in modern control to include:

state space
→ observer
→ optimal control
→ robust control
→ MPC
→ nonlinear / adaptive control

The central problem remains unchanged:

Driving a real system with uncertainty and disturbances toward desired behavior, stably and measurably, while respecting physical constraints.

One of the most dangerous misconceptions in control engineering is:

simulation looks good
→ system is ready

The real engineering sequence is:

Model
↓
Design
↓
Analyze
↓
Simulate
↓
Add constraints
↓
Add disturbances
↓
Add uncertainty
↓
Validate real-time behavior
↓
Test gradually on hardware
↓
Measure
↓
Redesign if necessary

Final principle:

A good controller is not the most complex controller. It is the simplest controller that verifiably satisfies the requirements.


References

  • Albert-László Barabási. Network Science.
  • Petter Holme; Jari Saramäki (eds.). Temporal Network Theory. 2nd ed. Springer Nature Switzerland, 2023.
  • Åström, K. J.; Hägglund, T. Advanced PID Control. ISA.
  • Åström, K. J.; Murray, R. M. Feedback Systems: An Introduction for Scientists and Engineers. Princeton University Press / Caltech open edition.

https://fbsbook.org/

  • Black, H. S. Negative-feedback amplifier work and patents, Bell Telephone Laboratories, 1920s-1930s.
  • Bode, H. W. Network Analysis and Feedback Amplifier Design. Van Nostrand, 1945.
  • Dorf, R. C.; Bishop, R. H. Modern Control Systems. Pearson.
  • Evans, W. R. “Graphical Analysis of Control Systems.” Transactions of the AIEE, 1948.
  • Franklin, G. F.; Powell, J. D.; Emami-Naeini, A. Feedback Control of Dynamic Systems. Pearson.
  • Hernández-Guzmán, V. M.; Silva-Ortigoza, R. Automatic Control with Experiments. Advanced Textbooks in Control and Signal Processing, Springer, 2019.

DOI series: https://doi.org/10.1007/978-3-319-75804-6

  • Hurwitz, A. “Über die Bedingungen, unter welchen eine Gleichung nur Wurzeln mit negativen reellen Teilen besitzt.” Mathematische Annalen, 1895.
  • IEC. IEC 61508:2010 — Functional Safety of Electrical/Electronic/Programmable Electronic Safety-Related Systems.
  • IEC. IEC 62443 Series — Security for Industrial Automation and Control Systems.
  • Ioannou, P. A.; Sun, J. Robust Adaptive Control. Dover.
  • Kalman, R. E. “A New Approach to Linear Filtering and Prediction Problems.” Journal of Basic Engineering, 1960.
  • Khalil, H. K. Nonlinear Systems. Prentice Hall.
  • Leveson, N. G. Engineering a Safer World: Systems Thinking Applied to Safety. MIT Press, 2011.
  • MathWorks. Anti-Windup Control Using PID Controller Block.

https://www.mathworks.com/help/simulink/slref/anti-windup-control-using-a-pid-controller.html

  • MathWorks. Control System Toolbox Documentation.

https://www.mathworks.com/help/control/

  • MathWorks. Model Predictive Control Toolbox Documentation.

https://www.mathworks.com/help/mpc/

  • MathWorks. PID Controller Tuning.

https://www.mathworks.com/help/control/pid-controller-design.html

  • Maxwell, J. C. “On Governors.” Proceedings of the Royal Society of London, 1868.
  • Minorsky, N. “Directional Stability of Automatically Steered Bodies.” Journal of the American Society for Naval Engineers, 1922.
  • NIST. SP 800-82 Rev. 3 — Guide to Operational Technology (OT) Security. September 2023.

https://csrc.nist.gov/pubs/sp/800/82/r3/final

  • Nyquist, H. “Regeneration Theory.” Bell System Technical Journal, 1932.
  • Ogata, K. Modern Control Engineering. Prentice Hall.
  • Python Control Systems Library.

https://python-control.readthedocs.io/

  • Rawlings, J. B.; Mayne, D. Q.; Diehl, M. Model Predictive Control: Theory, Computation, and Design. Nob Hill Publishing.
  • Routh, E. J. A Treatise on the Stability of a Given State of Motion. 1877.
  • Skogestad, S.; Postlethwaite, I. Multivariable Feedback Control: Analysis and Design. Wiley.
  • Slotine, J.-J. E.; Li, W. Applied Nonlinear Control. Prentice Hall.
  • Zhou, K.; Doyle, J. C.; Glover, K. Robust and Optimal Control. Prentice Hall.
  • Ziegler, J. G.; Nichols, N. B. “Optimum Settings for Automatic Controllers.” Transactions of the ASME, 1942.
  • Walter W. Piegorsch, Richard A. Levine, Hao Helen Zhang, Thomas C. M. Lee (eds.). Computational Statistics in Data Science. Wiley, 2022. ISBN 9781119561071.
  • Billingsley, J. Mechatronics Experiments with Machine Vision. Springer Nature Switzerland, 2026. DOI: https://doi.org/10.1007/978-3-032-11218-7.
  • Necsulescu, D. Advanced Mechatronics: Monitoring and Control of Spatially Distributed Systems. World Scientific, 2009. ISBN 978-981-277-181-0.
  • Naveenkumar, P.; Sharma, V.; Devarajan, G.; Abdullah, A.; Elngar, A. A. (eds.). Handbook of AI-Based Mechatronics Systems and Smart Solutions in Industrial Automation. CRC Press, 2026. DOI: https://doi.org/10.1201/9781032615790.
  • Chunwei Zhang, Tianpeng Li, Ying Dai, Li Sun, and Ardashir Mohammadzadeh. Practical Neural Networks in Python and MATLAB. Springer Nature, 2026. DOI: https://doi.org/10.1007/978-3-032-14746-2.
Contents