Tomas A. Sanchez, July 2024.
Cruise Control (CC) is a system that automatically controls the speed of a motor vehicle. The system takes over the throttle of the car to maintain a steady speed as set by the driver.
The CC system is a feedback control system that uses a controller to maintain the desired speed. The controller adjusts the throttle of the car based on the difference between the desired speed and the actual speed of the car. The CC system is widely used in modern cars to improve fuel efficiency and reduce driver fatigue.
Read more about the Design and Analysis of Cruise Control Systems in the Notebook.
IMPORTANT: The simulation requires Python 3.10
or later. You can install the required dependencies using pip
:
pip install -r requirements.txt
You can run the simulation by executing the following command:
python src/acc/main.py
You will be prompted to enter multiple values for the simulation. You can use the default values by pressing Enter
.
Or you can run the simulation with the default values by executing the following command:
python src/acc/main.py --default
After the simulation is complete, a output/results.png
will be saved containing error, speed,
and throttle plots over time. Results are also provided as a CSV
file in output/results.csv
.
The project is structured as follows:
.
├── notebooks
│ └── acc.ipynb
├── output
│ ├── results.csv
│ └── results.png
└── src
└── acc
├── simulation
├── model
│ ├── control.py
│ ├── feedback.py
│ └── process.py
└── cli.py
notebooks/
: Contains Jupyter notebooks for the analysis of the CC system.output/
: Contains the simulation results inCSV
andPNG
formats.src/acc/
: Source code for the CC system.simulation/
: Δt simulation logic.model/
: contains each control system component.control.py
: PID controller.feedback.py
: Feedback element (Speedometer).process.py
: Plant.
cli.py
: Command-line interface for running the simulation.
This project is licensed under the terms of the MIT license unless otherwise specified. See LICENSE
for
more details or visit https://mit-license.org/.
This project was designed and developed by Tomás Sánchez <[email protected]>.
If you find this project useful, please consider supporting its development by sponsoring it.
Special thanks to the Python Control Systems Library for providing knowledge and physics models for the simulation.