-
Notifications
You must be signed in to change notification settings - Fork 0
postmanic edited this page Oct 17, 2015
·
6 revisions
There are a few remarks to make about this implementation:
The function is called once every TS seconds, with Ts being set to 20 seconds in my brewing program. It means that a new value for the PID controller output is calculated every 20 seconds.
The actual temperatures are read in every second. These temperatures are filtered and then passed to this function (as xk).
The values of Kc, Ti, Td and Ts can be adjusted by the brewer (see the GUI section on the software page).
The extension _1 to several variables (e.g. xk_1, lpf_1) indicates the previous version of that variable. For example: xk_1 means the value of xk during the previous call to this function (20 seconds ago). Same with the extension _2 (which was the value 2 * 20 seconds ago).
Prior to calling pid_reg4() for the first time, it has to be initialised. For this reason, the function init_pid4() was created which calculates the value of certain constants. This routine has to be called whenever one or more parameters have been changed.