Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

- Set `zip(..., strict=True)` in solver and expression tree files to ensure iterable length safety. ([#5241](https://github.com/pybamm-team/PyBaMM/pull/5241))
- Adds `options` property to IDAKLU, fixes pickling issue with `__getstate__` when keys are not available. ([#5234](https://github.com/pybamm-team/PyBaMM/pull/5234))
- Fixed a bug where no error was raised if a list of input sets were provided to the solver while Experiments were being used ([#5226](https://github.com/pybamm-team/PyBaMM/pull/5226))
- Fixed a bug where simulations using output variables in `IDAKLUSolver` couldn't be pickled ([#5225](https://github.com/pybamm-team/PyBaMM/pull/5225))
- Added explicit warning in installation docs about unmaintained Conda recipe due to pybammsolvers split (Fixes #5155). See pull request [#5206](https://github.com/pybamm-team/PyBaMM/pull/5206)
- Fixed a bug where time-based Heaviside or modulo discontinuities could trigger out-of-bounds errors in time arrays. ([#5205](https://github.com/pybamm-team/PyBaMM/pull/5205))
Expand Down
6 changes: 6 additions & 0 deletions src/pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@ def solve(

elif self.operating_mode == "with experiment":
callbacks.on_experiment_start(logs)

if isinstance(inputs, list):
raise pybamm.SolverError(
"Solving with a list of input sets is not supported with experiments."
)

self.build_for_experiment(
initial_soc=initial_soc,
direction=direction,
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,3 +952,17 @@ def test_simulation_cannot_force_calc_esoh(self):
UserWarning, match="Model is not suitable for calculating eSOH"
):
sim.solve([0, 1], calc_esoh=True)

def test_error_solve_with_multiple_inputs_and_experiment(self):
experiment = pybamm.Experiment([("Charge at 1C for 1 hour")])
model = pybamm.lithium_ion.SPM()
sim = pybamm.Simulation(model, experiment=experiment)
parameter_loop = [
{"Current function [A]": 2},
{"Current function [A]": 4},
]
with pytest.raises(
pybamm.SolverError,
match="list of input sets is not supported with experiments",
):
sim.solve(inputs=parameter_loop)
Loading