Yep, this is where my misunderstanding was stemming from. I am calling a set of data the collection of 2000 samples from each channel (5CTs + 1 voltage)… or 12k samples overall. The terminology of a set in the Learn section means a single reading of one or more CT values paired with a single voltage reading, right?
It all makes sense now. With a purely resistive load, I can assume that the current wave should follow the voltage wave exactly, and the discrepancy between the two when I measure it is the combination of the time shift and transformer phase errors. I can calculate the time shift error, but I don’t think I can calculate the phase error between the voltage and current transformers, so I will have to rely on measurements alone for this error.
Assuming I’m on the right track now, when it comes to using measurements for correction any remaining phase error, should I be looking where the “zeros” of each wave are? For instance, if the zero of ct1 happens in sample number 123, but the zero of the voltage reading happens in sample number 125, there are 2 samples worth of time that I need to correct for, which in my case is 64µs.
So, when generating a new waveform to correct for phase - can I apply the correction technique to the individual current waves, or do I have to generate 5 slightly different voltage waves for each individual current sensor? I’m thinking that perhaps the irregular current waveforms for various electronics won’t take nicely to the phase correction algorithm, whereas the nicely shaped AC sine wave will.
I intend to collect 2k samples from each channel, then go back and perform the phase correction maths for each channel using either: 5 variations of the voltage measurements applied to the respective current measurements, or adjust each of the 5 current wave forms. (To me, it doesn’t matter which method I choose as the number of CPU operations will be the same).
For a bit of miscellaneous stuff… Yesterday I invested the time in adding a debug mode to my software. Previously, in order to visualize the raw data (like for all the screenshots of graphs I shared thus far)…
I would have to set the filename for the CSV data dump in the code, run the program, terminate it, copy the CSV out to my computer, upload it to Plotly, build the chart, name the traces, etc. Now, with my new debug mode, I simply run my program, pass the debug keyword in, followed by a filename, and it dumps an interactive chart with a fresh set of 2000 samples to a local webserver on the Pi that I can view within seconds. Example:
$ python3 power-monitor.py debug "example for OpenEM"
Web server root now has “example for OpenEM.html”:
Clicking on the above filename gives me the chart itself, which I can pan and zoom any which way, or turn off individual data series.
Well worth the time!!