Skip to main content

A Python library for interating with the Breathe Design api and analyzing and visualizing Breathe Design data

Project description

Breathe Design

A python based api wrapper for running the breathe design model.

Registration Required: To use the Breathe Design API, you must register for a free trial. You can sign up at https://www.breathebatteries.com/breathe-design-free-trial.

Installation steps

In a new project or existing project

In the virtual environment in your new or existing project, simply install breathe_design with

pip install breathe_design

Using this repo

If you want to work with the examples in this repo, follow these steps...

  • Open your terminal or command prompt.

  • Navigate to the directory or create new one where you want to setup.

  • Run the following command to clone our GitHub repository.

    git clone https://github.com/BreatheBatteries/breathe_design.git .
    

To set up everything in one go, just run .\setupEnvironment.ps1.

That will create a virtual environment and install the requirements.

Alternative manual setup

Alternatively, run following command to create the virtual environment:

python -m venv myvenv

Replace myvenv with the desired name for your virtual environment.

  • Activate the virtual environment:

    • On Windows:
      myvenv\Scripts\activate
      
    • On macOS/Linux:
      source myvenv/bin/activate
      

    After activating the virtual environment, you'll see (myenv) in your terminal prompt to indicate that the environment is active.

  • Install the breathe_design package in the virtual environment:

    pip install breathe_design
    

Running the models

The app requires a connection to our server for which you must log in to receive an api key. Once logged in you can fetch the batteies in your library.

from breathe_design import api_interface as api
batteries = api.get_batteries()
print(batteries)

Access the base parameters for your battery

base_params = api.get_design_parameters("Molicel P45B")
print(base_params)

See the equilibrium KPIs and there sensitivities to changes in the base parameters

eqm_kpis, fig = api.get_eqm_kpis("Molicel P45B")
print(eqm_kpis)
fig.show()

Add any number of new designs

designs = [
    {
      "designName": "Lower NP",
      "NPratio": base_params["NPratio"]*0.95
    },
    {
      "designName": "Higher Vmax",
      "Vmax_V": base_params["Vmax_V"]+0.05
    },
    {
      "designName": "Thicker Cathode",
      "cathodeThickness_um": base_params["cathodeThickness_um"]*1.05
    },
    {
      "designName": "Less Porous Anode",
      "anodePorosity": base_params["anodePorosity"]*0.95
    },
    {
      "designName": "Thinner Separator",
      "separatorThickness_um": base_params["separatorThickness_um"]*0.95
    },
  ]

Recompute the KPIs

eqm_kpis, fig = api.get_eqm_kpis("Molicel P45B", designs)
print(eqm_kpis)

Plot the KPIs for all designs relative or delta with the baseline

from breathe_design import plot_kpis
plot_kpis(eqm_kpis, "relative")
plot_kpis(eqm_kpis, "delta")

Perform dynamic analysis for your designs

from breathe_design import Cycler
from breathe_design import plot_dynamic_kpis
from breathe_design import extract_dynamic_kpis

baseline_capacity = eqm_kpis.loc["Capacity [Ah]", "Baseline"]
cycler = Cycler(selected_unit="C", cell_capacity=baseline_capacity)
cycler_input = cycler.cccv(1.0, -1.0, 0.01, 4.2, 2.6, 60.0, 60.0)
output = api.run_sim(
    base_battery="Molicel P45B",
    cycler=cycler.cccv(1.0, -1.0, 0.01, 4.2, 2.6, 60.0, 60.0),
    designs=designs,
    initialSoC=0.5,
    initialTemperature_degC=21.0,
    ambientTemperature_degC=21.0
    )
plot_dynamic_kpis(output["dynamicData"])

Let's now try changing the form factor

base_format = api.get_battery_format("Molicel P45B")
smaller_format = base_format.copy()
smaller_format["name"] = "Smaller Format"
smaller_format["height_mm"] = 0.9 * base_format["height_mm"]
thinner_format = base_format.copy()
thinner_format["name"] = "Thinner Format"
thinner_format["diameter_mm"] = 0.9 * base_format["diameter_mm"]
formats = [smaller_format, thinner_format]
eqm_kpis, fig = api.get_eqm_kpis("Molicel P45B", designs=[], formats=formats)
eqm_kpis

Examples

Check out the python notebooks in docs/examples for how to use the api.

Reporting Bugs

If you find a bug, or run into an error, please raise an issue on the GitHub account.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

breathe_design-1.2.1.tar.gz (8.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

breathe_design-1.2.1-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file breathe_design-1.2.1.tar.gz.

File metadata

  • Download URL: breathe_design-1.2.1.tar.gz
  • Upload date:
  • Size: 8.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for breathe_design-1.2.1.tar.gz
Algorithm Hash digest
SHA256 35eedf207635a55bd5f57ddc0eda3dde8758a0f586a6435605e8c8be010e364d
MD5 ad182d8d884f81199c041f05fbe16c85
BLAKE2b-256 f79b5d1ea21b1e64e3d519444087029d215763e32bfec3b2c55d1f70fd1225cc

See more details on using hashes here.

File details

Details for the file breathe_design-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: breathe_design-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for breathe_design-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b78b322cc9bd004761b81c9f2a650e22349e1128a667bd2317615d25760a216
MD5 2f2cece3cd4462da467fba2b23d6b04d
BLAKE2b-256 337667eb793e6b4069fa8cb48616eca382eedda7e4addc6805c7a8f61ee4947a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page