pybamm-team / liionpack

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

[Bug]: ECM model does not work (solvers.py tries to get initial SOC from concentrations) #304

Open Nomados opened 3 months ago

Nomados commented 3 months ago

liionpack Version

0.3.8

Python Version

3.8

Describe the bug

When trying to model with ECM model parameters (that was checked with pybamm separately) I am getting this error:

File "liionpack/solver_utils.py", line 427, in solve output = rm.solve( File "liionpack/solvers.py", line 207, in solve self.setup_actors(nproc, self.inputs_dict, initial_soc) File "liionpack/solvers.py", line 478, in setup_actors a.setup( File "liionpack/solvers.py", line 46, in setup _, _ = lp.update_init_conc(parameter_values, initial_soc, update=True) File "liionpack/sim_utils.py", line 53, in update_init_conc c_n_max = param["Maximum concentration in negative electrode [mol.m-3]"] KeyError: 'Maximum concentration in negative electrode [mol.m-3]'

Ofc it makes no sense for the ECM model but it is enforced in solvers.py (line 39) ` self.parameter_values = parameter_values if initial_soc is not None: if ( (type(initial_soc) in [float, int]) or (type(initial_soc) is list and len(initial_soc) == 1) or (type(initial_soc) is np.ndarray and len(initialsoc) == 1) ): , _ = lp.update_init_conc(parameter_values, initial_soc, update=True) else: lp.logger.warning( "Using a list or an array of initial_soc "

Steps to Reproduce

No response

Expected behaviour

No response

Relevant log output

No response

Additional context

No response

Nomados commented 3 months ago

actually a life example with ECM would be really cool