Optimized fault detection and control for enhanced reliability and efficiency in DC microgrids