Added the PID values calculate loop