{"id":13473456,"url":"https://github.com/hirschmann/pid-autotune","last_synced_at":"2025-10-11T07:41:42.400Z","repository":{"id":40523978,"uuid":"87570496","full_name":"hirschmann/pid-autotune","owner":"hirschmann","description":"PID-controller/brewing kettle simulation","archived":false,"fork":false,"pushed_at":"2017-07-14T20:40:50.000Z","size":96,"stargazers_count":155,"open_issues_count":4,"forks_count":42,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-05T10:40:31.251Z","etag":null,"topics":["autotune","brewing","pid","python","simulation"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hirschmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-07T17:28:11.000Z","updated_at":"2025-04-03T06:00:35.000Z","dependencies_parsed_at":"2022-07-26T09:32:04.506Z","dependency_job_id":null,"html_url":"https://github.com/hirschmann/pid-autotune","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hirschmann/pid-autotune","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirschmann%2Fpid-autotune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirschmann%2Fpid-autotune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirschmann%2Fpid-autotune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirschmann%2Fpid-autotune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hirschmann","download_url":"https://codeload.github.com/hirschmann/pid-autotune/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirschmann%2Fpid-autotune/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006626,"owners_count":26084131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autotune","brewing","pid","python","simulation"],"created_at":"2024-07-31T16:01:03.765Z","updated_at":"2025-10-11T07:41:42.364Z","avatar_url":"https://github.com/hirschmann.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# PID-controller/brewing kettle simulation\n\nThis project has been created to support tuning a PID controller for a home brewing setup using [CraftBeerPI](https://github.com/Manuel83/craftbeerpi).\nIt consists of a brewing kettle simulation, a PID controller (based on [Arduino PID Library](http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/)) and a PID autotune algorithm (based on [Arduino PID Autotune Library](http://brettbeauregard.com/blog/2012/01/arduino-pid-autotune-library/))\n\n### Project goals\n\n- allow users to find PID parameters which provide a sufficient basis for further manual tuning\n- allow users to compare different PID parameters\n- help users to understand how different PID parameters (Kp, Ki, Kd) influence a PID controller's behavior (not only limited to home brewing setups)\n- speed up auto tuning\n\n## PID comparison\n\nCompare different PID parameters using the default kettle setup:  \n`sim.py --pid 'reference' 98 0.66 230 --pid 'Kp too low' 30 0.66 230 --pid 'Ki too low' 98 0.01 230`\n\n![PID parameters comparison](images/pid-comparison.png)\n\n## PID autotune simulation\n\nSimulate a PID autotune run on a 50l kettle with a 4 kW heater:  \n`sim.py --atune --volume 50 --power 4`\n\n![PID autotune simulation](images/pid-atune.png)\n\nGenerated PID parameters using different tuning rules:\n\n```\nrule: ziegler-nichols\nKp: 7.66141138481997\nKi: 0.4086086071903984\nKd: 35.91286586634361\n\nrule: tyreus-luyben\nKp: 5.920181524633613\nKi: 0.07104217829560336\nKd: 35.239175741866745\n\nrule: ciancone-marlin\nKp: 3.9467876830890756\nKi: 0.46308975481578485\nKd: 18.272165199486462\n\nrule: pessen-integral\nKp: 9.30314239585282\nKi: 0.6202094930568547\nKd: 52.46132929992192\n\nrule: some-overshoot\nKp: 4.341466451397983\nKi: 0.2315448774078924\nKd: 54.26833064247478\n\nrule: no-overshoot\nKp: 2.60487987083879\nKi: 0.13892692644473545\nKd: 32.56099838548487\n\nrule: brewing\nKp: 104.1951948335516\nKi: 0.8335615586684127\nKd: 205.64841085569392\n```\n\n## Options\n\n```\nusage: sim.py [-h] [-p name kp ki kd] [-a] [-v] [-e] [-n] [-t T] [-s T]\n              [--ambient T] [-i t] [-d t] [--sampletime t] [--volume V]\n              [--diameter d] [--power P] [--heatloss x] [--minout x]\n              [--maxout x]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -p name kp ki kd, --pid name kp ki kd\n                        simulate a PID controller\n  -a, --atune           simulate autotune\n  -v, --verbose         be verbose\n  -e, --export          export data to a .csv file\n  -n, --noplot          do not plot the results\n  -t T, --temp T        initial kettle temperature in °C (default: 40)\n  -s T, --setpoint T    target temperature in °C (default: 45)\n  --ambient T           ambient temperature in °C (default: 20)\n  -i t, --interval t    simulated interval in minutes (default: 20)\n  -d t, --delay t       system response delay in seconds (default: 15)\n  --sampletime t        temperature sample time in seconds (default: 5)\n  --volume V            kettle content volume in liters (default: 70)\n  --diameter d          kettle diameter in cm (default: 50)\n  --power P             heater power in kW (default: 6)\n  --heatloss x          kettle heat loss factor (default: 1)\n  --minout x            minimum PID controller output (default: 0)\n  --maxout x            maximum PID controller output (default: 100)\n```\n\n# Installation\n1. Install _git_ and _python3_\n2. Clone this repository:  \n`git clone https://github.com/hirschmann/pid-autotune.git`\n3. Install project dependencies:  \n`pip install matplotlib`\n\nAfter you have completed these steps, you should be able to run _sim.py_ as shown above. If plots are not shown, you have to configure the matplotlib backend, see [What is a backend?](http://matplotlib.org/faq/usage_faq.html#what-is-a-backend)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirschmann%2Fpid-autotune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhirschmann%2Fpid-autotune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirschmann%2Fpid-autotune/lists"}