Current simulation #1639
-
Hello all, |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 21 replies
-
I think the first issue is related to You can check the version by running -
|
Beta Was this translation helpful? Give feedback.
-
If you run the drive cycle using |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification, as you mentioned, when I run the simulation with a defined cycling current and reach cutoff voltage, I run into an error which is probably the same event handling problem with Casadi solver. |
Beta Was this translation helpful? Give feedback.
-
By option 1 I meant can you just pass the current directly from the experiment (i.e. the text file you just shared) and see what the voltage response is? You could pass the whole thing like a drive cycle like in this example. If you are just doing steps of constant current you can do something like import pybamm
experiment = pybamm.Experiment(
[
(
"Discharge at C/5 for 10 hours or until 3.3 V (20 second period)",
"Rest for 1 hour (120 second period)",
"Charge at 1 A until 4.1 V",
"Hold at 4.1 V until 10 mA",
"Rest for 1 hour",
),
]
* 3
)
model = pybamm.lithium_ion.DFN()
sim = pybamm.Simulation(
model, experiment=experiment, solver=pybamm.CasadiSolver("fast with events")
)
sim.solve()
sim.plot(["Current [A]", "Terminal voltage [V]"]) where you can control the resolution of each step by passing a period in brackets (the default is 60s). This produces |
Beta Was this translation helpful? Give feedback.
-
Agreed, we are certainly getting our wires crossed!
So, just to be totally clear, do you want to do cycles of "CCCV charge+rest+CCCV discharge+rest" but with a different constant current in each cycle? Or are you trying to prescibe current as a function of time at some point? In both cases you will need to define each cycle, but you can automate this somewhat. E.g. if you had a number of different currents you wanted to discharge at for each cycle you could do the following import pybamm
# loop to build experiment
discharge_currents = [0.5, 1, 1.5]
cycles = []
for discharge_current in discharge_currents:
cycle = [
(
# use fstring to give current
f"Discharge at {discharge_current}A for 10 hours or until 3.3 V",
"Rest for 1 hour",
"Charge at 1 A until 4.1 V",
"Hold at 4.1 V until 10 mA",
"Rest for 1 hour",
),
]
# add to existing cycles
cycles += cycle
experiment = pybamm.Experiment(cycles)
# set up and solve sim
model = pybamm.lithium_ion.SPMe()
sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver())
sim.solve()
# plot
sim.plot(["Current [A]", "Terminal voltage [V]"]) Re the error it looks like it is in setting the parameters in the rhs of the PDE for the positive particle concentration. @Saransh-cpp if you have time can you take a look at the error and see if it is related to the paramater path (I think you fixed a bug related to this recently?), thanks. |
Beta Was this translation helpful? Give feedback.
-
experiment = pybamm.Experiment(
[
(
"Charge at 1 A until 4.0 V",
"Hold at 4.0 V until 50 mA",
"Rest for 30 minutes",
"Run US06_A (A) until 3.7 V",
"Rest for 30 minutes",
)
]
* 100,
termination="80% capacity",
drive_cycles={
"US06_A": drive_cycle_current,
},
)
|
Beta Was this translation helpful? Give feedback.
-
I think you can use For the error, can you share the script that you are using? |
Beta Was this translation helpful? Give feedback.
-
I just wanted to check in and see if the problem with installing Scikit.ODEs is resolved? I tried to install it via WSL (Ubuntu). The first line
When I wanted to run the last line, I got the error below: error
|
Beta Was this translation helpful? Give feedback.
I think the first issue is related to
pybamm
's version. In some older versions, theInterpolant
class used to take indata
(having two columnsx
andy
), but in the latest versions the class takes inx
andy
separately.You can check the version by running -