A lightweight command-line tool that answers the four Phase 3 query patterns
directly from the SQLite database. It prints results to the terminal and, where
applicable, generates plots into outputs/plots/cycle_N/.
The database must already be populated (Phases 1–4):
python -m src.clean
python -m src.simulate
python -m src.database
python -m src.visualizepython -m src.query cycles CELL_APrints every cycle recorded for the cell together with point count, duration, and voltage range.
python -m src.query compare CELL_A 2Computes RMSE for each model config that has simulation data for this
cell/cycle, prints the values, and saves an overlay plot to
outputs/plots/cycle_2/compare_CELL_A_cycle2.png.
python -m src.query params DFNLists every model_configs row whose model_type matches, along with the
number of cell-cycles that have simulation results under that config.
python -m src.query voltage DFN Chen2020
python -m src.query voltage DFN Mohtat2020 --cycle 3Plots simulated voltage curves for every cell that was run with the given
model/parameter-set combination. Without --cycle, generates one plot per
available cycle. With --cycle N, restricts to that single cycle. Plots are
saved to outputs/plots/cycle_N/voltage_all_cells_<param_set>_cycleN.png.
src.visualize can also produce one long voltage trace by placing every
available cycle back-to-back on a cumulative time axis (spacing follows each
cycle’s experimental duration). The plot includes experiment vs simulation for
that cell’s parameter set (Chen2020 or Mohtat2020), gray dotted vertical lines at
cycle boundaries, and the mean per-cycle RMSE in the title.
python -m src.visualize --concat CELL_A
python -m src.visualize --concat-all--concat— one cell; if you omit the cell id, it defaults toCELL_A(python -m src.visualize --concatis the same as--concat CELL_A).--concat-all— runs--concatfor every cell (CELL_A…CELL_E).
Files are written to:
outputs/plots/combined/concatenated_<CELL_ID>_<parameter_set>_cycles<first>_<last>.png
Example: concatenated_CELL_A_Chen2020_cycles1_10.png.
Requires the same populated database as the per-cycle plots (python -m src.database).
Estimates state of charge on the same cumulative time axis as the concatenated voltage plot, using:
- Coulomb counting (main curve): per cycle, initial SoC from OCV inversion
of the first voltage sample (same PyBaMM DFN “1 s rest” OCV table as
estimate_initial_socinsrc.simulate), then trapezoidal integration of experimentalcurrent_Awith that cycle’s protocol capacity (Ah) fromestimate_capacity(extract_protocol(...)). - OCV lookup (sparse scatter): SoC from voltage only where
|I| < 5 mA(approximate rest). Under load, voltage ≠ OCV, so those points are not shown.
python -m src.soc_track CELL_A
python -m src.soc_track --allWritten next to the concatenated figures:
outputs/plots/combined/soc_concat_<CELL_ID>_<parameter_set>.pngoutputs/plots/combined/soc_concat_<CELL_ID>_<parameter_set>.csv
Needs experimental_data in SQLite (run python -m src.database) and
data/cleaned_cycling_data.csv for per-cycle capacity extraction.
Trains a GradientBoostingRegressor to predict DFN voltage error
V_exp − V_sim from (time, current, coulomb SoC, temperature) on cycle 2,
adds the prediction to the DFN curve, and writes plots to outputs/plots/mlopt/.
Uses a time-ordered 70% / 30% train–test split for reported test RMSE.
python -m src.mlopt