wdoekes / pe32proxsenspy_pub

ProjectEnergy32: read water meter with a proximity sensor using Python, publish to MQTT
0 stars 0 forks source link

Occasional litre spikes #1

Open wdoekes opened 11 months ago

wdoekes commented 11 months ago
# journalctl -o short-precise -S '08:08' -U '08:09' -u pe32proxsenspy_pub | sed -e 's/Dec 21 //;s/ [^ ]* [^ ]*: //;s/device_id=[^ ]*/device_id=***/'
-- Journal begins at Mon 2023-12-18 12:41:08 CET, ends at Thu 2023-12-21 08:54:35 CET. --
08:08:02.983115Published: device_id=*** w_absolute_l=-1 w_relative_l=4114 w_flow_mlps=185 dbg_uptime=1438967016 dbg_version=pe32proxsenspy_pub-FIXME
08:08:08.289096Published: device_id=*** w_absolute_l=-1 w_relative_l=4115 w_flow_mlps=186 dbg_uptime=1438972321 dbg_version=pe32proxsenspy_pub-FIXME
08:08:13.591327Published: device_id=*** w_absolute_l=-1 w_relative_l=4116 w_flow_mlps=188 dbg_uptime=1438977624 dbg_version=pe32proxsenspy_pub-FIXME
08:08:18.995925Published: device_id=*** w_absolute_l=-1 w_relative_l=4117 w_flow_mlps=186 dbg_uptime=1438983029 dbg_version=pe32proxsenspy_pub-FIXME
08:08:24.401226Published: device_id=*** w_absolute_l=-1 w_relative_l=4118 w_flow_mlps=185 dbg_uptime=1438988434 dbg_version=pe32proxsenspy_pub-FIXME
08:08:24.725574Published: device_id=*** w_absolute_l=-1 w_relative_l=4119 w_flow_mlps=3086 dbg_uptime=1438988758 dbg_version=pe32proxsenspy_pub-FIXME
08:08:26.069038Published: device_id=*** w_absolute_l=-1 w_relative_l=4119 w_flow_mlps=0 dbg_uptime=1438990102 dbg_version=pe32proxsenspy_pub-FIXME
08:08:29.729762Published: device_id=*** w_absolute_l=-1 w_relative_l=4120 w_flow_mlps=199 dbg_uptime=1438993763 dbg_version=pe32proxsenspy_pub-FIXME
08:08:35.201774Published: device_id=*** w_absolute_l=-1 w_relative_l=4120 w_flow_mlps=0 dbg_uptime=1438999235 dbg_version=pe32proxsenspy_pub-FIXME

Looks like this:

image

Or this:

image

Or this:

image

The spike must be a bad reading too many:

image

wdoekes commented 10 months ago
from math import pi, sqrt

# > Hoofdleiding = diameter 22 mm.
# > Aftakking van de hoofdleiding = diameter 15 mm.
# > Douche-, bad– en keukenkraan = diameter 15 mm.
# > Toilet, toiletkraan en wastafelkraan = diameter 12 mm.
WATER_PIPE_DIAMETER_M = 0.022   # 22mm = 0.022m

# > De maximale toegestane uitgaande druk van pompstations bedraagt 6,5
# > bar. Komt de waterdruk boven de 5 bar uit, dan is het goed om
# > maatregelen te nemen.
# > Wettelijk gezien hoort de waterdruk in uw huis minimaal 1,5 bar te
# > zijn. Hoewel de drukgarantie minimaal 1,5 bar is streven de meeste
# > watermaatschapijen ernaar om het water minimaal met 2 bar uw huis
# > binnen te laten lopen.
MAX_WATER_PRESSURE_PA = 3.5e5   # 3.5 bar = 3.5*10^5 Pa = 3.5*10^5 kg/(m*s^2)

# Constants.
WATER_DENSITY_KG_PER_M3 = 1000  # 1000kg/m^3

# Calculate velocity in m/s.
MAX_WATER_VELOCITY_M_PER_S = sqrt(
    (2 * MAX_WATER_PRESSURE_PA) / WATER_DENSITY_KG_PER_M3)

# Calculate flow rate in m^3/s.
MAX_FLOW_RATE_M3_PER_S = (
    (pi * WATER_PIPE_DIAMETER_M**2 * MAX_WATER_VELOCITY_M_PER_S) / 4)

# Calculate flow rate in L/h.
MAX_FLOW_RATE_L_PER_H = (
    MAX_FLOW_RATE_M3_PER_S * 3600 * 1000)

# How many rotations is that per second?
print('max L/h:', MAX_FLOW_RATE_L_PER_H)            # 36'207 L/h
print('max L/s:', MAX_FLOW_RATE_L_PER_H / 3600)     # 10.06 L/s
print('min-time-between-rotation (ms):', 1000 / (MAX_FLOW_RATE_L_PER_H / 3600))

So it's actually possible with enough pressure...

max L/h: 36206.51827427984
max L/s: 10.057366187299957
min-time-between-rotation (ms): 99.42961023560625

Not likely, but possible.

If we decrease pressure to 2bar, it's still a max. of 7.6L/s (27kL/h) and an interval of 131ms per rotation.

But maybe we can skip glitches if there is no buildup...

wdoekes commented 10 months ago

Urgh..

image

Lots of these:

Jan 09 22:15:02 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
Jan 09 22:17:10 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
Jan 09 22:17:11 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
Jan 09 22:17:11 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
...
Jan 09 23:39:28 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
Jan 09 23:39:30 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
Jan 09 23:39:31 framboos.kiwi pe32proxsenspy_pub[22471]: absorbed jitter, keeping True
root@framboos(ro):~# journalctl -u pe32proxsenspy_pub.service  -S '2024-01-09 22:15'  -U '2024-01-09 23:45' | grep jitter | wc -l
13614
root@framboos(ro):~# journalctl -u pe32proxsenspy_pub.service  -S '2024-01-09 22:15'  -U '2024-01-09 23:45' | grep Publish | wc -l
1250
root@framboos(ro):~# journalctl -u pe32proxsenspy_pub.service  -S '2024-01-09 22:15'  -U '2024-01-09 23:45' | sed -e '/w_flow/!d;s/.*w_flow_mlps=\([^ ]*\) .*/\1/' | sort -n | tail -n10
3484
3484
3484
3496
3496
3745
3745
3759
3773
3773