我正在设计一个电池模型及其控制,以进行循环充电和放电。电池模型是通过使用simscape电池块(基于表格(创建的。控件使用Stateflow建模。状态流程图将SOC值作为输入,并提供电流值作为输出。默认情况下,电池将处于静止状态,并且在该状态下不会消耗电流(I=0A(。然后基于电池的SOC%,它进入充电(3A电流(或放电(-3A电流(状态。我已将控件定义如下。
- 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!
老实说,我不是这个话题的真正参与者,但我认为你可能需要重新思考充电/放电的条件。
SOC >= 0.5 || SOC == 1
对我来说似乎是多余的,但罪魁祸首可能是从出院状态过渡到休息状态的条件。
SOC == 0.001
在浮点数中寻找精确的等价性从来都不是一个好主意。尝试使用SOC <= 0.01
。充电到休息的转换也是如此。希望我在这里不是在胡说八道。