Home > database >  Battery management using MATLAB Simulink and Stateflow
Battery management using MATLAB Simulink and Stateflow

Time:08-11

I am designing a battery model and its control to undergo cyclic charge and discharge. The battery model is created by using a simscape electrical battery block (Table-based). The control is modeled using Stateflow. The stateflow chart takes SOC values as inputs and provides current values as outputs. By default, the battery will be at rest and no current is drawn at that state (I=0A). And then based on the SOC % of the battery, it goes to charge (3A current) or discharge (-3A current) state. I have defined the controls as follows.

- If the battery has SOC >= 50%, it has to discharge.  
- If the battery   has SOC < 50%, it has to charge. 
- While discharging, if the battery reaches 0% SOC, it goes to rest. 
- While charging, if the battery reaches 100% SOC, it goes to rest.

I have defined the initial SOC as 50%.
When I run the simulation, the battery started to discharge as per the condition provided in the stateflow chart.
I = -3
But the battery has not come to rest after reaching 0% S0C.
I am getting a warning that,
*At time 1944.017100, one or more assertions are triggered. State of charge must be greater than or equal to zero. The assertion comes from: Block path: Example_cell_model/Battery (Table-Based)1Assert location:  o (location information is protected)*

I don't understand why the battery has not come back to rest.
Does anyone have any idea of [enter image description here][1]the cause of this problem and how to resolve it?

[Battery model][1]
[Stateflow chart][2]
[Simulation result][3]
[Warning message][4]


  [1]: https://i.stack.imgur.com/TFstb.png
  [2]: https://i.stack.imgur.com/PbtuD.png
  [3]: https://i.stack.imgur.com/kUAP4.png
  [4]: https://i.stack.imgur.com/njLQy.png

Thanks in advance! 

CodePudding user response:

I'll be honest here, i'm not really someone who's in this topic by any margin but, i think you might want to rethink the conditions for charge/dischare.

SOC >= 0.5 || SOC == 1

seems redundant to me for one, but the culprit might be the condition for the transition from discharge to rest state.

SOC == 0.001

It's never really a good idea to look for exact equivalencies in floating point numbers. Try going for SOC <= 0.01. The same applies with charge to rest transition. Hope i'm not talking complete nonsense here.

  • Related