Error in defining custom experiment. #4024
Unanswered
kumaryash7
asked this question in
Q&A
Replies: 1 comment 2 replies
-
This is a bug, it's fixed in develop #4018 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to define a custom experiment where I am trying to use Discharge capacity as a termination condition for my experiment.
The part of my code implementing this is : -
import pybamm
model = pybamm.lithium_ion.DFN()
model.variables["Capac [A.h]"] = model.variables['Discharge capacity [A.h]']
parameter_values = pybamm.ParameterValues("Prada2013")
def cap_cutoff(variables):
return variables["Capac [A.h]"] - 0.46
The CustomTermination class takes a name and function
cap_termination = pybamm.step.CustomTermination(
name="Capacity cut-off [A.h]", event_function=cap_cutoff
)
Provide a list of termination events, each step will stop whenever the first
termination event is reached
terminations = [cap_termination]
experiment = pybamm.Experiment(
[
(
pybamm.step.c_rate(1, termination=terminations),
)
)
sim = pybamm.Simulation(model, parameter_values=parameter_values, experiment=experiment)
sim.solve(initial_soc=1)
This is giving error as : -
ModelError:
No key set for variable 'Discharge capacity [A.h]'. Make sure it is included in either
model.rhs or model.algebraic in an unmodified form
(e.g. not Broadcasted).
Beta Was this translation helpful? Give feedback.
All reactions