Module 26: Implementation
Rick Hill, PhD
Dept of Mechanical Engineering
Module 26: Implementation
• Complicating factors
• Control design without a model
Implementation
• Implementation of control algorithms
Practical Implementation
• Model error • Disturbances/noise
• Complexity • Nonlinearities
• Actuator dynamics (saturation)
• Sensor dynamics • Control implementation
Implementation
• Sampling
D
R + E Y
Control U +
Actuator Plant
- Algorithm +
N
+
Sensor
+
Actuator/Sensor Dynamics
• Can model using techniques we have
learned throughout this course
• Often dynamics are fast compared to the
plant and controller and hence can be
Implementation
treated as static
• Other times dynamics must be modeled
• Can attempt to remove sensor altogether
and use a model to estimate certain
quantities
Sensorless Control
• Motivation
• Some quantities cannot be measured (battery state of
charge, SOC)
• Removal of a sensor reduces cost and weight, and
improves reliability
Implementation
• Estimator still has dynamics … needs to be faster than
rest of system
• Concept:
• Estimate states using a model of the plant (open-loop)
• Use measurements of some states as a correction to the
estimates (closed-loop)
• Use probabilistic information to “optimally” balance the
contribution of the model and the measurement (Kalman
Filter)
Sensorless Control
• Concept of a state estimator (observer)
U Actual Y
Plant
Implementation
Yest +
+ Model of
+ Plant -
correction
K error in
estimate
• There is a duality between estimation and
control
Complexity
• If it is not desired to disregard some fast
dynamics, may be able to decouple system
components based on speed
Implementation
• Like what was done with motor control
• Fast inner loop first, then slower outer loop
Model Error
• Options:
1. Make system robust to model
uncertainty
Implementation
2. Attempt to estimate model parameters
• State estimation techniques
• Adaptive control techniques
Model Error
• Sensitivity function indicates robustness
GCL amount the closed-loop transfer
GCL 1 function changes for a given
S change in the plant
P 1 C ( s) P( s)
P
M(dB)
ω(rad/sec)
Disturbances
• Options
• Make system robust to disturbances, be
aware of effect on other goals (noise
rejection, reference tracking)
Implementation
• “Feed forward” knowledge about the
disturbance (if available) to correct the
control signal
Noise
• Options
• Make system robust to noise, be aware of
effect on other goals (disturbance
rejection, reference tracking)
Implementation
• Use a filter to help improve
noise/resonance attenuation properties of
the system
Filter Design
• Noise signals are in a different frequency range than
reference signals (band-pass filter, notch filter)
• Filters can add delay if implemented in real time
Bode Diagram Bode Diagram
10 0
Implementation
0 -5
Magnitude (dB)
Magnitude (dB)
-10
-10
-20
-15
-30
-20
-40
-50 -25
0 90
-45 45
Phase (deg)
Phase (deg)
-90 0
-135 -45
-180 -90
-1 0 1 2 -1 0 1 2 3
10 10 10 10 10 10 10 10 10
Frequency (rad/sec) Frequency (rad/sec)
• Noise and reference are in the same frequency range
• Kalman filter
Nonlinearities/Saturation
• No real amplifier/actuator can supply infinite
control effort, eventually they saturate
• Can simulate effect
Implementation
Saturation
• The effect of saturation is that the overall gain
is effectively reduced (nonlinearly)
• Saturation can cause a problem in that an
integrator in the controller will continue to
Implementation
integrate the error (request more control
effort) even when the actuator is saturated
• One solution is to use an “integrator anti-
windup” strategy to switch the integrator off
Control Design without a Model
• Throughout this course we have assumed a
model on which to base our design
• What to do when there is no model
• Use intuition about effect of control to tune
Implementation
gains
• Use an empirical technique (Ziegler
Nichols, many others)
• Use trial and error to optimize the resulting
behavior (software is available, can be
time consuming)
PID Intuition
• Some intuition about the effect of the terms
of a PID controller
• Increasing Kp: Same amount of error generates a
proportionally larger amount of control … makes
Implementation
system faster, but overshoot more (less stable)
• Increasing Kd: Allows controller to anticipate an
increase in error, adds damping to the system
(reduces overshoot)
• Increasing Ki: Control effort builds as error is
integrated over time, helps reduce steady state
error, but can be slow to respond
Note: these guidelines do not hold for all situations
Ziegler Nichols
1
C ( s ) K p (1 Td s )
• First Method Ti s
• Look at open-loop step response of plant, use parameters
of response to calculate control gains
Type of Kp Ti Td
Control
P
T/L - -
PI 0.9T/L L/0.3 -
PID 1.2T/L 2L 0.5L
Ziegler Nichols
1
C ( s ) K p (1 Td s )
• Second Method Ti s
• Increase Kp until closed-loop system is on the verge of
instability, use critical gain and resulting period
Type of Kp Ti Td
Control
P
0.5Kcr - -
PI 0.45Kcr Pcr/1.2 -
PID 0.6Kcr 0.5Pcr 0.125Pcr
Numerical Optimization
• Test the system over the entire space of
possible control gains (for a specific input)
• Can do for a specifically defined cost function
• Some standard Performance Indices exist
Implementation
too integral of absolute error IAE T e(t ) dt
0
Ex: T
integral of time multiplied by absolute error ITAE t e(t ) dt
0
• MATLAB can perform this type of optimization
Controller Implementation
• The first feedback systems implemented
their control “algorithms” mechanically (ex.
Flyball governor, toilet float, thermostat)
Implementation
• Today algorithms are implemented in
electronics or more commonly software
Analog Implementation
Control “algorithms” can be implemented in electronics
• Passive circuit – • Active circuit – includes
resistors, capacitors, operational amplifier,
inductors, not powered external power
Implementation
• Ex: filters, lead and lag • Ex: integrators, differentiators,
compensators for isolation
Digital Implementation
• Implement control algorithm in software –
more adaptable, can implement nonlinear
and binary logic easily
• Requires control algorithms to be
Implementation
implemented digitally
• input must be sampled
• output must be held
• equations must be discretized
• Automatic code generation
Digital Implementation
• Sampling the input is analog to digital
conversion
• Holding the output is digital to analog
conversion
Implementation
• Converting from to analog to digital adds
delay and quantization error (consider our
lab), introduces aliasing
Digital Implementation
• Converting continuous models to digital
• Differential equations → difference equations
x(t t ) x(t ) 1
x(t ) [ x(k 1) x(k )]
t
Implementation
Ts
• Laplace transform → z-transform
1
sX ( s ) [ zX ( z ) X ( z )]
Ts
• How to design?
• Design in continuous domain and convert (better ways
than above), design directly in digital domain
Module 26 Summary
• Dealing with complexity
• Control design without a model
• Heuristic
Implementation
• Numerical search
• Control algorithm implementation
• Analog
• Digital
UDM Controls Related Courses
ENGR 4220/5220: Controls I
ELEE 4700/5700: Controls II
ELEE 4520/5520: Real-time Control Systems
ELEE 4760/5760: Digital Control Theory
Implementation
ELEE 5780: Optimization and Optimal Control
ELEE 5540: Fuzzy Systems Theory
ENGR 5520: Sensors and Actuators
ENGR 5780: Mechatronics
ENGR 5790: Mechatronics: Simulation and Modeling