Robotics - Digital Control (Done)
Robotics - Digital Control (Done)
2
Industrial Control Applications
3
Industrial Control (cont.)
4
Industry 4.0
Disturbance
Reference Controlled
input
+ + + Variable
Controller Actuator Process
_
Filter Sensor
6
Example: Analog PID
Consider the following ‘simple’ PID controller (parallel structure):
Kd s
1 + αK d s
Differentiator
/ Filter
Desired Error Controller
Value + Output
+ Kp +
- +
Variable Gain
Amplifier
Measured
Variable
Ki
s
Integrator
Ki sK d
C (s) = K p + +
s 1 + αsK d
7
Example: Analog PID (cont.)
It can be implemented using electronic circuitry:
1
R2C I ∫
VI (t ) = − VE (t )dt
dV (t )
VD (t ) = −C D R3 E
dt
8
Example: Analog PID (cont.)
All well and good, but:
...
9
9
Digital Control Implementation
High-level
+ Digital
Controller Low-level
(Enterprise _
(Fieldbus)
)
Network
Network
Digital Filter
Control Remote
Center I/O
10
Modern DCS Control Implementation
Global Network
‘Internet’ Cloud
IP Addressing / DNS
Non managed QoS
Non Real-Time (Best
Effort) Common Network (IP-Based)
SCADA Functionality
Traffic policing
Firewall Gateway
11
Digital Control
• Digital control loop:
z − 1 G ( s)
• Process pulse transfer function: G ( z ) = ⋅Z
z s
• The closed-loop transfer function of this digital control system is:
D( z )G ( z )
GCL ( z ) =
1 + D( z )G ( z )
Sensor /
y(k)
Sampler
𝑌𝑌(𝑧𝑧) 𝑧𝑧 − 1 𝐺𝐺(𝑠𝑠)
𝐺𝐺(𝑧𝑧) = = ⋅ 𝑍𝑍
𝑈𝑈(𝑧𝑧) 𝑧𝑧 𝑠𝑠
U ( z ) K1 + K 2 z −1 + K 3 z −2
D
= ( z) =
E( z) 1 − z −1
14
Digital PID Control (cont.)
• The relationships between the three digital PID gains and that of the
continuous (ideal) PID controller are as follows, assuming a sample time of Ts
seconds:
U ( z ) K1 + K 2 z −1 + K 3 z −2
D
= ( z) =
E( z) 1 − z −1
K iTs K d
K1 K p
= + + 1
2 Ts
K iTs 2 K d
K2 K p
= − − 1
2 Ts
K
K3 = K p d
Ts
• These calculations may easily be put into a spreadsheet for design purposes!
15
DDS for FOPDT Plant
− sd
• For a FOPDT process: G p ( s ) =
Ke
1+τ s
− sd
• Closed loop reference model: GCL ( s ) = e
1 + λs
17
Setting the sample time
• Sampling time selection: t t
Ts ≈ min ro , rc
10 10
18
Example
3e −2 s Digital PI / FOPDT
G ( s) = K 3.00000
1 + 20 s Tau 20.00000
d 2.00000
λ = 10 Lambda 10.00000
Ts 1.00000
ca 1.00000
0.47126 − 0.44828 z −1 sc 1.00000
D( z ) = d' 4.00000
1 − z −1 Ts max 2.20000
K1 0.47126
K2 -0.44828
19
Example (cont.)
20
Arduino Example
Master
(Node #0)
Controller #1 Controller #2
TIA-485
(Node #1) (Node #2)
21
Example Arduino Sketch (Control Code)
// Sampling time
#define SAMPLE_TIME (100U) // Same units as timer (ms)
// Global timestamp
static unsigned long int time_last=0;
// Setup code
void setup(void)
{
// Initialise ADC/DAC, TIA-485 network, etc…
}
22
Example Arduino Digital PID Control Code
// Entry point for the controller code
void Control_Update(void)
{
float Setpoint, Sensor;
static float u=0, e=0, e1=0, e2=0; // Define the controller
#define PID_K1 (1.0f)
// Read the setpoint and measured variables #define PID_K2 (1.0f)
Sensor=analogRead(SENSOR_ADC_CHANNEL); #define PID_K3 (1.0f)
Setpoint=RXBuffRead(NODE_1); #define CONTROL_MAX (10.0f)
#define CONTROL_MIN (0.0f)
// Data housekeeping
e2 = e1; e1 = e;