Accurate Modeling of Li-ion Cells Applied to LiFePO4 and NMC Chemistries