{ "info": { "author": "Martin Lundberg", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "# simple-pid\n\n[![Travis](https://travis-ci.com/m-lundberg/simple-pid.svg?branch=master)](https://travis-ci.com/m-lundberg/simple-pid)\n[![PyPI](https://img.shields.io/pypi/v/simple-pid.svg)](https://pypi.org/project/simple-pid/)\n[![Read the Docs](https://img.shields.io/readthedocs/simple-pid.svg)](https://simple-pid.readthedocs.io/)\n[![License](https://img.shields.io/github/license/m-lundberg/simple-pid.svg)](https://github.com/m-lundberg/simple-pid/blob/master/LICENSE.md)\n\nA simple and easy to use PID controller in Python. If you want a PID controller without external dependencies that just works, this is for you! The PID was designed to be robust with help from [Brett Beauregards guide](http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/).\n\nUsage is very simple:\n\n```python\nfrom simple_pid import PID\npid = PID(1, 0.1, 0.05, setpoint=1)\n\n# assume we have a system we want to control in controlled_system\nv = controlled_system.update(0)\n\nwhile True:\n # compute new ouput from the PID according to the systems current value\n control = pid(v)\n\n # feed the PID output to the system and get its current value\n v = controlled_system.update(control)\n```\n\nComplete API documentation can be found [here](https://simple-pid.readthedocs.io/en/latest/simple_pid.html#module-simple_pid.PID).\n\n## Installation\nTo install, run:\n```\npip install simple-pid\n```\n\n## Usage\nThe `PID` class implements `__call__()`, which means that to compute a new output value, you simply call the object like this:\n```python\noutput = pid(current_value)\n```\n\n### The basics\nThe PID works best when it is updated at regular intervals. To achieve this, set `sample_time` to the amount of time there should be between each update and then call the PID every time in the program loop. A new output will only be calculated when `sample_time` seconds has passed:\n```python\npid.sample_time = 0.01 # update every 0.01 seconds\n\nwhile True:\n output = pid(current_value)\n```\n\nTo set the setpoint, ie. the value that the PID is trying to achieve, simply set it like this:\n```python\npid.setpoint = 10\n```\n\nThe tunings can be changed any time when the PID is running. They can either be set individually or all at once:\n```python\npid.Ki = 1.0\npid.tunings = (1.0, 0.2, 0.4)\n```\n\nIn order to get output values in a certain range, and also to avoid [integral windup](https://en.wikipedia.org/wiki/Integral_windup) (since the integral term will never be allowed to grow outside of these limits), the output can be limited to a range:\n```python\npid.output_limits = (0, 10) # output value will be between 0 and 10\npid.output_limits = (0, None) # output will always be above 0, but with no upper bound\n```\n\n### Other features\n#### Auto mode\nTo disable the PID so that no new values are computed, set auto mode to False:\n```python\npid.auto_mode = False # no new values will be computed when pid is called\npid.auto_mode = True # pid is enabled again\n```\nWhen disabling the PID and controlling a system manually, it might be useful to tell the PID controller where to start from when giving back control to it. This can be done by enabling auto mode like this:\n```python\npid.set_auto_mode(True, last_output=8.0)\n```\nThis will set the I-term to the value given to `last_output`, meaning that if the system that is being controlled was stable at that output value the PID will keep the system stable if started from that point, without any big bumps in the output when turning the PID back on.\n\n#### Observing separate components\nWhen tuning the PID, it can be useful to see how each of the components contribute to the output. They can be seen like this:\n```python\np, i, d = pid.components # the separate terms are now in p, i, d\n```\n\n#### Proportional on measurement\nTo eliminate overshoot in certain types of systems, you can calculate the [proportional term directly on the measurement](http://brettbeauregard.com/blog/2017/06/introducing-proportional-on-measurement/) instead of the error. This can be enabled like this:\n```python\npid.proportional_on_measurement = True\n```\n\n## Tests\nUse the following to run tests:\n```\ntox\n```\n\n## License\nLicensed under the [MIT License](https://github.com/m-lundberg/simple-pid/blob/master/LICENSE.md).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/m-lundberg/simple-pid", "keywords": "pid controller control", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "simple-pid", "package_url": "https://pypi.org/project/simple-pid/", "platform": "", "project_url": "https://pypi.org/project/simple-pid/", "project_urls": { "Documentation": "https://simple-pid.readthedocs.io/", "Homepage": "https://github.com/m-lundberg/simple-pid" }, "release_url": "https://pypi.org/project/simple-pid/0.2.4/", "requires_dist": [ "m2r; extra == 'docs'", "sphinx-rtd-theme; extra == 'docs'" ], "requires_python": "", "summary": "A simple, easy to use PID controller", "version": "0.2.4" }, "last_serial": 5946343, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3dec95375aed0589ca5301ce7ddc82fa", "sha256": "60089c0fbfd70dad9e17fd805067dc44aeee166836a57a575bed4f46bdc4a6d5" }, "downloads": -1, "filename": "simple_pid-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3dec95375aed0589ca5301ce7ddc82fa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3782, "upload_time": "2018-05-11T14:12:53", "url": "https://files.pythonhosted.org/packages/33/a8/d3ea0a42c3d73fad90d96bcc1c01627a9df7bb1f31f9e6cae4a43df75fd5/simple_pid-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32cfa7ac7ccc3c80c5e3fe91fae696a4", "sha256": "83b63cd1578b29a88cd61376f8edc25de525c3d636bd066bd96c51356e0fda04" }, "downloads": -1, "filename": "simple-pid-0.1.0.tar.gz", "has_sig": false, "md5_digest": "32cfa7ac7ccc3c80c5e3fe91fae696a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3527, "upload_time": "2018-05-11T14:12:57", "url": "https://files.pythonhosted.org/packages/55/7a/271adb68d8ebc3c1d7b8846c7642a8cd3eba981f14710c3fc2052dd3b3f4/simple-pid-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a2e6af2015c385f997d8f3c9dc3a4a5f", "sha256": "8c5cb2d2331448bff43a053a30c0b26e8e9ce18ae2f6c2bea36e720826b0e37f" }, "downloads": -1, "filename": "simple_pid-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a2e6af2015c385f997d8f3c9dc3a4a5f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3833, "upload_time": "2018-05-11T14:12:55", "url": "https://files.pythonhosted.org/packages/ad/d5/8c5c5267298ed95f6d1341d17f86efcfab6a420cedfc6d055fd5ef5b036e/simple_pid-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab873b83574a7086c3613662c2525ecb", "sha256": "77d4137c1a3a8328488540a9432ab3afeb715105cf1bbc880e01deeca41352c1" }, "downloads": -1, "filename": "simple-pid-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ab873b83574a7086c3613662c2525ecb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3588, "upload_time": "2018-05-11T14:12:59", "url": "https://files.pythonhosted.org/packages/60/bc/c315291c936b9c2afd96810b4fc0a25e1f9ad0ea9f366b95d804fb818e02/simple-pid-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0b20b5f9d944d786b27c75515b7b8dcf", "sha256": "3b7b9f4c2e7e7b6063657b1d3b239582317ab4dd4d72fd9a45f8ea86e5165278" }, "downloads": -1, "filename": "simple_pid-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0b20b5f9d944d786b27c75515b7b8dcf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3841, "upload_time": "2018-05-12T10:59:24", "url": "https://files.pythonhosted.org/packages/76/1f/a71e315e1cab46f7c046b897de49479c5570cd77d9dafede32b312e57315/simple_pid-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a52dfbfe92824bca890d4c94ed4e91e", "sha256": "8fe3121c9b999cf5d1515e0e9d069531f997ab8d551fd9ebd6d44c3964c074c7" }, "downloads": -1, "filename": "simple-pid-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3a52dfbfe92824bca890d4c94ed4e91e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3594, "upload_time": "2018-05-12T10:59:27", "url": "https://files.pythonhosted.org/packages/70/e3/097c29f90441bb472d32648f90f47e5d3d44b77ea0282ff1f3cb2716dc72/simple-pid-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c2d1e44c5cae1ecd416b8a52b46460cf", "sha256": "fdd673ec9bb359d9fb1caaa42ab0cba6e5049362069ad7e9a4e0d90878772ee3" }, "downloads": -1, "filename": "simple_pid-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c2d1e44c5cae1ecd416b8a52b46460cf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4606, "upload_time": "2018-06-03T22:11:28", "url": "https://files.pythonhosted.org/packages/f3/93/7cf2acf379427122eb58017ac41b25505b86e5ebdf5cb8005037a64b7e54/simple_pid-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7a3c0e6e882e7d8d386268b8f16e989", "sha256": "4bf93379d174ed8632df1f3c2e6f3279027e6bf9a316c640276b80f1283850ef" }, "downloads": -1, "filename": "simple-pid-0.1.3.tar.gz", "has_sig": false, "md5_digest": "b7a3c0e6e882e7d8d386268b8f16e989", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4304, "upload_time": "2018-06-03T22:11:31", "url": "https://files.pythonhosted.org/packages/7f/28/cef58d223cac1c5ed52b78bdea65f6e90a9e4dfbbab9971713b80e707db0/simple-pid-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "56f0096fef3f778986575a504373916e", "sha256": "a3ad09260215025bf3e7e3eb41dd0a58cddfc589e4200f74e42af6f2ffa9b2e9" }, "downloads": -1, "filename": "simple_pid-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "56f0096fef3f778986575a504373916e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5708, "upload_time": "2018-10-02T18:44:12", "url": "https://files.pythonhosted.org/packages/c4/d9/bfe25f8afcb3131f96a907bd11a2a72757cd64968d72f578728752a8343b/simple_pid-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f37cfe50caa9fe5f49be0c09b7df7dc", "sha256": "9c7aeae16a1b883cd886377bc682f9ba67457a7bee98fbe8a95b56d72bf354f8" }, "downloads": -1, "filename": "simple-pid-0.1.4.tar.gz", "has_sig": false, "md5_digest": "7f37cfe50caa9fe5f49be0c09b7df7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4668, "upload_time": "2018-10-02T18:44:16", "url": "https://files.pythonhosted.org/packages/3c/52/523db0c9ad0db12d3fc38006af195729600d97b8feee98b2233acff52284/simple-pid-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "e2fc7cce5dbcd33246a2dacaa1375ddb", "sha256": "849f8566a5c3959dd2b52cf6420a4a6c3417e5124b0ae967762d9f2b5066dc23" }, "downloads": -1, "filename": "simple_pid-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e2fc7cce5dbcd33246a2dacaa1375ddb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5894, "upload_time": "2019-01-30T23:27:12", "url": "https://files.pythonhosted.org/packages/34/5a/5bd2a63ead0a6f27a1e6573c382006aebb7d3c993ec3f7f987ea4c86bc7f/simple_pid-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec66fb054d106c60f7c69728972ab6de", "sha256": "a7c4ae429a88bfdb4f52f9dcc39896c97da1abf2505dbcc08c80cb5b8041bde8" }, "downloads": -1, "filename": "simple-pid-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ec66fb054d106c60f7c69728972ab6de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4880, "upload_time": "2019-01-30T23:27:17", "url": "https://files.pythonhosted.org/packages/74/50/bbb800278b966ea471c5d19db40e899e5c67ab5576211fe479c8f6afabc9/simple-pid-0.1.5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "245a782deb5a50ce8e835db3dd85dfdc", "sha256": "417844d0995a928925aa57f2afcad985fc88816b2fe1b67107b1ef7b322c2e66" }, "downloads": -1, "filename": "simple_pid-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "245a782deb5a50ce8e835db3dd85dfdc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6365, "upload_time": "2019-02-25T20:45:40", "url": "https://files.pythonhosted.org/packages/b2/90/21f785750659d95ce61be0ca6065857823f935b07a67fc8da5fc5c664b89/simple_pid-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4ea402b9d890e721790a28ec264d44d4", "sha256": "a928acff460645b057c6de216739ef924888b01154b7c3874d295eb643b3b0e5" }, "downloads": -1, "filename": "simple-pid-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4ea402b9d890e721790a28ec264d44d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5374, "upload_time": "2019-02-25T20:45:46", "url": "https://files.pythonhosted.org/packages/c3/f6/300caf315c63828913d342e68aaf3957f4d135f11dd90f9ab11db13989bf/simple-pid-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "7817757959b03c8f176c90037f9e5c88", "sha256": "34d6042cca7b2e91394d066cc6e83fb9f679dc112af6a87d9e805f99a64184cf" }, "downloads": -1, "filename": "simple_pid-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7817757959b03c8f176c90037f9e5c88", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6375, "upload_time": "2019-02-28T19:28:37", "url": "https://files.pythonhosted.org/packages/f7/eb/c863e397b974c03f65aed46e76737bfd28cabf8c6609f72537cbf09cd585/simple_pid-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dccda2b12c2c2f289c8353fcacd0bf25", "sha256": "609010e2dbccc513f7a8a90f97ddf3eea89134ed1d6c2e7eeb51e04e53bd9932" }, "downloads": -1, "filename": "simple-pid-0.2.1.tar.gz", "has_sig": false, "md5_digest": "dccda2b12c2c2f289c8353fcacd0bf25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5385, "upload_time": "2019-02-28T19:28:43", "url": "https://files.pythonhosted.org/packages/5e/31/2fadbfc4b548f16d05ce88af5638ef9fd954d66367831a3fdd6c2df39a1d/simple-pid-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "a1265488981b98253c6198129233012a", "sha256": "eafb8b34987f734ae6ee3d9c3c0f2c5f946353517004438f7fbc25bbe5c12e34" }, "downloads": -1, "filename": "simple_pid-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a1265488981b98253c6198129233012a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6395, "upload_time": "2019-07-04T17:47:56", "url": "https://files.pythonhosted.org/packages/0a/1d/71af5f7204ed54e4ea4d38d747d83df1bc7e11bd59225cdb5e27d4851152/simple_pid-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5104a6ed4001616978eb7c4f6d3c543c", "sha256": "69cb7a669a3a14131ca265ea140b6f973e7b65cc05c2efc67d6ab6ce7d4e011d" }, "downloads": -1, "filename": "simple-pid-0.2.2.tar.gz", "has_sig": false, "md5_digest": "5104a6ed4001616978eb7c4f6d3c543c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5419, "upload_time": "2019-07-04T17:48:04", "url": "https://files.pythonhosted.org/packages/29/97/3578eac3649cbfbeed39f773b496caad658a9e4fd9b11df289fdf924df0a/simple-pid-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "f01d21660e2fc130ccf8a35cdf995595", "sha256": "92267d86838e84932d755604b9167632fa394260f387b35e084b2992ed707f4b" }, "downloads": -1, "filename": "simple_pid-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f01d21660e2fc130ccf8a35cdf995595", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6463, "upload_time": "2019-08-26T18:53:34", "url": "https://files.pythonhosted.org/packages/7c/d4/ebea9ab299514526bd6c5529f277d4f3233f25bd8fb2931dbbe26b72dd1c/simple_pid-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d7fc32746a745092ad862ec00a0e0838", "sha256": "7cdafb2e3450e92d01bb0ae019a3a601437ba491a51e67b359c57755c6fd9847" }, "downloads": -1, "filename": "simple-pid-0.2.3.tar.gz", "has_sig": false, "md5_digest": "d7fc32746a745092ad862ec00a0e0838", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5486, "upload_time": "2019-08-26T18:53:43", "url": "https://files.pythonhosted.org/packages/36/5c/b4a8db7ce0caf125862c61925db1ad7696aef017a87b184c6a972db549bb/simple-pid-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "aca8e1c353991a4c5037c3a309cbe40a", "sha256": "25cfa3408a7b024e090dab00813866b46eca31452ecfc982a7078b4a4730686c" }, "downloads": -1, "filename": "simple_pid-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aca8e1c353991a4c5037c3a309cbe40a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6574, "upload_time": "2019-10-08T19:41:28", "url": "https://files.pythonhosted.org/packages/25/37/6e65affc5c135cda2ad6931c83e185957faf2c74c6432bad5fbf5523f344/simple_pid-0.2.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5892b40a69624d8e6064c1569c681190", "sha256": "d1192b4c42ea5b3d278bb85b565841acb6292e60af2fb31f28c56eb8e704326d" }, "downloads": -1, "filename": "simple-pid-0.2.4.tar.gz", "has_sig": false, "md5_digest": "5892b40a69624d8e6064c1569c681190", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5600, "upload_time": "2019-10-08T19:41:39", "url": "https://files.pythonhosted.org/packages/aa/c3/ddf8bb48dee7bdbfb6e2376b179a64c8c2c590308ad05b47c02941959a71/simple-pid-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aca8e1c353991a4c5037c3a309cbe40a", "sha256": "25cfa3408a7b024e090dab00813866b46eca31452ecfc982a7078b4a4730686c" }, "downloads": -1, "filename": "simple_pid-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aca8e1c353991a4c5037c3a309cbe40a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6574, "upload_time": "2019-10-08T19:41:28", "url": "https://files.pythonhosted.org/packages/25/37/6e65affc5c135cda2ad6931c83e185957faf2c74c6432bad5fbf5523f344/simple_pid-0.2.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5892b40a69624d8e6064c1569c681190", "sha256": "d1192b4c42ea5b3d278bb85b565841acb6292e60af2fb31f28c56eb8e704326d" }, "downloads": -1, "filename": "simple-pid-0.2.4.tar.gz", "has_sig": false, "md5_digest": "5892b40a69624d8e6064c1569c681190", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5600, "upload_time": "2019-10-08T19:41:39", "url": "https://files.pythonhosted.org/packages/aa/c3/ddf8bb48dee7bdbfb6e2376b179a64c8c2c590308ad05b47c02941959a71/simple-pid-0.2.4.tar.gz" } ] }