Text this: On the Optimal Selection and Integration of Batteries in DC Grids through a Mixed-Integer Quadratic Convex Formulation