How Battery-Swap Stations Should Link Underbody Images to the VIN and the Battery-Pack Serial
Battery-swap stations should make the swap event the authoritative link between images and identities. The station integration should assign a unique capture ID to each pass over the underbody scanner, the swap event should record the VIN plus the outgoing and incoming pack identities, and a link record ties each capture to the VIN and to the pack that was installed when the image was taken.
The governing rule is that a capture belongs to the vehicle that drove over the scanner and to the pack installed in it at that moment. Keep a history of when each pack was installed in and removed from each VIN, and every confirmed capture can be traced from either key, even after the pack has served many other vehicles.
Why one underbody image needs two identities
In a swap network, the vehicle and the pack follow different paths. The VIN stays with the vehicle as its identity key, while a removed pack goes to charging, re-inspection or quarantine before it serves another vehicle.
For US-market vehicles, the VIN is a well-defined key. Under 49 CFR 565.13, each VIN has 17 characters with a check digit in position nine, and two vehicles subject to the federal safety standards and manufactured within a 60-year period beginning with the 1980 model year cannot share one.
The pack needs its own history because observations and dispositions of pack-housing damage should stay with the pack identity, not with the car that happened to bring it in. In the EU, the European Commission's batteries page lists 18 February 2027 in its indicative implementation timeline as the date the battery passport becomes mandatory for relevant battery categories placed on the EU market, including electric vehicle batteries, with each passport linked to its battery through a QR code.
The data model: entities and required fields
The schema below is a proposed station-side design. Keep images, identities and swaps as separate entities joined by IDs, so a correction to one identity never silently rewrites image evidence.
| Entity | Purpose | Key fields |
|---|---|---|
| Vehicle | One row per VIN | VIN, VIN format check result, vehicle account reference |
| Battery pack | One row per physical pack | Internal pack ID, pack serial, serial issuer or namespace, pack type, status (in vehicle, in station, on hold) |
| Install interval | Where a pack was and when | Pack ID, VIN, installed_at, removed_at, swap event ID |
| Swap event | One row per swap attempt | Swap event ID, station ID, bay, VIN, outgoing pack ID, incoming pack ID, raw serial reads with issuer or namespace, business outcome, identity link status |
| Underbody capture | One row per scanner pass | Capture ID, image reference, station ID, lane, captured_at, capture phase (arrival or exit), completeness flag |
| Capture link | The authoritative join | Capture ID, VIN, pack ID, swap event ID, identity source for each key, link status, superseded_by |
| Finding | One row per flagged item | Finding ID, capture ID, defect type, underbody zone, history target (vehicle or pack) |
| Review decision | Human outcome on a finding | Reviewer ID, decision, timestamp, reason, resulting pack status |
Three fields deserve special care. The capture phase separates images of the outgoing pack (arrival) from images of the incoming pack (exit), the identity source records whether each key came from a system read, an account record or a manual entry, and the history target decides which record a finding lands in.
The linking flow for one swap
The sequence below is a target design in which the station control system owns the swap event and exchanges data with the scanner software through its API. Order matters, because each step depends on keys created in the step before it.
The integration specification should first define three inputs: how each scanner pass is matched to a swap event and lane position, what moment the capture time represents, and how detection results reference their capture and map onto vehicle zones. When any of these keys is missing, duplicated or in conflict, the link stays pending.
-
On approach, the station system matches the arriving vehicle to its account and confirms the VIN, applying the VIN format rules of the vehicle's market.
-
The station system opens a swap event with the VIN, station ID and bay.
-
The vehicle passes over the scanner, and the integration layer creates a capture record with a unique capture ID, the image reference, the capture time and the arrival phase.
-
Before removal, the station reads the installed pack's serial through the identity channel chosen for the project, such as the swap equipment or battery management data, resolves it to the internal pack ID, and writes both to the swap event; a serial that does not resolve to exactly one pack leaves the pack link pending.
-
Once the outgoing pack is uniquely resolved, the station system writes the capture link: arrival capture ID, VIN, outgoing pack ID and swap event ID.
-
The confirmed removal closes the outgoing pack's install interval, and the confirmed installation of the incoming pack, with its serial resolved by the same rule as in step 4, opens a new interval.
-
If the site runs an exit pass, that capture is linked to the VIN and the incoming pack as the exit phase.
-
Detection results for each capture are stored against its capture ID, and the station system maps each finding to a vehicle or pack history using its zone map for that vehicle and pack type.
-
Pack-zone findings from the arrival capture can be reviewed after the removed pack is routed to a hold position, which keeps that review off the swap lane, while pack-zone findings from an exit capture concern the newly installed pack and follow the station's release rules for the vehicle. A pack on hold returns to the charging pool only after its required disposition is complete.
Matching rules that keep the link defensible
A link is only as good as the rule that produced it. Write these rules into the integration specification so that every record can be explained later.
-
Attribute captures to packs through the install interval, treated as [installed_at, removed_at), with all systems on one time base and boundary conflicts set to pending.
-
Never join on timestamps alone when a swap event ID exists, since back-to-back vehicles can produce captures seconds apart.
-
Record the identity source for each key, so audits can separate machine-read links from typed or reconstructed ones.
-
Treat link records as append-only, and handle corrections by writing a new record that supersedes the old one with a reason and user ID.
-
Track the business outcome and the identity link status separately: a swap can be recorded as completed while its links are still pending, and a fully confirmed link requires both packs to resolve uniquely to internal pack IDs, while an aborted swap closes with whatever identities it actually involved.
Exception handling
Most link errors come from a handful of predictable situations. Define the handling for each before the first live swap.
| Exception | Risk | Recommended handling |
|---|---|---|
| VIN fails the applicable format check or does not match the account | Images filed under the wrong vehicle | Hold the link in pending and require an operator to confirm the VIN before it is written |
| Outgoing pack serial cannot be read | Arrival images cannot be tied to a pack | Link the capture to the VIN and swap event, mark the pack link pending, hold the removed pack, and release it only after its identity is confirmed from a reliable removal record or a manual identity check |
| Swap aborted after capture | Arrival image tied to a swap that never completed | Keep the arrival capture linked to the pack installed at capture time, and rebuild the final installed state from the confirmed removal and installation events, leaving it pending if unknown |
| Two vehicles pass in quick succession | Captures swapped between vehicles | Match by swap event ID and lane sequence, never by nearest timestamp |
| Incomplete or unreadable capture | Gaps in pack history | Set the completeness flag, keep the record, and apply the site's rescan policy |
| Finding in the pack zone | Defect stays in vehicle history only | Record it against the pack and route the pack into the defined review or hold process |
| Finding that cannot be placed in a zone | Wrong history target | Send it to review rather than defaulting it to the pack or the vehicle |
| Finding outside the pack zone | Pack status changed without cause | Record it against the VIN, and let the station's rules decide whether it affects the pack |
| Manual correction after the fact | Lost audit trail | Supersede rather than overwrite, and keep the original link visible to auditors |
Where the underbody scanner fits
The scanner side of the design needs consistent, readable images at the speed vehicles actually arrive. The Elscope Vision underbody scanner page lists high-brightness illumination with 4K image resolution, clear images with minimized distortion, and support for image capture at different vehicle speeds, and it names Battery Swap Station among its application scenarios.
For the finding layer, the same page lists AI recognition of underbody defects such as cracks, rust, scratches and oil leaks. Accuracy depends on the inspection scenario and system configuration, which is why the flow above routes pack-zone findings to a reviewer.

The history view lists each underbody scan as its own card with a scan number, time and damage status.
On data handling, the page states that data is stored locally with secure access and full traceability, and that API support enables data integration and custom software development. VIN confirmation, pack serial reads, install intervals and the capture link sit in the station control system, and the exchange between the two systems is defined during project integration through that API.
Acceptance tests before go-live
Run the integration against a scripted set of test swaps before live traffic, and keep the results as part of the handover record.
-
Complete a normal swap and confirm the arrival capture links to the VIN and outgoing pack, and, where an exit pass runs, the exit capture to the VIN and incoming pack.
-
Query one pack and confirm it returns every confirmed capture in the test set taken while that pack was installed, across different vehicles.
-
Query one VIN and confirm it returns every confirmed capture in the test set, regardless of which pack was installed.
-
Simulate an unreadable serial, a serial that resolves to more than one pack, an aborted swap and a VIN mismatch, and confirm each lands in the pending or aborted state defined above.
-
Simulate a missing, duplicated or conflicting pass-to-event key, a capture time on an install interval boundary, a finding that does not reference a capture and a finding that cannot be placed in a zone, and confirm none of them produces a confirmed link or an automatic history target.
-
Run two vehicles through in close sequence and confirm no captures cross between swap events.
-
Correct a link manually and confirm the original record remains visible with the reason and user ID.
-
Run representative vehicles from the network at their actual approach speeds and confirm the captured underbody area is readable for the pack zone review.
FAQ
Should the pack serial be written into the image file name or metadata?
Embedded metadata or file names can carry a copy of the identities for convenience, but they should not be the authoritative link. The link table is where corrections, supersessions and identity sources are recorded and audited.
Which history does a pack-zone finding go into when packs are pooled?
It goes into the pack's history, because the pack will next be installed in another vehicle. The vehicle's history still references the capture, since it was taken while that pack sat in that VIN.
What happens to the history when a vehicle changes owner?
The VIN keeps its link to past captures, while the account system updates the owner and access rights. Under this schema, an owner update does not by itself require changing the VIN-to-capture links, and access and retention handling stays in the account and records policy.
Can links be rebuilt later if the integration fails for a day?
Partial recovery is possible when swap logs, capture times, lane sequence and identity reads survive and line up. Mark rebuilt links with their own identity source, and leave any capture that cannot be disambiguated as unresolved.
Design pack and VIN linkage with your station team
If your team is designing image, VIN and pack serial linkage for a swap network, contact Elscope Vision to review the underbody scanner, its API and the integration points for your station control system.