Real time simulation of power systems