Electric Locomotive

The Electric Locomotive is a vehicle used to transport cargo and pioneers along the Railway. Connected Freight Cars can be loaded or unloaded via Freight Platforms. The Electric Locomotive can be automated, by setting a list of Train Stations for it to stop at.

Multiple cargo freight cars and locomotives can be chained together to form a single train. The train is currently the fastest ground vehicle in-game, allowing for efficient long-range resource transportation. Aerial Drones, unlocked at Tier 7, are twice as fast, but have their own set of advantages and disadvantages.

Power consumption
The Electric Locomotive requires a minimum of 25 MW to operate at all times, even when stationary or docked at a Train Station. It may draw up to 110 MW when accelerating, with the exact amount depending on how much "strain" the motor is under; for example, it will use more power when climbing a hill than on a level track. Likewise, it will automatically dial back the power consumption when under less strain, dropping to its minimum 25 MW when going downhill. A locomotive cannot accelerate unless the railway is powered, but it can always use its brakes.

Note that the power consumption shown in the HUD is multiplied per locomotive on that train. For example, when driving a train with four locomotives and drawing the maximum load of 110 MW, you are actually consuming 440 MW total.

By holding the key opposite of current travel direction ( or ), the Locomotive will use the regenerative brake. The regenerative brake will, depending on the current speed of the locomotive, generate up to 33 MW. By subtracting the base demand of 25 MW, this results in a net power gain of up to 8 MW.

Construction
A locomotive can only be constructed on a railway. The face with the windshield is the front and the side with six motors in the rear. When driving a train manually, you can travel at full speed both forward and backward regardless of the position or direction of the locomotive within the train. However, auto-pilot can only travel in a given direction if there is at least one locomotive at the front of the train. For example, a train with three locomotives facing forward can only drive forward with auto-pilot and requires a loop at the end of the line to turn around; a train with the first and last locomotive facing forward and the middle locomotive facing backward can still only travel forward; a train with the front two locomotives facing forward and the last locomotive facing backward can be automated in both directions and no longer needs to turn around. Every locomotive always provides full torque regardless of the direction of travel.

Locomotives automatically engage the brakes when there is no driver. Thus they can be freely built on a slope and will eventually come to a stop if you jump out of a moving train with no auto-pilot. To add more locomotives or freight cars to the train, simply aim at the railway in front of or behind the train and the blueprint will usually snap in place. Sometimes the blueprint will not look like it is snapping, but building the locomotive or car anyways will still connect it to the rest of the train if it is close enough that it should snap. There is no way to edit the middle of a train; the only way to edit the middle of a train is to dismantle the whole thing and rebuild it in the new layout. Locomotives or cars can be added even when the train is moving, but only by the host in multiplayer games.

A locomotive cannot be dismantled while it is moving or on an automatic schedule, only when it is completely stationary and auto-pilot is disabled. However, the railway beneath it can be dismantled and the train will abruptly halt and remain floating in the air.

Usage
Entering a train with auto-pilot disabled will allow you to drive it manually. Holding the forward or backward directional key will begin "revving up" the locomotive, slowly increasing the power consumption until the motors generate enough torque to overcome its weight and the train begins to accelerate in that direction.

Trains have two different braking systems:
 * Pressing the directional key in the opposite direction ( or ) of travel will engage the electric brakes. They are quiet and have no outward visual sign of being engaged except the flashing UI element that says "BRAKE" and partially extending the air brake flaps (the panels on top of the locomotive) when traveling forward at very high speed. These brakes are less effective at high speed and reach maximum stopping power below approximately 50 km/h.
 * Pressing the handbrake key will engage the air brakes. They are loud and engage multiple moving parts across the train, including fully extending the air brake flaps, lowering a large brake pad located between the two sets of wheels on locomotives that presses directly onto the railway itself, and pressing brake pads against every wheel on the entire train, including freight cars, which creates a high pitched squealing sound, make freight car wheels glow red at high enough speeds, and release a jet of air pressure upon reaching a full halt. These brakes have the same stopping power regardless of your current speed.

Either brake systems can be engaged separately or both can be engaged together for maximum stopping power. When stopped on an incline, even a very gentle one, releasing both brakes will cause the train to begin rolling downhill. If it is for some reason necessary to remain stopped on an incline and manually holding the brakes is to be avoided, exiting the train will automatically engage the brakes and they will remain "locked" down even after re-entering the train until some input is received or auto-pilot is engaged. Under its own power, a locomotive's top speed is approximately 120 km/h on a flat railway. Its top speed is slower when climbing a steep incline, but should always be capable of reaching at least 54 km/h so long as the train is not too heavy for the locomotives. When rolling downhill it can rapidly accelerate well beyond its top speed, nearly 500 km/h given a long enough hill (see image).

Currently, trains can only collide with wheeled vehicles and other trains. Trains will pass freely through everything else, including natural terrain, player-built structures, and even the player themselves, doing no damage and losing no momentum. The sides of the train do have collision boxes, but only to prevent the pioneer from clipping through the sides.

Train length
If used on a very flat railway, a single locomotive can pull dozens of freight cars, possibly with no limit if the railway is perfectly flat, only with progressively slower acceleration.

However, even a slight incline will cause the weight of the cars to quickly overcome the locomotive and it will begin to roll backward. Using natural hills or building a mixture of 2m and 4m ramps it is possible to achieve the steepest possible incline (see for more details), but a chain of 2-meter ramps or Double Ramps is the steepest incline that can support a railway and can be quickly and easily built. Using such an incline as a testing area, a single locomotive is just barely capable of pulling five freight cars without losing speed and can't even start from a full stop on such an incline, but it is very slow and is unlikely to work in any rail system with hills, and six cars cause the train to slowly lose speed and eventually start rolling backward given a long enough climb. Therefore it is recommended to maintain a ratio of no more than four cars per locomotive, but the flatter the railway, the fewer locomotives are required.

Weight of loaded Freight Car
A Freight Car's weight varies by load, see Freight Car for details.

An empty Freight Car weights 30 t, while a full one weights 100 t.

Train throughput
These formulas are only theoretical, as the round trip duration will increase due to congestion and trains waiting for other trains to pass.

The maximum potential throughput of a single train can be calculated in stacks/min or fluid using the following values:
 * Total round-trip duration of the train (in minutes)
 * Amount of Freight Cars
 * Storage capacity of each Freight Car (currently 32 stacks or 1600 m)

Then, the equation is:

$$Train\ throughput = {Storage\ capacity \times Amount\ of\ carriages \over Round\ trip\ duration}$$

E.g. for a train of three carriages that completes the round trip in five minutes:

$${32 \times 3 \over 5} = 19.2$$ stacks per minute or $${1600 \times 3 \over 5} = 960$$ m per minute.

The round trip duration depends on the speed of the train (number of locomotives), the length of the train (number of cars), the length and incline of the track as well as loading/unloading time (each lasts 27.08 seconds). One full cycle should be measured with a stopwatch. During loading and unloading animations, Freight Platforms stop accepting and outputting items, therefore it is advised to build or  for each Platform to prevent the flow from stopping.


 * For higher throughput, it is advantageous to extend the current train length instead of adding more trains. This also saves power.
 * The train average speed reduces as the distance reduces. Thus it could be disadvantageous to use trains for short-distance transportation.

Achieving desired throughput
The required amount of carriages can be calculated if the desired throughput and round trip duration are known.

$$Amount\ of\ freight\ carriages = {Throughput \times Round\ trip\ duration\ \over Stack\ size \times32}$$

$$Amount\ of\ fluid\ carriages = {Throughput \times Round\ trip\ duration\ \over 1600 }$$

Just like with the first formula, minutes have to be used (7 minutes and 30 seconds is 7.5 minutes, etc.).

$${Seconds \over 60} = {Minutes}$$

For example:
 * The desired throughput is 500;
 * Round trip duration is 3 minutes and 2 seconds;
 * Stack size is 200;

The first step is to convert seconds to minutes: $${2 \over 60} = 0.0333$$, combine the converted seconds and minutes to get total trip duration: $$3+0.0333 = 3.0333$$

So the final equation will be: $${500 \times 3.03 \over 200 \times 32} \approx 0.237$$

After this round the number to the first full number above it, so in this case we need 1 carriage.

Freight Car throughput
The maximum potential throughput of a single Freight Car can be calculated in items/min using the following values:
 * Total round-trip duration of the train (in minutes)
 * Storage capacity of a Freight Car (currently 32 stacks)
 * Stack size of transported cargo

First, time to fill has to be calculated: $$Time\ to\ fill = {Cargo\ stack\ size \times Freight\ Car\ capacity \over 1560}$$ or simply $$Time\ to\ fill = {Cargo\ stack\ size \over 45.75}$$

If time to fill is higher or equal to round trip duration: $$Freight\ Car\ throughput = {Round\ trip\ duration - 0.4513\overline{3} \over Round\ trip\ duration} \times 1560$$

If time to fill is less than round trip duration: $$Freight\ Car\ throughput = {Time\ to\ fill \over Round\ trip\ duration} \times 1560$$

Freight Platform fill duration
The following table shows how long it takes to completely fill up or empty the storage of a single Freight Platform. Format is h:mm:ss.

This table is useful for determining whether the round trip time isn't too long. The round trip time shouldn't be more than 3/5 of the shortest time required for the whole train.

Round trip time versus train length
Two end-to-end stations with a fixed length of railway in between are built, and the time taken for a round trip is measured: The train is configured as a 1-n-1 double-headed train, where n is the number of freight cars attached in-between.

First test: Distance = 8km (approx. diagonal length of the map)

Second test: Distance = 800 m (approx. the distance from grass field to coal) (Further testing is required)

A double-headed train with no Freight Car and manual drive is measured as a reference. Where a Freight Car is present, the loading and unloading time of 27.08 seconds at each station is included.

Automation
Pressing the vehicle menu key while inside the train (same as Resource Scanner, ) or interacting with any connected train station will bring up the train schedule menu. This allows you to toggle auto-pilot on or off and to edit the automation route. Name the train, then select it and set at least two different stations and a schedule will be created, which can be edited later. Train stations will only accept trains from one direction, but a train can depart in either direction. If a train does not begin moving once a route is set, check that the railway is connected properly, that all train stations are facing the correct direction, and check that the line has power.

Automated trains accelerate and brake slower, brake around sharp turns, and attempt to slow down as they approach a station on their schedule. However, if a train is unable to stop itself before reaching its scheduled stop (such as a station at the bottom of a steep hill), it will instantly halt exactly as if it had reached the end of a railway.

All connected locomotives are treated as a single train and share the same train schedule. Modifying a train's length in any way will completely reset its name and existing schedule.

Current issues

 * Trains currently have multiple issues when playing as the client in a multiplayer server:
 * Moving trains appear to lag.
 * Clients cannot manually drive trains or edit the automation schedule.
 * Trains always appear to have no power.
 * Clients cannot add additional locomotives or cars to a moving train.
 * Attempting to 'ride' a train by standing on top of it will crash the game and may kill the client upon attempting to re-join the server.
 * Sometimes after exiting a train, the build menu is locked. The issue can be resolved by pressing P twice, saving and loading the game, or by entering and exiting a Hyper Tube.
 * This can be caused if the train rides through a body of water
 * If two Train Stations are built without a gap separating the two station structures (such as a Train Station, Freight Platform, Train Station, Freight Platform setup) and two trains stop one in each station, both trains will get stuck in docking until the game is reloaded.
 * Some of these issues may be fixed by changing the Network Quality to Ultra under Gameplay Options for both the host and the client, however on poor connections this may make issues worse. Testing is advised.

Trivia

 * When using the horn (by pressing the left mouse button), there is a very slight chance that a steam locomotive horn will be heard instead of the normal one.
 * Unlike wheeled vehicles, automated trains continue to function when submerged underwater. Manually driven trains, however, will disembark the pioneer upon entering the water.
 * Pioneers inside a train are immune to Poison Gas and Radiation damage.
 * The train leans slightly when turning.
 * If a player is standing on a moving train and another train passes through it going the opposite direction, the player will be carried away by the second train

History

 * Patch 0.5.0.0:
 * Now can collide with each other rather than phasing through
 * Trains can't collide with motor vehicles, buildings or terrain, only other trains
 * Derailed trains can be re-railed by approaching them and pressing
 * Now listen to Train Signals
 * A list of keybinds is now shown while driving
 * Intersections can now be switched remotely while driving
 * Timetable UI has been reworked, with the addition of Stop Settings
 * Now can be painted from the Customizer
 * Patch 0.3.6.8: Fixed tick type for Electric Locomotives
 * Patch 0.3.4.13: The Trains handbrake animation will no longer end up in a spamming loop
 * Patch 0.3.4.9: Client players can now interact with Trains when the host is far away
 * Patch 0.2.1.20: Fixed Trains not receiving power on loading a game
 * Patch 0.2.1.17: Trains now auto release the brake if you jump in and apply throttle (W or S).
 * Patch 0.2.1.16:
 * Bugfix: Trains will no longer be stuck in docking due to multiple linked stations.
 * Bugfix: Update the master locomotive for player driven train during load.
 * Bugfix: Entering a train no longer auto releases the brakes, needs manual release with space.
 * Patch 0.2.1.15:
 * When a bidirectional train "reverses" it will now brake correctly.
 * Appending an AI controlled train doesn’t make the AI lose control over the train anymore.
 * Unmanned trains (not driven by player or AI) now automatically apply their brakes.
 * Patch 0.2.1.14:
 * Manual docking would sometimes crash, the crash is avoided but it's likely that the train won't dock if this case occurs.
 * Crashfix: Trains sometimes crash on client or when exiting the game.
 * The reverser would be incorrectly updated for bidirectional trains causing them to not be driveable in one of the directions. This affected both player and AI.
 * Patch 0.2.1.13:
 * You can have the AI enabled while being inside the train.
 * Self driving calculations improved for better brake prediction; this shortens the brake distances and fixes some problems going uphill or downhill.
 * Sound no longer plays when the train is not close to a player.
 * Only one AI per train; fixes the edge case where 2 AI's would try to drive the same train.
 * Trains sometimes run too fast and miss the station. This made them unreliable; now the AI brakes better and the station catches the train.
 * If a train is split in half at a switch the train is repositioned back together.
 * Fixed case where player character could get destroyed while driving a train near water.
 * Cannot use build gun after being inside a train near water.
 * Trains now save their velocity so they keep moving when loaded.
 * Patch 0.2.1.11:
 * Train names should now be saved correctly (also for clients)
 * Trains should now be properly shown on the Compass
 * Patch 0.2.1.3: Train particle effects that build up over time and result in decreased performance now get removed properly.
 * Patch 0.2.1.1: Added sound for steam when stopping
 * Patch 0.1.20:
 * Power consumption increased. From 15 -> 25 and max 80 -> 110
 * Fixed the bug that caused the train to abort the docking sequence prematurely
 * Fix for when 2 people try to dock the same train
 * Trains with multiple locomotives should dock properly now
 * Trains now lean in curves
 * Patch 0.1.19:
 * Power warnings for Trains
 * Client can now kind of drive Locomotives
 * Patch 0.1.17 build 101353:
 * Added docking notification while driving a train
 * Train AI no longer gets stuck when railroad is removed ahead
 * Trains can now dock in reverse
 * General improvements to the self-driving AI
 * Updated some of the Train UI
 * Patch 0.1.17: Trains should no longer get stuck if they don’t have any valid Freight Platforms
 * Patch 0.1.16: Introduced

Gallery
Elektrische Lokomotive Locomotive électrique Электрический локомотив