Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on:
pull_request:
schedule:
- cron: "0 7 * * 1" # Every Monday at 07:00 UTC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write # required for OIDC tokenless Codecov upload
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.13"]

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: ${{ matrix.python-version }}

- name: Install package and test dependencies
run: pip install -e ".[test]"

- name: Run unit tests
if: matrix.os != 'ubuntu-latest'
run: pytest -m unit

- name: Run unit tests with coverage
if: matrix.os == 'ubuntu-latest'
run: pytest -m unit --cov=ragone --cov-report=xml

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5
with:
files: coverage.xml
fail_ci_if_error: true
use_oidc: true

- name: Run integration tests
run: pytest -m integration
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# Ignore pycache
__pycache__/

# Ignore egg-info
*.egg-info/

# Ignore modules file, for self-reference only
modules

Expand All @@ -17,7 +20,11 @@ figures_old/

# Ignore slurm files
*.slurm
slurm/

# Ignore debug files
debug*.py
debug*.ipynb

# Ignore agents files
.github/agents/
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
# Ragone plots

[![Tests](https://github.com/mmsg-warwick/ragone/actions/workflows/tests.yml/badge.svg)](https://github.com/mmsg-warwick/ragone/actions/workflows/tests.yml)

[![codecov](https://codecov.io/gh/mmsg-warwick/ragone/graph/badge.svg?token=uk6ryEFTRn)](https://codecov.io/gh/mmsg-warwick/ragone)


This repository contains the code to generate Ragone plots and reproduce the results of the article:

> F. Brosa Planella, S.J. Cooper There is no knee in Ragone: Clarifying battery energy and power fade using Ragone plots, _Under review_.

## Installation

Clone the repository and install it in editable mode:

```bash
git clone git@github.com:mmsg-warwick/ragone.git
cd ragone
pip install -e .
```

To also install the optional test dependencies:

```bash
pip install -e ".[test]"
```

## Repository structure

- `data/`: Contains the data files produced by the scripts. The .pkl files are the solutions of the ageing simulations, used later to extract the Ragone curves at different states of health. The .csv files are the summary metrics extracted from the fits of the Ragone curves.
- `data/`: Contains the data files produced by the scripts. The .pkl files are the solutions of the ageing simulations, used later to extract the Ragone curves at different states of health, and they are needed to run the other scripts. The .csv files are the summary metrics extracted from the fits of the Ragone curves, and they are needed to run `plot_power_energy_fade.py`.
- `figures/`: Contains all the figures produced by the scripts (a lot!). There are various types of figures, and the naming convention explains what is being shown. Here are the main types of figures:
- `ragone_ageing_{mode}_{degradation mechanisms}_{scale}.png`: These are Ragone plots for a specific simulations at different cycle numbers (i.e. different states of health). `mode` is how the battery is cycled (either power or current), `degradation mechanisms` is the combination of degradation mechanisms included in the simulation (e.g. SEI growth, lithium plating and/or LAM), and `scale` is whether the plot is in linear or loglog scale. Some plots have the tag `fast`, which means fast charging.
- `fits/`: This folder contains the fits of the various Ragone curves (i.e. those in the previous point). The naming convention is the same as above, but with the tag `fit`and the cycle number. The fitted parameters are shown on the plot, but they are collected in the .csv files in the `data/` folder.
- `ragone_compare_modes_directions_{scale}.png`: For a single simulation, it shows the Ragone curves for all the combinations of cycling mode (power or current) and direction (charge or discharge). `scale` is whether the plot is in linear or loglog scale.
- `ragone_parameters_{mode}_{parameter}_{scale}.png`: Ragone plots showing the effect of a single parameter. The value is taken to be the average value for a given cycle number. The naming convention is the same as above, but with the tag `parameter` describing which parameter is being varied (e.g. either active material volume fraction or porosity, for each electrode).
- `rate_capability_{mode}_{degradation mechanisms}.png`: Show the measured energy vs cycle number for various discharge powers.
- `rpt_{mode}_{degradation mechanisms}.png`: Show the measured energy vs cycle number for various discharge powers (rate performance test).
- `power_energy_fade_{degradation mechanisms}.png`: Show the normalised energy and power fade vs cycle number, comparing slow and fast charging.
- `n_{degradation mechanisms}.png`: Show the evolution of the Ragone fit exponent `n` vs cycle number, comparing slow and fast charging.
- `aged_solution_evolution_vf.png`: Show the evolution of electrode porosity and active material volume fractions with cycle number.
3 changes: 3 additions & 0 deletions clean_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rm *.out
rm figures/*.png
rm figures/fits/*.png
12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_SEI.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_SEI_lam.csv

This file was deleted.

10 changes: 0 additions & 10 deletions data/ragone_ageing_metrics_linear_SEI_plating.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_SEI_plating_lam.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_fast_SEI_plating_lam.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_lam.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_plating.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/ragone_ageing_metrics_linear_plating_lam.csv

This file was deleted.

22 changes: 11 additions & 11 deletions data/ragone_ageing_metrics_loglog_SEI.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.596951318809396,66.41280696483759,2.015154668846777
100,17.95152891456745,52.15549269099276,2.770779687527218
200,17.746209812428695,46.44525698856221,2.7372909803085417
300,17.594389714220437,42.29124796426325,2.6507932754820107
400,17.49122185464082,38.89627382321718,2.4885596675308745
500,17.394558152729488,35.65893141286961,2.3698535101854494
600,17.393789741061973,32.3536046194732,2.16581796928561
700,17.075624299772493,29.818609935378266,2.3675811563251568
800,17.00831004491522,26.931359637399847,2.262761105567525
900,17.03783164074784,24.13488896761801,2.0690785006018175
1000,17.07324482719987,21.575821623662335,1.9001556344523485
1,18.588869148125227,66.13782556355861,2.0340838454644583
100,18.444905165199927,63.65767438208787,2.4473317255581217
200,18.348520327783554,60.06054196935567,2.5297236329960997
300,18.170934636241764,57.12264245459217,2.7550456084001187
400,18.023812938498693,54.25060013091537,2.926515901928819
500,17.972593417448007,51.31610582660734,2.8460399496758617
600,17.827064159575915,48.730347728792715,2.9886680829187884
700,17.793060473895345,45.938346272630206,2.8440955614654753
800,17.65324395627252,43.50073142194886,2.9377537961268643
900,17.614708476064344,40.89137636383943,2.7756055264339263
1000,17.497376768043484,38.48775678379532,2.769215175189438
22 changes: 11 additions & 11 deletions data/ragone_ageing_metrics_loglog_SEI_lam.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.62791820057905,82.8380339058508,2.0349151652276416
100,17.91461017303945,61.82766850033459,2.7431482994590364
200,17.468080934496808,54.60863030042134,2.8846006835469673
300,17.16369770386534,49.618844622263666,2.743039481548394
400,16.792286140179424,45.962980678338425,2.7866705356084545
500,16.537340491083732,42.24431286701405,2.6513412778095113
600,16.084212734129544,39.525996494426636,2.919781774359719
700,15.761024259206055,36.351547620972504,3.0127899852403703
800,15.47353884388946,33.274623433677846,3.0765275017249336
900,15.249141708476763,30.28995222194495,3.0331138984931036
1000,15.495156756196273,26.989108848508753,2.1819097805880383
1,18.627667586101673,82.83581775824045,2.0342265756576143
100,18.39306613218836,79.43207755618184,2.2776797336781907
200,17.946280524755682,73.61047190500125,2.688787924645191
300,17.65999240065869,68.38933026525994,2.7248923876266824
400,17.296950693639854,64.0799956812326,2.91969737949068
500,16.93925462539147,60.13120801993461,3.1046771220373164
600,16.606610937221426,56.26447475331154,3.222927813285725
700,16.349008325623032,52.512477168089795,3.070159338852498
800,15.990256478807607,49.33431276799701,3.2177330048947304
900,15.746311960110635,45.86372052135845,3.0094244104611088
1000,15.365899971047513,43.10297110378992,3.1734406360924168
20 changes: 11 additions & 9 deletions data/ragone_ageing_metrics_loglog_SEI_plating.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.596951458870254,66.4128073847186,2.0151547396606664
100,17.677923533591507,51.552776636405575,2.7098610018888643
200,17.20342496641056,45.056960980684316,2.5896429853233833
300,16.767628424691445,40.1154120382559,2.425856378939746
400,16.41614416565388,35.266050430446384,2.179175440167929
500,15.981331106991227,30.299741265564645,2.1103555239761045
600,15.435421953291115,25.621609955725418,2.1476813995777966
700,15.218372427581125,20.37800702351446,1.866576570626802
800,14.88688244941285,14.751282587942734,1.83395865273708
1,18.58886925112517,66.13782346732611,2.0340842152365624
100,17.97011628768605,63.10231133873536,2.388865796812287
200,17.43989723802634,58.747261674318715,2.3847430015469304
300,16.86268599314218,54.95563903453221,2.4917967459811576
400,16.33824019616068,51.182821359013595,2.537212220772869
500,15.94733562075335,47.23592175886907,2.3485958403679352
600,15.469794571106378,43.71064684795954,2.337537603845972
700,15.061185552280152,40.06795560073897,2.2238872122405495
800,14.688772502595024,36.349759265429704,2.078234516151424
900,14.318620170410789,32.11453056453798,2.0013929373948227
1000,14.159745426973489,27.06063043493747,1.7762327760472534
22 changes: 11 additions & 11 deletions data/ragone_ageing_metrics_loglog_SEI_plating_lam.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.62791845651338,82.83803621644996,2.034914950919551
100,17.661020711182786,61.0392967713204,2.6766584506935773
200,16.94797076790511,53.19114637383829,2.762199496454801
300,16.397303195400927,47.58273622133731,2.5384983813459696
400,15.684187660967876,43.35673840010614,2.677249124169688
500,15.054505047413226,38.650109608116146,2.7499050323565526
600,14.675384503623523,32.96098754319194,2.4946054405975375
700,13.94641878928715,29.139494090772512,2.822186693810897
800,13.862275184264812,23.87260734713852,2.174059448521845
900,13.393223420092166,19.77494796162161,2.217655078094604
1000,12.931057224758925,16.170430729018726,2.2659401982591962
1,18.62766732065116,82.83581855439752,2.034226980603058
100,17.947318009455927,78.4055559185016,2.2175008820648623
200,17.102387630789504,71.78515255058906,2.5247215611295823
300,16.382247284547923,66.14978057258953,2.6454087392475927
400,15.777550771064462,60.992759893998816,2.5542782614193706
500,15.127299195087865,56.669355162966085,2.627368674066471
600,14.521875375005157,52.71851255328582,2.653281538919229
700,13.997682418342306,49.18014394586789,2.515810224382227
800,13.426587241349868,46.09415180654797,2.5448257095175326
900,12.929556754813147,43.05889210487882,2.4498804103768648
1000,12.345596231211978,40.179357631397295,2.639293162680192
12 changes: 12 additions & 0 deletions data/ragone_ageing_metrics_loglog_fast_SEI.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.588869148125227,66.13782556355861,2.0340838454644583
100,18.41268259503243,63.81743379890378,2.5278841051512733
200,18.234145244735142,60.262660755339965,2.820230649979339
300,18.164109723743234,56.87757266228201,2.837632758074931
400,18.00259573452546,54.04383545730077,3.065426665475087
500,17.987479610359348,50.85542697898945,2.9095940304821877
600,17.82159540958156,48.33424888529586,3.1135722729992046
700,17.707953735281524,45.583790569532766,3.1928426715572424
800,17.65627052437516,42.90676486417396,3.054435347663494
900,17.544573763197576,40.275275827135474,3.076162966917767
1000,17.488974071637855,37.67691994708163,2.9044753929016474
12 changes: 12 additions & 0 deletions data/ragone_ageing_metrics_loglog_fast_SEI_lam.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.627667586101673,82.83581775824045,2.0342265756576143
100,18.30102505038253,79.35004153131992,2.439333746421077
200,17.844449530248845,73.20804370047674,2.8850366658937805
300,17.466620599912925,68.01514213102939,3.1369278169538033
400,17.109337297186762,63.34798746116672,3.318199446024558
500,16.838372187697363,58.931630336996015,3.165515316118846
600,16.457137585050216,55.29488127470232,3.367597745935921
700,16.10440401579163,51.68184099740735,3.4851163807819785
800,15.836979694751316,48.14199159647825,3.249352202264333
900,15.459035945593971,45.18284119530951,3.398560600674494
1000,15.195111059673074,41.94730096683737,3.1490233831061256
12 changes: 12 additions & 0 deletions data/ragone_ageing_metrics_loglog_fast_SEI_plating.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Cycle number,Reference energy [W.h],Reference power [W],n
1,18.58886925112517,66.13782346732611,2.0340842152365624
100,17.890960465095866,63.18735543256366,2.4707349086500554
200,17.241309255762637,58.714017669079674,2.6671950748411484
300,16.76173804973874,54.13697758507331,2.544985574832404
400,16.21162924914967,50.0611016678795,2.6078342153385448
500,15.706325446329693,45.94983477788979,2.6113006696161065
600,15.252472656111664,41.691822216177,2.5344985320048625
700,14.850501409734052,37.38438434185675,2.372779084025644
800,14.527036069772475,32.83767291204493,2.118232347635064
900,14.139496314232444,27.198201190764795,2.0691380966842132
1000,13.765795736629673,18.306417761029337,2.1134906894140872
Loading
Loading