How do I include a PID block to control the required torque? I want to control the vehicle speed with a speed setpoint or speed profile (NEDC)
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a basic electric car model where I can see speed, displacement, acceleration, force, etc as the torque of the motor moves the car. I want to add a PID controller so I can control the vehicle speed. I tried having the PID directly connected to the torque input and add them, and I would get a good velocity vs time graph but every other graph became a mess. Anyone help?
3 comentarios
Sam Chak
el 26 de Sept. de 2024
If Kd ≠ 0, then PID Controller will produce a derivative action. However, if you put the PID in the displacement loop, you aren't controlling the velocity.
Respuestas (1)
Aravind
el 1 de Oct. de 2024
A PID controller can be implemented using a “PID Controller” block in Simulink. Typically, a PID controller will take the error, defined as the difference between the desired speed and the current speed of the car, as input, and output the necessary torque to achieve the desired speed. Here’s how you can set up speed control using a PID loop:
- Include the “PID Controller” block in your model. Set up the PID gains as required. You might need to tune these values to achieve the desired performance. Simulink provides a “PID Tuner” app that can assist with this process.
- Use a “Difference” block in Simulink to calculate the error, which is the difference between the desired and current speeds. Connect the output of this block to the input of the “PID Controller” block.
- The output of the “PID Controller” block, which is the required torque, should be connected as an input to your plant (the electric car model). This will form a feedback loop to control the car’s speed to follow the setpoint, provided the gains are tuned correctly.
- Run the simulation and observe the vehicle speed, torque, and other relevant outputs. If the performance is not satisfactory, adjust the PID gains manually or use the “PID Tuner” app to optimize them.
For additional resources, you can check out the following documentations:
- Official documentation of The “PID Controller” block: https://www.mathworks.com/help/releases/R2023a/simulink/slref/pidcontroller.html
- Official documentation of The “PID Tuner” App: https://www.mathworks.com/help/releases/R2023a/control/ref/pidtuner-app.html
- An example explaining how to use the “PID Tuner” App: https://www.mathworks.com/help/releases/R2023a/slcontrol/gs/automated-tuning-of-simulink-pid-controller-block.html
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre PID Controller Tuning en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!