I had expected that setting move_blocks to all ones, of length equal to prediction horizon, would be the same as having no move blocks, but doing so changes the result dramatically, and the constraints are no longer respected
ẍM = 50 # Maximum acceleration
ẋM = 10 # Maximum velocity
x⃛M = 8e3
Ts = 0.005 # Sample time
r(t) = 2.5 + 3 * (t - floor(t)) # Reference to be smoothed
t = 0:Ts:3-Ts # Time vector
R = r.(t)
Rmat = [R 0*R 0*R]'
Ac = [0.0 1.0 0.0; 0.0 0.0 1.0; 0.0 0.0 0.0]
Bc = [0.0; 0.0; 1.0]
Cc = [1.0 0 0; 0 1 0; 0 0 1]
mpc = LinearMPC.MPC(Ac, Bc, Float64(Ts); C=Cc, Np=50, Nc=50)
set_objective!(mpc; Q=[1e4, 0, 0], R=[1e-6], Rr=[1e-4], Qf=[1e8, 1e-2, 1e-3])
set_input_bounds!(mpc; umin=[-x⃛M], umax=[x⃛M])
add_constraint!(mpc;
Ax=[0.0 1.0 0.0],
lb=[-ẋM], ub=[ẋM],
soft=false)
add_constraint!(mpc;
Ax=[0.0 0.0 1.0],
lb=[-ẍM], ub=[ẍM],
soft=false)
LinearMPC.set_prestabilizing_feedback!(mpc)
mpc.settings.reference_preview = true
setup!(mpc)
sim = LinearMPC.Simulation(mpc; r=Rmat, N=600)
plot(sim)
LinearMPC.move_block!(mpc,ones(50)) # Should make no difference?
sim = LinearMPC.Simulation(mpc; r=Rmat, N=600)
plot!(sim, c=2)
hline!([ẋM, -ẋM], sp=2, lab="", l=:dash)
hline!([ẍM, -ẍM], sp=3, lab="", l=:dash)
hline!([x⃛M, -x⃛M], sp=4, lab="", l=:dash)

I had expected that setting
move_blocksto all ones, of length equal to prediction horizon, would be the same as having no move blocks, but doing so changes the result dramatically, and the constraints are no longer respected