thermferm/pid.c

Sat, 25 Apr 2020 20:31:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Apr 2020 20:31:31 +0200
changeset 605
e00f8ff4de9a
parent 495
712984fdd26b
permissions
-rw-r--r--

Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.

316
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
605
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
2 * Copyright (C) 2015..2020
316
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of the mbsePi-apps
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * mbsePi-apps is distributed in the hope that it will be useful, but
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include "thermferm.h"
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "pid.h"
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
27 void InitPID(pid_var *pid, int type)
316
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 {
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
29 pid->Err = pid->InputLast = pid->iState = 0.0;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
30 pid->Input = pid->OutP = pid->SetP = 0.0;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
31 pid->pGain = pid->iGain = pid->dGain = 0.0;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
32 pid->idleRange = 0.4;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
33 pid->Mode = PID_MODE_NONE;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
34 pid->Type = type;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
35 pid->iMax = 100.0;
316
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 }
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37
73cd31dc6ce1 Moved pid function to separate files
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
39
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
40 void UpdatePID(pid_var *pid)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
41 {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
42 if (pid->Mode == PID_MODE_AUTO) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
43
605
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
44 double dInput;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
45
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
46 if (pid->Type == PID_TYPE_HEAT)
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
47 pid->Err = pid->SetP - pid->Input;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
48 else
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
49 pid->Err = pid->Input - pid->SetP;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
50
605
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
51 dInput = (pid->Input - pid->InputLast);
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
52
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
53 /*
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
54 * Calculate the integral state with appopriate limiting.
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
55 */
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
56 pid->iState += (pid->iGain * pid->Err);
605
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
57 pid->iState -= (pid->pGain * dInput); // Add Proportional on Measurement
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
58 if (pid->iState > pid->iMax)
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
59 pid->iState = pid->iMax;
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
60 else if (pid->iState < 0)
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
61 pid->iState = 0;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
62
605
e00f8ff4de9a Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
63 pid->OutP = pid->iState - pid->dGain * dInput;
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
64 pid->InputLast = pid->Input;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
65
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
66 } else if (pid->Mode == PID_MODE_BOO) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
67 /*
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
68 * Mode Bang On Off
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
69 */
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
70 pid->InputLast = pid->Input;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
71
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
72 if (pid->Type == PID_TYPE_HEAT)
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
73 pid->Err = pid->SetP - pid->Input;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
74 else
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
75 pid->Err = pid->Input - pid->SetP;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
76
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
77 if (pid->OutP && (pid->Err <= 0.0))
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
78 pid->OutP = 0.0;
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
79 else if ((pid->OutP == 0.0) && (pid->Err > pid->idleRange))
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
80 pid->OutP = pid->iMax;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
81
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
82 pid->iState = 0.0;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
83
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
84 } else {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
85 /*
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
86 * While in manual mode, stay ready for bumpless switch to
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
87 * auto.
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
88 */
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
89 pid->InputLast = pid->Input;
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
90 pid->OutP = pid->iState = 0.0;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
91 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
92
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
93 if (pid->OutP > pid->iMax)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
94 pid->OutP = pid->iMax;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
95 if (pid->OutP < 0.0)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
96 pid->OutP = 0.0;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
97
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
98 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
99
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
100

mercurial