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/index.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -314,4 +314,6 @@ using Plots
314
314
plot(sim)
315
315
```
316
316
317
+
See [Example: `lqg_mpc_disturbance.jl`](https://github.com/JuliaControl/RobustAndOptimalControl.jl/blob/master/examples/lqg_mpc_disturbance.jl) for a more detailed example.
318
+
317
319
See the [docs for LinearMPC.jl](https://darnstrom.github.io/LinearMPC.jl/stable/) for more details on how to use the MPC controller and modify its settings.
Gde =ExtendedStateSpace(Gd, B1=I) # Since B1=I, R1 has size determined by state dimension, but C1=C, so Q1 has size determined by the output dimension
77
+
prob =LQGProblem(Gde, Q1, Q2, R1, R2)
78
+
obs =observer_predictor(prob, direct=false) # If a predictor is used, the observer update should be carried out in the end of the loop, if we use the filter below, we should instead perform the observer update in the beginning of the loop directly after obtaining the new measurement but before computing a new control signal.
xh = obs.A * xh + obs.B*[u_mpc; y] # Predict one step with the observer, u here is the control signal from the previous iteration, if using the predictor, use u from the current iteration and perform the observer update in the end of the loop instead
90
+
u_disturbance = i * Ts ≥10?1.0:0.0
91
+
r = [1.0] # output reference
92
+
u_mpc = LinearMPC.compute_control(mpc, xh; r) # Call MPC optimizer with estimated state
93
+
u_tot = u_mpc .+ u_disturbance # Total input is control signal + disturbance
94
+
x = G.A*x + G.B*u_tot # Advance the true plant state
0 commit comments