Seems as if slowly getting closer to understand the theory part … and the current graph looks much better, still with nightly generation though:

Btw, I learned in school (while ago), that voltage is “U”, is that maybe a German thing?

Anyway, to my understanding, we don’t need to worry about the vCal nor iCal - vCal is the result of a bit of trying and comparing the results of EmonLib::calcVI() with measuring the grid voltage with a multimeter (in addition I have displayed, what my inverter tells me (light-blue)).

Same for iCal (in my case a a fix 30A/1V SCT013 model, so iCal = 30).

But in both cases what would be the phaseCal to consider?

How would I determine the phase error of the V and I transformers?

I read this (and actually, all the other docs)

Different AC-AC Power Adapters — OpenEnergyMonitor 0.0.1 documentation

but that does not help as we don’t see the graph of the primary side - or am I missing something?

(nevertheless, which software did you use to take those pictures?)

My understanding so far:

With 50Hz grid frequency (i.e. 50 full sine waves per second) and requesting 20 crossings when calling calcVI() which equals 10 full sine waves, that calculation *always* takes 1/5 sec, i.e. 200ms, in practice ~208ms.

The number of samples taken during that time depends on the speed of the microcontroller.

Now, regarding the phaseCal - with in my case (and, in theory with this particular type of microcontoller, namely the current RPi Pico, this also should *always* be the case) ~6000 samples and a measured time of 208ms for the 10 full waves, we have 208ms/6000 = ~34.7 microsecs per one calcVI() cycle, and therefore also between two readings of V (and I).

Then:

- one full sine wave 360° = 1/50s = 20ms, therefore 1° = 20ms / 360° = 55.5microsecs
- taking time before measuring I and V shows that between both there are ~5 microsecs (so, ~30 microsecs for the rest of the calculations in calcVI - is that possible?)
- so one calcVI cycle equals 35 / 55.5 = 0.63° and the measure ~5 microsecs = 5 / 55.5 = 0.09°

All of that is almost constant per type of microcontroller and grid frequency(?)

Can that be correct? If so, is it really possible, that the deltaT of 5 microsecs = 0.09° between sampling V and I has that much of a influence? The faster the controller is, the less the phaseCal problem should be, at least the deltaT between sampling I and V (?)

In any case, would that be then a phaseCal of 0.91 (or rather 1.09)?

Some real samples, now with phaseCal=0.89, which I think look generally quite reasonable:

TGE PIN I: 0, U: 1

TGE ADC range: 4096

TGE Supply: 3300mVu, phaseCal: 0.89

TGE start 351113 Timeout: 2000, now: 351120 → 7ms

TGE startV 1846

TGE start Offsets: I: 2070.42 U: 2195.34

TGE end meas loop: 206ms NumSamples: 5931

TGE Raw samples V: ADC: 540 (deltaT: 10) filtV: -1653.73 (delta 0.00), pcFiltV: -1514.37 → -301.36

TGE Raw samples V: ADC: 530 (deltaT: 4) filtV: -1662.10 (delta -8.38), pcFiltV: -1661.20 → -330.58

TGE Raw samples V: ADC: 538 (deltaT: 4) filtV: -1652.49 (delta 9.62), pcFiltV: -1653.53 → -329.05

TGE Raw samples V: ADC: 511 (deltaT: 5) filtV: -1677.85 (delta -25.36), pcFiltV: -1675.11 → -333.34

TGE Raw samples V: ADC: 528 (deltaT: 4) filtV: -1659.22 (delta 18.62), pcFiltV: -1661.24 → -330.58

TGE Raw samples V: ADC: 516 (deltaT: 5) filtV: -1669.59 (delta -10.37), pcFiltV: -1668.47 → -332.02

TGE Raw samples V: ADC: 525 (deltaT: 5) filtV: -1658.97 (delta 10.62), pcFiltV: -1660.12 → -330.36

…

TGE Raw samples V: ADC: 2395 (deltaT: 5) filtV: 391.02 (delta 16.62), pcFiltV: 389.23 → 77.46

TGE Vrms: 226.03V

TGE Irms: 0.36A

The numbers above are:

for(int i = 0; i < 200; i++)

{

printf(“TGE Raw samples V: ADC: %d (deltaT: %d) filtV: %.2f (delta %.2f), pcFiltV: %.2f → %.2f\n”, samplesV[i], samplesDeltaT[i],

filtV[i], (i == 0 ? 0 : (filtV[i] - filtV[i - 1])), pcFiltV[i], (pcFiltV[i] * V_RATIO));

}

Interesting the samples around a zero-crossing - shouldn’t that be ADC=2048?

The ADC values are in a range of 474 … 3613 which yields a “center value” of 2043.5

TGE Raw samples V: ADC: 2467 (deltaT: 4) filtV: 89.80 (delta -17.09), pcFiltV: 91.64 → 18.24

TGE Raw samples V: ADC: 2450 (deltaT: 5) filtV: 72.73 (delta -17.07), pcFiltV: 74.57 → 14.84

TGE Raw samples V: ADC: 2430 (deltaT: 5) filtV: 52.68 (delta -20.05), pcFiltV: 54.84 → 10.91

TGE Raw samples V: ADC: 2412 (deltaT: 5) filtV: 34.64 (delta -18.03), pcFiltV: 36.59 → 7.28

TGE Raw samples V: ADC: 2400 (deltaT: 5) filtV: 22.62 (delta -12.02), pcFiltV: 23.92 → 4.76

TGE Raw samples V: ADC: 2378 (deltaT: 5) filtV: 0.62 (delta -22.00), pcFiltV: 3.00 → 0.60

TGE Raw samples V: ADC: 2364 (deltaT: 5) filtV: -13.37 (delta -13.99), pcFiltV: -11.86 → -2.36

TGE Raw samples V: ADC: 2342 (deltaT: 5) filtV: -35.33 (delta -21.97), pcFiltV: -32.96 → -6.56

TGE Raw samples V: ADC: 2328 (deltaT: 5) filtV: -49.28 (delta -13.95), pcFiltV: -47.78 → -9.51

TGE Raw samples V: ADC: 2315 (deltaT: 5) filtV: -62.22 (delta -12.94), pcFiltV: -60.83 → -12.10

TGE Raw samples V: ADC: 2297 (deltaT: 5) filtV: -80.15 (delta -17.92), pcFiltV: -78.21 → -15.56

Hmmm, hmmm, still no clue, what might be wrong …