Real-Time Algorithms for Active Power Measurements on PWM-Based Electric Drives