Demanded velocity vdem =
* (target - x). Input u = 100 * (vdem - v)
Velocity demand limit =
Initial position =
The drive is now limited in magnitude to 1.
You can change the position target,
target =
0
vdemlim){veldem=vdemlim;} if(veldem<-vdemlim){veldem=-vdemlim;} u=kv*(veldem-v); Colour("black"); if (u>1){u=1; Colour("red");} //This applies the limit if (u<-1){u=-1; Colour("red");} x = x + v*dt; //This is the simulation v = v + b*(u+disturbance)*dt; t = t + dt; Spot(t, x); Colour("gray"); Spot(t,u); Colour("blue"); Spot(t,v); if(t