New Control Algorithms for the Distributed Generation Interface in Grid-Connected and Micro-grid Systems