Given the increased penetration of smart grid technologies, distribution system operators are obliged to consider in their planning stage both the increased uncertainty introduced by non-dispatchable distributed energy resources, as well as the operational flexibility provided by new real-time control schemes. First, in this paper, a planning procedure is proposed which considers both traditional expansion measures, e.g. upgrade of transformers, cables, etc., as well as real-time schemes, such as active and reactive power control of distributed generators, use of battery energy storage systems and flexible loads. At the core of the proposed decision making process lies a tractable iterative AC optimal power flow method. Second, to avoid the need for a real-time centralised coordination scheme (and the associated communication requirements), a local control scheme for the operation of individual distributed energy resources and flexible loads is extracted from offline optimal power flow computations. The performance of the two methods is demonstrated on a radial, low-voltage grid, and compared to a standard local control scheme.