Supercapacitor Charging and Discharging Behavior
This example shows the voltage output by a Supercapacitor block as it is charged and then discharged. To charge the Supercapacitor, a current of 100 mA is input to the Supercapacitor for 100 seconds. The Supercapacitor is then rested for one minute. For the next hour, to discharge the Supercapacitor, a load of 50 mA is stepped on for one second in every 50 seconds. The Supercapacitor is then rested until the end of the simulation. The scope displays the Supercapacitor charging/discharging current and voltage.
Model

Results from Real-Time Simulation
This example has been tested on these platforms:
Speedgoat™ Performance real-time target machine with an Intel® 3.5 GHz i7 multi-core CPU and 4 GB RAM.
dSPACE® SCALEXIO LabBox with Intel® Core XEON E3-1275v3 at 3.5GHz and 4 GB RAM.
You can run this model in real time with a step size of 10 microseconds by using the Simscape local solver. For small sample rates, a task overrun might occur during the initial task execution due to a cold cache. To avoid this overrun, if the selected platform supports these options, relax the start-up behavior by specifying a limited number of task overruns or increasing the sample time of periodic tasks during the start-up phase of the real-time application.