https://github.com/translunar/closed_loop
Example of a PID controller attached to a mass-spring-damper system
https://github.com/translunar/closed_loop
dynamics engineering phyics pid-controller simulation
Last synced: about 1 year ago
JSON representation
Example of a PID controller attached to a mass-spring-damper system
- Host: GitHub
- URL: https://github.com/translunar/closed_loop
- Owner: translunar
- Created: 2024-02-23T07:31:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-27T01:39:59.000Z (over 2 years ago)
- Last Synced: 2025-01-31T09:28:59.504Z (over 1 year ago)
- Topics: dynamics, engineering, phyics, pid-controller, simulation
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# closed_loop
This demonstrates a closed loop, single-threaded mass-spring-damper with a
PID controller. I've also demonstrated some zero-mean Gaussian noise, and
plotting is carried out by a separate script. Models can run at different
rates, and the example includes two logging rate groups as well.
## Running the example
source .venv/bin/activate
pip install -r requirements.txt
python world.py 10.0 5.0 && python plotter.py
Note that the mandatory arguments for `world.py` are:
* the simulation duration (in units of time)
* the desired position of the mass (PID controller setpoint)
The simulation is defined in `world.py` in `__main__`.
To run unit tests,
pytest test/
## A note about typing
I decided against using mypy to check typing because it would be difficult
to finish this task in five hours with typing.
## Copyright
Copyright Juno Woods, Ph.D., Translunar LLC, 2024. All rights reserved.