svn commit: r334769 - head/sys/kern

Alan Cox alc at FreeBSD.org
Thu Jun 7 07:48:51 UTC 2018


Author: alc
Date: Thu Jun  7 07:48:50 2018
New Revision: 334769
URL: https://svnweb.freebsd.org/changeset/base/334769

Log:
  When pidctrl_daemon() is called multiple times within an interval, it
  should use the cumulative error to calculate the output.

Modified:
  head/sys/kern/subr_pidctrl.c

Modified: head/sys/kern/subr_pidctrl.c
==============================================================================
--- head/sys/kern/subr_pidctrl.c	Thu Jun  7 07:48:26 2018	(r334768)
+++ head/sys/kern/subr_pidctrl.c	Thu Jun  7 07:48:50 2018	(r334769)
@@ -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. */


More information about the svn-src-head mailing list