Community
OpenEnergyMonitor

Community

Maximum number of pulses

I’m wondering what the theoretical maximum pulse rate of a domestic meter in the UK on a standard UK single phase supply @ 1000 pulses per kWh is. I’m sure it should be simple to calculate but my head is hurting…

I’m wondering if the 0.2 sec sleep in emonhub could cause pulses to be missed by the pulse interfacer I’m using.

24 kW draw = 24 kWh in an hour = 24,000 pulses = 6.67 pulses per second = a pulse every 0.15s?

I thought so. So there is a possibility the delay would then miss a pulse I think - or am I misunderstanding the way the callbacks work - will they get called in the delay period and increment the counter anyway?

Ok so, yes it is possible!

It seems we have had just about everything in the house on at once (11.4kW) - shame I am not on Agile yet!

2x RPis, one direct serial to an emonTX CM firmware and one using the pulse interfacer with the pulse sensor wired direct to the Pi GPIO pins. I noticed it because of this - a sudden divergence between the TX and the pulse (I was comparing accuracy) cumulative readings.

I noticed it quick enough to grab the emonhub logs of both.

Note

  • The MQTT publishing I don’t think quite keeps up not helped by the fact I am sending to more than one broker
  • The pulse interfacer must be missing pulses.

Does the emonTX accumulate the interrupts and report every 10s?

Serial emonTX

2020-06-29 14:29:02,796 DEBUG    SerialTx   23136 NEW FRAME : MSG:23199,Vrms:243.34,P1:3550,E1:51090,pulse:1
2020-06-29 14:29:02,798 DEBUG    SerialTx   23136 Timestamp : 1593437342.7953339
2020-06-29 14:29:02,800 DEBUG    SerialTx   23136 From Node : Serial_PiZ
2020-06-29 14:29:02,802 DEBUG    SerialTx   23136    Values : [23199, 243.34, 3550, 51090, 1]
2020-06-29 14:29:02,818 DEBUG    SerialTx   23136 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:02,819 DEBUG    SerialTx   23136 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:02,941 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23199, "Vrms": 243.34, "P1": 3550, "E1": 51090, "pulse": 1, "time": 1593437342.7953339}
2020-06-29 14:29:02,945 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23199, "Vrms": 243.34, "P1": 3550, "E1": 51090, "pulse": 1, "time": 1593437342.7953339}
2020-06-29 14:29:12,791 DEBUG    SerialTx   23137 NEW FRAME : MSG:23200,Vrms:242.94,P1:4888,E1:51104,pulse:1
2020-06-29 14:29:12,793 DEBUG    SerialTx   23137 Timestamp : 1593437352.7901702
2020-06-29 14:29:12,795 DEBUG    SerialTx   23137 From Node : Serial_PiZ
2020-06-29 14:29:12,799 DEBUG    SerialTx   23137    Values : [23200, 242.94, 4888, 51104, 1]
2020-06-29 14:29:12,801 DEBUG    SerialTx   23137 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:12,803 DEBUG    SerialTx   23137 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:12,936 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23200, "Vrms": 242.94, "P1": 4888, "E1": 51104, "pulse": 1, "time": 1593437352.7901702}
2020-06-29 14:29:13,008 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23200, "Vrms": 242.94, "P1": 4888, "E1": 51104, "pulse": 1, "time": 1593437352.7901702}
2020-06-29 14:29:22,814 DEBUG    SerialTx   23138 NEW FRAME : MSG:23201,Vrms:240.18,P1:11442,E1:51135,pulse:1
2020-06-29 14:29:22,816 DEBUG    SerialTx   23138 Timestamp : 1593437362.8134532
2020-06-29 14:29:22,818 DEBUG    SerialTx   23138 From Node : Serial_PiZ
2020-06-29 14:29:22,820 DEBUG    SerialTx   23138    Values : [23201, 240.18, 11442, 51135, 1]
2020-06-29 14:29:22,821 DEBUG    SerialTx   23138 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:22,830 DEBUG    SerialTx   23138 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:23,088 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23201, "Vrms": 240.18, "P1": 11442, "E1": 51135, "pulse": 1, "time": 1593437362.8134532}
2020-06-29 14:29:23,121 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23201, "Vrms": 240.18, "P1": 11442, "E1": 51135, "pulse": 1, "time": 1593437362.8134532}
2020-06-29 14:29:32,848 DEBUG    SerialTx   23139 NEW FRAME : MSG:23202,Vrms:240.04,P1:11259,E1:51167,pulse:1
2020-06-29 14:29:32,851 DEBUG    SerialTx   23139 Timestamp : 1593437372.8467956
2020-06-29 14:29:32,885 DEBUG    SerialTx   23139 From Node : Serial_PiZ
2020-06-29 14:29:32,888 DEBUG    SerialTx   23139    Values : [23202, 240.04, 11259, 51167, 1]
2020-06-29 14:29:32,890 DEBUG    SerialTx   23139 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:32,900 DEBUG    SerialTx   23139 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:33,179 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23202, "Vrms": 240.04, "P1": 11259, "E1": 51167, "pulse": 1, "time": 1593437372.8467956}
2020-06-29 14:29:33,211 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23202, "Vrms": 240.04, "P1": 11259, "E1": 51167, "pulse": 1, "time": 1593437372.8467956}
2020-06-29 14:29:42,792 DEBUG    SerialTx   23140 NEW FRAME : MSG:23203,Vrms:240.01,P1:11406,E1:51198,pulse:1
2020-06-29 14:29:42,794 DEBUG    SerialTx   23140 Timestamp : 1593437382.791037
2020-06-29 14:29:42,796 DEBUG    SerialTx   23140 From Node : Serial_PiZ
2020-06-29 14:29:42,798 DEBUG    SerialTx   23140    Values : [23203, 240.01, 11406, 51198, 1]
2020-06-29 14:29:42,800 DEBUG    SerialTx   23140 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:42,801 DEBUG    SerialTx   23140 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:42,947 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23203, "Vrms": 240.01, "P1": 11406, "E1": 51198, "pulse": 1, "time": 1593437382.791037}
2020-06-29 14:29:42,996 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23203, "Vrms": 240.01, "P1": 11406, "E1": 51198, "pulse": 1, "time": 1593437382.791037}
2020-06-29 14:29:52,776 DEBUG    SerialTx   23141 NEW FRAME : MSG:23204,Vrms:240.05,P1:11230,E1:51230,pulse:1
2020-06-29 14:29:52,778 DEBUG    SerialTx   23141 Timestamp : 1593437392.775109
2020-06-29 14:29:52,779 DEBUG    SerialTx   23141 From Node : Serial_PiZ
2020-06-29 14:29:52,781 DEBUG    SerialTx   23141    Values : [23204, 240.05, 11230, 51230, 1]
2020-06-29 14:29:52,783 DEBUG    SerialTx   23141 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:52,785 DEBUG    SerialTx   23141 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:52,832 DEBUG    MQTT2      Publishing: emon/Serial_PiZ {"MSG": 23204, "Vrms": 240.05, "P1": 11230, "E1": 51230, "pulse": 1, "time": 1593437392.775109}
2020-06-29 14:29:52,870 DEBUG    MQTT       Publishing: emon/Serial_PiZ {"MSG": 23204, "Vrms": 240.05, "P1": 11230, "E1": 51230, "pulse": 1, "time": 1593437392.775109}

Pulse (but not all of the period for obvious reasons

2020-06-29 14:29:50,055 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230057
2020-06-29 14:29:50,111 DEBUG    pulse2     229929 NEW FRAME :
2020-06-29 14:29:50,113 DEBUG    pulse2     229929 Timestamp : 1593437390.111448
2020-06-29 14:29:50,115 DEBUG    pulse2     229929 From Node : 3
2020-06-29 14:29:50,117 DEBUG    pulse2     229929    Values : [230057]
2020-06-29 14:29:50,119 DEBUG    pulse2     229929 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:50,126 DEBUG    pulse2     229929 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:50,268 DEBUG    MQTT3      Publishing: emon/3/Pulse 230057
2020-06-29 14:29:50,273 DEBUG    MQTT2      Publishing: emon/3/Pulse 230057
2020-06-29 14:29:50,271 DEBUG    MQTT       Publishing: emon/3/Pulse 230057
2020-06-29 14:29:50,384 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230058
2020-06-29 14:29:50,435 DEBUG    pulse2     229930 NEW FRAME :
2020-06-29 14:29:50,437 DEBUG    pulse2     229930 Timestamp : 1593437390.4350913
2020-06-29 14:29:50,439 DEBUG    pulse2     229930 From Node : 3
2020-06-29 14:29:50,441 DEBUG    pulse2     229930    Values : [230058]
2020-06-29 14:29:50,457 DEBUG    pulse2     229930 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:50,459 DEBUG    pulse2     229930 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:50,607 DEBUG    MQTT       Publishing: emon/3/Pulse 230058
2020-06-29 14:29:50,609 DEBUG    MQTT2      Publishing: emon/3/Pulse 230058
2020-06-29 14:29:50,621 DEBUG    MQTT3      Publishing: emon/3/Pulse 230058
2020-06-29 14:29:50,714 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230059
2020-06-29 14:29:50,787 DEBUG    pulse2     229931 NEW FRAME :
2020-06-29 14:29:50,790 DEBUG    pulse2     229931 Timestamp : 1593437390.7875373
2020-06-29 14:29:50,801 DEBUG    pulse2     229931 From Node : 3
2020-06-29 14:29:50,803 DEBUG    pulse2     229931    Values : [230059]
2020-06-29 14:29:50,804 DEBUG    pulse2     229931 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:50,806 DEBUG    pulse2     229931 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:51,043 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230060
2020-06-29 14:29:51,053 DEBUG    MQTT       Publishing: emon/3/Pulse 230059
2020-06-29 14:29:51,046 DEBUG    MQTT2      Publishing: emon/3/Pulse 230059
2020-06-29 14:29:51,047 DEBUG    MQTT3      Publishing: emon/3/Pulse 230059
2020-06-29 14:29:51,109 DEBUG    pulse2     229932 NEW FRAME :
2020-06-29 14:29:51,112 DEBUG    pulse2     229932 Timestamp : 1593437391.1093245
2020-06-29 14:29:51,113 DEBUG    pulse2     229932 From Node : 3
2020-06-29 14:29:51,115 DEBUG    pulse2     229932    Values : [230060]
2020-06-29 14:29:51,117 DEBUG    pulse2     229932 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:51,119 DEBUG    pulse2     229932 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:51,175 DEBUG    MQTT3      Publishing: emon/3/Pulse 230060
2020-06-29 14:29:51,185 DEBUG    MQTT2      Publishing: emon/3/Pulse 230060
2020-06-29 14:29:51,195 DEBUG    MQTT       Publishing: emon/3/Pulse 230060
2020-06-29 14:29:51,372 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230061
2020-06-29 14:29:51,422 DEBUG    pulse2     229933 NEW FRAME :
2020-06-29 14:29:51,424 DEBUG    pulse2     229933 Timestamp : 1593437391.4218206
2020-06-29 14:29:51,426 DEBUG    pulse2     229933 From Node : 3
2020-06-29 14:29:51,427 DEBUG    pulse2     229933    Values : [230061]
2020-06-29 14:29:51,429 DEBUG    pulse2     229933 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:51,441 DEBUG    pulse2     229933 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:51,690 DEBUG    MQTT3      Publishing: emon/3/Pulse 230061
2020-06-29 14:29:51,698 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230062
2020-06-29 14:29:51,723 DEBUG    MQTT       Publishing: emon/3/Pulse 230061
2020-06-29 14:29:51,728 DEBUG    MQTT2      Publishing: emon/3/Pulse 230061
2020-06-29 14:29:51,750 DEBUG    pulse2     229934 NEW FRAME :
2020-06-29 14:29:51,752 DEBUG    pulse2     229934 Timestamp : 1593437391.7496948
2020-06-29 14:29:51,754 DEBUG    pulse2     229934 From Node : 3
2020-06-29 14:29:51,756 DEBUG    pulse2     229934    Values : [230062]
2020-06-29 14:29:51,757 DEBUG    pulse2     229934 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:51,759 DEBUG    pulse2     229934 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:51,898 DEBUG    MQTT3      Publishing: emon/3/Pulse 230062
2020-06-29 14:29:51,939 DEBUG    MQTT       Publishing: emon/3/Pulse 230062
2020-06-29 14:29:51,943 DEBUG    MQTT2      Publishing: emon/3/Pulse 230062
2020-06-29 14:29:52,027 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230063
2020-06-29 14:29:52,062 DEBUG    pulse2     229935 NEW FRAME :
2020-06-29 14:29:52,066 DEBUG    pulse2     229935 Timestamp : 1593437392.062415
2020-06-29 14:29:52,067 DEBUG    pulse2     229935 From Node : 3
2020-06-29 14:29:52,069 DEBUG    pulse2     229935    Values : [230063]
2020-06-29 14:29:52,071 DEBUG    pulse2     229935 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:52,073 DEBUG    pulse2     229935 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:52,309 DEBUG    MQTT3      Publishing: emon/3/Pulse 230063
2020-06-29 14:29:52,357 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230064
2020-06-29 14:29:52,361 DEBUG    MQTT2      Publishing: emon/3/Pulse 230063
2020-06-29 14:29:52,366 DEBUG    MQTT       Publishing: emon/3/Pulse 230063
2020-06-29 14:29:52,376 DEBUG    pulse2     229936 NEW FRAME :
2020-06-29 14:29:52,379 DEBUG    pulse2     229936 Timestamp : 1593437392.3763926
2020-06-29 14:29:52,382 DEBUG    pulse2     229936 From Node : 3
2020-06-29 14:29:52,385 DEBUG    pulse2     229936    Values : [230064]
2020-06-29 14:29:52,387 DEBUG    pulse2     229936 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:52,390 DEBUG    pulse2     229936 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:52,480 DEBUG    MQTT       Publishing: emon/3/Pulse 230064
2020-06-29 14:29:52,483 DEBUG    MQTT2      Publishing: emon/3/Pulse 230064
2020-06-29 14:29:52,520 DEBUG    MQTT3      Publishing: emon/3/Pulse 230064
2020-06-29 14:29:52,692 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230065
2020-06-29 14:29:52,801 DEBUG    pulse2     229937 NEW FRAME :
2020-06-29 14:29:52,803 DEBUG    pulse2     229937 Timestamp : 1593437392.8004935
2020-06-29 14:29:52,805 DEBUG    pulse2     229937 From Node : 3
2020-06-29 14:29:52,807 DEBUG    pulse2     229937    Values : [230065]
2020-06-29 14:29:52,809 DEBUG    pulse2     229937 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:52,819 DEBUG    pulse2     229937 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:52,837 DEBUG    MQTT3      Publishing: emon/3/Pulse 230065
2020-06-29 14:29:52,912 DEBUG    MQTT       Publishing: emon/3/Pulse 230065
2020-06-29 14:29:52,919 DEBUG    MQTT2      Publishing: emon/3/Pulse 230065
2020-06-29 14:29:53,016 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230066
2020-06-29 14:29:53,023 DEBUG    pulse2     229938 NEW FRAME :
2020-06-29 14:29:53,025 DEBUG    pulse2     229938 Timestamp : 1593437393.022645
2020-06-29 14:29:53,027 DEBUG    pulse2     229938 From Node : 3
2020-06-29 14:29:53,032 DEBUG    pulse2     229938    Values : [230066]
2020-06-29 14:29:53,034 DEBUG    pulse2     229938 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:53,037 DEBUG    pulse2     229938 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:53,233 DEBUG    MQTT2      Publishing: emon/3/Pulse 230066
2020-06-29 14:29:53,246 DEBUG    MQTT3      Publishing: emon/3/Pulse 230066
2020-06-29 14:29:53,324 DEBUG    MQTT       Publishing: emon/3/Pulse 230066
2020-06-29 14:29:53,345 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230067
2020-06-29 14:29:53,442 DEBUG    pulse2     229939 NEW FRAME :
2020-06-29 14:29:53,444 DEBUG    pulse2     229939 Timestamp : 1593437393.4417927
2020-06-29 14:29:53,446 DEBUG    pulse2     229939 From Node : 3
2020-06-29 14:29:53,447 DEBUG    pulse2     229939    Values : [230067]
2020-06-29 14:29:53,449 DEBUG    pulse2     229939 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:53,451 DEBUG    pulse2     229939 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:53,635 DEBUG    MQTT       Publishing: emon/3/Pulse 230067
2020-06-29 14:29:53,643 DEBUG    MQTT2      Publishing: emon/3/Pulse 230067
2020-06-29 14:29:53,656 DEBUG    MQTT3      Publishing: emon/3/Pulse 230067
2020-06-29 14:29:53,674 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230068
2020-06-29 14:29:53,762 DEBUG    pulse2     229940 NEW FRAME :
2020-06-29 14:29:53,765 DEBUG    pulse2     229940 Timestamp : 1593437393.7620077
2020-06-29 14:29:53,768 DEBUG    pulse2     229940 From Node : 3
2020-06-29 14:29:53,770 DEBUG    pulse2     229940    Values : [230068]
2020-06-29 14:29:53,777 DEBUG    pulse2     229940 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:53,779 DEBUG    pulse2     229940 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:53,984 DEBUG    MQTT3      Publishing: emon/3/Pulse 230068
2020-06-29 14:29:53,998 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230069
2020-06-29 14:29:54,061 DEBUG    MQTT2      Publishing: emon/3/Pulse 230068
2020-06-29 14:29:54,065 DEBUG    MQTT       Publishing: emon/3/Pulse 230068
2020-06-29 14:29:54,084 DEBUG    pulse2     229941 NEW FRAME :
2020-06-29 14:29:54,086 DEBUG    pulse2     229941 Timestamp : 1593437394.083907
2020-06-29 14:29:54,088 DEBUG    pulse2     229941 From Node : 3
2020-06-29 14:29:54,093 DEBUG    pulse2     229941    Values : [230069]
2020-06-29 14:29:54,094 DEBUG    pulse2     229941 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:54,096 DEBUG    pulse2     229941 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:54,175 DEBUG    MQTT       Publishing: emon/3/Pulse 230069
2020-06-29 14:29:54,178 DEBUG    MQTT2      Publishing: emon/3/Pulse 230069
2020-06-29 14:29:54,193 DEBUG    MQTT3      Publishing: emon/3/Pulse 230069
2020-06-29 14:29:54,327 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230070
2020-06-29 14:29:54,399 DEBUG    pulse2     229942 NEW FRAME :
2020-06-29 14:29:54,401 DEBUG    pulse2     229942 Timestamp : 1593437394.3993318
2020-06-29 14:29:54,403 DEBUG    pulse2     229942 From Node : 3
2020-06-29 14:29:54,405 DEBUG    pulse2     229942    Values : [230070]
2020-06-29 14:29:54,409 DEBUG    pulse2     229942 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:54,411 DEBUG    pulse2     229942 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:54,594 DEBUG    MQTT2      Publishing: emon/3/Pulse 230070
2020-06-29 14:29:54,596 DEBUG    MQTT       Publishing: emon/3/Pulse 230070
2020-06-29 14:29:54,610 DEBUG    MQTT3      Publishing: emon/3/Pulse 230070
2020-06-29 14:29:54,655 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230071
2020-06-29 14:29:54,714 DEBUG    pulse2     229943 NEW FRAME :
2020-06-29 14:29:54,718 DEBUG    pulse2     229943 Timestamp : 1593437394.7143738
2020-06-29 14:29:54,725 DEBUG    pulse2     229943 From Node : 3
2020-06-29 14:29:54,728 DEBUG    pulse2     229943    Values : [230071]
2020-06-29 14:29:54,731 DEBUG    pulse2     229943 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:54,734 DEBUG    pulse2     229943 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:54,812 DEBUG    MQTT       Publishing: emon/3/Pulse 230071
2020-06-29 14:29:54,818 DEBUG    MQTT2      Publishing: emon/3/Pulse 230071
2020-06-29 14:29:54,826 DEBUG    MQTT3      Publishing: emon/3/Pulse 230071
2020-06-29 14:29:54,984 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230072
2020-06-29 14:29:55,042 DEBUG    pulse2     229944 NEW FRAME :
2020-06-29 14:29:55,052 DEBUG    pulse2     229944 Timestamp : 1593437395.0418801
2020-06-29 14:29:55,054 DEBUG    pulse2     229944 From Node : 3
2020-06-29 14:29:55,057 DEBUG    pulse2     229944    Values : [230072]
2020-06-29 14:29:55,059 DEBUG    pulse2     229944 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:55,077 DEBUG    pulse2     229944 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:55,147 DEBUG    MQTT       Publishing: emon/3/Pulse 230072
2020-06-29 14:29:55,149 DEBUG    MQTT2      Publishing: emon/3/Pulse 230072
2020-06-29 14:29:55,152 DEBUG    MQTT3      Publishing: emon/3/Pulse 230072
2020-06-29 14:29:55,286 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230073
2020-06-29 14:29:55,381 DEBUG    pulse2     229945 NEW FRAME :
2020-06-29 14:29:55,383 DEBUG    pulse2     229945 Timestamp : 1593437395.380669
2020-06-29 14:29:55,385 DEBUG    pulse2     229945 From Node : 3
2020-06-29 14:29:55,386 DEBUG    pulse2     229945    Values : [230073]
2020-06-29 14:29:55,388 DEBUG    pulse2     229945 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:55,390 DEBUG    pulse2     229945 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:55,571 DEBUG    MQTT3      Publishing: emon/3/Pulse 230073
2020-06-29 14:29:55,573 DEBUG    MQTT2      Publishing: emon/3/Pulse 230073
2020-06-29 14:29:55,574 DEBUG    MQTT       Publishing: emon/3/Pulse 230073
2020-06-29 14:29:55,578 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230074
2020-06-29 14:29:55,593 DEBUG    pulse2     229946 NEW FRAME :
2020-06-29 14:29:55,596 DEBUG    pulse2     229946 Timestamp : 1593437395.5929716
2020-06-29 14:29:55,599 DEBUG    pulse2     229946 From Node : 3
2020-06-29 14:29:55,600 DEBUG    pulse2     229946    Values : [230074]
2020-06-29 14:29:55,602 DEBUG    pulse2     229946 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:55,604 DEBUG    pulse2     229946 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:55,796 DEBUG    MQTT       Publishing: emon/3/Pulse 230074
2020-06-29 14:29:55,800 DEBUG    MQTT2      Publishing: emon/3/Pulse 230074
2020-06-29 14:29:55,803 DEBUG    MQTT3      Publishing: emon/3/Pulse 230074
2020-06-29 14:29:55,869 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230075
2020-06-29 14:29:55,908 DEBUG    pulse2     229947 NEW FRAME :
2020-06-29 14:29:55,911 DEBUG    pulse2     229947 Timestamp : 1593437395.9079857
2020-06-29 14:29:55,914 DEBUG    pulse2     229947 From Node : 3
2020-06-29 14:29:55,930 DEBUG    pulse2     229947    Values : [230075]
2020-06-29 14:29:55,933 DEBUG    pulse2     229947 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:55,936 DEBUG    pulse2     229947 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:56,171 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230076
2020-06-29 14:29:56,245 DEBUG    pulse2     229948 NEW FRAME :
2020-06-29 14:29:56,248 DEBUG    pulse2     229948 Timestamp : 1593437396.245117
2020-06-29 14:29:56,250 DEBUG    pulse2     229948 From Node : 3
2020-06-29 14:29:56,265 DEBUG    pulse2     229948    Values : [230076]
2020-06-29 14:29:56,267 DEBUG    pulse2     229948 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:56,269 DEBUG    pulse2     229948 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:56,346 DEBUG    MQTT2      Publishing: emon/3/Pulse 230075
2020-06-29 14:29:56,348 DEBUG    MQTT3      Publishing: emon/3/Pulse 230075
2020-06-29 14:29:56,349 DEBUG    MQTT       Publishing: emon/3/Pulse 230075
2020-06-29 14:29:56,458 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230077
2020-06-29 14:29:56,473 DEBUG    pulse2     229949 NEW FRAME :
2020-06-29 14:29:56,475 DEBUG    pulse2     229949 Timestamp : 1593437396.4731045
2020-06-29 14:29:56,478 DEBUG    pulse2     229949 From Node : 3
2020-06-29 14:29:56,480 DEBUG    pulse2     229949    Values : [230077]
2020-06-29 14:29:56,482 DEBUG    pulse2     229949 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:56,484 DEBUG    pulse2     229949 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:56,568 DEBUG    MQTT3      Publishing: emon/3/Pulse 230076
2020-06-29 14:29:56,574 DEBUG    MQTT       Publishing: emon/3/Pulse 230076
2020-06-29 14:29:56,571 DEBUG    MQTT2      Publishing: emon/3/Pulse 230076
2020-06-29 14:29:56,689 DEBUG    MQTT3      Publishing: emon/3/Pulse 230077
2020-06-29 14:29:56,692 DEBUG    MQTT2      Publishing: emon/3/Pulse 230077
2020-06-29 14:29:56,694 DEBUG    MQTT       Publishing: emon/3/Pulse 230077
2020-06-29 14:29:56,784 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230078
2020-06-29 14:29:56,787 DEBUG    pulse2     229950 NEW FRAME :
2020-06-29 14:29:56,789 DEBUG    pulse2     229950 Timestamp : 1593437396.7865932
2020-06-29 14:29:56,790 DEBUG    pulse2     229950 From Node : 3
2020-06-29 14:29:56,793 DEBUG    pulse2     229950    Values : [230078]
2020-06-29 14:29:56,794 DEBUG    pulse2     229950 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:56,796 DEBUG    pulse2     229950 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:56,914 DEBUG    MQTT2      Publishing: emon/3/Pulse 230078
2020-06-29 14:29:56,917 DEBUG    MQTT       Publishing: emon/3/Pulse 230078
2020-06-29 14:29:56,920 DEBUG    MQTT3      Publishing: emon/3/Pulse 230078
2020-06-29 14:29:57,111 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230079
2020-06-29 14:29:57,200 DEBUG    pulse2     229951 NEW FRAME :
2020-06-29 14:29:57,203 DEBUG    pulse2     229951 Timestamp : 1593437397.199952
2020-06-29 14:29:57,206 DEBUG    pulse2     229951 From Node : 3
2020-06-29 14:29:57,208 DEBUG    pulse2     229951    Values : [230079]
2020-06-29 14:29:57,211 DEBUG    pulse2     229951 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:57,214 DEBUG    pulse2     229951 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:57,440 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230080
2020-06-29 14:29:57,449 DEBUG    MQTT       Publishing: emon/3/Pulse 230079
2020-06-29 14:29:57,452 DEBUG    MQTT2      Publishing: emon/3/Pulse 230079
2020-06-29 14:29:57,453 DEBUG    MQTT3      Publishing: emon/3/Pulse 230079
2020-06-29 14:29:57,523 DEBUG    pulse2     229952 NEW FRAME :
2020-06-29 14:29:57,525 DEBUG    pulse2     229952 Timestamp : 1593437397.522739
2020-06-29 14:29:57,527 DEBUG    pulse2     229952 From Node : 3
2020-06-29 14:29:57,528 DEBUG    pulse2     229952    Values : [230080]
2020-06-29 14:29:57,530 DEBUG    pulse2     229952 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:57,532 DEBUG    pulse2     229952 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:57,670 DEBUG    MQTT2      Publishing: emon/3/Pulse 230080
2020-06-29 14:29:57,673 DEBUG    MQTT3      Publishing: emon/3/Pulse 230080
2020-06-29 14:29:57,675 DEBUG    MQTT       Publishing: emon/3/Pulse 230080
2020-06-29 14:29:57,769 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230081
2020-06-29 14:29:57,835 DEBUG    pulse2     229953 NEW FRAME :
2020-06-29 14:29:57,838 DEBUG    pulse2     229953 Timestamp : 1593437397.8353379
2020-06-29 14:29:57,839 DEBUG    pulse2     229953 From Node : 3
2020-06-29 14:29:57,842 DEBUG    pulse2     229953    Values : [230081]
2020-06-29 14:29:57,844 DEBUG    pulse2     229953 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:57,846 DEBUG    pulse2     229953 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:58,093 DEBUG    MQTT2      Publishing: emon/3/Pulse 230081
2020-06-29 14:29:58,099 DEBUG    MQTT3      Publishing: emon/3/Pulse 230081
2020-06-29 14:29:58,101 DEBUG    MQTT       Publishing: emon/3/Pulse 230081
2020-06-29 14:29:58,102 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230082
2020-06-29 14:29:58,149 DEBUG    pulse2     229954 NEW FRAME :
2020-06-29 14:29:58,152 DEBUG    pulse2     229954 Timestamp : 1593437398.148799
2020-06-29 14:29:58,155 DEBUG    pulse2     229954 From Node : 3
2020-06-29 14:29:58,157 DEBUG    pulse2     229954    Values : [230082]
2020-06-29 14:29:58,160 DEBUG    pulse2     229954 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:58,163 DEBUG    pulse2     229954 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:58,223 DEBUG    MQTT3      Publishing: emon/3/Pulse 230082
2020-06-29 14:29:58,226 DEBUG    MQTT2      Publishing: emon/3/Pulse 230082
2020-06-29 14:29:58,228 DEBUG    MQTT       Publishing: emon/3/Pulse 230082
2020-06-29 14:29:58,433 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230083
2020-06-29 14:29:58,472 DEBUG    pulse2     229955 NEW FRAME :
2020-06-29 14:29:58,474 DEBUG    pulse2     229955 Timestamp : 1593437398.471936
2020-06-29 14:29:58,476 DEBUG    pulse2     229955 From Node : 3
2020-06-29 14:29:58,478 DEBUG    pulse2     229955    Values : [230083]
2020-06-29 14:29:58,479 DEBUG    pulse2     229955 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:58,497 DEBUG    pulse2     229955 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:58,565 DEBUG    MQTT2      Publishing: emon/3/Pulse 230083
2020-06-29 14:29:58,567 DEBUG    MQTT3      Publishing: emon/3/Pulse 230083
2020-06-29 14:29:58,568 DEBUG    MQTT       Publishing: emon/3/Pulse 230083
2020-06-29 14:29:58,757 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230084
2020-06-29 14:29:58,800 DEBUG    pulse2     229956 NEW FRAME :
2020-06-29 14:29:58,802 DEBUG    pulse2     229956 Timestamp : 1593437398.7997723
2020-06-29 14:29:58,804 DEBUG    pulse2     229956 From Node : 3
2020-06-29 14:29:58,806 DEBUG    pulse2     229956    Values : [230084]
2020-06-29 14:29:58,807 DEBUG    pulse2     229956 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:58,809 DEBUG    pulse2     229956 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:58,988 DEBUG    MQTT       Publishing: emon/3/Pulse 230084
2020-06-29 14:29:58,990 DEBUG    MQTT2      Publishing: emon/3/Pulse 230084
2020-06-29 14:29:58,991 DEBUG    MQTT3      Publishing: emon/3/Pulse 230084
2020-06-29 14:29:59,087 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230085
2020-06-29 14:29:59,112 DEBUG    pulse2     229957 NEW FRAME :
2020-06-29 14:29:59,115 DEBUG    pulse2     229957 Timestamp : 1593437399.1123571
2020-06-29 14:29:59,117 DEBUG    pulse2     229957 From Node : 3
2020-06-29 14:29:59,119 DEBUG    pulse2     229957    Values : [230085]
2020-06-29 14:29:59,121 DEBUG    pulse2     229957 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:59,123 DEBUG    pulse2     229957 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:59,209 DEBUG    MQTT       Publishing: emon/3/Pulse 230085
2020-06-29 14:29:59,214 DEBUG    MQTT2      Publishing: emon/3/Pulse 230085
2020-06-29 14:29:59,215 DEBUG    MQTT3      Publishing: emon/3/Pulse 230085
2020-06-29 14:29:59,416 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230086
2020-06-29 14:29:59,426 DEBUG    pulse2     229958 NEW FRAME :
2020-06-29 14:29:59,429 DEBUG    pulse2     229958 Timestamp : 1593437399.4260333
2020-06-29 14:29:59,432 DEBUG    pulse2     229958 From Node : 3
2020-06-29 14:29:59,435 DEBUG    pulse2     229958    Values : [230086]
2020-06-29 14:29:59,437 DEBUG    pulse2     229958 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:59,447 DEBUG    pulse2     229958 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:59,742 DEBUG    Dummy-4    pulse2 : Pulse Channel 15 pulse: 230087
2020-06-29 14:29:59,757 DEBUG    MQTT       Publishing: emon/3/Pulse 230086
2020-06-29 14:29:59,760 DEBUG    MQTT3      Publishing: emon/3/Pulse 230086
2020-06-29 14:29:59,761 DEBUG    pulse2     229959 NEW FRAME :
2020-06-29 14:29:59,768 DEBUG    pulse2     229959 Timestamp : 1593437399.7614243
2020-06-29 14:29:59,770 DEBUG    pulse2     229959 From Node : 3
2020-06-29 14:29:59,759 DEBUG    MQTT2      Publishing: emon/3/Pulse 230086
2020-06-29 14:29:59,774 DEBUG    pulse2     229959    Values : [230087]
2020-06-29 14:29:59,781 DEBUG    pulse2     229959 Sent to channel(start)' : ToEmonCMS
2020-06-29 14:29:59,783 DEBUG    pulse2     229959 Sent to channel(end)' : ToEmonCMS
2020-06-29 14:29:59,878 DEBUG    MQTT3      Publishing: emon/3/Pulse 230087
2020-06-29 14:29:59,882 DEBUG    MQTT       Publishing: emon/3/Pulse 230087
2020-06-29 14:29:59,884 DEBUG    MQTT2      Publishing: emon/3/Pulse 230087

EmonLibCM_getPulseCount( )
Returns the accumulated count of pulses since the library was initialised, provided that
pulse counting has been enabled.

EmonLibCM_getWattHour(int channel)
Returns the integer value of the accumulated energy in watt-hours since the library was
initialised, for that channel.

But E1 (or En) from the emonTx is not the pulse count, it comes from getWattHour( ), so it’s the power integral over time derived from the c.t. & v.t.

Oh yes I know that and that was my point, I was measuring the power used in 2 completely different ways, on 2 independent systems and that was why I noticed the issue.

Just looked at the chart again and it is quite clear when the current implementation hits the rate limit by the straight line. Before and after it follows the emonTX Energy measurements.

1 Like

What confused me, which is why I spelled out what the two methods available in the emonTx do, was

when it was obvious that you were not using the pulse count of the emonTx running emonLibCM, instead comparing the analogue energy measured by the emonTx against the pulse input of the RPi.

It looks as if the rate limit will be a little under 5 pulses per second. That’s a good finding and we need to remember it in case another user comes across the problem later. It should really go in the documentation.

A very good finding indeed.

Or change the sleep value. I’m no python guru but Brian’s findings suggest you can only have one pending event while sleeping. I rate limit my pulse counting to ~12Hz primarily as part of the debouncing/deglitching. 5Hz seems a bit restrictive. I think that works out at 18kW doesn’t it? A 3-phase Tesla charger can pump 22kW. Does anyone know the history of the 200 msec sleep?

That’s pre-supposing one pulse = 1 Wh. It’s a common but not standard value, the Optical pulse sensor page in Resources gives 4000 pulses per kWh as the “fastest”, and I think that isn’t the fastest I’ve seen reported/mentioned in the forum. IIRC, it was someone in Continental Europe.

It seemed a good idea at the time?
As I haven’t the faintest clue about how the Pi and emonHub works, I couldn’t hazard a better guess. But it looks to me as if rather more of the pulse handling needs to be done as a low level service inside the Pi itself and rather less in emonHub and the interfacer.

Reading the slope off the graphs, I reckon it was rate limiting at 3.9 kW (first graph) or 3.5 kW (second graph) so that’s not far off 1 per second, not 5.
(That seemed so ridiculous that as a check, I looked at the slope of the emonTx with emonLibCM - it came to about 12 kW, which is close enough to Brian’s 11.4 kW.)

At that rate, I’d suggest that the direct pulse input is unusable except for a 16 A PV infeed, if the meter pulse equates to 1 Wh, even then it might rate-limit at or near maximum production.

Now that you mention it, the 3-phase meter at that house with the Tesla only pulses at 250 per kWh. Maybe they tune the rate to ensure maximum power doesn’t have it flashing insanely fast.

I’m no Python expert myself, but I do know that Pyhton is a multi-thread capable language.
The module Advanced Python Scheduler I use to control various events can have more than one
pending event. Maybe multi-threading is the way to go?

In this old thread, @danbates says “time.sleep() could be a millisecond, one second, 5000 seconds, makes no difference, as long as the program is running the interrupts will happen and callbacks are initiated immediately.”

Dan, does that include the case where multiple interrupts arrive during the one sleep() call?

That sounds about right. Here’s a snippet from APS that does what you’re speaking of:
(that is, I think it does, but I may be off on a tangent too. As I mentioned earlier, I’m no
Python expert, I just dabble with it)

def main():
    sched.add_cron_job(read_meter, second='1,6,11,16,21,26,31,36,41,46,51,56')
    sched.add_cron_job(read_water_htr, second='3,8,13,18,23,28,33,38,43,48,53,58')
    sched.add_cron_job(get_garage_temp, minute='*/1', second='0')
    sched.add_cron_job(send_to_pvo, minute='*/5', second='2')
    sched.add_cron_job(wrt_daily_data, hour='23', minute='59', second='52')
    sched.add_cron_job(wrt_monthly_separator, day='1', hour='0', minute='0', second='3')

    while True:
       time.sleep(1)

if __name__ == "__main__":
    main()

Without the sleep construct, the script runs once then exits.

add_cron_job makes me think each of those is a completely separate unix process launched by the cron daemon.

It appears that way, but it’s just a name. Advanced Python Scheduler has three different ways
to schedule a job. the add_cron_job syntax is very similar to cron syntax, hence the name.
Job scheduling is handled entirely by APS. i.e. cron is not used.

1 Like

I’m pretty sure the callback on the interrupt will fire even in the sleep mode.

What it needs is to limit how often the read() sends data to the main process. I’m sure I’ve seen one of the other interfacers do that. It is not handling the interrupt that takes the time, it is the rest of the processing. This would simply mean that instead of reporting every pulse, it would report the pulses in the last n seconds.

This was part of the reason for introducing (not merged yet) an MQTT JSON option whereby a single MQTT publish is done for every frame - the publish can be a significant block of the processing time. I have also seen emoncms drop MQTT messages if a value is published too quickly onto the same topic - this only really matters if the data frame is timestamped.

yes but if it is too short, emonhub takes up too much processing time (there is a thread somewhere on that) hence the sleep. It should possibly be refactored into a full callback rather than a polling architecture perhaps, but that is way beyond my Python!

As already hinted at by @Bill.Thomson, any number of callbacks of the same callback can happen any time during ‘sleep’.
Absolutely right @borpin

I think we are agreeing…

Coffee must’ve just kicked in :rofl: