The battery model currently charges in large chunks cycling the battery (typically p_batt_ch = battery_max_rate until SOC = 100%).
This is caused by the GLPK_MI solver which uses the revised simplex method [1]. The revised simplex method promotes a large basis (prefers solutions in which the highest number of decision variables is 0). In the linear case/for the L1 norm this causes large peaks in the decision variable p_batt_ch and other energy storage systems.
A simple example (you can think of c as the TOU price vector and x as p_batt_ch):
max (sum(c*x[i]))
subject to: sum(x[i]) <= 13
x[i] <=5
c = [1, 1, 1, 1.1, 1]
Intuitively there are many solutions to this problem. The non-uniformity of c promotes charging the maximum amount at i=4 but the rest of the time steps have equivalent rewards.
argmax = {[5, 0, 0, 5, 3], or [5, 3, 0, 5, 0], or [2, 2, 2, 5, 2]}. The revised simplex method promotes solutions 1 and 2. However, generally we desire solution 3 in which the battery charges for a longer time period at a slower rate [cite?].
This can be solved linearly if we explicitly penalize the change in charge rate by some weighting factor lambda. Let x_init be the observed rate of charge taken in the last time step.
max (sum(c*x[i]) + lambda * sum [abs(dx)])
subject to: sum(x[i]) <= 13
dx[0] = x_init - x[0]
dx[i] = x[i-1] - x[i]
x[i] <=5
c = [1, 1, 1, 1.1, 1]

[1] https://www.gnu.org/software/glpk/
[2] https://www.researchgate.net/publication/226205536_Hyper-Sparsity_in_the_Revised_Simplex_Method_and_How_to_Exploit_it