Repository navigation
Make no charge of a plug-in hybrid's engine, and simulate one - #180
Merged
Merged
Conversation
A vehicle's powertrain replaces whether it runs on its battery alone: electric, plug-in hybrid or other. Volvo's fuelType names a plug-in hybrid by its fuels joined by a slash, PETROL/ELECTRIC as two real V60s answer; a list holding ELECTRIC is taken for one. Nothing it reads changes yet: the catalog still recognizes the electric ones only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plug-in hybrid's engine raises the SoC while driving, in charge mode or holding an empty battery: driven between two parked readings, such a rise made up a charge, with a cost. For a plug-in hybrid, a rise read parked is now a reconstructed charge only when the reading that shows it says the cable connected; the odometer, read once an hour parked, would tell too late. A charge seen on its plug is unchanged, and so is an electric vehicle, or one whose powertrain is not read yet. A test derives two real V60s' responses, kept out of the repository, when RUNSTEN_V60_FIXTURES names them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Volvo scenario's powertrain may be plugin_hybrid: its details tell PETROL/ELECTRIC, its engine holds an empty battery a point up and down, as a real V60 did over 41 km, and a drive may have it charge the battery (engineChargeKWhPer100km, its rate an assumption). Its fuel is not simulated yet. scenarios/v60-phev.yaml drives in charge mode between two parked readings: derived end to end, it makes no charge of it, where an electric car's reading would. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 of 4 tasks
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A first step of #165, which it does not close: the catalog's plug-in hybrid variants, the fuel of a trip and the documentation come next.
Two real Volvo V60 plug-in hybrids (2021 and 2027) were read for a week. Their charges on a plug come out right already, but their engine also raises the SoC while driving: holding an empty battery a point up and down, or in charge mode. Driven between two parked readings, such a rise would have made up a charge, with a cost.
Changes
core.Snapshot.Powertrain(electric,plugin_hybrid,other) replacesBatteryElectric, which stays as a method. Volvo'sfuelTypenames a plug-in hybrid by its fuels joined by a slash (PETROL/ELECTRIC, as both V60s answer). Nothing it reads changes yet: the catalog still recognizes electric variants only.detector.onPlug). The odometer would tell whether it drove, but parked it is read once an hour. A charge seen on its plug is unchanged, and so is an electric vehicle, or one whose powertrain is not read yet.powertrain: plugin_hybrid(detailsPETROL/ELECTRIC, an empty battery held atholdSoc, a drive'sengineChargeKWhPer100kmfor a charge mode, its rate an assumption; no fuel yet), the profilev60-phev-like, andscenarios/v60-phev.yaml.AGENTS.md: the rule, and the simulated hybrid.How it was tested
TestHybridReconstructedCharges(core): the cable connected, disconnected, not reported, connected only before; an electric car; the powertrain read after the rise; a charge mode on a trip seen; charge sustain. Each case in a rebuild and incrementally, with and without the vehicle's timestamps. The three that must refuse a charge failed without the rule.TestSimulatedPlugInHybrid(derive): the scenario through the simulator, the collector and the derivation. One charge on the socket, the charge-mode trip revealed by the odometer, no charge made up; read as an electric car's, the same responses make one, so the scenario keeps its point. Without the rule, it fails with a made-up charge.TestRealPlugInHybridsderives the two real V60s' responses and finds what production derived (20 and 8 trips, 5 and 1 charges, none made up). These responses are users' own: they stay out of the repository, and the test is skipped unlessRUNSTEN_V60_FIXTURESnames them.Unit tests of the simulated vehicle (charge sustain, charge mode), of the scenarios' checks and of the details'
fuelType.task unitpasses:task unit-go(lint, tests, govulncheck, build);unit-webnot run, nothing of the front end nor of the API's contract changedThe API's diff (
api/openapi.yaml,internal/api/testdata/) is intended, or there is none: noneTexts in English, French and Swedish, if the interface changed: it did not
No real VIN, token, API key or position, fixtures included
task integrationandtask systemwere not run locally: no migration, no change of the store, of Compose or of the images.🤖 Generated with Claude Code
Summary by CodeRabbit