tl, dr: For a bench setup get true RMS power meters for both the DC and AC side, and measure over a variety of load conditions. Option: use a 4-channel scope with math capability. Besides waveform math and RMS, these typically also do FFT so you can see harmonics.
For an in-built metering consider the sensing and computation required to do it correctly, considering how noisy your inverter can be.
Consider including testing with reactive loads like motors and IT gear as these influence power factor.
What you state is true: efficiency = output power/input power. So you think that you could measure amps and volts of each, multiply them together to get power and divide to get efficiency. That will give something, but it won't be as accurate as it could be.
To your questions:
Is the output power obtained from the load voltage * the load current connected to the inverter?
Kind of. But we're talking about an AC output, so we have an additional concern: power factor.
The trouble for AC is when power factor isn't unity. This means that on the AC side I and V are not in phase with each other, so some of the power is reactive and not doing any useful work. You see this when the output is driving a reactive load, like a motor. Your measurements need to correct for that.
Is the input power obtained from the input DC voltage * the input DC current?
Yes, for DC is this basically true. On the DC side you can compute based on averages. But you still need to consider that the DC side can have harmonics, and thus needs some signal processing to get robust RMS measurements. That's what a 'true RMS' meter does, we'll discuss that below.
Fortunately, you can sample I and V together at the same time then multiply the samples together sample-by-sample to obtain instantaneous power. Accumulate these over time to compute energy consumed, then divide by time (number of samples) to obtain power.
Digging deeper, we can express our power calculation as a set of I and V samples in a data set 'bucket', as follows:
- \$ P_{avgAC} = \frac{\sum_{i=0}^{n-1}({V_i}\times{I_i})}{n}\$
- \$ P_{avgDC} = \frac{\sum_{i=0}^{n-1}{V_i}\times\sum_{i=0}^{n-1}{I_i}}{n}\$
Where \$V_i\$ is a voltage sample, \$I_i\$ is a current sample, and
\$n\$ is the total samples in the 'bucket'. This gives us average power over the set of samples.
Working this way, on the AC side any I vs. V lead/lag will cancel out, leaving just real average power. We do DC by just summing I and V values then doing just one multiply and divide at the end to get average.
But to get closer to the real power values, we need to do a bit more work: true RMS. To calculate true RMS we take the bucket of \$I\$ and \$V\$ samples, compute their squares, sum, divide by the number of samples, then finally take the square root of that.
That is, for true RMS power of a sample set \$P\$ of \$n\$ samples:
- \$ P_{RMS} = \sqrt{\frac{\sum_{i=0}^{n-1}{P_i}^2}{n}}\$
This is similar to computing the AC average, except that it requires two multiplies per point instead of one (first P = I x V, then P x P), followed by a square root at the end. We also do the same for DC to get its RMS value as well. This will be the most accurate.
Sampling Discussion
How big of a bucket do we need? It should contain enough samples to cover at least one AC cycle, preferably a bit more than one. To make things easier the bucket size can be a power of 2, such as 2048 for example. Then the final divide is a shift.
What sample rate? Depends on the harmonics. To get a decent measurement with an inverter, especially a PWM type, we might have to sample at tens to hundreds of kHz because of all the noise the PWM activity causes. If you use 2048 points per 60 Hz cycle you get 122800 Hz sample rate. That would cover harmonics up to 61KHz. Too much for your micro? You'll need to band-limit your sensor inputs then, but you may lose accuracy.