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/manual/moveblock.md
+17-18Lines changed: 17 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,44 +28,43 @@ Finally, it is possible to define different move blocks for different control si
28
28
29
29
Consider the example of the control of an inverted pendulum on a cart, which is predefined as one of the examples in **LinearMPC.jl** and can be accessed with the call `mpc_examples`. We consider the case when we want the first output (the position of the cart) to reach a certain value (1 m to be specific.) Below we create three different MPC controllers with different prediction horizons and show the resulting step responses.
As can be seen, the higher the prediction horizon, the faster the setpoint is reached. (Note that for even lower values of the prediction horizon, the resulting closed-loop system becomes unstable.) The cost of the horizon can, however, be seen in the solve times, where the solve times are about four times slower for $N_p = 100$ compared with $N_p = 50$.
48
44
49
45
To reduce the computation time, we consider three different move blocks. We consider the case of no move blocks (which an empty vector of move blocks encodes,) of evenly spaced move blocks `[1,1,1,1,1]` and a more dynamics set of move blocks `[1,1,5,10,10]`. For all of the cases, we consider a prediction horizon of $N_p = 100$. The resulting step responses are shown below.
50
46
51
47
52
-
```julia
53
-
using LinearMPC,Plots
48
+
```@example move_block
54
49
mpc,_ = LinearMPC.mpc_examples("invpend",100)
50
+
dynamics = (x,u,d) -> mpc.model.F*x + mpc.model.G*u # Since long horizon
We see that the adaptive move block almost performs as well as using no move blocks. The main difference is that when no move blocks are used, there are 100 decision variables, while for both the move blocks `[1,1,1,1,1]` and `[1,1,5,10,10]` there are only 5 decision variables.
64
+
This can be seen in the solution times, where both of the move blocks leads to solution times that are about 5-10 times faster.
As can be seen, the adaptive move block almost performs as well as using no move blocks. The main difference is that when no move blocks are used, there are 100 decision variables, while for both the move blocks `[1,1,1,1,1]` and `[1,1,5,10,10]` there are only 5 decision variables.
71
-
This can be seen in the solution times, where both of the move blocks leads to solution times that are about 6 times faster (note that the actual speedup is even higher due to some overhead from the simulation.)
Copy file name to clipboardExpand all lines: docs/src/manual/prestab.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@ A popular choice of $K$ is as the gain from solving an infinite horizon LQR prob
21
21
```julia
22
22
set_prestabilizing_feedback!(mpc)
23
23
```
24
+
25
+
!!! note "Prestabilization + Move block"
26
+
If you use prestabilization and move blocking, only $v_k$ is held constant, not $u_k$. Hence, the closed-loop behaviour with/without prestabilization might differ.
27
+
24
28
## Example
25
29
Consider a first-order system with a pole in 10, which has the transfer function
0 commit comments