-
-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into issue-1481-casadi-interp
- Loading branch information
Showing
35 changed files
with
1,448 additions
and
1,261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,21 +2,21 @@ name: PyBaMM | |
|
||
on: | ||
push: | ||
|
||
pull_request: | ||
|
||
# everyday at 3 am UTC | ||
schedule: | ||
- cron: '0 3 * * *' | ||
|
||
jobs: | ||
|
||
style: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
|
@@ -37,19 +37,19 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Linux system dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt install gfortran gcc libopenblas-dev graphviz | ||
sudo apt install texlive-full | ||
# Added fixes to homebrew installs: | ||
# rm -f /usr/local/bin/2to3 | ||
# rm -f /usr/local/bin/2to3 | ||
# (see https://github.com/actions/virtual-environments/issues/2322) | ||
- name: Install MacOS system dependencies | ||
if: matrix.os == 'macos-latest' | ||
|
@@ -62,7 +62,7 @@ jobs: | |
- name: Install Windows system dependencies | ||
if: matrix.os == 'windows-latest' | ||
run: choco install graphviz --version=2.38.0.20190211 | ||
|
||
- name: Install standard python dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel setuptools | ||
|
@@ -72,9 +72,17 @@ jobs: | |
if: matrix.os == 'ubuntu-latest' | ||
run: tox -e pybamm-requires | ||
|
||
- name: Run unit tests for GNU/Linux | ||
- name: Run unit tests for GNU/Linux with Python 3.7 and 3.8 | ||
if: matrix.os == 'ubuntu-latest' && matrix.python-version != 3.9 | ||
run: python -m tox -e quick | ||
|
||
- name: Run unit tests for GNU/Linux with Python 3.9 and generate coverage report | ||
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 | ||
run: tox -e coverage | ||
|
||
- name: Run integration tests for GNU/Linux | ||
if: matrix.os == 'ubuntu-latest' | ||
run: python -m tox -e tests | ||
run: python -m tox -e integration | ||
|
||
- name: Run unit tests for Windows and MacOS | ||
if: matrix.os != 'ubuntu-latest' | ||
|
@@ -83,16 +91,11 @@ jobs: | |
- name: Install docs dependencies and run doctests | ||
if: matrix.os == 'ubuntu-latest' | ||
run: tox -e doctests | ||
|
||
- name: Install dev dependencies and run example tests | ||
if: matrix.os == 'ubuntu-latest' | ||
run: tox -e examples | ||
|
||
- name: Install and run coverage | ||
if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9) | ||
run: tox -e coverage | ||
|
||
- name: Upload coverage report | ||
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 | ||
uses: codecov/codecov-action@v1 | ||
|
||
uses: codecov/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Constant-current constant-voltage charge with US06 Drive Cycle using Experiment Class. | ||
# | ||
import pybamm | ||
import pandas as pd | ||
import os | ||
|
||
os.chdir(pybamm.__path__[0] + "/..") | ||
|
||
pybamm.set_logging_level("INFO") | ||
|
||
# import drive cycle from file | ||
drive_cycle_current = pd.read_csv( | ||
"pybamm/input/drive_cycles/US06.csv", comment="#", header=None | ||
).to_numpy() | ||
|
||
|
||
# Map Drive Cycle | ||
def map_drive_cycle(x, min_op_value, max_op_value): | ||
min_ip_value = x[:, 1].min() | ||
max_ip_value = x[:, 1].max() | ||
x[:, 1] = (x[:, 1] - min_ip_value) / (max_ip_value - min_ip_value) * ( | ||
max_op_value - min_op_value | ||
) + min_op_value | ||
return x | ||
|
||
|
||
# Map current drive cycle to voltage and power | ||
drive_cycle_power = map_drive_cycle(drive_cycle_current, 1.5, 3.5) | ||
|
||
experiment = pybamm.Experiment( | ||
[ | ||
"Charge at 1 A until 4.0 V", | ||
"Hold at 4.0 V until 50 mA", | ||
"Rest for 30 minutes", | ||
"Run US06_A (A)", | ||
"Rest for 30 minutes", | ||
"Run US06_W (W)", | ||
"Rest for 30 minutes", | ||
], | ||
drive_cycles={ | ||
"US06_A": drive_cycle_current, | ||
"US06_W": drive_cycle_power, | ||
}, | ||
) | ||
|
||
model = pybamm.lithium_ion.DFN() | ||
sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver()) | ||
sim.solve() | ||
|
||
# Show all plots | ||
sim.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.