Skip to content

Commit cd83282

Browse files
Copilotstritti
andcommitted
Implement Option A: Enhanced temperature formula with industry-standard turnover rates
- Update calculateFiltrationDuration() to use 2.5-3.5 turnovers/day (DIN standard) - Base turnover: 2.5x at 20°C, scales to 3.5x at 28°C, max 4.0x at pool max temp - Add comprehensive logging: turnover rate and filtration hours - Add validation warning for undersized pumps (>24h for 1 turnover) - Create detailed documentation in docs/temperature-based-filtration.md - Document Options B and C as alternatives in comprehensive guide - Align with DIN 19643 and pool industry best practices Co-authored-by: stritti <184547+stritti@users.noreply.github.com>
1 parent 5738baa commit cd83282

File tree

3 files changed

+445
-23
lines changed

3 files changed

+445
-23
lines changed
Lines changed: 371 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,371 @@
1+
# Temperature-Based Filtration Duration
2+
3+
## Overview
4+
5+
This document describes the temperature-based automatic filtration
6+
duration calculation feature, which adapts pool filtration runtime to
7+
water temperature for optimal water quality.
8+
9+
## Feature Description
10+
11+
The system can automatically calculate filtration duration based on
12+
pool water temperature, replacing fixed start/stop times with dynamic
13+
calculations that align with pool industry best practices and DIN
14+
standards.
15+
16+
### Key Benefits
17+
18+
- **Optimal Water Quality**: Ensures adequate filtration based on
19+
temperature
20+
- **Energy Efficiency**: Avoids over-filtration in cooler conditions
21+
- **Temperature Protection**: Increases filtration when pool approaches
22+
maximum temperature
23+
- **Configurable**: Users can choose between dynamic and fixed timer
24+
modes
25+
26+
## Configuration Parameters
27+
28+
### MQTT Homie Settings
29+
30+
All parameters are exposed as MQTT Homie settings and can be configured
31+
at runtime:
32+
33+
- `pool-volume` (float, m³): Pool volume in cubic meters
34+
- Default: 30
35+
- Range: 0-1000
36+
- Example: 30 m³ pool
37+
38+
- `pump-capacity` (float, m³/h): Pump flow rate in cubic meters per
39+
hour
40+
- Default: 6
41+
- Range: 0-100
42+
- Example: 6 m³/h pump
43+
44+
- `use-temp-based-duration` (boolean): Enable/disable temperature-based
45+
calculation
46+
- Default: false (uses fixed timer)
47+
- true: Dynamic temperature-based duration
48+
- false: Traditional fixed start/stop times
49+
50+
### Timer Settings
51+
52+
When using fixed timer mode or as base for temperature-based mode:
53+
54+
- `timer-start-h` / `timer-start-min`: Filtration start time
55+
- `timer-end-h` / `timer-end-min`: Filtration end time (fixed mode
56+
only)
57+
58+
## Calculation Methods
59+
60+
### Implemented: Option A - Enhanced Temperature Formula
61+
62+
**Selected for implementation** based on analysis of DIN standards and
63+
pool industry best practices.
64+
65+
#### Formula
66+
67+
```text
68+
turnoverFactor = baseTurnoverFactor × (temperature / 20.0)
69+
filtrationHours = (poolVolume / pumpCapacity) × turnoverFactor
70+
```
71+
72+
Where:
73+
74+
- `baseTurnoverFactor = 2.5` (industry minimum: 2-3 turnovers/day)
75+
- Temperature scaling increases turnover rate with temperature
76+
- Maximum capped at 4.0 turnovers at max pool temperature
77+
78+
#### Turnover Rates
79+
80+
| Temperature | Turnover Factor | Example (30m³, 6m³/h) |
81+
|-------------|-----------------|------------------------|
82+
| 20°C | 2.5x | 12.5 hours |
83+
| 24°C | 3.0x | 15.0 hours |
84+
| 28°C | 3.5x | 17.5 hours |
85+
| Max temp | 4.0x | 20.0 hours |
86+
87+
#### Rationale
88+
89+
- **Aligns with DIN 19643**: German standard for pool water treatment
90+
- **Industry Best Practice**: 2-3 turnovers minimum, 3-4 for warm pools
91+
- **Temperature Responsive**: Accounts for increased bacterial growth
92+
at higher temperatures
93+
- **Maximum Protection**: Prevents overheating when max temperature
94+
reached
95+
96+
### Alternative Approaches Considered
97+
98+
#### Option B: German Rule of Thumb Formula
99+
100+
Direct implementation of German pool industry formula:
101+
102+
```text
103+
filtrationHours = (temperature / 2) + 2
104+
```
105+
106+
**Pros:**
107+
108+
- Simple, well-known formula in German-speaking regions
109+
- Direct temperature dependency
110+
- No complex parameters
111+
112+
**Cons:**
113+
114+
- Does not account for pool volume or pump capacity
115+
- Fixed hours independent of actual turnover capability
116+
- May not suit all pool configurations
117+
118+
**Example:**
119+
120+
- 20°C: (20/2) + 2 = 12 hours
121+
- 28°C: (28/2) + 2 = 16 hours
122+
123+
#### Option C: Fully Configurable Turnover Parameters
124+
125+
Add user-configurable turnover range settings:
126+
127+
```cpp
128+
// Additional settings
129+
min-turnovers-per-day: 2.5 (default)
130+
max-turnovers-per-day: 4.0 (default)
131+
temp-multiplier: 1.0 (fine-tuning factor)
132+
133+
// Calculation
134+
baseTurnovers = min-turnovers-per-day
135+
tempFactor = (temp / 20.0) * temp-multiplier
136+
turnoverFactor = min(baseTurnovers * tempFactor, max-turnovers-per-day)
137+
```
138+
139+
**Pros:**
140+
141+
- Maximum flexibility for different pool types
142+
- Can accommodate special requirements (spas, commercial pools)
143+
- Fine-tuning possible without code changes
144+
145+
**Cons:**
146+
147+
- More complex configuration
148+
- Risk of misconfiguration
149+
- May overwhelm typical users
150+
151+
**Use Cases:**
152+
153+
- Commercial pools requiring 3-4 turnovers minimum
154+
- Spas needing rapid turnover (30-minute cycles)
155+
- Experimental optimization for specific conditions
156+
157+
## Standards and References
158+
159+
### DIN 19643
160+
161+
German standard for public swimming pool water treatment. Recommends:
162+
163+
- Minimum 2-3 complete turnovers per day
164+
- Higher rates for warm water or high bather loads
165+
- Process-specific calculations based on pool usage
166+
167+
### Pool Industry Guidelines
168+
169+
International recommendations:
170+
171+
- Residential pools: 2-3 turnovers/day minimum
172+
- Commercial pools: 3-4 turnovers/day
173+
- Spas/hot tubs: 6-12 turnovers/day (30-120 minute cycles)
174+
175+
### German Rule of Thumb
176+
177+
Common formula in German-speaking pool industry:
178+
179+
```text
180+
Filtration hours = (Water temperature °C / 2) + 2
181+
```
182+
183+
Provides baseline that increases with temperature:
184+
185+
- 20°C → 12 hours
186+
- 24°C → 14 hours
187+
- 28°C → 16 hours
188+
- 30°C → 17 hours
189+
190+
### Research Sources
191+
192+
- DIN 19643: Pool water treatment standards
193+
- EPA WaterSense: Commercial pool best practices
194+
- German pool industry (poolinfos.de, vivapool.de)
195+
- Pool equipment manufacturers (ZODIAC, Fluidra)
196+
197+
## Logging and Monitoring
198+
199+
### Log Output
200+
201+
When temperature-based mode is enabled, the system logs:
202+
203+
```text
204+
Using temperature-based filtration duration
205+
Pool temp: 24.0°C
206+
Max pool temp: 28.5°C
207+
Filtration duration: 15.0h
208+
Turnovers per day: 3.0x
209+
```
210+
211+
### Warnings
212+
213+
The system validates configuration and warns about:
214+
215+
**Pump Capacity Too Low:**
216+
217+
```text
218+
⚠ Warning: Pump capacity too low for pool volume
219+
Time for 1 turnover: 25.5h (>24h)
220+
Consider increasing pump capacity or reducing pool volume setting
221+
```
222+
223+
**Invalid Configuration:**
224+
225+
```text
226+
✖ Invalid filtration configuration (pool volume or pump capacity not
227+
set)
228+
Pool volume: 0.0 m³
229+
Pump capacity: 0.0 m³/h
230+
```
231+
232+
## Usage Examples
233+
234+
### Example 1: Standard Residential Pool
235+
236+
**Configuration:**
237+
238+
- Pool volume: 30 m³
239+
- Pump capacity: 6 m³/h
240+
- Temperature-based: enabled
241+
242+
**Results:**
243+
244+
| Water Temp | Turnovers | Duration | Notes |
245+
|------------|-----------|----------|-------------------|
246+
| 18°C | 2.5x | 12.5h | Spring/Fall |
247+
| 22°C | 2.75x | 13.75h | Early summer |
248+
| 26°C | 3.25x | 16.25h | Mid summer |
249+
| 28°C | 3.5x | 17.5h | Hot summer |
250+
251+
### Example 2: Large Pool with Powerful Pump
252+
253+
**Configuration:**
254+
255+
- Pool volume: 60 m³
256+
- Pump capacity: 12 m³/h
257+
- Temperature-based: enabled
258+
259+
**Results:**
260+
261+
| Water Temp | Turnovers | Duration | Notes |
262+
|------------|-----------|----------|-------------------|
263+
| 20°C | 2.5x | 12.5h | Base rate |
264+
| 28°C | 3.5x | 17.5h | Warm weather |
265+
266+
Same turnover rates, same duration (good pump sizing).
267+
268+
### Example 3: Undersized Pump
269+
270+
**Configuration:**
271+
272+
- Pool volume: 50 m³
273+
- Pump capacity: 2 m³/h
274+
- Temperature-based: enabled
275+
276+
**Warning:** Time for 1 turnover: 25.0h (>24h)
277+
278+
The system will warn that the pump cannot complete even one turnover in
279+
24 hours. Consider upgrading pump or adjusting settings.
280+
281+
## Backward Compatibility
282+
283+
### Default Behavior
284+
285+
By default, `use-temp-based-duration` is **false**, preserving existing
286+
fixed timer functionality.
287+
288+
Existing installations continue working without changes.
289+
290+
### Migration Path
291+
292+
To enable temperature-based filtration:
293+
294+
1. Configure pool volume and pump capacity settings
295+
2. Set `use-temp-based-duration` to `true` via MQTT
296+
3. Monitor logs to verify calculation
297+
4. Adjust timer start time if needed (end time is auto-calculated)
298+
299+
## Future Enhancements
300+
301+
Potential improvements for future versions:
302+
303+
1. **Seasonal Adjustments**: Different formulas for summer/winter
304+
2. **Usage-Based Scaling**: Increase turnovers after heavy use
305+
3. **Solar Integration**: Optimize filtration during solar heating
306+
4. **Water Quality Feedback**: Adjust based on sensor readings (ORP,
307+
pH)
308+
5. **Machine Learning**: Optimize based on historical patterns
309+
6. **Multi-Zone Pools**: Different calculations for pool vs. spa
310+
311+
## Troubleshooting
312+
313+
### Pump Runs Too Long
314+
315+
**Symptom:** Filtration duration exceeds expected hours
316+
317+
**Causes:**
318+
319+
- Pool volume setting too high
320+
- Pump capacity setting too low
321+
- Temperature very high
322+
- Max temperature protection triggered
323+
324+
**Solutions:**
325+
326+
- Verify and correct pool volume measurement
327+
- Verify and correct pump flow rate specification
328+
- Check if pool temperature ≥ max temperature setting
329+
330+
### Pump Runs Too Short
331+
332+
**Symptom:** Filtration duration insufficient, water quality degrades
333+
334+
**Causes:**
335+
336+
- Temperature-based mode not enabled
337+
- Pool volume setting too low
338+
- Pump capacity setting too high
339+
340+
**Solutions:**
341+
342+
- Enable `use-temp-based-duration` setting
343+
- Verify pool volume and pump capacity settings
344+
- Consider switching to fixed timer with longer duration
345+
346+
### Configuration Not Applied
347+
348+
**Symptom:** Changes to settings don't affect behavior
349+
350+
**Causes:**
351+
352+
- Settings not persisted
353+
- Controller not restarted
354+
- Wrong MQTT topic
355+
356+
**Solutions:**
357+
358+
- Verify MQTT messages received and acknowledged
359+
- Restart controller if needed
360+
- Check Homie device topic structure
361+
362+
## Conclusion
363+
364+
The temperature-based filtration feature provides an intelligent,
365+
standards-based approach to pool water management. Option A was selected
366+
for implementation as it balances simplicity, effectiveness, and
367+
alignment with industry best practices.
368+
369+
Users who prefer fixed timer schedules can continue using that mode,
370+
while those wanting optimized, temperature-responsive filtration can
371+
enable the new feature with minimal configuration.

0 commit comments

Comments
 (0)