can you please tell me how to calculate the effective power from an rectangular current and a retangular voltage.
The phase difference between both signals is zero.
Effective power can be calculated as the product of the rms voltage and current (the apparent power), multiplied by the power factor (the cosine of the phase angle between the voltage and the current).
you said nothing about, but I suppose you want a DSP/ MPU to compute it...
In simple words, multiply the samples of the Instaneous voltage by the samples of the instantaneous current, accumulating it along N samples, so divide the result by N.
N is given by the product of the sampling frequency by the integration period (chose suitable sampling frequency and integration period!)