Fundamentals of energy storage devices