I have a Matlab simulation model with .m files. The functions simulate a speed control system of a vehicle. I can control the vehicle's speed by adjusting the vehicle’s acceleration and braking.  The simulation runs over a set amount of time and a set number of iterations.  The control output is limited to a certain range due to the vehicle's acceleration and deceleration limits. For simplicity, let’s say this range is from -1 (max braking) to +1 (max accelerating).

What I have done:

I have written a function that takes the desired vehicle speed and the current vehicle speed as inputs. I use the difference between the desired speed and actual speed as my control error for every simulation step.  My function uses the error to represent a PID controller:

  • Proportional Control = Proportional Gain * error

  • Integral Control = Integral Gain * Sum of errors * Delta T

  • Derivative Control = Derivative Gain * (change in error) * (1/Delta T)

I have manually tuned the gains based on my visual observations of the system. I then send the final control output to the function controlling the vehicle speed. Results seem good.


How can I tune/find the optimal PID gain values for my above system considering that I do not have a plant representation or transfer function? 

I have seen the Ziegler-Nichols method, but I am not sure if that is the best approach to finding optimal control gain values. 


I was initially planning on finding the Transfer System/Plant model of my system but I am unsure if it would be worthwhile. I have seen there is a System Identification Toolbox in Matlab, but it seems I might as well continue to manually tune my existing PID controller rather than tuning the transfer function parameters to find the best system approximation.

Side question: What other controller types do you suggest I explore instead of PID?

Thank you for taking the time to read. I'd appreciate any feedback you could provide.

  • 1
    $\begingroup$ Unless you're doing something really simple, like temperature control that runs at steady state all the time, it's well worth collecting the info you have about your plant. In your case, signal_to_plant -> [actuator dynamics] -> acceleration -> [integrator] -> velocity_aka_plant_output ... so a first approximation guess at a qualitative model might be integrator-and-a-pole. Note possible difference w/ accel vs brake, esp with regard to limits (thus ARW design). throttle response might have a noticeable delay in it too, if your performance goals are aggressive. $\endgroup$
    – Pete W
    Feb 1, 2022 at 17:49
  • 2
    $\begingroup$ It’s always worthwhile having a mathematical model of the physical system you are trying to control. $\endgroup$ Feb 1, 2022 at 21:21
  • 1
    $\begingroup$ You would also need to define what you mean by optimal. Optimal-in-control-effort is usually in conflict with optimal-in-response-speed. $\endgroup$
    – AJN
    Feb 2, 2022 at 1:52
  • $\begingroup$ Ok, thank you @PeteW '@TeoProtoulis' and for the advice. Due to time constraints I was unfortunately unable to derive the mathematical model but will practise doing so with other similar examples. $\endgroup$ Feb 16, 2022 at 22:02


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.