The complexity is actually from the routing issues:
- Each freight car has a destination.
- The destination has a maximum car limit as well.
- The destination maybe had a/some car/s there already.
- Each car has a destination has a loading/unloading time*
- Some of these may be ready to be collected.
- If we collect them on this train, could this generate a demand for a replacement car
- and round we go again!
Determine the next train
- Select all of the possible cars in the yard that are available to be shipped (excluding empties).
- Select all of the cars on the route that are ready to be collected (either because they are empty or are now loaded - and have been at their current location for sufficient time (see * above)
- Use a randomiser to provide a list of cars up to the defined maximum car number for the train (it is possible that the number of cars is less than the maximum, but that is OK).
- Assess the cars to be collected on route (remembering that empty cars can be skipped if required)
- Assess the effect of these collections against the train length at each pickup/drop off location.
- If the number exceeds the maximum train length, re-assess the list until everything is OK.
- Once the train is defined, calculate the weight of the train and allocate sufficient head end power.
- If sufficient power is not available, reduce the length of the train accordingly - use the randomiser once more to decide on the final make up.
Complex Routing
The other interesting thing is that some cars have a complex routing requirement. let us take an example from the Pacific Fruit Express (PFE) back then when they used refrigerator cars that were chilled with block ice. Let us say that the PFE storage yard is somewhere north of Los Angeles, CA. It might go as follows:
- The car is sitting on a storage track
- It needs icing at the Ice House
- It is then shipped to the appropriate fruit packing company (maybe there are 3 with sidings on our division so it could be any one of three.
- It is loaded (1 day)
- It is collected and shipped to its destination
- It is returned to the storage track for cleaning and awaiting the next time.
- Ships to Oregon so their cars go north and transfer to other railroads
- Ships to Chicago so their cars go east and transfer to other railroads
- Ships to San Francisco so theirs stay on the home road
and so on...
Train Length
Initially, train length is determind by the number of cars that shuld be routed - taking into consideration that each and every industry has a frequency of cars attached. This means that it is possible for a train that is allocated a length of 10 cars may only be allocated 2 or 15. below the defined train limit, there is no issue but if the number is above then the randomiser will allocate cars to be dropped.
However, the ultimate limit is set by the train length. This, in itself, is set by a few factors - the power of the loco, the weight of each car and also, because it may meet other trains en-route (most US railroads are single track), the length of a siding that it can get into to get out of the way. The power of the loco isn't that important as you can always connect a second (or even third or fourth) loco. It is the siding length that is the ultimate limiter consequently, the maximum train length is one of the attributes of the train itself. This may differ by train type. If the train is a local/way freight then the limit is the shortest siding at locations along the route. If it is a through freight then the limit would be any siding on the main line. Passing sidings are not necessarily at a town or industry along the route but just may be on the main line for efficiency's sake.
However, the ultimate limit is set by the train length. This, in itself, is set by a few factors - the power of the loco, the weight of each car and also, because it may meet other trains en-route (most US railroads are single track), the length of a siding that it can get into to get out of the way. The power of the loco isn't that important as you can always connect a second (or even third or fourth) loco. It is the siding length that is the ultimate limiter consequently, the maximum train length is one of the attributes of the train itself. This may differ by train type. If the train is a local/way freight then the limit is the shortest siding at locations along the route. If it is a through freight then the limit would be any siding on the main line. Passing sidings are not necessarily at a town or industry along the route but just may be on the main line for efficiency's sake.
Note:
In American terminology what we in the UK call a siding as named a "spur". A siding, in US terminology, is a length of track parallel (usually)to the main track and connected at each end by a point (US - switch). This provides a "hole" for one train to go into thus getting out of the way of a, second, oncoming train. This is not something that we see often in the UK as very little of our routes (apart from a few branch lines) are single track.
This will be a fun bit of code to plan and implement.