What? Why? How?

A systematic way to change the behavior of a system.
- The system has undesirable characteristics (e.g., unstable)
- Higher level automation (e.g., cruise control)
Model, Analyze & Design, Deploy

Models: ODEs and OΔEs

Car

In[]:=
car=mv'[t]==f[t]-bv[t]
Karl Johan Åström and Richard M. Murray, Feedback Systems: An Introduction for Scientists and Engineers, Second Edition. Princeton University Press, February 2, 2021

Boat

δ
rudder angle
ψ
heading angle
β
sideslip angle
η={x,y,ψ}
​
​
ν={V,0,r}
​
​
={
X
ctrl
(δr,δT),
Y
ctrl
(δr,δT),
N
ctrl
(δr,δT)}

η
=
R
ψ
.
R
β
.ν
M

ν
+C(ν)ν+D(ν)ν=f
C. Sonnenburg et al., “Control-Oriented Planar Motion Modeling of Unmanned Surface Vehicles,” Oceans 2010 MTS Seattle, WA, USA, 2010, pp. 1-10, doi: 10.1109/OCEANS.2010.5664297.

Mixing tank

q
in1
reactant 1 input flow rate
q
in2
reactant 2 input flow rate
c
1
chemical 1 concentration
c
2
chemical 2 concentration
q
out1
product 1 output flow rate
q
out2
product 2 output flow rate
In[]:=
tank={
c
1
[k+1]==0.95123
c
1
[k]+4.9
q
in1
[k]+4.9
q
in2
[k],
c
2
[k+1]==0.904838
c
2
[k]-0.019
q
in1
[k]+0.009
q
in2
[k]};
B. Ogunnaike and W. Ray, Process Dynamics, Modeling, and Control. Oxford University Press, 17 November 1994.

Models: State space models

Linear state-space models

Example 1

In[]:=
carSSM=StateSpaceModel[car,v[t],f[t],v[t],t]

x
==a.x+b.u
​
y==c.x+d.u
In[]:=
=
-b
m
;=
1
m
;={{1}};={{0}};
In[]:=
StateSpaceModel[{,,,}]

Example 2

eulerEOM={​​
ℐ
1
′
ω
1
[t]-(
ℐ
2
-
ℐ
3
)
ω
2
[t]
ω
3
[t]==
τ
1
[t],​​
ℐ
2
′
ω
2
[t]-(
ℐ
3
-
ℐ
1
)
ω
1
[t]
ω
3
[t]==
τ
2
[t],​​
ℐ
3
′
ω
3
[t]-(
ℐ
1
-
ℐ
2
)
ω
1
[t]
ω
2
[t]==
τ
3
[t]};
In[]:=
StateSpaceModel[eulerEOM,{
ω
1
[t],
ω
2
[t],
ω
3
[t]},{
τ
1
[t],
τ
2
[t],
τ
3
[t]},{
ω
1
[t],
ω
2
[t],
ω
3
[t]},t]

Affine state-space models

In[]:=
eulerASSM=AffineStateSpaceModel[eulerEOM,{
ω
1
[t],
ω
2
[t],
ω
3
[t]},{
τ
1
[t],
τ
2
[t],
τ
3
[t]},{
ω
1
[t],
ω
2
[t],
ω
3
[t]},t]

x
==a(x)+b(x).u
​
y==c(x)+d(x).u
In[]:=
=
(
ℐ
2
-
ℐ
3
)
ω
2
ω
3
ℐ
1
,
(-
ℐ
1
+
ℐ
3
)
ω
1
ω
3
ℐ
2
,
(
ℐ
1
-
ℐ
2
)
ω
1
ω
2
ℐ
3
;​​=DiagonalMatrix[1/{
ℐ
1
,
ℐ
2
,
ℐ
3
}];​​={
ω
1
,
ω
2
,
ω
3
};​​=ConstantArray[0,{3,3}];​​={
ω
1
,
ω
2
,
ω
3
};
In[]:=
AffineStateSpaceModel[{,,,},]

Nonlinear state-space models

Example 1

In[]:=
NonlinearStateSpaceModel[eulerEOM,{
ω
1
[t],
ω
2
[t],
ω
3
[t]},{
τ
1
[t],
τ
2
[t],
τ
3
[t]},{
ω
1
[t],
ω
2
[t],
ω
3
[t]},t]

x
==f(x,u)
​
y==g(x,u)

Example 2

In[]:=
eqs={mx''[t]==f[t]Cos[δ[t]],my''[t]==f[t]Sin[δ[t]]};
In[]:=
nssm=NonlinearStateSpaceModel[eqs,{x[t],y[t]},{f[t],δ[t]},{x[t],y[t]},t]
In[]:=
={vx,Cos[δ]f/m,vy,Sin[δ]f/m};​​ℊ={x,y};​​NonlinearStateSpaceModel[{,ℊ},{x,vx,y,vy},{f,δ}]

Example 3

In[]:=
eqs=Tan[x'[t]]+Sin[x[t]]==u[t];
In[]:=
NonlinearStateSpaceModel[eqs,x[t],u[t],u[t],t]

Discrete-time models

In[]:=
StateSpaceModel[x[k+2]+x[k+1]+x[k]==u[k],x[k],u[k],x[k],k]
In[]:=
={{0,1},{-1,-1}};={{0},{1}};={{1,0}};={{0}};
In[]:=
StateSpaceModel[{,,,},SamplingPeriod->τ]

Models: Transfer function models

Continuous-time systems

From ODEs

In[]:=
eq=x''[t]+2x'[t]+3x[t]==u[t];
In[]:=
DSolveValue[{eq/.u[t]->DiracDelta[t],x[0]==0,x'[0]==0},x[t],t]/.HeavisideTheta[0]->0
In[]:=
LaplaceTransform[%,t,s]//Simplify
In[]:=
Map[LaplaceTransform[#,t,s]&,eq,{1}]
In[]:=
%/.{HoldPattern[LaplaceTransform][var_[t],__]:>(ToExpression@ToUpperCase@ToString@var)@s,_[0]:>0}
In[]:=
SolveValues[%,X[s]]
U[s]

From expressions

In[]:=
TransferFunctionModel
1
3+2s+
2
s
,s
In[]:=
TransferFunctionModel
1
s
,
s
s+1
,
2
2
s
+3
,s

Discrete-time systems

From OΔEs

In[]:=
eq=x[k+3]+2x[k+2]+x[k]==(u[k+1]+u[k])/2;
In[]:=
Map[ZTransform[#,k,z]&,eq,{1}]
In[]:=
%/.{HoldPattern[ZTransform][var_[k],__]:>(ToExpression@ToUpperCase@ToString@var)@z,_[_?IntegerQ]:>0}
In[]:=
SolveValues[%,X[z]]
U[z]
//Simplify

From expressions

More on Models

System models

Convert between models

Systems connections model

Analysis: State space methods

Controllability

Overview

Matrix

Gramian

PBH

Distribution

Example 1

Example 2

Observability

Matrix

Gramian

PBH

Codistribution

Example 1

Example 2

Simulation

Symbolic simulation

Numeric simulation

Discrete-time simulation

Measurements

Design: PID

Overview

Controller architectures and tuning rules

Example

A controller to maintain liquid level in a tank.
The model of the system.
Design the controller.
The closed-loop system.
Simulate it.

Design: LQ

Overview

Example

A model of the system.
Design the controller.
The closed-loop system.
Simulate it.
The controller effort.

Design: MPC

Overview

Example

Design a controller to automate the administration of anesthesia.

Model

A model of the pharmacokinetic (PK) characteristics.
A model of the pharmacodynamic (PD) characteristics.
A plot showing the nonlinear characteristics of the Hill equation.
A discrete-time approximation of the model.

Control design

Set up the cost to track the output.
Specify the constraint to prevent the patient from going into a deep hypnotic state.
Compute the controller.

Simulation

The closed-loop system.
The BIS plot.

Design: Feedback linearization

Overview

Linearization by transformation
The transformed system consists of a linear system and a residual system.
The system with a feedback compensator

Example

The model of a axial flow compressor.
Feedback linearize it.
Design a controller based on the linearized system.
The closed-loop system.
Its response.

Deployment: Microcontroller kit

Overview

Deploy a quarter-car model

HIL simulation

Things omitted

Models

◼
  • Delay systems
  • ◼
  • Descriptor systems
  • ◼
  • SystemModels
  • Analysis

    ◼
  • Classical analysis (Bode, Nyquist, stability margins, M and N contours, etc)
  • ◼
  • Circle criterion
  • ◼
  • Minimal models, decompositions and transformations, etc
  • ◼
  • Carleman and state transform linearizations
  • Design

    ◼
  • Pole placement
  • ◼
  • Tracking
  • ◼
  • Estimator design
  • ◼
  • Full information output regulator, asymptotic output tracking
  • CITE THIS NOTEBOOK

    Wolfram R&D LIVE: Control Systems: An Overview​
    by Suba Thomas​
    Wolfram Community, STAFF PICKS, May 11 2023
    ​https://community.wolfram.com/groups/-/m/t/2917597