Permanent Magnet Motor Simulation