Help

Principles of Free Driving

This is RailKernel’s implementation of Koploper’s Free Driving method. Free Driving lets a group of placed trains move dynamically around the layout. Triplets describe physically valid movements; a central dispatcher decides which train moves next and uses RailKernel’s existing routing and safety controls.

1. Triplets as building blocks

A Triplet describes one valid movement: previous block → current block → next block. Three blocks unambiguously establish the direction through the middle block. Triplets are generated only through Free Driving → Check Layout, so opening a project remains fast.

  • Follows every physically possible path between blocks.
  • Respects turnouts, crossings and block directions.
  • Treats a turntable as a terminus for now.
  • Prevents reversal inside the middle block.
  • Generates only physically valid Triplets.

2. Usable and ignored blocks

Only blocks with Usable enabled participate in Free Driving. A block without feedback is automatically made unusable. For the Triplet generator, such a block is a hard physical boundary: it is not A, B or C, receives no Triplets of its own and is treated as though a buffer stop stood at its entrance. The generator therefore never searches through an unusable block for a later block. A genuine dead-end block may be a starting point or destination, but can never be the middle block B of a Triplet. Check Layout reports how many unusable blocks and dead-end middle blocks were skipped.

  • Usable off: never A, B or C.
  • An unusable block terminates every generation path like a buffer stop.
  • No Triplets are generated through that block.
  • A dead-end track is never used as B.
  • The generation report shows the skipped counts.

3. Triplet properties

Defaults are derived from the three participating blocks. Only explicit user changes are stored in the project.

  • Enabled.
  • Priority.
  • Weight or probability.
  • Maximum speed.
  • Minimum and maximum train length.
  • Allowed train types.
  • Comment.

4. Storage, regeneration and obsolete settings

Triplets themselves are derived runtime objects and are not stored as complete objects in the project. Only Triplet properties explicitly changed by the user are retained, associated with a stable key containing the GUIDs and traversed sides of A, B and C. These settings are loaded when a project is opened but are not validated yet, because current Triplets deliberately have not been generated at that point. Free Driving → Check Layout first regenerates every Triplet and subsequently applies stored settings to exactly matching stable keys.

  • Valid stored settings are retained and applied.
  • Settings without a match are reported as orphaned with A–B–C, sides and key.
  • After the report, orphaned settings are removed from the project model.
  • The project is marked as changed; the data disappears from the XML on the next save.
  • Current geometry and block directions always take precedence.

5. When does this happen?

A stored Triplet setting becomes orphaned when the movement for which it was defined no longer exists with exactly the same stable key after regeneration. Its properties cannot safely be restored: they described one specific physical movement and direction, not merely three block names. RailKernel therefore never applies them approximately to another Triplet.

  • The geometric direction of A, B or C was reversed, changing the traversed entrance or exit.
  • The BOTH/FORWARD_ONLY direction mode changed, removing or introducing a permitted direction.
  • A participating block was detached or deleted.
  • Usable was disabled, for example because a block no longer contains feedback; Free Driving then ignores that block.
  • Track, turnouts, crossings or connections changed, altering the physical corridor or reachability.
  • A block was reattached or regenerated with another GUID or different boundary connectors.
  • After such a change, no exact match remains for A, B, C and their traversed sides; automatic transfer could attach properties to the wrong movement.

6. Trains participating in Free Driving

The user selects a set of placed trains that may participate in Free Driving.

  • The train is correctly placed.
  • It is not already moving.
  • It is not defective, blocked or deadlocked.
  • A valid Triplet exists in its current direction.
  • It satisfies the participating block and Triplet restrictions.

7. The Free Driving Dispatcher

One central dispatcher determines which train receives the next movement.

  • Available Triplets and block directions.
  • Train and block restrictions, train length and train type.
  • Electrification.
  • Triplet priority and weight.
  • Existing reservations.
  • Waiting time since the previous movement.
  • Potential conflicts and deadlocks.

8. The relay principle

Free Driving does not mean that one fixed group runs continuously. A pool contains waiting trains and a configurable limit controls how many may move simultaneously.

  • Trailing reservations are released after arrival.
  • The arriving train returns at the back of the waiting pool.
  • Another suitable train receives the released movement slot.
  • Trains alternate and the same train does not continually receive priority.

9. Selecting the next movement

The dispatcher finds every valid Triplet from the current position and direction, removes those that cannot be executed, and selects from the remainder. A planned movement may end only in a block where the train is allowed to stop according to the block settings. Station blocks are normal stopping places; other blocks must be explicitly marked for stopping. An emergency or safety stop remains possible in every block.

  • A required block or accessory is unavailable.
  • Block direction, train length, train type or electrification rejects the movement.
  • The destination block is not an allowed stopping place for this train.
  • The movement creates a reservation conflict or known deadlock.
  • Selection uses priority, waiting time, weight or randomness and a preference for variety.
  • Recently used blocks and repetitive shuttling can be avoided.

10. Reservation and execution

The movement is reserved atomically: either every required component is reserved, or none is. If any component fails, the attempt is rolled back and another Triplet or train is tried. During generation, corridors A → B and B → C are recorded together with their track and accessories. The required position of each turnout is derived from the connectors actually traversed, including a train approaching from a branch. Points are therefore always set in advance and are never trailed open by the train.

  • Blocks A, B and C according to the current movement phase.
  • All required intermediate track.
  • Accessories inside the blocks and corridors A → B and B → C.
  • The required state of every normal, curved, three-way and double-slip turnout.
  • An optional following safety section.
  • Existing route, feedback, speed, braking, stopping and safety logic executes the movement.

11. Geometry-based sharp release

During Check Layout, RailKernel precompiles a release matrix for every Triplet. For every feedback in B and C it geometrically calculates how many millimetres that feedback lies beyond the end of block A and beyond the end of every accessory in A → B and B → C. While driving, this distance is compared with the physical train length behind the leading detection axle. As soon as a block or accessory is proven to lie completely behind the train, that individual resource is released immediately. Following trains can therefore use cleared infrastructure at the earliest safe moment.

The final feedback in C is also a hard cleanup boundary: block A and all accessories before B are always released there. This prevents a reservation from remaining stuck because of rounding, an unusual detection length or a missing intermediate feedback event. Infrastructure between B and C remains protected while it could still be underneath the train. The complete calculation can be inspected for every Triplet on the Release matrix tab.

Check Layout also finds the adjacent pair of usable blocks with the smallest combined length. Its report names both blocks, shows their individual lengths and presents their sum as the maximum safe train length for Free Driving. This is where a geometric layout proves its worth: RailKernel knows not merely the order of symbols, but the real distances between them. Schematic software can imitate this only by making the user measure every route physically and maintain piles of manual release tables—a turnout symbol does not know where the rear of your train is.

  • Every feedback in B and C has precompiled distances to block A and the accessories in A → B and B → C.
  • Each resource is released separately as soon as the complete train has cleared it.
  • The final feedback in C always releases block A and all accessories before B.
  • The Triplet Editor Release matrix makes every decision inspectable.
  • The shortest adjacent block pair determines the reported maximum safe train length.
  • Without real geometry, these distances must be measured and entered manually.

12. Arrival in the next block

The first implementation makes a fresh decision after every Triplet. This is simple, safe and dynamic. The train continues when the block is not an allowed stopping place and another safe Triplet is available. Planned stops and waiting take place in station blocks and other blocks explicitly marked as stopping places. A future movement may optionally join several Triplets.

When a train wants to travel from B to C and no safe continuation Triplet B → C → D is currently available, RailKernel anticipates a possible stop in C before the train departs from B. It calculates the remaining distance from the first reliable feedback in C to the end of C. The braking model then selects the highest speed whose complete braking distance fits within that distance; the train may therefore already slow down in B. If even the braking distance at the lowest practical speed does not fit, the movement towards C is not started.

The continuation is checked again when the train reaches the entry feedback in C. If D is still not safely available, RailKernel immediately sends a stop command. The layout must be physically designed and configured so that the train can stop completely within C from that feedback. Without usable braking calibration RailKernel cannot calculate a dependable speed limit, and the configured block speed remains authoritative. Providing a correct braking model and sufficient physical braking distance remains the user's responsibility.

  • The train stops at an allowed stopping place when required.
  • A blocked D can already limit the speed while the train departs from B.
  • The available block length beyond the entry feedback in C must exceed the actual braking distance.
  • If the continuation is still blocked, the train starts stopping immediately at the entry feedback in C.
  • A safety or emergency stop may always be made regardless of the marker.
  • Trailing reservations are released.
  • Position and direction are updated.
  • Relevant events and RailScripts run.
  • After any dwell time, the train becomes available again.

13. Waiting and deadlocks

If a train has no valid Triplet, it waits while the dispatcher tries another train. Availability is reconsidered when blocks or accessories change. If no participant can move, the Train Monitor reports DEADLOCKED.

  • Inspect the situation.
  • Move a train manually or release a reservation.
  • Find an alternative route or disable a Triplet.
  • Stop the Free Driving session.

14. The role of RailScript

RailScript is optional; Free Driving requires no script. Scripts can nevertheless react to its events.

  • Departure, block entry and block exit.
  • Movement start, completion or abortion.
  • Train stop, deadlock or emergency stop.
  • Operate sounds and lighting, display messages, change variables or start other scripts.

15. Summary

Triplets describe what is physically possible. The dispatcher decides which waiting train moves next. Existing RailKernel routing reserves and executes the movement safely. This provides Koploper-style Free Driving based on explicit geometry, visible Triplets, verifiable constraints, dynamic reservations and RailScript events.

  • Triplets describe valid movements.
  • The dispatcher and relay principle provide fair alternation.
  • Reservations prevent conflicts.
  • Feedbacks determine the real train position.
  • A new decision follows every movement.
  • The Train Monitor shows waiting, running and deadlocked states.