Skip to content

Commit

Permalink
added PR to changelog and tests for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishab87 committed Feb 21, 2025
1 parent 435ad80 commit 9084495
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
29 changes: 29 additions & 0 deletions tests/unit/test_experiments/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9084495

Please sign in to comment.