I built a permanent magnet pulsed DC motor, and am trying to accurately measure power input, which proves to be harder than expected.

The motor is pulsed with a 25% duty cycle square wave and powered by a 24V battery.

Normally, Power = Volts * Amps, but that does not take the duty cycle into account.

On top of that, the rotating permanent magnets induce a counter EMF, and the difference between the applied battery voltage and the counter EMF is what determines how much current flows through the windings.

This means the current waveform is no longer a square wave, as I tried to illustrate below:

Current waveform

One research officer from an electric company mentioned the following:

enter image description here

However, it seems to me that the average current

already takes both the ON and OFF current into account, so why would you still need to multiply by the duty cycle?

How would you accurately measure the power input into a permanent magnet pulsed DC motor?