Railway Empire
brigames Apr 16, 2019 @ 12:21pm
How many freight trains are needed to meet a city's demand?
Using the two numbers given in the game, weekly demand and train duration, I did some math and got the answer (Demand x Duration)/56, but check my reasoning:

GIVEN
1. d = The city's demand in cars per week (from the city information screen)
2. t = The duration in days for a train to make a round trip to the city (from the line setup screen)
3. 1 train = 8 cars

FIND
n = The number of trains needed on a rail line to meet demand

First, convert demand and supply to a common unit of 'trains per week':

Demand = d cars per week = d/8 trains per week

Supply = n trains can deliver every t days = n trains per t days = n trains per t/7 weeks = (7n)/t trains per week

So for supply to equal or exceed demand:

(7n)/t >= d/8

or

n >= (td)/56

For example, if demand is 3.6 cars per week and Duration is 45 days, then (3.6*45)/56 = 2.9 trains are needed. I've tried this out in my games and it seems like demand gets met pretty well. There are probably other factors involved but I don't have enough RE hours to know what they might be.
< >
Showing 1-15 of 16 comments
Totemych Apr 16, 2019 @ 1:03pm 
oh! no... sounds like reverse engineering :steammocking:
Any ideas about "train can wait at station and not running until..." ?!
miranda9 Apr 16, 2019 @ 3:05pm 
Nice math exercise! Or you cold simply run the train and look at the results.
chaney Apr 16, 2019 @ 6:03pm 
This is basically right, but with a few assumptions.

Trains don't run steadily due to weather, breakdowns, track conflict, etc. so you may get a little behind if the value of t is to the low end of the distribution. If it is based on a long t value, you may calculate too many trains. Given that City stock is fairly high limited, as long as you get to a few spares at some point, you should be fine.

This also neglects things like Refrigerated cars, which reduce the trains to 7 cars (n >= td/49.)

A more common issue you may run into is that the source may not be able to supply enough to keep up with all the trains demanding it. Multiple Cities trying to get Corn from a single Level 1 source won't work out because the production will be too low.

Thanks for posting the good calculation - it's a useful estimate and a great way to approach the game!
Empty1958 Apr 17, 2019 @ 6:04am 
I like all of this. There is one more thing that gets in the way of this working well. City growth is a bit unpredictable.
chaney Apr 17, 2019 @ 3:06pm 
Originally posted by Empty1958:
I like all of this. There is one more thing that gets in the way of this working well. City growth is a bit unpredictable.

If the weighted average of demanded products supplied > 60%, the City will grow steadily. The precise amount of growth (people per day) is smooth and in the range of 0.2% but the precise percentage has some variation in the very limited testing I have done. This results in a bit more than doubling population over a year if demand is always met.

I suspect demand of each product grows in finer increments than 0.1 carloads/time, but the demand is only reported to 1 decimal place.
rff1 Apr 18, 2019 @ 12:19pm 
In a 100-yesr scenario the demand D is given as per month, and train trip time as W weeks. Using N trains of C cars, the formula becomes N >=( D*W) / (C*4).

If place A is getting more than one commodity from B then all trains from B to A will take the same time W, and the demands for the various goods can be added to make D. I have tried this, and it works. Doing the separate calculations for each good, and rounding-up N each time, probably indicates one extra train per commodity which would have the advantage of allowing for some growth.

As for city growth, what I have seen disagrees with chaney's 0.2% per day, or about 6% per month. Whatever the city size, I see similar growth of population, so smaller cities grow faster, relatively, than big ones. It takes less time for a city to grow from size 1 to 2 than from 5 to 6.
gardlt Apr 18, 2019 @ 12:56pm 
rff1, did you watch growth carefully in a controlled game?

I agree with chaney. If you saw one of my posts about my large warehouse city, just one Promoter popped a city from 7.5M to 10M, without having a Green growth icon at any time. It's pretty obvious that a small town wont grow by 2.5M each time you hire a Promoter, even with a Green growth icon to increase effectiveness of the promoter!
Empty1958 Apr 18, 2019 @ 2:11pm 
Originally posted by chaney:
Originally posted by Empty1958:
I like all of this. There is one more thing that gets in the way of this working well. City growth is a bit unpredictable.

If the weighted average of demanded products supplied > 60%, the City will grow steadily. The precise amount of growth (people per day) is smooth and in the range of 0.2% but the precise percentage has some variation in the very limited testing I have done. This results in a bit more than doubling population over a year if demand is always met.

I suspect demand of each product grows in finer increments than 0.1 carloads/time, but the demand is only reported to 1 decimal place.

I have never taken time to watch growth at 60% and will not argue the calculation. However, if you supply for a given population @60%. In a month the pop has changed and either you need to change the supply or accept a lower percentage and no growth. If you want growth do you recalculate, or just add more supply? My mistake was using the word "unpredictable" instead of "constantly changing". The game is very dynamic.

The calculation is a great place to start. And someone could probably put it in a spreadsheet with many variable to create a nice cheat sheet.
chaney Apr 19, 2019 @ 12:36am 
Right on Empty1958, a growing City needs trains added every now and then.

rff1, a daily growth of 0.2% would yield in a 30 day month a growth of 1.002^30, or 1.0617 ... so I think we agree. (Conversely, 1.06^(1/30)=1.00194, again approximate agreement.)
Totemych Apr 19, 2019 @ 12:08pm 
offtopic: are there any ideas about system identification in matlab or similar?! Will do we use ANOVA analysis then?)

Why should we know about how many trains should run to the city?! Just observe factor for industries' and city inhabitants' satisfaction and add train only if it really needed
Dray Prescot Apr 19, 2019 @ 3:11pm 
What I did last summer as a set of test cases on City Growth, was supply a lot of carloads of goods to a test City, but I would ONLY supply certain goods/resources and there would be NO supply of the remaining goods and resources. (You have to pick the right test City, and the right goods to NOT deliver for this to work) Then I would sit down and watch the City's population grow until it stopped growing, and keep track of the amounts of various consumer resources/goods in the demand list in carloads, particularly just before it stopped growing and then just after it stopped growing. Feel free to run your own test cases, just be careful to control your test cases and keep good records.

My conclusion was that it was Total CARLOADS (of Consumer Goods) being CONSUMED divided by the Total CARLOADS (of Consumer Goods) DEMANDED by the population over the last 30 Days (how that average was weighted over that 30 days I do not know) that determined the 60% FOD (Fullment of Demand) that determined if the population would grow. (It has been suggested that more recent deliveries are more heavily weighted than older deliveries in figuring this 30 day average).

In many cases, I would be only be delivering only 4 out of 8 types goods demanded, or 5 out of 10 types of goods demanded (or 6 out of 12), yet the City would still be over 60% FOD and the population was still growing. This could happen because the early goods on the list had higher demands per week than later goods on the list. The City would stop growing when the FOD fell below 60% (and stayed below 60%).

It is NOT the Carloads being SUPPLIED that mattered, but the Carloads being CONSUMED. Supplying twice or thrice the demand makes no difference compared to supplying just the demand. Obviously in the long run the Supply has to be equal to or greater than the consumption, but the City's internal stockpiles evened out the week to week fluctuations. If you supply too much, at some point the City will stop accepting and paying for delivery of that good (for a while).

I did this study because there were many people who said that it was number of Types of Goods being supplied that mattered, and I wanted to confirm or deny this, so I (and others) would understand how RE really worked. If all goods had the same weekly demands (if they were demanded at all), then the number of Types of Goods would give the same result as my result using carloads.

https://steamcommunity.com/app/503940/discussions/0/1741090847741885679/

You will have to convert from carloads per week to trainloads as indicated by others above. As well as take into account how long a train takes to make it's trip to determine how many trains you need for that good to that City. Most of the time you will only need 1 trainload of a particular good every 3 or 4 (or more) weeks. Cities will demand more as their populations increase. Local Industries will increase deliveries needed by a lot.

For many goods you will only need one (or 2) train(s) delivering that good to each City to grow the population, at least until the Cities are a lot larger. Industrial production needs are in addition to this. Length and speed of the trips is the critical factor determining how many trains are actually needed.
Last edited by Dray Prescot; Apr 19, 2019 @ 3:42pm
byRo_br Apr 29, 2019 @ 2:06pm 
Originally posted by chaney:
I suspect demand of each product grows in finer increments than 0.1 carloads/time, but the demand is only reported to 1 decimal place.

Exactly!
If you add up all the individual demands for products, it will always be less than the reported total city demand. That is because all numbers in the game are shown truncated and not rounded. i.e. 0.29 will be shown as 0.2 and not 0.3.

This can be checked...
Put another "5" after each number in the list - i.e. 0.7 becomes 0.75, 3.6 becomes 3.65. Add them all up. The total will now be VERY close.

You can do the same with passenger / mail demand. Add up the numbers shown + add in 0,5 for each item on the list and the total should (almost) match.
Last edited by byRo_br; Apr 29, 2019 @ 2:36pm
byRo_br Apr 29, 2019 @ 2:14pm 
Originally posted by brigames:
For example, if demand is 3.6 cars per week ...

OK. but just remember that the demand shown for industrial "raw materials" is the maximum capacity of your factory and not the real demand.
If your meat producing city is not supplying anywhere else and its internal demand for meat is 0.3, then your "real" demand for cattle is 1.5 x 0.3 = 0.45 - a long way from 3.6!
Last edited by byRo_br; Apr 29, 2019 @ 2:31pm
byRo_br Apr 29, 2019 @ 2:31pm 
Originally posted by chaney:
Originally posted by Empty1958:
I like all of this. There is one more thing that gets in the way of this working well. City growth is a bit unpredictable.

If the weighted average of demanded products supplied > 60%, the City will grow steadily. .

Your FOD (thanks, Dray!) can change daily - going up and down a few percent over the course of a week as per the updating of the calculation. So if you look at the value only each quarter, you can't be sure that the number is representative.

If you are only a few points above 60% there will be some (or many!) days in the quarter where the FOD will be below 60%. For each day above 60% you get your ~0.2% growth, for each day below, 0%.

If your FOD is about 70% or above then these random fluctuations will not ever bring it below 60% and you will have your full ~20% growth in the quarter.
Last edited by byRo_br; Apr 29, 2019 @ 2:32pm
chaney Apr 29, 2019 @ 3:26pm 
Since we're talking detail, I studied FOD some time ago. I carefully constrained delivery and tracked the time response to a step input. The response was very nicely fit with an exponential decay weighted average over 30 days. This will smooth out small changes, and makes yesterday much more relevant than two weeks ago.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Apr 16, 2019 @ 12:21pm
Posts: 16