Skip to content

Commit 8177a25

Browse files
committed
docs update
1 parent be35ec9 commit 8177a25

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/src/lqg_disturbance.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,20 @@ We also provide new covariance matrices for the Kalman filter where the entry of
6868
```@example LQG_DIST
6969
R1 = diagm([0.001, 1])
7070
R2 = I(ny)
71-
prob = LQGProblem(Gd, Q1, Q2, R1, R2)
71+
SQ = [zeros(nx-nu, nu); Q2] # Adding Q2 to the x-u cross term achieves perfect integral action without manually modifying the computed feedback gain, if not all inputs are augmented with integral action, we should add Q2[augmented_inds, :] instead
72+
prob = LQGProblem(Gd, Q1, Q2, R1, R2; SQ=SQ)
7273
Gcl = [G_PS(prob); -comp_sensitivity(prob)] # -comp_sensitivity(prob) is the same as the transfer function from load disturbance to control signal
7374
res = lsim(Gcl, disturbance, 100)
7475
plot(res, ylabel=["y" "u"]); ylims!((-0.05, 0.3), sp = 1)
7576
```
7677

7778
This time, we see that the controller indeed rejects the disturbance and the control signal settles on -1 which is exactly what's required to counteract the load disturbance of +1.
7879

80+
```@example LQG_DIST
81+
using Test
82+
@test lqr(prob)[end] ≈ 1.0 # The gain from estimated disturbance state to control signal should be 1.0, indicating perfect integral action
83+
```
84+
7985
Before we feel confident about deploying the LQG controller, we investigate its closed-loop properties.
8086

8187
```@example LQG_DIST

0 commit comments

Comments
 (0)