This document presents a generic Optimal Power Flow Formulation (OPF) for operating Active Distribution networks during grid-connected and gridislanded modes. The optimization model is intended to be executed in real-time, considering the effect of droop controls. Hence, fast convergence and global optimum are required to guarantee the grid’s optimal operation during these two operation modes. For this reason, the mixed integer nonlinear programming model is relaxed into a convex optimization model. Several approaches are discussed to evaluate the convergence and computation time performance. The results demonstrate that the Wirtinger linearization presents the best performance; furthermore, the optimization model guarantees a proper and safe operation while minimizing operations costs.