Abstract: Embodiments relate to an operating system coupled to and controlling at least one Distributed Energy Resource (DER) in a smart grid and includes an electricity distribution network and a 2-dimensional Extremum Seeking (2D-ES) controller coupled to network. The electricity distribution network has first and second inputs and one output and maps all active power and reactive power inputs to the smart grid providing measurements of an objective function. The 2D-ES controller controls the DER and includes an active power loop and a reactive power loop. The active power loop is in communication with the first input and the output, governs active power contribution, and receives measurements of the objective function which contain static and oscillatory components. The reactive power loop is in communication with the second input and the output, governs reactive power contribution, and receives measurements of the objective function which contain static and oscillatory components.