我正在设计一种电池模型及其控制,以进行循环充电和放电。电池模型是通过使用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!
1条答案
按热度按时间qeeaahzv1#
我在这里老实说,我不是一个真正在这个主题上有任何差距的人,但我认为你可能想要重新考虑指控/解散的条件。
对我来说,这似乎是多余的,但罪魁祸首可能是从出院状态转换到休息状态的条件。
在浮点数中寻找精确的等价物从来都不是一个好主意。尝试使用
SOC <= 0.01
。同样的道理也适用于充电到静止的过渡。希望我说的不是胡说八道。