pybamm-team / liionpack

A battery pack simulation tool that uses the PyBaMM framework
https://liionpack.readthedocs.io/en/latest/
MIT License
90 stars 30 forks source link

[Bug]: running an experiment where amperage is described in C ratings causes errors #201

Open skywo1f opened 1 year ago

skywo1f commented 1 year ago

liionpack Version

June 2022

Python Version

3.8

Describe the bug

running an experiment where amperage is described in C ratings causes errors


experiment = pybamm.Experiment(
    [

            "Charge at 1 C until 3.65 V",
            "Hold at 3.65 V until C/10",
            "Rest for 5 minutes",
            "Discharge at 3 C until 2.5 V",
            "Rest for 5 minutes",

    ],period="10 seconds"
    )

causes:

Traceback (most recent call last):
  File "testA.py", line 44, in <module>
    output = lp.solve(netlist=netlist,
  File "/home/iviti/batterySims/liionpack/liionpack/solver_utils.py", line 436, in solve
    output = rm.solve(
  File "/home/iviti/batterySims/liionpack/liionpack/solvers.py", line 317, in solve
    self.protocol = lp.generate_protocol_from_experiment(experiment, flatten=True)
  File "/home/iviti/batterySims/liionpack/liionpack/protocols.py", line 28, in generate_protocol_from_experiment
    if t % dt != 0:
TypeError: unsupported operand type(s) for %: 'NoneType' and 'float'

Steps to Reproduce

run any experiment where discharging or charging is described in terms of C

Expected behaviour

This works in regular pybamm

Relevant log output

No response

Additional context

No response

philgravy commented 3 months ago

did you ever fix this? I'm trying to run experiments like that but I keep getting errors that say "only current operations are supported". Looking into modifying the source code but I'm curious if you've fixed it before I try doing so