Closed lingqi-su closed 3 years ago
Ciao, interesting question. Can you elaborate a little more the request? I'm not an expert of what PID is, but I had a quick look and an idea would be like:
Is this what you are thinking about?
Ciao, interesting question. Can you elaborate a little more the request? I'm not an expert of what PID is, but I had a quick look and an idea would be like:
- PID gets the room temp from the temp sensor
- PID gets a variable input as temp reference
- PID generates a signalthat is the difference between the 2 inputs.
- Integration use signal from PID as delta to decide if it has to turn on something.
Is this what you are thinking about?
This is quite close to what I' thinking. PID controller comes from the control theory. This is a more accurate approach than the on-off controller implemented in this custom component.
The PID controller calculates the current control error e
and adjust the output according to the error value. In the case of the current package, the output can be the time that the switch remains open during the next cycle period. The output y
is calculated as follows
The kp
, ki
and kd
are constants that can be selected manually (e.g. empirically with Ziegler–Nichols rule). The y0
are some default value. In case of heating, the e
should be the difference between the temperature setpoint and the current value. E.g. if the setpoint is 21 degree C and the current value is 20 degree C, then the error is 21 - 20 = 1
. In case of cooling, the e
should be the difference between the current value and the temperature setpoint. E.g. if the setpoint is 26 degree C and the current value is 25 degree C, then the error is 25 - 26 = -1
.
If we select the output y
to be the percentage time that the switch remains open during a cycle period (5 min), y0=0.5
, kp = 0.1
, ki = 0
, kd = 0
as an example (in this case, it's a P-controller, since it has no I and D part), the output would be 0.6. This means that for the next cycling period, the switch will remain on for 3 min.
It might be worth checking this out.
Ciao paulps2,
Thanks for the clarification, but I still don't catch the real use case in this situation. This PID could be useful if you don't have a thermostat and that will control the switch. Instead HA with the the virtual thermostat is exactly doing the PID scope:
What you want to do can be done, but it is out of scope for this integration. What you need is more a switch controlled by an analog input. So you have your PID as input in RPi GPIO so:
Closing for inactivity
Hi,
the PID controlling is a much better choice over the "static hysteresis" based controlling (like the wall thermostat), because of the PID:
As I know, all standard air and water heaters use PID for effective temperature control.
Hi, I would like to ask if you guys are planning to implement a PID controller into this custom components? A PID controller would be great and enhance the control accuracy.