Skip to content

Generalize BMS cell data model for arbitrary cell counts#528

Open
bracyw wants to merge 2 commits intodevelopfrom
525-generalize-bms-cell-data-model
Open

Generalize BMS cell data model for arbitrary cell counts#528
bracyw wants to merge 2 commits intodevelopfrom
525-generalize-bms-cell-data-model

Conversation

@bracyw
Copy link
Collaborator

@bracyw bracyw commented Feb 22, 2026

Changes

Replaces all hardcoded BMS cell-count enums and fixed-length tuple types with a single config-driven BMS_CONFIG object (in new bms.config.ts file). To support a different accumulator with different cell/segment counts, only the values in BMS_CONFIG need to change — everything else derives from it.

The refactoring:

  • Extracted BMS_CONFIG into its own file to break a circular import between bms.utils.ts ↔ topic.utils.ts (old const enums were inlined at compile time; new runtime object needed independent module)
  • Changed Segment enum to type alias with dynamically generated allSegments array
  • Replaced all cell-index enums with Array.from() calls derived from BMS_CONFIG
  • Replaced fixed tuple types with CellReading[] and CellReading[][]
  • Replaced hardcoded values (e.g., beta cell cap of 10) with config references

Files changed: bms.config.ts (new), bms.utils.ts, topic.utils.ts, cell.service.ts, cell-by-cell-heat-map.component.ts

Test Cases

  • App loads without console errors at /bms
  • All 5 segments render with temperature, voltage, and chip temp summaries
  • Cell-by-cell heat maps display correct cell counts (14 alpha, 11 beta per segment)
  • Segment detail view (/bms/segment/:id) navigates and renders correctly
  • ng build succeeds with no new warnings

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (N/A - no visual changes)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No package-lock.json changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #525

@bracyw bracyw self-assigned this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generalize BMS cell data model for arbitrary cell counts

1 participant