Analysis a DSP Implementation and Experimental Validation of a Loss Minimization Algorithm Applied to Permanent Magnet Synchronous Motor Drives