Real power is based on the difference in phase between the voltage and the current waveforms. You mainly see it in calculation of power factor. From wikipedia:
The ratio between real power and apparent power in a circuit is called
the power factor. It's a practical measure of the efficiency of a
power distribution system. For two systems transmitting the same
amount of real power, the system with the lower power factor will have
higher circulating currents due to energy that returns to the source
from energy storage in the load. These higher currents produce higher
losses and reduce overall transmission efficiency. A lower power
factor circuit will have a higher apparent power and higher losses for
the same amount of real power. The power factor is one when the
voltage and current are in phase. It is zero when the current leads or
lags the voltage by 90 degrees. Power factors are usually stated as
"leading" or "lagging" to show the sign of the phase angle of current
with respect to voltage.
In your application I believe they are using shiftedV as a way to see how much the phase has changed since the last value. With a purely resistive load, the power factor would be 1...so the real power=apparent power. So you are probably suppose to use a resistive load to determine your phasecal number(set it so real=apparent). Then you can find the power factor for various loads.
Edit: If you take the time average of the instantaneous product of voltage and current, you will surely have a real power measurement. As I (poorly) implied above, I believe the shiftedV is used to adjust for any reactance elements introduced by the measurement process. As a way to null out the effects of the electronics, so you get the real power of the load. Here good reading and pictures National Instruments
Yes, although watch for aliasing. After all, real power is the average power, usually averaged over a whole repeating cycle.
What you have to watch out for are high frequencies in the instantaneous power signal. As when point-sampling any signal, the frequencies above half the sample rate become aliases, which is a form of noise on the sampled signal. If the power signal has significant content above half your sample frequency, then you will get erroneous readings.
For example, consider a line-powered device that has a full wave bridge feeding a reservoir cap immediately on the power input. The current will have significant high frequency content so that you have to sample much faster than twice per power line cycle to get meaningful readings. Or, you can think of this same thing in the time domain. The current will be short spikes near the voltage peaks. If you sample such that you often miss these peaks, you are going to get the wrong idea of the average power.
Fortunately, modern microcontrollers can sample much much faster than the AC line frequency. 1000 samples per AC line cycles isn't overkill, but that's only 60 kHz sample rate, which is pretty slow compared to what many micros can do nowadays. When trying to compute power and you think the waveforms won't be nice sinusoids, sample as fast as you can.
I should also point out that low pass filtering the voltage and current independently to avoid aliases, then computing power from these slower samples is not valid. You can only average (low pass filter) after computing power from voltage and current, not before. Put another way, the product of average current and average voltage does not yield average power.
Best Answer
In a steady-state circuit, if you average the "instantaneous power" over a cycle, you get "real power"... so yes, they are the same.
Furthermore, this is how power meters work, to show what the real power consumed. They average the instantaneous voltage and current (vectors) over a few seconds.
If you know what power factor is, see this answer for more details: https://electronics.stackexchange.com/a/50034/16096
edit:
unless you are taking about some appliance like an air conditioner.. whose power consumption changes as it turns on and off.. then the "average power" would be averaged over the day