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 it is not moving. It may draw up to 110 MW when accelerating, with the exact amount depending on how much "strain" it 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 the sum of every locomotive's consumption on that train. A train with four locomotives may thus show 100 - 440 MW.

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 and cab is the front and the side with six motors is the rear. When driving a train manually, the position of the locomotive within a train doesn't affect which direction you can travel in, neither does it affect the maximum velocity.

However, auto-pilot can only travel if they have at least one locomotive at front end of the train, with the front facing in the travel direction. A train with locomotives only facing forward can only travel forward in auto-pilot and requires a loop at the end of the line to turn around; a locomotive in the middle of a train cannot run in auto-pilot; a train with at least one locomotive at either end, with the fronts facing away from each other can be automated in both directions and no longer needs to turn around.

Every locomotive always provides full force regardless of where it is in the train, making it possible to add more locomotives so a heavy train to can climb a steep hill.

Locomotives automatically engage the brakes when there is no driver. Thus they can be freely built on a slope and will try to stop when no driver is inside, even in 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. The brakes can release before the locomotive has reached enough power to get moving. This means that if the train is on a hill, will begin rolling backwards until the locomotives pull power up enough to pull the train up the hill.

Trains have two different braking systems:
 * Pressing the directional key in the opposite direction ( or ) of travel will engage the regenerative 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 80 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 driving manually, releasing the brakes will cause the train to start rolling. Exiting the train will automatically engage the brakes, and it will try to stop from rolling. It will keep braking until it receives player input again or auto-pilot is engaged and active. 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
A single locomotive can pull approximately 100 freight cars on a perfectly flat rail, granted that they are empty. ( See section on Weight and Forces below )

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. Due to freight cars having variable weight depending on how full they are, the number of locomotives needed varies. The steepness of the tracks also affects this.

Weights and forces
Locomotives weigh 300 t. At maximum strain, they use 110 MW, and apply a force of 2000 kN. The train's total weight influences acceleration. A train with one locomotive and a total weight of 2000 tons (17 full freight cars + locomotive) will accelerate at roughly $$\frac{2000\ kN}{2000\ t} = 1\ m/s^2$$. This means that it will reach 36 km/h after 10 seconds or 50 m. Above 60 km/h, the train will dial back the force gradually, so the total time to reach maximum speed is greater than expected. The total force applied is the sum of force from locomotives and negative slope force minus all resistances.

The air brake applies a force of 900 kN ( 200 kN on freight cars), while the regenerative brake applies 600 kN above 80 km/h and 2000 kN below. A train's braking force is the sum of all brakes combined.

The resistances influence how fast trains can go and how big they can be. Every single freight car and locomotive in a train is affected by these forces individually. Namely, these forces are:


 * Drag: Also known as air resistance, this force increases the faster the train goes. It increases by the square of velocity. The Locomotive at the front will experience roughly 15 kN at 120 km/h, for every Freight Car this increases by about 5.4 kN.
 * Roll Resistance: This is the friction of the wheels. For Locomotives, it is a static 4.4 kN. For Freight Cars, it ranges from 0.4 to 1.5 kN, increasing with the total weight of the car.
 * Incline Force: This is the force experienced when on a slope. It pulls the train backwards, and is equal to $total\ weight \times slope$ . If the train is moving downhill, this force is negative and is added to locomotive force. (see Freight Car for details.)
 * Curve Resistance: As trains take curves, they experience an additional rolling resistance. This one depends on the curve radius and train velocity. It can be approximated as: $$\frac{0.4\times weight \times velocity}{radius}$$ . Note that for freight cars, only their payload is accounted for. The curve radius is measured from the middle of the tracks. A quartercircle curve on 3x3 foundations has radius 22 m, a 6x6 curve has radius 46. Larger curves have smaller curve resistances.

An empty Freight Car weights 30 t, while a full one weights 100 t (the payload is 70 t, composed of the 14 t for the container and 1.75 t for each full stack).

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 can save power if done correctly. A locomotive can consume a maximum of 110MW, while a freight platform consumes 50MW. This means that if you have to add more than 3 platforms to achieve proper throughput, it is more efficient to simply add a whole other train.
 * 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 48.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.
 * The general design of the locomotive appear to be an EMD F40PH Diesel Locomotive

History

 * Patch 0.6.0.10: Lights now actually emit light, similar to motor vehicles
 * Patch 0.6.0.0: Removed Beacon cost
 * 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 Электровоз