Skip to content

Commit

Permalink
Examples + General Code Clean (#31)
Browse files Browse the repository at this point in the history
* Examples Updt. / Citation / Dependancy+Repo Clean / +WLTP / Sim_Model.jl Name Updt.
  • Loading branch information
BradyPlanden authored Nov 16, 2022
1 parent c2ed128 commit 568b134
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 18,278 deletions.
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ authors:
- family-names: Morrey
given-names: Denise
orcid: "https://orcid.org/0000-0002-0105-3425"
journal: "Arxiv"
date-released: 2022-03-31
doi: 10.48550/arXiv.2203.17105
journal: "Journal of Energy Storage"
date-released: 2022-11-01
doi: 10.1016/j.est.2022.105637
keywords:
- "lithium-ion battery"
- "battery management system"
- "reduced-electrochemical model"
- "battery modelling"
- "julia"
version: "0.2.0"
version: "0.3.2"
repository-code: "https://github.com/BradyPlanden/LiiBRA.jl"
title: "A Computationally Informed Realisation Algorithm for Lithium-Ion Batteries Implemented with LiiBRA.jl"
6 changes: 2 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LiiBRA"
uuid = "a5b28938-1935-4481-b801-30e5c8ed4e83"
authors = ["Brady Planden <[email protected]>"]
version = "0.3.1"
version = "0.3.2"

[deps]
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Expand All @@ -10,7 +10,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TSVD = "9449cd9e-2762-5aa3-a617-5413e99d722e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UnitSystems = "3a241a3c-2137-41aa-af5e-1388e404ca09"
Expand All @@ -20,7 +19,6 @@ FFTW = "1.4"
Interpolations = "0.13, 0.14"
Parameters = "0.12"
Roots = "1.3, 2"
StatsBase = "0.33"
TSVD = "0.4"
UnitSystems = "0.3"
julia = "1.7"
julia = "1.7, 1.8"
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
[![DOI:10.1016/j.est.2022.105637](http://img.shields.io/badge/DOI-10.1016/j.est.2022.105637-blue.svg)](https://doi.org/10.1016/j.est.2022.105637)

<p align="center">
<img src="LiiBRA.png" width="600" align="center" />
<img src="examples/figures/LiiBRA.png" width="600" align="center" />
</p>

## Create and Simulate Reduced Order Lithium-Ion Battery Models
LiBRA provides an open-source implementation of realisation algorithms used for generating reduced-order state-space models. This work aims to develop real-time capable physics-informed models for deployment onto embedded hardware. LiiBRA provides capabilities in offline and online model creation, as well as a framework for lithium-ion degradation predictions. For more information on LiiBRA, and the computationally-informed discrete realisation algorithm (CI-DRA), please refer to the publication above.

Further examples are located in the "examples" directory. Please open an [issue] if you have requests or ideas for additional examples.

Install (Julia 1.7 and later)
-----------------------------

Expand All @@ -30,19 +32,19 @@ using LiiBRA, Plots
Setup:
```julia
Cell = Construct("LG M50")
SList = collect(1.0:-0.25:0.0)
= collect(1.0:-0.25:0.0)
SOC = 0.75
T = 298.15
Cell.Const.T = 298.15
```

Realisation:
```julia
A,B,C,D = Realise(Cell,SList,T);
A,B,C,D = Realise(Cell,);
```

HPPC Simulation:
```julia
Results = HPPC(Cell,SList,SOC,4.0,-3.0,A,B,C,D);
Results = HPPC(Cell,,SOC,4.0,-3.0,A,B,C,D);
```

Plotting Results:
Expand All @@ -63,7 +65,7 @@ plot(Results.t, Results.Cell_V;
```

<p align="center">
<img src="examples/Voltage_HPPC.png" width="1000" align="center" />
<img src="examples/figures/Voltage_HPPC.png" width="1000" align="center" />
</p>

```julia
Expand All @@ -74,14 +76,14 @@ plot(Results.t, Results.Ce;
right_margin = 15Plots.mm,
ylabel = "Electrolyte Concen. (mol/m³)",
xlabel = "Time (s)",
title="Spacial Electrolyte Concentration",
title="Electrolyte Concentration",
label=["Neg. Separator Interface" "Neg. Current Collector" "Pos. Current Collector" "Pos. Separator Interface"],
size=(1280,720)
)
```

<p align="center">
<img src="examples/Electrolyte_HPPC.png" width="1000" align="center" />
<img src="examples/figures/Electrolyte_HPPC.png" width="1000" align="center" />
</p>

```julia
Expand All @@ -92,14 +94,14 @@ plot(Results.t, Results.Cse_Pos;
right_margin = 15Plots.mm,
ylabel = "Concentration (mol/m³)",
xlabel = "Time (s)",
title="Spacial Positive Electrode Concentration",
title="Positive Electrode Concentration",
label=["Current Collector" "Separator Interface"],
size=(1280,720)
)
```

<p align="center">
<img src="examples/Pos_Electrode_HPPC.png" width="1000" align="center" />
<img src="examples/figures/Pos_Electrode_HPPC.png" width="1000" align="center" />
</p>

```julia
Expand All @@ -110,14 +112,14 @@ plot(Results.t, Results.Cse_Neg;
right_margin = 15Plots.mm,
ylabel = "Concentration (mol/m³)",
xlabel = "Time [s]",
title="Spacial Negative Electrode Concentration",
title="Negative Electrode Concentration",
label=["Current Collector" "Separator Interface"],
size=(1280,720)
)
```

<p align="center">
<img src="examples/Neg_Electrode_HPPC.png" width="1000" align="center" />
<img src="examples/figures/Neg_Electrode_HPPC.png" width="1000" align="center" />
</p>


Expand All @@ -126,3 +128,4 @@ plot(Results.t, Results.Cse_Neg;
Please report any issues using the Github [issue tracker]. All feedback is welcome.

[issue tracker]: https://github.com/BradyPlanden/LiiBRA/issues
[issue]: https://github.com/BradyPlanden/LiiBRA/issues
31 changes: 31 additions & 0 deletions examples/CIDRA_Benchmark.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using BenchmarkTools, LiiBRA
BenchmarkTools.DEFAULT_PARAMETERS.seconds = 10
Cell = Construct("LG M50")
= SOC = 0.8

function DRA_Loop(Cell, Ŝ)

# Arrhenius
Cell.Const.T = 298.15
Arr_Factor = (1/Cell.Const.T_ref-1/Cell.Const.T)/R

# Realisation Variables
Cell.RA.H1 = [1:2000; 3000:3500]
Cell.RA.H2 = [1:2000; 3000:3500]
Cell.RA.Fs = 4
Cell.RA.Tlen = 16200
Cell.RA.M = 4
Cell.RA.SamplingT = 1/4

# Set Cell Constants
Cell.Const.κ = Cell.Const.κf(Cell.Const.ce0)*exp(Cell.Const.Ea_κ*Arr_Factor)
Cell.RA.Nfft = Cell.RA.Nfft!(Cell.RA.Fs, Cell.RA.Tlen)
Cell.RA.f = Cell.RA.f!(Cell.RA.Nfft)
Cell.RA.s = Cell.RA.s!(Cell.RA.Fs,Cell.RA.Nfft,Cell.RA.f)
Cell.Neg.β = Cell.Neg.β!(Cell.RA.s)
Cell.Pos.β = Cell.Pos.β!(Cell.RA.s)

return @benchmark CIDRA(Cell)
end

Time = DRA_Loop(Cell, Ŝ)
141 changes: 0 additions & 141 deletions examples/DRA_Benchmark.jl

This file was deleted.

Loading

0 comments on commit 568b134

Please sign in to comment.