This research studies the modeling, control and optimization of power networks. A unifying mathematical approach is proposed for the modeling of both the physical power network as well as market dynamics. For the physical system, several models of varying complexity describing the changes in frequency and voltages are adopted. For the electricity market, various dynamic pricing algorithms are proposed that ensure a optimal dispatch of power generation and demand (via flexible loads). Such pricing algorithms can be implemented in real-time and using only local information that is available in the network (such as the frequency). By appropriately coupling the physical dynamics with the pricing algorithms, stability of the combined physical-ec...