Internal model based framework for tracking and fault tolerant control of a permanent magnet