Skip to content
Connected RailsConnected Rails

Stabling roads and shunt jobs

A line that is only driven along needs nothing here; a line that is shunted needs somewhere to shunt to. yards: names the places stock lives — a mark on the track like a device, with the direction a standing train faces and the length of the road behind it:

yards: [
(name: "Portal West", kind: Portal, edge: 0, s: 300.0, facing: Forward, length: 300.0),
(name: "Portal Ost", kind: Portal, edge: 1, s: 300.0, facing: Backward, length: 300.0),
(name: "Abstellgleis 1", kind: Stabling, edge: 2, s: 20.0, facing: Backward, length: 280.0),
],

Two kinds, and the difference is what may happen there:

  • Stabling is a siding on the modelled line. A unit left on one stands where it can be seen and occupies its road like any other train — this is what an operating day puts its stock on between two workings.
  • Portal is the edge of the modelled line: the fiddle yard past the last signal, the junction to the railway you did not build. Trains appear and disappear at portals and nowhere else. The rule check refuses a portal whose track does not run out to a buffer stop or a module boundary — a train appearing on a running road is not a train, it is a collision.

name is content, not translated: it is a place on this line, like a station name, and it is what a shunt job addresses. edge/s is where the head of a standing train comes to; facing is the way it looks (into the line at a portal, out of the siding on a stabling road), so the body of the consist lies on the other side of the mark. length is what fits on the road — 0 means “not stated”, and then nothing is refused for being long. Two roads of the same name is a finding, because a job that names it would always get the first one.

Yards follow their track exactly as devices and objects do: splitting an edge carries them onto the right half, deleting one takes its roads with it, and a composition shifts every edge by the module’s offset — so a module names its own roads and the composed line has them all. The example line (mods/example/lines/beispielstrecke.ron) has a turnout at km 4.0, a stabling siding off its diverging leg and a portal at each end.

The simulation reads them as sim_core::yard::Yard: Sim::place_at(train, "Abstellgleis 1") puts a consist on the road (refusing one that is too long, a road that is occupied, or a mark the track behind runs out on), and Sim::withdraw(train, "Portal Ost") takes a train off the line at a portal it is actually standing at. A withdrawn train keeps its slot and its vehicles — it is out of service, not deleted — so the same unit comes back out later.

A driver can be given a shunt job instead of, or after, a timetable — a list of moves worked off in order. A job is a ShuntJob and has three places to live: inline in a consist’s shunt: (below, under Operating days), a file of its own in jobs/*.ron that a scenario script hands to a driver by name (cr.shunt(train, "example:lokzug_abstellen"), see Scenario scripting), or a table the script writes itself. mods/example/jobs/lokzug_abstellen.ron is a file of that kind:

(
name: "Rangierfahrt Musterstadt",
moves: [
SetBack(Yard("Abstellgleis 1")),
Couple,
DrawUp(At(edge: EdgeId(0), s: 900.0)),
Uncouple(0),
Stand,
],
)

DrawUp runs forward until the head is at the target, SetBack reverses until the rear is — that is what “set back onto a road” means, the road takes the rear first. Either move ends early when the buffers are met, whatever the mark said, because that is what the shunter’s arm is for. A target is either a point on the graph (At(edge:, s:), with an optional module: resolved against a composition like a timetable stop) or a road by name (Yard("…")). Couple joins the train to whatever it stands up against; Uncouple(n) parts it behind vehicle n; Stand finishes.

The job is driven at the German shunting speed, 25 km/h, creeping over the last few metres. A target the line does not have, or a coupling that cannot be made, stops the train instead of running it on to nowhere.