You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below demonstrates basic pole placement controller design using the same double integrator system from the LQR example. We design a state-feedback controller with desired closed-loop poles and an observer that is 5 times faster than the closed-loop response.
70
+
71
+
```@example POLEPLACEMENT
72
+
using ControlSystemsBase
73
+
using LinearAlgebra
74
+
using Plots
75
+
76
+
# Create system - same as LQR example
77
+
Ts = 0.1
78
+
A = [1 Ts; 0 1]
79
+
B = [0; 1]
80
+
C = I(2)
81
+
P = ss(A,B,C,0,Ts)
82
+
83
+
# Design controller using pole placement
84
+
# Choose desired closed-loop poles (well-damped, faster than original system)
85
+
desired_poles_cont = [-2+0.5im, -2-0.5im] # Continuous-time poles
86
+
desired_poles = exp.(Ts .* desired_poles_cont) # Discrete-time poles inside unit circle
87
+
88
+
# Design state feedback gain using pole placement
89
+
L = place(P, desired_poles) |> real
90
+
91
+
# Design observer with poles 5x faster (closer to origin for discrete time)
92
+
observer_poles = exp.(Ts*5 .* desired_poles_cont)
93
+
K = place(P, observer_poles, :o) |> real # Note the :o for observer design
94
+
95
+
# Create observer-controller using the observer_controller function
96
+
controller = observer_controller(P, L, K)
97
+
98
+
# Form closed-loop system and analyze
99
+
T_cl = feedback(P * controller)
100
+
101
+
r(x,t) = [1.5(t>=2.5); 0] # Form control law (r is a function of t and x), change reference to 1.5 at t≧2.5
Plot Gang of Four to analyze closed-loop properties
109
+
```@example POLEPLACEMENT
110
+
gangoffourplot(P, controller)
111
+
```
112
+
113
+
114
+
The pole placement design allows direct specification of closed-loop pole locations. The [`place`](@ref) function computes the required feedback gains, while [`observer_controller`](@ref) combines the state feedback and observer into a single controller.
115
+
116
+
67
117
## PID design functions
68
118
A basic PID controller can be constructed using the constructors [`pid`](@ref), [`pid_2dof`](@ref).
69
119
In ControlSystems.jl, we often refer to three different formulations of the PID controller, which are defined as
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/pid_design.jl
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ end
132
132
133
133
Calculates and returns a PID controller on 2DOF form with inputs `[r; y]` and outputs `u` where `r` is the reference signal, `y` is the measured output and `u` is the control signal.
134
134
135
-
Belowm we show two different depections of the contorller, one as a 2-input system (left) and one where the tw internal SISO systems of the controller are shown (right).
135
+
Below we show two different depections of the controller, one as a 2-input system (left) and one where the tw internal SISO systems of the controller are shown (right).
0 commit comments