Real-time Simulator of Permanent-magnet Synchronous Motor Based on Programmable Logical Devices