If a station gets four trains per hour, that’s one every fifteen minutes, right?

Not always. We could have all four in the space of ten minutes, then nothing for the rest of the hour.

That’s a much worse passenger experience, almost as bad as having just one train per hour.

Here’s a quick calculator to get the effective frequency — how many evenly-spaced trains per hour would it take to get the same average waiting time?

Add Services
Minutes past the hour

___ trains per hour.

___-minute maximum wait.

We calculate this number by getting the square of the headways, then dividing a square hour through by the sum of those squared headways.

The reasoning behind this formula assumes passengers arrive uniformly (and continously). Thus we can calculate the total amount of time waited for the train and thus identify the evenly-spaced headway with equal waiting time.

(If you have a fixed time you need to be somewhere, you will wait a combination of time at the platform and at your destination as there’s no guarantee the station near your destination is a perfect walking time away, so the assumption of uniformity is somewhat justified. Or maybe you arrive at the station shortly before the train, but you waited to leave your house…)

As a slightly simplified example, if the train leaves every 10 minutes, and a person arrives each minute, then someone will wait 9 minutes, 8, 7, 6…

“But that’s a triangle in area, so don’t we need to halve the squares?” Well, an hourly service is a triangle too, of area 0.5 square hours. So the factor of 0.5 cancels out!

Some of my trains run express…

Hoo boy. When all the trains run at the same speed, we only need to consider the headways. Now things are more complicated.

Please enter both the departure time (in minutes past the hour) and a speed penalty (in minutes). Negative numbers are also allowed to represent expresses being faster.

Add Services
Minutes past the hour Minutes slower

___ trains per hour (relative to the fastest train).

___-minute maximum wait, including the time differences between trains.

We’ll characterise each train (indexed by i) as having a departure time D[i] and a journey time penalty J[i] (to some implied destination on the express pattern). Specifically, J should be the journey-time penalty for all-stops trains (zero for the fastest service and positive for the rest). The calculator ensures this by subtracting the least value of J from each.

Then the total time is a piecewise function f[i](t) = J[i] + D[i] - t when D[i] >= t and infinity otherwise.

The non-infinite part describes the upper edge of our triangles from earlier, except now we can imagine they sit on a platform of height J.

But we have more than one train. We overlay these lines and take the minimum across each of them (because you take the train which gets you there fastest).

Then we calculate the total area. Unlike before, we divide half a square hour by the total — this 0.5 square hour figure represents a single express train per hour at the fastest journey time.

As a worked example, consider an all-stops service running every 15 minutes; at :00, :15, :30 and :45. Over the top of this, an express service runs half-hourly at :10 and :40. Alone, the express runs at 2tph effective. When we include the all-stops services, the effective frequency (relative to the express service, which counts for 2 tph) is 3.27 tph, calculated as (1800 minute^2 train hour^-1) / (550 minute^2).

What’s with the dimensional analysis?

We have effective frequency (in trains per hour) proportional to the inverse of the waiting area (in squared time). Higher frequency, less waiting.

This means we have trains per hour = k / (squared time) where k is some constant of proportionality. It’s very common for these constants to have confusing combinations of units.

Doing some simplification for this k we could also write 1800 minute^2 as 0.5 hour^2 and from there we can alternatively write k = 0.5 train hour.

But usually timetables are given in minutes past the hour, so it’s convenient to work with k in terms of squared minutes, as we generally have been to this point.
A diagram showing departure time (X axis) and waiting time (Y axis)
All-stops effective frequency

We can also consider the effective frequency in all-stops terms. To do this, we now take journey times relative to the slowest service, the all-stops. This results in the same dashed line of least-waiting, but now it dips into the negatives. Our total area is left at just 250 square minutes for a whopping 7.2 tph in all-stops terms.

At some point when calculating relative to the all-stops service, it is possible for the total area to be at or below zero. This occurs for our above example if the express becomes 15 minutes faster, rather than 5. The total area is -100 square minutes — which equals -18 tph in all-stops terms, but the number only indicates the equivalent total area. Two of the four all-stops trains are not worth catching.

The alternative to having the total area be at or below zero is presumably to have the constant of proportionality include the all-stops delay. But this is dodgy too - imagine if the delay were 5 minutes, so the total area of a 1tph reference is the usual 1800 sq min plus another 300 sq min for the all-stops delay, total 2100 sq min. Now an even 4tph in all-stops terms, including their natural delay, is then 4 * 112.5 + 300 = 750 sq min, but 2100 / 750 = 2.8 tph rather than the expected four!

There is also a threshold where it is never worth catching an all-stops train. This occurs when the express train is at least as frequent as the amount of time it saves. After this, adding more all-stops trains does not reduce the express TPH. Arguably, the all-stops TPH should be considered infinite at this point.

In general, it is highly recommended to calculate in express terms and so the calculator does this.