Permenant Magnet Syncronous Motor Driver and Supporting Code/Sims