Add example of a solar heater control

esbenvb 2019-06-16 23:04:05 +02:00
parent 0d9761cb15
commit ff4110ca81
1 changed files with 73 additions and 0 deletions

@ -32,6 +32,7 @@
27. [Switch relays via serial interface](#27-Switch-relays-via-serial-interface)
28. [Using BREAK to simulate IF..ELSEIF..ELSE..ENDIF](#28-Using-BREAK-to-simulate-IFELSEIFELSEENDIF)
29. [Adjust PowerDelta according to current Power values](#29-adjust-powerdelta-according-to-current-power-values)
30. [Simple solar heater control](#30-simple-solar-heater-control)
------------------------------------------------------------------------------
#### 1. Use long press action on a switch
@ -1161,4 +1162,76 @@ ELSE // ENERGY#Power changed (i.e. LE 5)
DO PowerDelta 100
```
[Back To Top](#top)
------------------------------------------------------------------------------
#### 30. Simple solar heater control
In a swimming pool, a filter pump and a solar panel is installed. When the sun is shining, the pump should push water through the solar panel, to heat the pool. When it's night or cloudy, the pump should be off, to avoid cooling the pool water through the solar panel. The pump is controlled by a Sonoff TH10 with 2x DS18B20 sensors connected.
3 simple rules:
* Pump should start when solar panel is more than 2 deg warmer than the pool water
* Pump should stop when solar panel is less than 1 deg varmer than the pool water
* Pump should not start if the solar panel is below 25 deg celsius.
`t1`: pool temp
`t2`: panel temp
`var1`: in valid panel temp range?
`var2`: off threshold temp for panel
`var3`: on threshold temp for panel
`mem3`: lowest valid panel temp
```
mem3 25
rule1
on DS18B20-1#temperature do
event t1=%value%
endon
on DS18B20-2#temperature do
event t2=%value%
endon
on event#t2>%mem3% do
var1 1;
endon
on event#t2<=%mem3% do
var1 0;
endon
on event#t1 do
backlog
var2 %value%;
add2 1;
endon
on event#t1 do
backlog
var3 %value%;
add3 2;
endon
on event#t2>%var3% do
power1 %var1%;
endon
on event#t2<%var2% do
power1 0;
endon
rule1 1
```
To test the rule without having the sensors in place, simply enter the events for `t1` and `t2` in the console:
```
event t1=21
event t2=30
```
And watch the relay turn on and off based on the values.
Please not that this example does not support manual override or handle missing sensor data. Take a look at [Simple Thermostat Example](#9-simple-thermostat-example) for examples.
[Back To Top](#top)