Designing of cost-effective and low-carbon multi- energy nanogrids for residential applications