You are here: Wiki > start > usertrack > ssrun > rolling_stock_accounting

Table of Contents

Rolling Stock Accounting

Rolling Stock Accounting

Some depots and sidings (i.e. places where trains exit the simulation but don't leave the physical area) use a feature called "rolling stock accounting"; whether this has been used is up to the simulation developer. When this has been implemented for a location, the simulation keeps track of what trains have been sent into the depot or come out of it and ensures that the results are realistic. No longer do you have something that in reality is two short sidings but in the simulation you can have dozens of trains enter from it without any exiting at the location.

Rolling stock accounting only keeps track of the length of train sent into the location or entering from it. It doesn't worry about specific types of rolling stock, electric versus diesel, or anything else. Each location that has accounting applied to it has a fixed capacity (presumably based on how long the various roads in the depot actually are). In the examples on this page, that capacity is 500 metres.

Put simply, when a train tries to exit at a location, the core code checks whether there's enough space for it. If there is, the train exits and the amount of rolling stock in the depot increments accordingly. If there isn't enough space, the train sits on the last piece of track, unable to exit. Similarly, if the timetable says a train enters but there isn't enough rolling stock there, nothing will happen. Here's an example:

Occupancy at 12:00 300
150 metre train exits the simulation 450
100 metre train enters the simulation 350
200 metre train attempts to exit 350 Train can't exit as only 150m of space left
150 metre train enters the simulation 200
150 metre train enters the simulation 50
100 metre train attempts to enter 50 Train can't enter as there's not enough rolling stock left

When the simulation starts, the core code has no idea how much is in the location. Therefore the code is a little bit cleverer: it keeps track of the minimum and maximum that could be in the location. Initially this could be anything between 0 and 500 metres of rolling stock but eventually, as trains go in and out, the number will be known exactly. For example:

Simulation start 0 to 500
100 metre train enters the simulation 0 to 400
100 metre train exits the simulation 100 to 500
150 metre train exits the simulation 250 to 500
100 metre train exits the simulation 350 to 500
(200 metre train can't exit)
120 metre train enters the simulation 230 to 380
200 metre train enters the simulation 30 to 180
(200 metre train can't enter)
100 metre train enters the simulation 0 to 80
50 metre train exits the simulation 50 to 130
130 metre train enters the simulation 0
(no train can enter the simulation)
160 metre train exits the simulation 160

And now the contents are known exactly.

Note: separate from this, there may be restrictions on how long a specific train may be and still enter or exit the location. For example, a depot might have a main exit with no restrictions but also a second exit that involves using a 40 metre long head-shunt. Trains entering or exiting that way are limited to 40 metres in length irrespective how much stock or space there is at the location (but if there's only 20 metres of stock in the location, you obviously still can't have a 40 metre train entering).

Back to Text Tutorials

Last edited by clive on 04/07/2022 at 07:03