Battery Management in Off-Grid Systems