Skip to content

Commit

Permalink
#1726 merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Oct 27, 2021
2 parents fc46433 + f2c36a1 commit 3b3cf0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Features

- Summary variables can now be user-determined ([#1759](https://github.com/pybamm-team/PyBaMM/pull/1759))
- Added `all_first_states` to the `Solution` object for a simulation with experiment ([#1759](https://github.com/pybamm-team/PyBaMM/pull/1759))
- Added a new method (`create_gif`) in `QuickPlot`, `Simulation` and `BatchStudy` to create a GIF of a simulation ([#1754](https://github.com/pybamm-team/PyBaMM/pull/1754))
- Added more examples for the `BatchStudy` class ([#1747](https://github.com/pybamm-team/PyBaMM/pull/1747))
- SEI models can now be included in the half-cell model ([#1705](https://github.com/pybamm-team/PyBaMM/pull/1705))
Expand All @@ -12,6 +13,7 @@
- Half-cell model and lead-acid models can now be simulated with `Experiment`s ([#1759](https://github.com/pybamm-team/PyBaMM/pull/1759))
- Removed in-place modification of the solution objects by `QuickPlot` ([#1747](https://github.com/pybamm-team/PyBaMM/pull/1747))
- Fixed vector-vector multiplication bug that was causing errors in the SPM with constant voltage or power ([#1735](https://github.com/pybamm-team/PyBaMM/pull/1735))

# [v21.9](https://github.com/pybamm-team/PyBaMM/tree/v21.9) - 2021-09-30

## Features
Expand Down
13 changes: 12 additions & 1 deletion pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,20 @@ def solve(
if starting_solution is None:
starting_solution_cycles = []
starting_solution_summary_variables = []
starting_solution_first_states = []
else:
starting_solution_cycles = starting_solution.cycles.copy()
starting_solution_summary_variables = (
starting_solution.all_summary_variables.copy()
)
starting_solution_first_states = (
starting_solution.all_first_states.copy()
)

cycle_offset = len(starting_solution_cycles)
all_cycle_solutions = starting_solution_cycles
all_summary_variables = starting_solution_summary_variables
all_first_states = starting_solution_first_states
current_solution = starting_solution

# Set up eSOH model (for summary variables)
Expand Down Expand Up @@ -894,13 +899,18 @@ def solve(
self._solution = self._solution + cycle_solution

# At the final step of the inner loop we save the cycle
cycle_solution, cycle_summary_variables = pybamm.make_cycle_solution(
(
cycle_solution,
cycle_summary_variables,
cycle_first_state,
) = pybamm.make_cycle_solution(
steps,
esoh_sim,
save_this_cycle=save_this_cycle,
)
all_cycle_solutions.append(cycle_solution)
all_summary_variables.append(cycle_summary_variables)
all_first_states.append(cycle_first_state)

# Calculate capacity_start using the first cycle
if cycle_num == 1:
Expand Down Expand Up @@ -935,6 +945,7 @@ def solve(
if self.solution is not None and len(all_cycle_solutions) > 0:
self.solution.cycles = all_cycle_solutions
self.solution.set_summary_variables(all_summary_variables)
self.solution.all_first_states = all_first_states

pybamm.logger.notice(
"Finish experiment simulation, took {}".format(timer.time())
Expand Down
4 changes: 3 additions & 1 deletion pybamm/solvers/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,14 @@ def make_cycle_solution(step_solutions, esoh_sim=None, save_this_cycle=True):

cycle_summary_variables = get_cycle_summary_variables(cycle_solution, esoh_sim)

cycle_first_state = cycle_solution.first_state

if save_this_cycle:
cycle_solution.cycle_summary_variables = cycle_summary_variables
else:
cycle_solution = None

return cycle_solution, cycle_summary_variables
return cycle_solution, cycle_summary_variables, cycle_first_state


def get_cycle_summary_variables(cycle_solution, esoh_sim):
Expand Down

0 comments on commit 3b3cf0b

Please sign in to comment.