A capacitor is a simple way to model a battery. Say 1000 F. The time step might need to be increased to suit.
Since a battery has internal resistance, put a few tenths of an ohm inline.
Since a battery will self-discharge, put a resistor across the capacitor (say 470 ohms).
When we compare charging curves, the capacitor volt level rises on a curve similar to charging a battery.
However when starting out fully charged, the capacitor volt level drops much more steeply compared to the battery.
When discharging a fully charged cap, its ampere flow resembles a battery.
However when charging, the capacitor ampere flow drops much more steeply than the battery.
There are anomalies which will take effort and ingenuity to remedy.
- - - Updated - - -
Screenshot: