diff --git a/CHANGELOG.md b/CHANGELOG.md index 51157cd497..5e4e4bf106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Creates a 'calc_esoh' property in battery models ([#4825](https://github.com/pybamm-team/PyBaMM/pull/4825)) - Added 'get_summary_variables' to return dictionary of computed summary variables ([#4824](https://github.com/pybamm-team/PyBaMM/pull/4824)) - Added support for particle size distributions combined with particle mechanics. ([#4807](https://github.com/pybamm-team/PyBaMM/pull/4807)) +- Added InputParameter support in PyBamm experiments ([#4826](https://github.com/pybamm-team/PyBaMM/pull/4826)) ## Breaking changes diff --git a/tests/integration/test_experiments.py b/tests/integration/test_experiments.py index e31f098184..687ac5fab6 100644 --- a/tests/integration/test_experiments.py +++ b/tests/integration/test_experiments.py @@ -89,7 +89,7 @@ def test_infeasible(self): def test_drive_cycle(self): drive_cycle = np.array([np.arange(100), 5 * np.ones(100)]).T c_step = pybamm.step.current( - value=drive_cycle, duration=100, termination=["4.00 V"] + value=drive_cycle, duration=100, termination=["< 4.00 V"] ) experiment = pybamm.Experiment( [ diff --git a/tests/unit/test_experiments/test_experiment.py b/tests/unit/test_experiments/test_experiment.py index 2d0cf01461..57f1fac2e8 100644 --- a/tests/unit/test_experiments/test_experiment.py +++ b/tests/unit/test_experiments/test_experiment.py @@ -252,3 +252,32 @@ def test_value_function_with_input_parameter(self): assert direction is None, ( "Expected direction to be None when the expression depends on an InputParameter." ) + + def test_symbolic_current_step(self): + model = pybamm.lithium_ion.SPM() + expr = 2.5 + 0 * pybamm.t + + step = pybamm.step.current(expr, duration=3600) + experiment = pybamm.Experiment([step]) + + sim = pybamm.Simulation(model, experiment=experiment) + sim.solve([0, 3600]) + + solution = sim.solution + voltage = solution["Current [A]"].entries + + np.testing.assert_allclose(voltage[-1], 2.5, atol=0.1) + + def test_voltage_without_directions(self): + model = pybamm.lithium_ion.SPM() + + step = pybamm.step.voltage(2.5, termination="2.5 V") + experiment = pybamm.Experiment([step]) + + sim = pybamm.Simulation(model, experiment=experiment) + + sim.solve() + solution = sim.solution + + voltage = solution["Terminal voltage [V]"].entries + assert np.allclose(voltage, 2.5, atol=1e-3)