A timetable connects distance, time and demand
A campus shuttle travels from Main Gate to Library, CSE Block and Hostel. The three legs are 2.4 km at 24 km/h, 1.5 km at 18 km/h and 3.0 km at 30 km/h. Total dwell time at stops is eight minutes.
Morning departures start at 08:00 and repeat every 20 minutes for ten trips. Each shuttle has 48 seats and expected demand is 420 passengers. Demand across four one-hour windows follows the ratio 3:4:2:1. The planner must calculate journey duration, correct average speeds, departure times, minimum trips, occupancy and passengers per window.
Calculate time for each leg before adding
time = distance / speed Leg 1: 2.4/24 hour = 0.10 hour = 6 minutes Leg 2: 1.5/18 hour = 1/12 hour = 5 minutes Leg 3: 3.0/30 hour = 0.10 hour = 6 minutes
Total moving distance is 6.9 km and moving time is 17 minutes. Adding eight minutes of dwell gives 25 minutes elapsed journey time. Dwell affects passenger arrival time but does not add distance.
Do not average the three speed numbers directly
Moving average speed = total distance / total moving time = 6.9 / (17/60) = 24.35 km/h Overall average speed = total distance / total elapsed time = 6.9 / (25/60) = 16.56 km/h
The arithmetic mean of 24, 18 and 30 is 24 km/h, but it gives each speed equal importance. The shuttle spends unequal distances and times at those speeds. The valid average is total distance divided by corresponding total time. Including dwell time produces a different operational average.
| Measure | Time denominator | Use |
|---|---|---|
| Moving average | 17 minutes | Vehicle motion performance |
| Overall average | 25 minutes | Passenger timetable |
Regular departures form an AP in minutes
a = 08:00 = 480 minutes after midnight d = 20 minutes nth departure = a + (n − 1)d 10th departure = 480 + 9×20 = 660 minutes = 11:00
The generated sequence is 08:00, 08:20, 08:40, 09:00, 09:20, 09:40, 10:00, 10:20, 10:40 and 11:00. Converting clock time to minutes makes ordinary AP arithmetic possible; divmod converts it back to hours and minutes.
Round trips upward when capacity is a minimum
Minimum trips = ceil(420 / 48) = ceil(8.75) = 9 Planned seats = 10 × 48 = 480 Occupancy = 420/480 × 100 = 87.5% Unused seats = 480 − 420 = 60
Nine trips provide 432 seats and are the mathematical minimum. Ten scheduled trips create a 60-seat buffer. Whether that buffer is adequate depends on arrival variation and desired service level, not only the average prediction.
Use the ratio, then preserve the total
The ratio 3:4:2:1 contains ten parts. With 420 expected passengers, one part is 42, so the four windows receive 126, 168, 84 and 42 passengers. Their sum is exactly 420.
When a total is not divisible by the ratio sum, independent rounding can lose or create passengers. The program first assigns integer floors, then gives the remaining passengers to windows with the largest fractional remainders. This is a practical largest remainder allocation.
Python program with explicit units
Loading source…RouteLeg keeps each distance and speed together and derives minutes. Separate functions handle journey aggregation, clock formatting, AP departures and integer ratio allocation, making every formula independently testable.
Trace the plan from route to seats
- Calculate each leg.
- Combine movement.
- Build timetable duration.
- Calculate both averages.
- Generate departures.
- Check capacity.
- Distribute demand.
Press Next to begin.
Test units and boundaries
Distance-time identity
Average bounds
AP difference
Capacity boundary
Ratio conservation
Check the reasoning
How is moving average speed calculated?
Why are nine trips required for 420 passengers?
Extensions
- Calculate a return schedule using a required layover.
- Find the interval needed for 15 departures between 07:30 and 12:10.
- Add standing capacity with a maximum permitted occupancy percentage.
- Compare one large shuttle with two smaller vehicles using operating cost.
Explain why each formula fits
Why is average speed not the mean of speeds?
Speeds contribute for different durations or distances. Total distance divided by total time automatically supplies the correct weighting.
Why convert clock time to minutes?
It turns time-of-day values into one numeric scale where AP addition and comparison are straightforward.
Why use ceiling for required trips?
The constraint is capacity at least equal to demand, and trips are indivisible. Ceiling gives the smallest integer satisfying that inequality.
Why can expected occupancy be insufficient for planning?
An average hides uneven arrivals. Peak-window demand, variation, delays and required service buffers must also be checked.
Units and constraints decide the correct operation
Journey legs require compatible time units, average speed requires total distance over total time, regular departures use AP, capacity minima use ceiling and ratio allocations must conserve integer demand.
