PID old error was not set to the previous value but was always zero.

Sun, 15 Feb 2015 18:06:21 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 15 Feb 2015 18:06:21 +0100
changeset 307
249e7d506069
parent 306
97602274eb58
child 308
876a8420c75a

PID old error was not set to the previous value but was always zero.

thermferm/thermferm.c file | annotate | diff | comparison | revisions
--- a/thermferm/thermferm.c	Sat Feb 07 23:12:55 2015 +0100
+++ b/thermferm/thermferm.c	Sun Feb 15 18:06:21 2015 +0100
@@ -1320,7 +1320,7 @@
 				sp = unit->prof_target;
 			}
 
-			unit->PID_err_old = err;
+//			unit->PID_err_old = err;
 			err = sp - pv;
 			if (err < unit->idle_rangeH && err > unit->idle_rangeL) {
 			    err = 0;
@@ -1335,6 +1335,7 @@
 			    unit->PID_I_err = 10.0;
 			P_err = err;
 			D_err = err - unit->PID_err_old;
+			unit->PID_err_old = err;
 
 			/*
 			 * A postive value means heating, a negative value cooling.

mercurial