Battery 18650 T3b Netlist Explicit Grammar#

Source: examples/grammar/battery_18650_t3b_netlist_explicit_grammar.py

Introduction#

Build and optionally evaluate a simple tier-3B battery grammar state.

Technical Implementation#

This page is generated from the top-of-file module docstring and the example source code. The full script is included below for direct inspection.

 1from __future__ import annotations
 2
 3import design_research_problems as derp
 4
 5
 6def main() -> None:
 7    """Build a small 2S2P explicit netlist and evaluate it when PyBaMM is installed."""
 8
 9    # Load the explicit-netlist grammar and start from its one-cell seed state.
10    problem = derp.get_problem("battery_18650_t3b_netlist_explicit_grammar")
11    state = problem.initial_state()
12
13    # First add a parallel mate across the seed cell, then append a second
14    # series stage with one cell per branch to build a simple 2S2P pack.
15    stage_output_terminal_id = state.pack_positive_terminal_id
16    state = problem.add_cell(
17        state,
18        x=0,
19        y=1,
20        z=0,
21        connect_negative_to_terminal_id=state.pack_negative_terminal_id,
22        connect_positive_to_terminal_id=stage_output_terminal_id,
23    )
24    state = problem.add_cell(
25        state,
26        x=1,
27        y=0,
28        z=0,
29        connect_negative_to_terminal_id=stage_output_terminal_id,
30        use_positive_as_pack_terminal=True,
31    )
32    state = problem.add_cell(
33        state,
34        x=1,
35        y=1,
36        z=0,
37        connect_negative_to_terminal_id=stage_output_terminal_id,
38        connect_positive_to_terminal_id=state.pack_positive_terminal_id,
39    )
40
41    try:
42        evaluation = problem.evaluate(state)
43    except derp.MissingOptionalDependencyError as exc:
44        print(exc)
45        return
46    print(evaluation)
47
48
49if __name__ == "__main__":
50    main()

Expected Results#

Run Command

PYTHONPATH=src python3 examples/grammar/battery_18650_t3b_netlist_explicit_grammar.py

Run the command shown below from repository root. Output should summarize the problem setup, a baseline solution, or diagnostic values relevant to this example.