In this article, by calculating the potential energy of generators, a dynamic real-time energy function based power grid model for the multimachine system is proposed based on available measurement (synchrophasor and prediction). Then, a wide-area optimal control framework that can control multiple generators simultaneously to enhance the transient stability of the system and increase the stability margin is designed and implemented. The main contributions are the proposed dynamic model is dynamic, feasible, and can effectively capture grid dynamics and transients. Furthermore, the architecture provides a dynamic state-space model based on grid events. The proposed approach has been tested on IEEE 68 bus test system and the results are provided. It is observed that the proposed control architecture provides an increased stability margin (up to 60%) and improved critical clearing time by 30%.