This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

CANx based meter counter
#13
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)
Reply


Messages In This Thread
CANx based meter counter - by Andey - 02.08.2020, 14:39
RE: CANx based meter counter - by admin - 03.08.2020, 09:44
RE: CANx based meter counter - by Andey - 03.08.2020, 10:01
RE: CANx based meter counter - by admin - 04.08.2020, 11:02
RE: CANx based meter counter - by Andey - 23.10.2020, 06:31
RE: CANx based meter counter - by admin - 23.10.2020, 06:40
RE: CANx based meter counter - by Andey - 23.10.2020, 06:49
RE: CANx based meter counter - by Andey - 11.02.2024, 08:14
RE: CANx based meter counter - by admin - 12.02.2024, 08:19
RE: CANx based meter counter - by EjvindHald - 20.02.2025, 16:27
RE: CANx based meter counter - by admin - 21.02.2025, 08:00
RE: CANx based meter counter - by EjvindHald - 22.02.2025, 04:24
RE: CANx based meter counter - by admin - 25.02.2025, 07:19
RE: CANx based meter counter - by EjvindHald - 02.03.2025, 19:06
RE: CANx based meter counter - by admin - 03.03.2025, 07:44
RE: CANx based meter counter - by EjvindHald - 03.03.2025, 18:45

Forum Jump: