Hi, I have an assignment to implement a battery balancing simulator. I am assuming a two-step linear discharge curve for the battery. For this assignment i will only consider the discharge cycle. I want to use a simple algorithm that balances based on voltage difference between the batteries, such that if the difference is more than a specified threshold the battery with lower voltage is switched off. But when i calculate the current sourced from each battery the battery with the maximum voltage supplies all the current and other batteries receive current even when the difference is below threshold. It makes sense that this would happen but then how does a battery pack work if there is a minor difference in the voltages in the batteries and the cell with highest voltage supplies all the current? Any suggestions on how can i improve the algorihtm is also welcome. Thanks.