A Cost Modeling Framework For Modular Battery Energy Storage Systems