TEC PFE replica #4: Delay

Now what is a bus without delays? We're going to add a delay detection to our bus.

Main case:

We are going to use a pretty simple method based on the position of the bus and scheduled time of the next stop.

current_time = 80 #s from midnight
scheduled_time = [70, 90] #s from midnight
total_distance = 1000 #m
remaining_distance = 500 #m

time_per_meter = (scheduled_time[1] - scheduled_time[0]) / total_distance
time_at_current_position = scheduled_time[0] + remaining_distance * time_per_meter

delay = current_time - time_at_current_position

This is not a smooth approach, but it is accurate enough for our needs.

Conclusion

While the mathematics involved isn't perfect, it gives us a good approximation of delay times. We can now display a more accurate estimation of delays.

This concludes the prototype of our project. There is still an extra part that runs parallel to this.

Github repo

Take me to the extra part!

Back to the index