Electrochemical energy storage safety analysis and design scheme