Optimisation and Control of Distributed Energy Resources for Power and Voltage Regulation in Distribution Networks