1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

When pidctrl_daemon() is called multiple times within an interval, it

should use the cumulative error to calculate the output.
This commit is contained in:
Alan Cox 2018-06-07 07:48:50 +00:00
parent fcabd54160
commit 5b274055d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334769

View File

@ -146,7 +146,7 @@ pidctrl_daemon(struct pidctrl *pc, int input)
pc->pc_derivative = pc->pc_error - pc->pc_olderror;
/* Divide by inverse gain values to produce output. */
output = (error / Kpd) + (pc->pc_integral / Kid) +
output = (pc->pc_error / Kpd) + (pc->pc_integral / Kid) +
(pc->pc_derivative / Kdd);
output = MAX(output - pc->pc_output, 0);
/* Save for sysctl. */