News:

SimuTranslator
Make Simutrans speak your language.

Fixed departure times question

Started by neil, November 07, 2022, 10:43:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neil

Playing around with fixed departure times, just to see how they work.

I've set up a line between two rail stations A and B with fixed departure times from station A set to 6 so 3:59, 7:59, 11:59, 15:59, 19:59 and 23:59.

If there's a train in station A at 3:59, it departs as expected. However, if there's ANOTHER train in station A at the same time, it also departs behind the first train. That's not what I expected - I thought it would wait until 7:59.

Thoughts?

Roboron

#1
There is some extra time for convois to depart, because it was thought that convois should depart if they arrived a bit late.

prissi

A convoi entering the station after the time has passed, should wait. All convoi of the same line already waiting will depart at the same time, unless they are not fully unloaded and there are waiting goods/pax

uint32 convoi_t::get_departure_ticks(uint32 ticks_at_arrival) const
{
// we need to make it this complicated, otherwise times versus the end of a month could be missed
uint32 arrived_month_tick = ticks_at_arrival & ~(welt->ticks_per_world_month - 1);
uint32 arrived_ticks = ticks_at_arrival - arrived_month_tick;
uint32 delta = schedule->get_current_entry().get_absolute_departures();
uint32 departure_ticks = schedule->get_current_entry().get_waiting_ticks();

// there could be more than one departure per month => find the next one
for( uint i = 0; i<delta; i++ ) {
uint32 next_depature_slot = departure_ticks + (i*(welt->ticks_per_world_month/delta));
if( next_depature_slot > arrived_ticks ) {
return arrived_month_tick+next_depature_slot;
}
}
// nothing there => depart slot is first one in next month
return arrived_month_tick+welt->ticks_per_world_month+departure_ticks;
}

There is no extra tolerance in principle.

To make clear: The second convoi was outside the station when the departure time came?

neil

No, both trains were already waiting in the station when the departure time came.

In real life, this happens quite a lot at rail terminus stations, say at Ealing Broadway on the London tube system. Two District Line trains will be waiting to go east on opposite platforms but only one will leave when the departure time comes.

Is it possible to hold a code "flag" against each departure time? The flag would be set when a train fulfills that departure time and no other train could depart (until the next departure time) because the flag is already set.

prissi

So far a schedule is not neccessarily part of a line. One could of course add something like this to the schedule interface only to be active, if a schedule is part of a line.

neil

OK, I see what you mean ... I think  :D