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
Copy file name to clipboardExpand all lines: docs/src/lqg_disturbance.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,3 +99,31 @@ plot(f1, f2, titlefontsize=10)
99
99
```
100
100
101
101
We see that we now have a slightly larger disturbance response than before, but in exchange, we lowered the peak sensitivity and complimentary sensitivity from (1.5, 1.31) to (1.25, 1.11), a more robust design. We also reduced the amplification of measurement noise ($CS = C/(1+PC)$). To be really happy with the design, we should probably add high-frequency roll-off as well.
102
+
103
+
## Extracting the controller
104
+
Above, we have simulated the closed-loop response by creating closed-loop functions directly using [`G_PS`](@ref) and [`comp_sensitivity`](@ref). To extract the controller used underneath the hood in these examples, we may call [`observer_controller`](@ref) or [`extended_controller`](@ref), depending on whether we want a feedback controller only or a 2 DOF controller that takes separate reference inputs.
105
+
106
+
107
+
## Explicit error integration
108
+
Integral action can also be added to an LQG controller by calling [`extended_controller`](@ref) with the option `output_ref = true` and by providing an integrator gain matrix `Li`. We demonstrate this below
109
+
110
+
```@example LQG_DIST
111
+
nx = G.nx
112
+
nu = G.nu
113
+
ny = G.ny
114
+
x0 = zeros(G.nx) # Initial condition
115
+
116
+
Q1 = 100diagm(ones(G.nx)) # state cost matrix
117
+
Q2 = 0.01diagm(ones(nu)) # control cost matrix
118
+
119
+
R1 = 0.001I(nx) # State noise covariance
120
+
R2 = I(ny) # measurement noise covariance
121
+
prob = LQGProblem(G, Q1, Q2, R1, R2)
122
+
123
+
Li = [3;;] # Integral gain
124
+
C = extended_controller(prob; output_ref = true, Li)
Copy file name to clipboardExpand all lines: src/lqg.jl
+45-13Lines changed: 45 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -271,7 +271,7 @@ function extended_controller(K::AbstractStateSpace)
271
271
end
272
272
273
273
"""
274
-
extended_controller(l::LQGProblem, L = lqr(l), K = kalman(l); z = nothing)
274
+
extended_controller(l::LQGProblem, L = lqr(l), K = kalman(l); z = nothing, output_ref = false, Li = nothing)
275
275
276
276
Returns a statespace system representing the controller that is obtained when state-feedback `u = L(xᵣ-x̂)` is combined with a Kalman filter with gain `K` that produces state estimates x̂. The controller is an instance of `ExtendedStateSpace` where `C2 = -L, D21 = L` and `B2 = K`.
277
277
@@ -290,25 +290,57 @@ system_mapping(Ce) == -C
290
290
```
291
291
292
292
Please note, without the reference pre-filter, the DC gain from references to controlled outputs may not be identity. If a vector of output indices is provided through the keyword argument `z`, the closed-loop system from state reference `xᵣ` to outputs `z` is returned as a second return argument. The inverse of the DC-gain of this closed-loop system may be useful to compensate for the DC-gain of the controller.
293
+
If the option `output_fer = true` is set, the function returns a controller that expects output references `yᵣ` instead of state references `xᵣ`. In this case, `ny` integrators are added that integrate the error \$e = yᵣ - y\$. The integrator gain matrix `Li` of size `(nu, ny)` must be provided in this case. This option is sometimes referred to as "Tracking LQG" or `lqgtrack`.
0 commit comments