Demanded velocity vdem =
* (target - x). Input u = 100*(vdem - v)
Velocity demand limit =
Initial position =
The drive is now limited in magnitude to 1. The plot is red when u is on a limit.
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");} MoveTo(x,v); x = x + v*dt; //This is the simulation v = v + b*u*dt; t = t + dt; LineTo(x, v); MoveBlock(x); if(t