Advanced hierarchical control and stability analysis of DC microgrids