Optimal Tuning Parameters of a PID Controller Based on Reference Trajectory