Designing a Real-Time Grid Simulator for use in Market and A.G.C. Studies