Hardware implementation of the Real-time online optimization of motor-drive