Subtract use from pulse-counted feed

I an emonpi connected up to my electricity, and I have solar. So CT1 and CT2 are on my “use” (excludes hot water service) and solar generation as per the guide. I also have a pulse counter connected to my electricity meter.
The electricity meter has a “controlled load” circuit for an off-peak water heater. I’m trying to figure out how to count the pulses to determine the total power coming into the power meter, then subtract the “use” power to determine the power being used by the hot water service on the controlled-load circuit.
So:
(Total power from pulse counter) - (use feed) = controlled load usage.

Can someone please assist me in getting something like that set up?

I’m running into problems because I can’t get my head around the power to energy conversions. Also, since it’s off-peak, every time I try something I have to wait until ~1am-6am (when the controlled load is turned on) before I can test to see if it’s right.

Note 1: I know the pulse counting isn’t real-time, but that’s not really important. Daily values would be good, 10 minute resolution would be even better.
Note 2: I know the solar circuit could affect the values, but the controlled load will only ever run at night when the solar isn’t generating anything, so it shouldn’t be an issue.

Hi @Orionn,

I’ve got my pulse counter setup to give me an online view of the solar generation meter reading as follows:

I’ve just looked and found a “If !Schedule, Zero”, I’m guessing that you could set the schedule to only log the kWh accumulator (row 6 in mine) within 01:00 - 06:00. And thereby collate a kWh/day figure, if you then do the same for the use feed, then you could setup a virtual feed to subtract one kWh/d figure from the other.

I’ve not setup a schedule before, hence cannot guide on this aspect

I’ve setup a virtual feed to subtract one feed from the other and use this to show my daily delta between imported and exported electricity, and hence trying to justify the cost of a battery:

Clive.

Thanks Clive. I haven’t made my situation clear. Let me try again.
I have:
a power meter with optical pulses being measured. (z)
a “use” circuit for general household circuits - (a)
a controlled load, hot water circuit that only comes on at night, at times determined by the power company. - (b)
a solar circuit for generated solar power - ( c )
So at all times, a+b-c = z.

Perhaps if I do the pulse counter as a kWhd measurement, then subtract the “import” kWhd measurement, that will work. I thought I had a reason why that wouldn’t, but now I can’t think of it, so I’ll give that a shot. It won’t tell me what time the controlled load comes on, but it will give me a “per day” reading on the controlled load circuit.

Or z-a+c = b

Assuming you are keeping a running kWh total of each z , a and c, you can simply add

reset to zero
+feed “z”
-feed “a”
+feed “c”
log to feed “b”

to the end of the processing in the last input in the chain (so it uses all new values) and you will have running total kWh for the water heater that can be graphed for daily amount as per the use and solar feeds.

You can also use the kWh to kWh/d process to track daily amounts, in a similar way if you choose

You will not be able to get an accurate “power” for “b” due to the pulsed input “z” not offering a real time power value to complete the sums.

You should also try and avoid using import or export in this type of calculation as you can get errors due to only having data part of the time, eg when exporting, “import” will be 0 regardless of how much you are exporting (as opposed to a negative value), this may work in some instances (eg your off-peak circuit is unlikely to coincide with PV generation) but it’s perhaps not good practice as it can be difficult to debug and understand at a later date when making changes etc.

Cool, good idea Paul. I think I was also getting confused between power and kWh.
I’ve got this, let’s see what I get.

OK, those settings didn’t get any usable results. But I have found the below graph.
These are using the exact feeds (and feed names, I think) found in the how-to’s when installing the emonpi.
Looking at the bars, the blue lines is the pulse-count (peak+controlled load), and the yellow bar is the peak, so the difference is the controlled load. But the problem is I can’t extract that data - the blue bars are off by a factor of 1000, and just multiplying that feed by 0.001, then subtracting the other feed gave garbled results.


Alternatively, what is the best way to get a power feed from the impulse counter? I know it won’t be very accurate, but I think it will be close enough for my purposes.

Looking at the processlist in your previous post lines 1 to 5 look ok.
line 6 is subtracting “import_kwhd” from the total ever “pulsecount_kwh”, therefore line 7 is not “controlled_load_kwhd”.

You have added a “reset to original” at line 8 which will never work correctly following the first reset or reboot of the pulsecounter hardware. I had said use a “reset to zero” followed by a “+feed”, that would give you a reset to the “total power wh pulse” so that you can do the z-a+c = b maths. What you are currently doing is taking the current pulsecount (which could be 0 if the pulsecounting device has just been restarted) and dividing that by 1000 in an attempt to arrive a kwh total for all time, then doing the maths.

Since lines 4 and 5 pass the full kwh total (“total power wh pulse”? not the clearest name as power is not involved) without altering it, you should be able to just delete lines 6, 7, 8 & 9 so that line 5 feeds into (the current) line 10 and that should work just fine.

What happened on Feb 14th? it looks like your water heater was generating electricity :slight_smile: , I assume the pulsecounter was not attached to the meter perhaps? Or is that just a result of using the calculated “import_kwh” feed?

Thanks Paul. I’ve deleted the lines you mentioned and I’ll give it a few days and see what I get.

Yeah, I noticed that Feb 14 anomoly, but figured it was a just a glitch. No idea what happened on that day - it was Valentine’s Day, and we all find a little extra energy on Valentine’s Day.

OK, so I got it working well enough. It’s not realtime, only a daily value, but that’s good enough for me.

For anyone else who wants to find this info, here’s my input processes:


And here’s the graph it spits out:

(orange bars are my off-peak/controlled load, yellow bars are total, so peak + offpeak.)

Glad to hear you are making progress and getting the data you are after.

Just to point out a couple of things about your current processlist that might help you or others reading this post.

Processing lines 3, 4 and 5 are all passing the “pulsecount_kWh” value on to the next process. Therefore processing lines 6, 7 and 8 are all redundant because you are calculating “pulsecount_kWh” from multiplying “total power wh pulse” by 0.001 again, not only do you already have a “pulsecount_kWh” feed you could use to save processing power, but the kWh to kWh/d on line 5 is already outputting that value before you “reset to zero” in line 7.

Line 9 log to feed “import - peak and offpeak from pulse” is a duplication of the “pulsecount_kWh” because the previous 3 lines are duplicating previous work, so you are saving the same value to another feed of a different name.

So lines 6,7,8 and 9 can all be deleted so line 5 feeds into the current line 10.

However. This processlist will only be accurate if the off-peak period is never during sunlight hours. For example my “off-peak” is 00:00 to 07:00 GMT which is fine in the winter months, during the summer months the sun comes up well before that, this position is impacted further by my meter being pretty old and not adjusting for BST, so in actual fact my off-peak is 01:00 to 08:00 in the summer months.

Even if it rarely or even never impacts your data, you should ideally include the PV kWh between lines 5 and 10 using a +feed so that IF ever there is PV during the off-peak period, it is handled correctly rather than corrupting your data. adding that process would also help make sense of the existing processing without needing to understand or be aware of the “sunlight v off-peak load” timing element.

Plus now you have the “Off-peak controlled load” feed (currently in line 11), you can use the “kWh to power” process to get a sort of realtime power. It will provide a realtime power value but since it is based on sporadic pulses, it may give inaccurate results during times of low consumption, that’s low total consumption not just off-peak load consumption.