Water Leak Detection task

Avatar
  • updated
Bonjour à tous,

Je cherche a réaliser une task qui me permettrai de détecter une fuite.

J'ai un compteur d'eau qui envois 1puls tout les 10L d'eau. J'ai un module KNX qui réalise l'incrément, pas de problème.

J'ai réalisé une task qui se lance a chaque changement de valeur (OnChanged) du compteur, soit tout les 10L.

Lorsque cette task est lancée, j'incrémente de 1 un compteur "Count" et si celui ci atteint un nombre définit, j'alerte comme quoi il existe une fuite.

Cela fonctionne, mais fonctionne également lorsque le tirage d'eau est normal, par exemple, une douche. En effet, je vais incrémenter plusieurs fois (sans atteindre la cible du compteur "Count" et ensuite, sur un prochain tirage d'eau, je vais continuer a incrémenter jusqu’à atteindre la cible. Et bim, détection de fuite...

Je me suis dit qu'il faudrait peut être que je remette a 0 le compteur "Count" si il n'évolue pas pendant xx minutes, ce qui traduirait qu'il n'existe pas de fuite et éviterai les déclenchement  non pertinents. Mais je n'arrive pas a le coder correctement...

La difficulté réside sur le fait que je n’envoie la valeur du compteur qu'a chaque changement de celui ci, et donc a chaque nouvelle puls, qui représente 10L...

Peut etre existe il aussi une autre solution...

D'avance merci pour vos aides sur ce sujet.

Hello everyone,

I'm trying to create a task that will allow me to detect a leak.

I have a water meter that sends one pulse every 10 liters of water. I have a KNX module that handles the incrementing process, no problem there.

I've created a task that runs every time the meter's value changes (OnChanged), which is every 10 liters.

When this task is run, I increment a counter called "Count" by 1, and if it reaches a defined number, I trigger an alert indicating a leak.

This works, but it also works when the water flow is normal, for example, during a shower. Indeed, I'm going to increment the counter several times (without reaching the target) and then, on the next water draw, I'll continue incrementing until I reach the target. And bam, leak detection...

I thought that perhaps I should reset the "Count" counter to 0 if it doesn't change for xx minutes, which would indicate that there's no leak and avoid unnecessary triggers. But I can't seem to code it correctly...

The difficulty lies in the fact that I only send the counter value each time it changes, and therefore with each new pulse, which represents 10L...

Perhaps there's another solution...

Thank you in advance for your help with this.

Avatar
Jürgen Jürgenson

While your current setup using pulse counting is a good start, it has limitations, especially when it comes to detecting small leaks or distinguishing between normal usage and leaks in old pipes. Combining this method with dedicated leak sensors and electric valves can significantly improve the reliability and effectiveness of your leak detection system.

If you decide to stick with the pulse counting method, consider refining the logic and integrating additional data sources to enhance detection accuracy. However, for a more robust solution, incorporating dedicated leak detection hardware is highly recommended. Leak sensor and electric valve would work better.

But for it to work with pulse counting programs you probably need to use timers. 

If water meter sends a pulse it starts a timer. If another pulse is received and it is in normal timeframe, it either adds to the pulse count if its in a normal timeframe/usage - Or If there are too many pulses it will trigger an alarm. But if another pulse comes and it not in a normal timeframe it will reset the counters and start the program from the beginning. But this will only detect large leaks.

Pseudocode

On Pulse Change:
Increment LeakPulseCount
Record CurrentTime as LastPulseTime

// Calculate time since last pulse
Calculate TimeSinceLastPulse = CurrentTime - LastPulseTime

// If this is the first pulse or time between pulses is within normal range
If TimeSinceLastPulse < NormalUsageThreshold:
// Continue counting pulses within a time window
If LeakPulseCount >= LeakThreshold:
Trigger Leak Alert
Else:
// Time between pulses exceeds normal usage - reset counters
Reset LeakPulseCount to 0

On ResetInterval Elapsed:
If No New Pulse Detected Within ResetInterval:
Reset LeakPulseCount to 0
Clear all timers
Reset BurstStartTime timer

Avatar
Simon Hannecart

Anglais :

Hello,


Sorry for my late reply. First of all, thank you for taking the time to answer me and provide such a detailed response.

What system would you recommend for more precise leak detection? Is there a native KNX system?

Regarding your PseudoCode:

- How do you handle the time-related aspects? Do you use a "calculation" function?


If possible, I would greatly appreciate some help with your code.

Thank you again for your time and advice.


Francais :


Bonjour,

Désolé pour mon retour tardif. Tout d'abord merci pour le temps que vous avez pris pour me répondre et détailler votre réponse.

Quel système me conseillerez vous pour avoir une détection de fuite plus précise ? Existe il un système natif en KNX ? 

Concernant votre PseudoCode :

- Comment faites vous le travail sur tout ce qui est temps ? Fonction "calculation" ? 

Si possible d'avoir un peu d'aide sur votre code, cela m'aiderai grandement.

Merci encore pour votre temps et vos conseils.