Distribution systems analysis and optimization