Skip to content

The plant is a type switch: BatteryPack if use_pack else BatteryPlant — a third plant model is another branch in the core #3

Description

@dim-sous

What is wrong

core/simulator/core.py:79:

plant = BatteryPack(bp, tp, thp, elp, pp) if use_pack else BatteryPlant(bp, tp, thp, elp)

Two plant models, one if. The choice is a boolean derived from whether pp (PackParams) was passed (core.py:77-80), so "which plant" is encoded as "which optional argument is not None". A third model — a different chemistry, a reduced-order surrogate for fast sweeps, a degradation-aware plant for v9 — is another branch in the loop and another optional parameter on run_simulation.

The two classes already share an implicit contract the loop relies on: step(...), get_measurement(), get_state(), reset() (core/physics/plant.py:520-706 and :811-952). Nothing names it.

What it should be

Same shape as the estimator seam (#2) and the strategy seam that already works:

  • A PlantLike Protocol owned by the harness (this is devkit code — a real battery is the plant).
  • The concrete plant chosen where the experiment is composed, never in the loop. n_cells and any pack-only trace shape (SimTraces(n_cells=…), core.py:80,92) become facts the plant reports about itself, not values the loop derives from a flag.
  • A registry with provenance, so a plant enters as a name.

Done when

  • The loop constructs no plant; it receives one.
  • Adding a plant model is one file plus a registry line.
  • Proof: both existing plants produce bit-identical traces before and after.

Phase 1 of the platform epic. Depends on #1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineseams, run schema, data modelregistryentity registries + provenance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions