Skip to content

[Bug]: Error on equivalent_circuit_identification.ipynb #341

Description

@victorventuri

Python Version

3.9.6

Describe the bug

When attempting to run examples/notebooks/equivalent_circuit_identification.ipynb, an error occurs on the 5th cell, line 3: values = model.predict(t_eval=t_eval)

The error reads AttributeError: 'ParameterSet' object has no attribute 'get'

The traceback is below in the log output.

This is happening with PyBOP 24.3, and the underlying PyBaMM is 24.1. I am still learning to use PyBOP and PyBaMM, so any help would be greatly appreciated.

Steps to reproduce the behaviour

This happened by just running the notebook.

Relevant log output

{
	"name": "AttributeError",
	"message": "'ParameterSet' object has no attribute 'get'",
	"stack": "---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], line 3
      1 sigma = 0.001
      2 t_eval = np.arange(0, 900, 3)
----> 3 values = model.predict(t_eval=t_eval)
      4 corrupt_values = values[\"Voltage [V]\"].data + np.random.normal(0, sigma, len(t_eval))
      6 # Form dataset

File ~/python_envs/pkgs_batt_test/lib/python3.9/site-packages/pybop/models/base_model.py:491, in BaseModel.predict(self, inputs, t_eval, parameter_set, experiment, init_soc)
    489 if self._unprocessed_model is not None:
    490     if experiment is None:
--> 491         return pybamm.Simulation(
    492             self._unprocessed_model,
    493             parameter_values=parameter_set,
    494         ).solve(t_eval=t_eval, initial_soc=init_soc)
    495     else:
    496         return pybamm.Simulation(
    497             self._unprocessed_model,
    498             experiment=experiment,
    499             parameter_values=parameter_set,
    500         ).solve(initial_soc=init_soc)

File ~/python_envs/pkgs_batt_test/lib/python3.9/site-packages/pybamm/simulation.py:91, in Simulation.__init__(self, model, experiment, geometry, parameter_values, submesh_types, var_pts, spatial_methods, solver, output_variables, C_rate)
     85         raise NotImplementedError(
     86             \"BasicDFNHalfCell is not compatible with experiment simulations.\"
     87         )
     89 if experiment is None:
     90     # Check to see if the current is provided as data (i.e. drive cycle)
---> 91     current = self._parameter_values.get(\"Current function [A]\")
     92     if isinstance(current, pybamm.Interpolant):
     93         self.operating_mode = \"drive cycle\"

AttributeError: 'ParameterSet' object has no attribute 'get'"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions