Hi,
It seems like you are facing a problem with the Simscape Dynamic Power Load block, which only allows for discharging of the battery and not charging. In order to accurately model the behavior of the battery during both discharge and charge cycles, you may want to consider using other Simscape Electrical components such as the Simscape Electrical Two-Quadrant Chopper block.
The Simscape Electrical Two-Quadrant Chopper block is a versatile component that can be used to simulate both the charging and discharging of a battery. It allows you to specify the desired voltage and current values for both the charging and discharging cycles, and it can also be used to implement various charging and discharging algorithms.
Alternatively, you can consider creating your own custom Simscape Electrical component using the Simscape Language. This would allow you to create a customized battery model that can accurately simulate the charging and discharging cycles of the battery based on your specific requirements.
If you still want to use the Dynamic Power Load block, you may need to adjust the solver settings in order to prevent instability. This may involve increasing the simulation time step, reducing the maximum step size, or changing the solver algorithm used by Simscape. However, this may result in longer simulation times and less accurate results.
In summary, there are several approaches you can take to accurately model the charging and discharging cycles of a battery in Simscape. The best approach depends on the specific requirements of your simulation and the level of accuracy you need.
For further reference please refer:
Hope this helps!