Tutorial:Trains

This tutorial explains what there is to know about trains, how to set them up, how to calculate throughput etc.

NOTE: This article is still work-in-progress, images are to be added.

Prerequisites
Trains are unlocked in Tier 6. Before they can be unlocked, Oil processing has to be set up to allow for to be made. Beside Computers, a sufficient amount of and  is also required.

Track construction
are built using and. One railway segment can be up to 100 meters long. Railways take shape and angle based on the terrain they are built on, which can lead to very wiggly tracks or tracks that clip through the ground on uneven terrain. For optimal results, construct Railways on Foundations.

Switches
Switches are formed by joining Railway segments together:
 * This cannot be done directly before or after a Train Station
 * Railroad Switch Control will appear at each switch; it is only relevant for manual driving (automatic trains will always choose a path regardless of the switch control)
 * A switch doesn't have to be just 2-way, it is possible to keep on adding more tracks
 * A switch can be cross-shaped
 * AVOID: There is a bug, where if a single Railway segment has a switch on both ends, automatic trains will have troubles pathing through the switch. Instead of having one Railway segment with a switch on both ends, break the segment into two smaller segments, both of which only have a switch at one end.

Train composition
Trains are made up out of and. Trains with more carriages will speed up and brake slower, but most importantly handle inclines worse. Therefore, having multiple Locomotives is a requirement unless the track is completely without inclines, the recommended ratio is 1 Locomotive for 4 Freight Cars. Whether a Freight Car is loaded has no effect on the weight.

Freight Cars can carry either 32 stacks of items or 1600 m, however, not fluids and items at the same time.

It is un-advisable to mix cargo in Freight Cars, the most optimal solution is to have at least one Freight Car per item. See § Calculating throughput for how many Freight Cars should a train have to have sufficient capacity.

Train operation
A train can be only operated if it has at least one Electric Locomotive and is on a powered Railway. For manual driving, / to speed up or use engine brake (based on direction), to use rail brake and  to use the horn. Automated driving is set up using a timetable (explained in § Automation).

Trains cannot derail (the train is forcefully stopped at the end of the Railway) nor collide with other trains (they simply phase through each other). There are no train signals whatsoever.

Bi-directional trains
Placing a Locomotive (or Locomotives) on both ends of a train makes it bi-directional, as Locomotives on autopilot don't reverse. A bi-directional train can run as a shuttle without turning around.

Stations and loading cargo
Stations consist of 4 different buildings:, , and.

Starting with the Train Station, it is very important to note that it is directional. The direction of the Train Station dictates how will trains arrive in the station, but not depart. That means that for bi-directional trains, both Train Stations have to face the end of the track. Train Stations have to be powered and constantly consume 50 MW, they also power the railway network they are on and all other stations on the same network (making it an extension of the standard power grid).

Freight Platforms attach to the Train Station. They can be rotated either left or right, which has no effect on how they behave. Inside their UI, they can be either set to "load" or "unload" (where the yellow button is the currently active option). One Freight Platform handles one Freight Car, therefore in order to load a train consisting of one Locomotive and three Freight Cars, the station will begin with a Train Station (for the Locomotive) followed by three Freight Platforms. Freight Platforms stop accepting or outputting items during the 25-second long loading animation. In order to prevent items from stopping moving, Industrial Storage Containers or at least two Industrial Fluid Buffers should be placed before each loading and after each unloading Freight Platform.

Freight Platforms can be spaced out using Empty Platforms. For example, for a train made up of 2 Locomotives and 7 Freight Cars where only the 3rd Freight Car has to be loaded, the station will consist of a Train Station, 3 Empty Platforms (one for the second Locomotive and two for the two Freight Cars that precede the 3rd one) and one Freight Platform (that handles the 3rd Freight Car). It is not necessary to add flailing Empty Platforms after the last used Freight Platform.

Building a complete railway
As an example, we'll automate the transportation of products:, ,  and  or. Packaging the fluid doubles the capacity one Freight Car can transport, at the cost of having to deal with recycling Empty Canisters or dedicating a part of the Plastic production, it is better to use double the amount of Freight Cars in that scenario. It is best to avoid transporting fluids as much as possible (that's why we're transporting Crude Oil products and not Crude Oil itself; for power generation, burn all produced Fuel near the source without having to transport it, for Jetpack and Vehicle fuel only small amounts of either fluid or Packaged Fuel are necessary). For the purpose of this tutorial, fluid Fuel will be transported.

Starting with the train, it will have 5 carriages (one for Plastic, Rubber and Coke each and two for fluid Fuel, avoiding mixing cargo whatsoever). As mentioned above, the recommended ratio is 1 Locomotive per 4 Freight cars, and because five Freight Cars are used, the train will be hauled with two Electric Locomotives. It is very useful to define the order of the carriages, so we don't accidentally happen to mix cargo later on.

The station at the Crude Oil outpost will consist of a Train Station, one Empty Platform and five Freight Platforms, of which the last two are for fluids. All of the Freight Platforms have to be set to "load" in their UI (each one individually). The Train Station can be renamed upon being interacted with.

The station at our destination will look exactly the same, with the only exception that the Freight Platforms will be set to "unload".

Automation
Trains can be automated using a timetable. Despite the name, the timetable has nothing to do with time, only sets which stations the train should path to and stop at, it is not possible to e.g. make the train wait until it is fully loaded or unloaded. Setting up the timetable is quite primitive:
 * Make one entry for each Train Station, in order, only mentioning each station once
 * The train will complete the route in order and automatically go from the last station to the first one
 * Bi-directional train routes are set up the same way, however, ensure the train can actually reach all of the stations (as mentioned above, Train Stations are directional and trains can only arrive in them in that direction, but can depart either forward or in reverse)
 * If the train cannot find a path, check if are all Train Stations rotated correctly, and the Railway is connected (easiest way to check if the Railway is connected is to drive the route manually, if the train suddenly stops then the Railway is not connected)