In tokamak and other fusion devices, magnetic control is the main tool that allows to regulate the plasma current, position and shape; it is in charge of actuating the desired plasma current waveform, steering the plasma position to a given set point and maintain the plasma shape close to a prescribed plasma equilibrium. This work describes the application of several physics concepts and computational tools in order to obtain a novel optimal controller for the plasma centroid position, which has been implemented and tested in the real-time plasma control system at the ISTTOK tokamak. A key point for the development of the new control system was the installation of a recently upgraded hardware, that numerically integrates in real-time the magnetic probes signals.INDEX TERMS Real-time control, plasma current, plasma current centroid position, magnetic probe, poloidal field coils, numerical integration.