From f4fcaf1e3a3af3759946ce750380d41988de16ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Mon, 14 Jun 2021 23:16:07 +0200 Subject: [PATCH] Start documentation of PID controller --- doc/.vscode/settings.json | 3 +++ doc/source/firmware/index.rst | 1 + doc/source/firmware/pid-controller.rst | 36 ++++++++++++++++++++++++++ doc/source/firmware/pid.drawio | 1 + 4 files changed, 41 insertions(+) create mode 100644 doc/.vscode/settings.json create mode 100644 doc/source/firmware/pid-controller.rst create mode 100644 doc/source/firmware/pid.drawio diff --git a/doc/.vscode/settings.json b/doc/.vscode/settings.json new file mode 100644 index 0000000..4b4b223 --- /dev/null +++ b/doc/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "restructuredtext.confPath": "${workspaceFolder}/source" +} \ No newline at end of file diff --git a/doc/source/firmware/index.rst b/doc/source/firmware/index.rst index 028147c..79776b4 100644 --- a/doc/source/firmware/index.rst +++ b/doc/source/firmware/index.rst @@ -11,6 +11,7 @@ mechanisms and the behavior. For a detailed code documentation see the doxygen o :maxdepth: 2 pt1000-processing + pid-controller safety/index code/index diff --git a/doc/source/firmware/pid-controller.rst b/doc/source/firmware/pid-controller.rst new file mode 100644 index 0000000..e6b034e --- /dev/null +++ b/doc/source/firmware/pid-controller.rst @@ -0,0 +1,36 @@ +.. _pid_controller: + +PID Controller +============== + +The PID controller is the main element of the oven. It controls the output of the solid state relais in order to achieve the desired temperature. + +The PID controller is implemented in the ``pid-controller.c`` file. See the :ref:`pid_code_api` for details. + +Functional Description +---------------------- + +The following figure shows the PID controller's structure. + +.. drawio-image:: pid.drawio + +The controller is composed of 3 paths. The proportional, the derivate, and the integrator path. +Compared to a textbook PID controller, this version contains a few additional features. + +The integrator has a configurable maximum limit of :c:var:`pid_controller.integral_max`. Once this value is reached (plus or minus), the integrator freezes. +The integrator is also frozen in case the output value is in saturation. This serves as an anti-windup protection. + +The output value saturates at configurable high and low limits (:c:var:`pid_controller.output_sat_max` and :c:var:`pid_controller.output_sat_min`). The controller instance used for the +reflow oven's solid state relais output is saturated by software to a limit of 0 to 100. + +In addition to the above features, the derivate term contains an additional first order low pass filter in order to prevent coupling of high frequency noise amplified by the derivate term. +The low pass filter is charcterized by its time constant :math:`k_{d\tau}`. + + +.. _pid_code_api: + +PID Controller Code API +----------------------- + +.. doxygengroup:: pid-controller + :project: Reflow Controller Firmware \ No newline at end of file diff --git a/doc/source/firmware/pid.drawio b/doc/source/firmware/pid.drawio new file mode 100644 index 0000000..77c9c5e --- /dev/null +++ b/doc/source/firmware/pid.drawio @@ -0,0 +1 @@ +3Vttb6M4EP41+dgIMObl4/bl7lba1VXqSbt3XyonOMRXiDnjtGR//dnYQHhLySaEdFFV2ePx2Hjm8YzHZAbu4ux3hpL1VxrgaGYZQTYD9zPL8j1T/JeEnSJA6CtCyEigSGZFeCI/sCYamrolAU5rjJzSiJOkTlzSzQYveY2GGKNvdbYVjeqjJijELcLTEkVt6jcS8LWmmoZRNfyBSbjWQ3tQNyzQ8iVkdLvR480ssMof1RyjUpYipGsU0DdFykWAhxm4Y5RyVYqzOxzJpS2WTY3zW09rOW+GN3xIBy/JHl5eQ/vrX8//QJh8C+iPpxutq5TvivXAgVgeXaWMr2lINyh6qKi3+TtjKdUQtYrnC6WJIJqC+C/mfKd1jbacCtKax5FuxRnh3/fKf0tRc6hr95mWnFd2RWXD2e57xSirf++3Vd3yWq3fI2YkxhwzTVQvLd+0dy0LpdEtW+IDC1iYLGIh5of4zFLlAkmYiumwnejIcIQ4ea1PBGmbDku+susjJWKKlqHh50BLrEfeSePPstyCUohRk9M9KwsRhb2pVKTcbo6wISlyAiMqDaJmDpV19BjEcN2/r9NRVFrujIVCHWOQOtuC7HcEKeNuCfrEGNrtsSWSIT0wYbd7nN55NfjNOr8oqBmc1Ui1Gl5RtMXFfu1EQru3C1EIZeHzhuOQIU5Z0SRGKltLdlZRbPH38kxUoQWCysSlvb6tCcdPCcp3kzfhSuvmvCJRdEcjyvK+I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