Deep Dive — Mock Carousel Simulation API
The Challenge
- Testing real automated parking carousels was costly and risky.
- The old “simulator” skipped sensors and fault states → gave false confidence.
- Needed something that captured hundreds of interconnected states.
My Approach (Iteration 1)
I started by treating the carousel as a living state machine, mapping every signal: inverter trips, drive status, pallet occupancy, door sensors. JSON dumps became my blueprint.

- Modeled every component: PLC, sensors, pallets, doors, status objects.
- Powerful, but too heavy — changes meant plumbing through layers.
- Simulator reflected API fields more than real machine behavior.
The Refactor (Iteration 2)
After a few days, I stepped back and asked: what are the verbs and invariants?
- Rotate to bay N.
- Open door only if safe.
- Reserve a pallet.
- Fail closed on alarm.

- Collapsed classes, tightened responsibilities.
- Commands drove explicit state transitions → clearer, safer.
- Edge cases became scenarios: inverter trip mid-rotation, door sensor mismatch, simultaneous entries.
- Deterministic logs allowed easy replay and debugging.
The Reality We Simulated

Impact
- Simulation “felt real” — trusted enough to run in CI pipelines.
- Cycle times dropped dramatically.
- New features prototyped without touching hardware.
- Foundation for scaling to tandem carousels, gates, and future variations.