liionpack icon indicating copy to clipboard operation
liionpack copied to clipboard

power charging

Open kenan991 opened this issue 3 years ago • 24 comments

Is there a specific reason why other than in PyBaMM there are only constant current operations are supported? in another word is there any way I can dis/charge power from/to battery? and is liionpack a suitable library for simulating the behavior of a bigger battery like a power bank?

kenan991 avatar Jan 12 '22 09:01 kenan991

No specific reason other than it hasn't been developed yet. liionpack is still pre-release. If you are interested in adding that functionality we can help and that would be great

TomTranter avatar Jan 12 '22 10:01 TomTranter

@cyasing

TomTranter avatar Feb 01 '23 16:02 TomTranter

@OlliRuokojoki

TomTranter avatar Feb 01 '23 16:02 TomTranter

So I think we'd need to control power at the pack level and then work out the total pack voltage then divide power by this to get current and apply the single step currents as normal

TomTranter avatar Feb 01 '23 16:02 TomTranter

Have to allow power control in protocols https://github.com/pybamm-team/liionpack/blob/develop/liionpack/protocols.py

TomTranter avatar Feb 01 '23 16:02 TomTranter

It's used in the solver here https://github.com/pybamm-team/liionpack/blob/b1a1ddbc6f607f24b3f916b8cc68f4a17980cf2e/liionpack/solvers.py#L319

TomTranter avatar Feb 01 '23 16:02 TomTranter

And here https://github.com/pybamm-team/liionpack/blob/b1a1ddbc6f607f24b3f916b8cc68f4a17980cf2e/liionpack/solvers.py#L425

TomTranter avatar Feb 01 '23 16:02 TomTranter

Terminal voltage can be used to divide power to set terminal current. This is set here https://github.com/pybamm-team/liionpack/blob/b1a1ddbc6f607f24b3f916b8cc68f4a17980cf2e/liionpack/solvers.py#L431 I guess using the value from previous time step should work

TomTranter avatar Feb 01 '23 16:02 TomTranter

@cyasing

Thank you.

cyasing avatar Feb 01 '23 16:02 cyasing

Terminal voltage can be used to divide power to set terminal current. This is set here

https://github.com/pybamm-team/liionpack/blob/b1a1ddbc6f607f24b3f916b8cc68f4a17980cf2e/liionpack/solvers.py#L431

I guess using the value from previous time step should work

It looks like the terminal voltage is set after solving solve_circuit_vectorized(netlist) in the function _step(), which in itself requires current value I_map to solve: https://github.com/pybamm-team/liionpack/blob/b1a1ddbc6f607f24b3f916b8cc68f4a17980cf2e/liionpack/solvers.py#L425 Power needs to be converted to current before that, doesn't it?

cyasing avatar Feb 02 '23 07:02 cyasing

Yep you could loop in the initialisation step to get the right current

TomTranter avatar Feb 02 '23 09:02 TomTranter

@cyasing I could work with you on this issue. Can I find you for example in the pybamm Slack channel so we could chat?

OlliRuokojoki avatar Feb 02 '23 16:02 OlliRuokojoki

@cyasing I could work with you on this issue. Can I find you for example in the pybamm Slack channel so we could chat?

@OlliRuokojoki I don't have a slack account yet. I'll ask for an invitation.

cyasing avatar Feb 02 '23 18:02 cyasing

Use this invite https://join.slack.com/t/pybamm/shared_invite/zt-1obrjh8fr-FKm~sT8693cZnAcim5dh~A

TomTranter avatar Feb 02 '23 19:02 TomTranter

Use this invite https://join.slack.com/t/pybamm/shared_invite/zt-1obrjh8fr-FKm~sT8693cZnAcim5dh~A

Thanks!

cyasing avatar Feb 02 '23 19:02 cyasing

Did you get something working for this? I ask because the script you use on the other issue uses power

TomTranter avatar Feb 14 '23 11:02 TomTranter

Did you get something working for this? I ask because the script you use on the other issue uses power

I have added some code to convert power to current in the way you described, but getting that to test requires me to figure out the problem with the shifting solver, or at least the reason behind the capacity warning coming up in it. It's in a loop.

cyasing avatar Feb 14 '23 11:02 cyasing

Is everything you are working on in a branch somewhere I can take a look at?

TomTranter avatar Feb 14 '23 12:02 TomTranter

I had forked the repository, actually. It is here: https://github.com/cyasing/liionpack-power-trial.git . Do tell me if forking like this is not something I should do.

cyasing avatar Feb 14 '23 12:02 cyasing

Hi, Is anyone still working on this? I'd really need this feature.

OlliRuokojoki avatar May 29 '23 08:05 OlliRuokojoki

Hey @OlliRuokojoki - I made some changes to the vectorized circuit solve which iterates until a certain power is within tolerance. I haven't updated any solvers to accommodate this change yet but there is an example of how you would call this function. Do you think you can handle doing the rest? I don't have much time to work on this right now

TomTranter avatar Jun 07 '23 15:06 TomTranter

FYI - there is a PyBaMM change to experiments coming in to the next release imminently so might make sense to wait for that https://github.com/pybamm-team/PyBaMM/pull/2960

TomTranter avatar Jun 08 '23 13:06 TomTranter

Hi @TomTranter, I have now simplified my large battery pack to just a single large battery cell as basic PyBaMM works much better. I may just keep working on my simulation with the single cell to make the process a lot easier.

By the way does Liionpack support drive cycles? If I used drive cycles and current data I could get the results I'm looking for. At some lower and upper voltages I could stop the drive cycle, write new current data based on the new terminal voltage and then continue the drive cycle at the point it was interrupted by my voltage check. Do you think this approach is feasible with Liionpack?

Thanks for the help!

OlliRuokojoki avatar Jun 12 '23 20:06 OlliRuokojoki

It does support drive cycles but stopping and re-starting simulations with old solution is not totally straight forward. Our plan is to merge liionpack into PyBaMM so the solvers and experiments will all work exactly the same in future. It's just quite a big job and other things have taken priority right now. If you can get the single PyBaMM model working for your needs I would stick with that

TomTranter avatar Jun 13 '23 10:06 TomTranter