You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,I encountered a problem when simulating liionpack. When I used the discharge capacity as the output variable, the following error occurred. I would be very grateful if you could answer my question!
import pybamm
import liionpack as lp
import numpy as np
import matplotlib.pyplot as plt
I_mag = 30.0
OCV_init = 4.0 # used for intial guess
Ri_init = 5e-2 # used for intial guess
R_busbar = 1.5e-3
R_connection = 1e-2
Np = 4
Ns = 1
Nbatt = Np * Ns
netlist = lp.setup_circuit(Np=Np, Ns=Ns, Rb=R_busbar, Rc=R_connection, Ri=Ri_init, V=OCV_init, I=I_mag)
cycle_number = 100
experiment = pybamm.Experiment(
["Charge at 15 A for 10 minutes", "Rest for 10 minutes", "Discharge at 15 A for 10 minutes", "Rest for 10 minutes"]*100,
period="30 seconds",)
parameter_values = pybamm.ParameterValues("Chen2020")
output_variables = [
'Discharge capacity [A.h]',
'Total capacity lost to side reactions [A.h]',
'Total lithium capacity [A.h]',
'Voltage [V]',
'Resistance [Ohm]',
'Loss of capacity to negative SEI [A.h]',
'Loss of capacity to positive SEI [A.h]',
]
def SEI_degradation(parameter_values=None):
"""
Create a PyBaMM simulation set up for integration with liionpack
Args:
parameter_values (pybamm.ParameterValues):
The default is None.
Returns:
pybamm.Simulation:
A simulation that can be solved individually or passed into the
liionpack solve method
"""
# Create the pybamm model
model = pybamm.lithium_ion.SPM(
options={
"SEI": "ec reaction limited",
"SEI film resistance": "distributed",
"SEI porosity change": "true",
}
)
# Add events to the model
model = lp.add_events_to_model(model)
# Set up parameter values
if parameter_values is None:
parameter_values = pybamm.ParameterValues("Chen2020")
# Set up solver and simulation
solver = pybamm.CasadiSolver(mode="safe")
sim = pybamm.Simulation(
model=model,
parameter_values=parameter_values,
solver=solver,
)
return sim
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,I encountered a problem when simulating liionpack. When I used the discharge capacity as the output variable, the following error occurred. I would be very grateful if you could answer my question!
import pybamm
import liionpack as lp
import numpy as np
import matplotlib.pyplot as plt
I_mag = 30.0
OCV_init = 4.0 # used for intial guess
Ri_init = 5e-2 # used for intial guess
R_busbar = 1.5e-3
R_connection = 1e-2
Np = 4
Ns = 1
Nbatt = Np * Ns
netlist = lp.setup_circuit(Np=Np, Ns=Ns, Rb=R_busbar, Rc=R_connection, Ri=Ri_init, V=OCV_init, I=I_mag)
cycle_number = 100
experiment = pybamm.Experiment(
["Charge at 15 A for 10 minutes", "Rest for 10 minutes", "Discharge at 15 A for 10 minutes", "Rest for 10 minutes"]*100,
period="30 seconds",)
parameter_values = pybamm.ParameterValues("Chen2020")
output_variables = [
'Discharge capacity [A.h]',
'Total capacity lost to side reactions [A.h]',
'Total lithium capacity [A.h]',
'Voltage [V]',
'Resistance [Ohm]',
'Loss of capacity to negative SEI [A.h]',
'Loss of capacity to positive SEI [A.h]',
]
def SEI_degradation(parameter_values=None):
"""
Create a PyBaMM simulation set up for integration with liionpack
parameter_values.update({"EC initial concentration in electrolyte [mol.m-3]": "[input]"})
EC_conc=np.array([4000.0, 3500.0, 3000.0, 2500.0])
inputs = {"EC initial concentration in electrolyte [mol.m-3]": EC_conc}
output = lp.solve(
netlist=netlist,
parameter_values=parameter_values,
experiment=experiment,
sim_func=SEI_degradation,
output_variables=output_variables,
initial_soc=0.5,
inputs=inputs,
)
lp.plot_output(output)
lp.show_plots()
NotImplementedError: <class 'pybamm.expression_tree.unary_operators.ExplicitTimeIntegral'> does not implement _unary_evaluate.
Beta Was this translation helpful? Give feedback.
All reactions