I understand that you are facing issues while running your algorithm to estimate SOC and SOH for your BMS. Some possible reasons for the error are mentioned below.
- If you are using the Simscape battery (available at Simscape/Electrical/Sources) model it needs to be ensured that the model follows the specific chemistry, like voltage dynamics,temparature effect and charging dynamics of the battery for which BMS needs to be implemented.
- A low-pass filter can be added to reduce the noise at voltage and current measurements.
- Ensure the initial values of SOC and SOH are close to the actual values.
Further, the blocks SOC Estimator and SOH Estimator available at Simscape/Battery/BMS/Estimators can be used directly in Simulink. The following documentation can be followed:
Some examples of SOC and SOH estimation models can be found here.
Hope this helps resolve the issue.