X2140: some AI trains don't start

Bug #1310683 reported by Cédric GNIEWEK
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Rails
Fix Released
Medium
r.roeterdink

Bug Description

Hi,

I identified some problems with AI trains since X2140. The train doesn't restart after a station stop.

I added some screenshots (the grey part is the roof of Paris Montparnasse).
With revision 2140, the AI train (on my screenshot, ID 15) doesn't have a departure time (normally : 16:46:48).

A weird thing : when the clock is at 23:57:00, a departure time appears (0:00:00). It increases until midnight (departure 0:03:00).
Then the train finally starts at 0h03.

I think the problem may be coming from the CalculateDepartTime function of StationStop class.

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :
Revision history for this message
r.roeterdink (r-roeterdink) wrote :

Further changes have allready been made to the CalculateDepartTime function, these will be committed in a few days time.
I will let you know when that new version is available.

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

Ok, thanks.
And I will let you know if the bug is resolved then.

James Ross (twpol)
Changed in or:
status: New → Triaged
importance: Undecided → Medium
summary: - Some AI train doesn't start since X2140
+ X2140: some AI trains don't start
Changed in or:
assignee: nobody → r.roeterdink (r-roeterdink)
Revision history for this message
r.roeterdink (r-roeterdink) wrote :

Could you please test version 2203 and check if the problem still occurs?

Changed in or:
status: Triaged → Fix Committed
Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

Hi,

The problem still occurs.

I have run this part of OR in debug mode.
else if (ActualArrival > sixteenHundredHours && ArrivalTime < eightHundredHours) // arrived before midnight, expected to arrive before
{
ActualArrival -= (24 * 3600);
}

It seems like this part of the code is the cause of a negative ActualArrival...
In my case, ArrivalTime is equal to 0 whereas the start time is 60060.
OR considers that 0 means tomorrow at midnight.
Is it the same for MSTS ?

If it's the case, the traffic file is wrong.
But, it started in revision 2140.
Which one is right ? I don't know...

Revision history for this message
r.roeterdink (r-roeterdink) wrote :

Ah, well, that explains.
It would indeed have worked before version 2140 - but that was because before that version, OR could not handle trains which ran through midnight - it could not properly process arrival / departure times after midnight.
MSTS cannot do so either - for instance, if you depart at 23:59 while the booked departure was 00:01, you are not reported as leaving early but as running 1438 minutes late.
The other way round - depart at 00:01 while booked at 23:59 - you were not reported to be late at all.

Arrival time of 0 has to be considered midnight - otherwise it would not be possible to set arrival or departure at 00:00 exactly (actually, timetables often show trains to arrive at 24:00 and depart at 00:00).

I think you'll find all works well if you set a proper arrival time - which may be the same as the departure time.
By default, the MSTS Activity Editor always sets both arrival and departure times.

The fact that the program generates a negative arrival time is correct - otherwise it would not be able to calculate the proper departure time (required stop time = booked departure - booked arrival ; if arrival is before and departure after midnight this would be a very large negative number).

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

Ok.
Well, the TRF file has 0 in the ArrivalTime and DepartureTime of the first station stop of 2 traffics... that's a bit weird.

Small question : Why are the constants called eightHundredHours and sixteenHundredHours in this function ?
Why not eightHours and sixteenHours ?

Revision history for this message
r.roeterdink (r-roeterdink) wrote :

Eighthundredhours refers to that time moment (08:00), not to the value of eighthundred hours.
It's used in both railway and military to identify the exact hour.
And : 20:00 is twenty-hundred, not twothousand!

Revision history for this message
Cédric GNIEWEK (sharpeserana) wrote :

Ah, ok, I understand ! Thanks.

James Ross (twpol)
Changed in or:
milestone: none → 1.0
James Ross (twpol)
Changed in or:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.