A bidirectional converter for the integration of LiFePO4 batteries with RES-based generators Part I: Revising and finalizing design