Li-ion batteries are commonly used in stationary and mobile energy systems, and its markets are growing rapidly. Due to the high impact of energy costs on the economics and life cycle assessment, the efficiency of storing electrical energy becomes one of the main points of interest. This can be reached by improving the general efficiency of the battery or optimization of the system design. Furthermore, in heterogeneous storage systems, the distribution of the requested power to different battery systems can be optimized as a control problem, which is the topic of this work. Therefore, the effective total loss of energy of the distribution of power over time between the distinct subsystems is used as cost function. In literature, the model predictive control (MPC) is often used for this approach due to its online solubility. Anyhow, with the standard algorithms such as interior point or sequential quadratic programming, only local optima can be achieved. Furthermore, most authors restrict themselves to fast charging trajectories. In this study, the MPC algorithm is compared to the global optima of the dynamic programming (DP) approach for different power distribution cases. A system of 3 batteries with the respective power electronics which are connected to a superimposed grid via a central connection point is analyzed. To reduce the computational load, an energy flow model is developed and verified. Due to the system’s 3-dimensional state space, the DP is parallelized and calculated on a high-performance computing cluster. The system is reviewed by both optimization strategies for a homogenous and a heterogenous share of the battery energies. Additionally, the aging of one battery is considered by decreasing the energy and efficiency by 20% for both system cases. The system’s load consists of a bi- and unidirectional power distribution. All evaluations are carried out by MPC and DP. As a result, the DP is superior to the MPC in all studied cases. Systems without the consideration of aging of one battery achieve almost the same values for the total loss of energy. Nonetheless, the difference for the other cases is significant. Therefore, suggestions for improving the MPC with a penalty term or the use of the DP inside the MPC are given.