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 ビュー (過去 30 日間)
Rafael
Rafael 2024 年 9 月 26 日
回答済み: Aravind 2024 年 10 月 1 日
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 件のコメント
Rafael
Rafael 2024 年 9 月 26 日
So the PID takes the derivative of the input? That means if I comment it to the displacement line it should work?
Sam Chak
Sam Chak 2024 年 9 月 26 日
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.

サインインしてコメントする。

回答 (1 件)

Aravind
Aravind 2024 年 10 月 1 日
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:
  1. 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.
  2. 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.
  3. 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.
  4. 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:
  1. Official documentation of The “PID Controller” block: https://www.mathworks.com/help/releases/R2023a/simulink/slref/pidcontroller.html
  2. Official documentation of The “PID Tuner” App: https://www.mathworks.com/help/releases/R2023a/control/ref/pidtuner-app.html
  3. 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!

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by