Battery 18650 T4 Thermal Hybrid Grammar#
Source: examples/grammar/battery_18650_t4_thermal_hybrid_grammar.py
Introduction#
Build and optionally evaluate a simple tier-4 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
3from _battery_transition_helpers import apply_first_transition
4
5import design_research_problems as derp
6
7
8def main() -> None:
9 """Apply topology, pose, and thermal edits, then evaluate when PyBaMM is installed."""
10
11 # Load the tier-4 thermal grammar and start from the deterministic seed.
12 problem = derp.get_problem("battery_18650_t4_thermal_hybrid_grammar")
13 state = problem.initial_state()
14
15 # Use one topology edit, one pose edit, and one thermal tuning edit so the
16 # example touches each part of the tier-4 representation.
17 state = apply_first_transition(problem, state, "adjust_cell_count")
18 state = apply_first_transition(problem, state, "move_cell_x")
19 state = apply_first_transition(problem, state, "tune_cooling_coefficient")
20
21 try:
22 evaluation = problem.evaluate(state)
23 except derp.MissingOptionalDependencyError as exc:
24 print(exc)
25 return
26 print(evaluation)
27
28
29if __name__ == "__main__":
30 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/grammar/battery_18650_t4_thermal_hybrid_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.