This example provides a charge/discharge control logic to a current source in parallel with the battery model. The control is configured to put the battery through charge/discharge cycles for as long as the simulation runs:
Notice how the charge and discharge cycles take about 30 minutes, which is what was to be expected by charging/discharging a 1A.h battery with a 2A current.