6/18/2025 7:22 PM | |
Joined: 6/11/2019 Last visit: 9/4/2025 Posts: 2625 Rating:
|
Hello PierHB, Filtering always results in a time delay. There are elegant solutions using custom filters. However, they require several functions (see here in the German section of the forum). Another option would be to compare the last stored value with the current value. If this is greater than the desired deviation, the comparators are switched on and the current value is stored again. To prevent multiple triggering due to large changes, a switch-off delay keeps the muxer open for a short time. I've attached an example. Regards, Ella_68 (translated by Google) AttachmentFilterschaltung.zip (162 Downloads) |
6/19/2025 10:20 AM | |
Joined: 3/24/2025 Last visit: 6/24/2025 Posts: 8 Rating:
|
Hi everyone, many thanks to ixo65 and Ella_68. Special thanks for the attached example and the link (I'll need some time to process the Dutch content) — they’ve really helped me understand how to manage filtering logic. I’ve adapted your logic into KOP (ladder diagram) instead of FUP (function block diagram), as I’m a beginner and it helps me visualize the process more easily. My goal is to avoid sending intermediate values, reduce the number of MQTT messages sent from LOGO! 8.4, and prevent temporary spikes (e.g., from 200 to 1000 and quickly back to 201) from triggering updates — such as unnecessarily changing the shadow from 200 to 201. (To achieve this, I’ve used an on-delay timer (TON) triggered by a significant value change, and connected its output in series with a condition that checks whether the value difference exceeds a set threshold. but ⚠️ The issue: when there’s a fast spike up to 999, the value 1000 is never sent. The output might remain at 900, .... is the threshold is 100. This gives a misleading update, since it never reflects that the value briefly reached near 1000 or 0. and Additionally, I have a small startup issue: AQ1 temporarily shows 0 during the delay time, which is also not ideal.) Any suggestions on how to preserve this anti-spike behavior, but avoid sending a "201" if the previous value was just "200"? Thanks again! Pierre
Attachmenttest_on change_Update.zip (151 Downloads) |
Last edited by: PierHB at: 06/19/2025 10:55:13 |
|
6/20/2025 2:47 PM | |
Joined: 6/11/2019 Last visit: 9/4/2025 Posts: 2625 Rating:
|
Hello PierHB, I've revised my first draft "Filterschaltung". Now the analog value is only output when the hold-open time for B004 has elapsed. Of course, the time is only a default value, since I don't know the duration of your spike. You'll have to experiment a bit with the time value of B005. The problem with the 999, of course, remains. I've also included the other suggestion from the German section of the forum, "Spikefilter mit mediane Mittelwert" in the zip file. Here, too, you have to adjust the clock rate "TL" of B001 to your requirements. The time must be longer than the spike. Note that by calculating the median average of three intermediate values, the response time is only established during the second cycle of B001. Of course, it's also possible to make the spike filter interference-proof. For this, the median average would only have to be calculated from 5 or 7 values. However, the program will then become significantly larger and the response time will increase to 3 or 4 sampling cycles. Best regards, Ella_68 (translated by Google) AttachmentFilterschaltung Vol.2.zip (129 Downloads) |
This contribution was helpful to
1 thankful Users |
Follow us on