Logic Machine Forum
CANx based meter counter - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: CANx (https://forum.logicmachine.net/forumdisplay.php?fid=23)
+--- Thread: CANx based meter counter (/showthread.php?tid=2770)



CANx based meter counter - Andey - 02.08.2020

Hello.
I have an electric meter (ETI DEC-3) that has pulses output. It outputs one pulse each 1.25 watts measured. What is a way to handle these pulses, count them and make a trend from this data?


RE: CANx based meter counter - admin - 03.08.2020

Impulse counter is not yet implemented in CANx devices. We will add it later.


RE: CANx based meter counter - Andey - 03.08.2020

Wow! Great news! I hope CANx-UIO16 will support this feature. When do you plan to implement it?

BTW. Answering in other my thread (about open collector inputs) I had renewed my knowledge about VALSENA-DIN32 modbus module. One of input modes supported (according reference manual) is impulses counter. First I need to learn manual on electric meter to find out exact impulses specification (open collector, dry contact) and DIN32 to learn does impulses counter is available and how to program this mode.
I'll report about results, but in any case impulses counter is a very useful feature for CANx modules, IMHO.


RE: CANx based meter counter - admin - 04.08.2020

UIO16 will support impulse counter mode but I can't give an exact time frame on when it will be implemented at the moment.


RE: CANx based meter counter - Andey - 23.10.2020

Well. It is better late than never.
VALSENA-DIN32 count pulses. Main problem was to tune input pin properties: debounce time was too big by default. But finally it works. Actually VALSENA has communication problem but I'll open other thread about it.


RE: CANx based meter counter - admin - 23.10.2020

We have a preliminary firmware for UIO8/16 with pulse counter input. It's not fully tested but if you want to try then it can be provided.


RE: CANx based meter counter - Andey - 23.10.2020

Thank you. For now I have solution. So I can to wait until this feature will be released officially.
Or you want me to be a beta tester?


RE: CANx based meter counter - Andey - 11.02.2024

Hello.
Are any news about pulses counter implementation? For CANx-UIO16 and/or CANx-UI10 devices.


RE: CANx based meter counter - admin - 12.02.2024

It has been implemented for UIO8 and UIO16 some time ago. No plans to implement it for UI10 though.
You need to reflash your device, see this guide: https://kb.logicmachine.net/canx/stm32/
Use the latest V4 version.


RE: CANx based meter counter - EjvindHald - 20.02.2025

It is great with implementation for UIO8 and UIO16. Where can I read more about this?

I am not using CANx, but I do have a LogicMachine5 RIO3 LTE with 16 i/o ports. I need to detect pulse patterns with a sliding time window.


RE: CANx based meter counter - admin - 21.02.2025

Reactor IO is similar to CANx UIO. Pulse counter outputs the number of pulses every 10 seconds. Not sure if it's suitable for your task.


RE: CANx based meter counter - EjvindHald - 22.02.2025

(21.02.2025, 08:00)admin Wrote: Reactor IO is similar to CANx UIO. Pulse counter outputs the number of pulses every 10 seconds. Not sure if it's suitable for your task.

Unfotunately, it cannot be used in my use case.

I have a gate opener with an orange lamp which blinks either fast or slow depending on if the gate is opening or closing. Via a relay this is connected to the logic machine ports producing one pulse per blink. Can you recommend the best path forward to detect opening or closing activity based on this?


RE: CANx based meter counter - admin - 25.02.2025

You can use binary input mode and event script to measure the time between each ON telegram.
Code:
value = event.getvalue()
if not value then
  return
end

tsec, tusec = os.microtime()
time = tsec + tusec / 1000000

key = 'on_time'
out = '1/1/2'

delta = time - storage.get(key, 0)
  
log(delta)

if delta < 0.4 then
  grp.checkwrite(out, false)
elseif delta < 0.8 then
  grp.checkwrite(out, true)
end

storage.set(key, time)



RE: CANx based meter counter - EjvindHald - 02.03.2025

   
(25.02.2025, 07:19)admin Wrote: You can use binary input mode and event script to measure the time between each ON telegram.
Code:
value = event.getvalue()
if not value then
  return
end

tsec, tusec = os.microtime()
time = tsec + tusec / 1000000

key = 'on_time'
out = '1/1/2'

delta = time - storage.get(key, 0)
 
log(delta)

if delta < 0.4 then
  grp.checkwrite(out, false)
elseif delta < 0.8 then
  grp.checkwrite(out, true)
end

storage.set(key, time)

Thanks - this is much appreciated. I assume that usage of the storage function will only have minor impact on wear and tear of the SD Card? Is your suggestion a resident or event-based script?

Besides the need for my gate, I also have another use case which have a higher frequency, so it will be directly connected to the local i/o ports to reduce the traffic on the bus. I found the frequency option, but I could find any description of it. Can you provide a link or similar with a description? Also here I need to test towards a given threashold within a time period. See screenshot.
Thanks Smile


RE: CANx based meter counter - admin - 03.03.2025

Database and storage use RAM and then the data is saved periodically to SD card. Script must be run as event.

Frequency converts the pulse count to pulses per second. The value is updated every 10 seconds.


RE: CANx based meter counter - EjvindHald - 03.03.2025

Thanks for your reply.

So the solution you suggested initially seems to be the only way to test against a threashold in a gliding window of 10 seconds. I will try it with higher frequency as well.