python pid control

Solutions on MaxInterview for python pid control by the best coders in the world

showing results for - "python pid control"
Lilwenn
05 Feb 2020
1from simple_pid import PID
2pid = PID(1, 0.1, 0.05, setpoint=1)
3
4# assume we have a system we want to control in controlled_system
5v = controlled_system.update(0)
6
7while True:
8    # compute new ouput from the PID according to the systems current value
9    control = pid(v)
10
11    # feed the PID output to the system and get its current value
12    v = controlled_system.update(control)
13