ELI5 - Train Distance Calculations

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
MakeItGraphic
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Jan 06, 2018 7:53 am
Contact:

ELI5 - Train Distance Calculations

Post by MakeItGraphic »

I am trying to extrapolate the total distance and time a set train schedule travels to reach its stop. Eg. From Station 1 to Station 2 is 234km, time taken in game is x. [A day = 7 mins https://wiki.factorio.com/Time (or 6M.56S.4MS so an hour is 27S.35MS)]
In-Game_Day.PNG
In-Game_Day.PNG (1.55 KiB) Viewed 1393 times
To calculate distance you need to need to know the scale:

Tile Distance = 0.001KM x 0.001KM
Types of Rail Collision Boxes = 3 (this is all observational, it could very very well be wrong)
Straight Rail = 2 Tile L = 0.002KM
Curve Rail =*5 Tile L = 0.005KM
Diagonal Rail = 1 Tile L = 0.001KM
RAIL_COLLISIONBOXES.PNG
RAIL_COLLISIONBOXES.PNG (879.42 KiB) Viewed 1393 times
Then you need to way to count the total number of rails between said stations.

Something like this could probably help with that: https://mods.factorio.com/mod/tape_measure_tool

Anyways once you have the distance measured you need to know the speed: Locomotive (base) | 259km/H (COAL)

Acceleration Formula:
Acceleration_Formula.PNG
Acceleration_Formula.PNG (22.64 KiB) Viewed 1393 times
https://docs.google.com/spreadsheets/d/ ... 1156092035

At this point I am becoming lost, its overly technical for me. However am I on the right track? (pardon the pun)

----------------

My now realization of why this stuff has no real significance in game is because of how drastically short an hour really is in the world of Factorio. However with that said two questions as follow up to the above:

1. Wait Conditions |Time Passed

https://wiki.factorio.com/Railway
Wait_Conditions.PNG
Wait_Conditions.PNG (16.19 KiB) Viewed 1393 times
There is no mention of what exactly 'Time Passed' means, but I'm assuming this is set in Factorio time right? So default condition is 30S, or approximately wait for 1 hour. Or no?

2. Modifying the clock

Lets say you changed clock to:

If D = 2H then H = 5M | Diurnal Cycle Split 60MIN

What effects does this have on the game, keeping in-line with what was said here

Again 'Locomotive (base) | 259km/H (COAL)' default time this would take APPROX. 30S to travel 259KM. However if the clocked was changed would the in-game mechanics compensate for this so then it would take 5M to travel 259KM. Or are the day/night clock separate from the internal clock mechanics?

Code: Select all

Ticks

The base unit of all time inside Factorio. When running at game speed 1, there should always be 60 ticks in every real-time second leading to the figure of 60 updates per second, short UPS. This means that 1 tick should ideally always take 1/60th of a real-time second (0.01667 seconds). However, it is possible to change the game speed using mods or console commands, so it is possible that ticks don't take 0.01667 real-time seconds. Furthermore, game speed will automatically slow down when the computer that is running the game is unable to do all needed calculations in the wanted 0.01667 real-time seconds. The "show-fps" debug option allows to see the current UPS which can be used to estimate how long a tick currently takes. 
It starts to become overly technical again here for me.

If anyone could help shed some light on these matters it would be greatly appreciated. - MiG
User avatar
MakeItGraphic
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Jan 06, 2018 7:53 am
Contact:

Re: ELI5 - Train Distance Calculations

Post by MakeItGraphic »

0k so the time of day is just to control day/night cycle not game mechanics. 1H in day cycle seems to be 1MIN by the clock in 'Time Tools' mod which is actually 20-21S approx. in real time, which is actually quite a bit shorter then the reported time. However that's probably my math or something else.

Anyways a day in Factorio is 7 mins. A day is 24 hours. An hour in a day in Factorio is 1 minute in Factorio clock*, so a day is 24MINS VS the 7 mins on D/N cycle.

So if "Locomotive (base) | 259km/H (COAL)" that's not 30S rather 1M?

And if that's actual measure of time for game mechanics vs using D/N cycle you could set the D/N cycle to match the G/M cycle to get an accurate measure on in-game "time"

EDIT: 0k holy god, so if that time to reach top speed is based on the G/M time cycle not the D/N time cycle. Then it's probably safe to assume the same goes for the 'Wait Condition' at 30S which is 30 mins D/N.

So if you wanted a train to sit for x hours you'd do it in intervals of 30S.

The whole point of this is I'm trying to program combinators to send circuit conditions based on the D/N cycle to train stops to create schedules.

EDIT: I think this kind of makes sense now :?: So bad at math, 1 hour last 1 min by default game settings approx.

So to be matched it has to be increased by a factor of 60, to match the G/M time cycle.

EDIT: when i did this I got 472S total cycle 7.86M, default says 416.66S for cycle 7M.
DN_SYNC.mp4
(1.66 MiB) Downloaded 69 times
Anyways, that kind of fixed the issue for me. Used Clockwork | https://mods.factorio.com/mod/Clockwork

Edit: Now that the two clocks are synced I can see 'Wait Conditions' are actually based on RT (real time) not the game time. Can this be added to the wiki for the 'Time Passed' condition?

30S RT passed is about 1H30M G/M. So every 10 seconds RT is approx. 30 mins in game.

EDIT:

[20S(RT)=1H(GM)]=224S(DN^.25) = 2H(RT)/386H(GM)/24H(DN^.25)
[20S(RT)=1H(GM)]=15M(DN^4) = 30M(RT)/96H(GM)/24H(DN^4)
[20S(RT)=1H(GM)]=1H(DN^20) = 8M(RT)/24H(GM)/24H(DN^20) <---- SYNC VALUE
[20S(RT)=1H(GM)]=2H(DN^40) = 4M(RT)/12H(GM)/24H(DN^40)
[20S(RT)=1H(GM)]=3H(DN^60) = 2M(RT)/8H(GM)/24H(DN^60)
[20S(RT)=1H(GM)]=5H(DN^100) = 1M(RT)/4.8H(GM)/24H(DN^100)
---------------------------
DN Max Global Value 1000
DN Minimum Value 0.25

0k so if you wanted to increase your RT, you have to decrease your DN. Lowest value would yield a 2 hour DN cycle, and approx. 16 day GM cycle. Or 5M30S(RT)=16H(GM)*1H(DN^.25) approx.
Last edited by MakeItGraphic on Thu Feb 13, 2020 11:21 am, edited 20 times in total.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: ELI5 - Train Distance Calculations

Post by darkfrei »

It can be calculated dynamically, just check the changed distance every delta time.
See code of https://mods.factorio.com/mod/Odometer

The day length doesn't change seconds, minutes and hours. You can have more or less than 24 hours / day. This planet has short day length, just several minutes, not hours.
Post Reply

Return to “Gameplay Help”