how to match the train identity in the train movement data and train schedule data ?

489 views
Skip to first unread message

Chris

unread,
Feb 22, 2013, 9:17:31 AM2/22/13
to openrail...@googlegroups.com
Hi, guys :

   so now I am working on two kind of data sets, one is the real time data - train movement data, and another is the static data -  train schedule data.  In the train movement data,  the element  - train_id (e.x 365O39MR20) is used to identify the train while in the schedule data set, the element of identifying the train is main_train_uid assoc_train_uid and CIF_train_uid (e.x Y64029).   

  Apparently, the train identity in two data sets are different, if I am receiving a real time data of the train, how can I link it to this train 's schedule since the train identities in 2 data sets don't match.

best regards
chris

Peter Hicks

unread,
Feb 22, 2013, 9:33:12 AM2/22/13
to Chris, openrail...@googlegroups.com
Hi Chris

On 22 Feb 2013, at 14:17, Chris <hel...@gmail.com> wrote:

So now I am working on two kind of data sets, one is the real time data - train movement data, and another is the static data -  train schedule data.  In the train movement data,  the element  - train_id (e.x 365O39MR20) is used to identify the train while in the schedule data set, the element of identifying the train is main_train_uid assoc_train_uid and CIF_train_uid (e.x Y64029).   

Apparently, the train identity in two data sets are different, if I am receiving a real time data of the train, how can I link it to this train 's schedule since the train identities in 2 data sets don't match.

The data you need to link a schedule UID to a train ID is the Activation message - see http://nrodwiki.rockshore.net/index.php/Train_Activation.

When you receive an activation message, look up the schedule it applies to using the UID, Start Date and STP indicator (and if you store VSTP schedules elsewhere, the schedule source will be 'V' for a VSTP schedule, or 'C' otherwise).

Kind regards,


Peter

xi sizhe

unread,
Feb 22, 2013, 10:03:00 AM2/22/13
to Peter Hicks, openrail...@googlegroups.com
Thanks a lot, Peter.  
I also have a few questions.
1. is it true that,   usually there is no train movement message or train activation message at night, yes ? 
2. And  the activation message only appears in the morning when the train is activated.  Once we skip the opportunity of activation message, there is no chance of linking  schedule UID to a train ID in this day? 
3. does the link of schedule UID to train ID change everyday or usually keep the same for a while ? 

best regards
chris


2013/2/22 Peter Hicks <peter...@poggs.co.uk>

Peter Hicks

unread,
Feb 22, 2013, 10:10:26 AM2/22/13
to xi sizhe, openrail...@googlegroups.com
Hi Chris

On 22 Feb 2013, at 15:03, xi sizhe <hel...@gmail.com> wrote:

1. is it true that,   usually there is no train movement message or train activation message at night, yes ? 

No - the movement feed will have data 24 hours a day.  Until the last release, there was a 'blackout' overnight whilst timetables were being generated, but this has gone now.

The volume of movement messages overnight (0100-0500) is very low, as there aren't many trains running.

2. And  the activation message only appears in the morning when the train is activated.  Once we skip the opportunity of activation message, there is no chance of linking  schedule UID to a train ID in this day? 

An activation message will come through either 1 or 2 hours before the train runs, but it can come through much earlier.  Examples of this are when a train is to be cancelled some hours in advance - the train is activated to assign it a 10-character train ID, then immediately cancelled with a reason code.

If you miss the activation message, you can probably (Tom Cairns has done this, but I don't know the details) work out the link by looking for train schedules valid on a particular day that call at the location you've received a movement message for, with a working timetable (WTT) arrival/departure time equal to that in the movement message.   If you have a single match, you've probably found the right schedule!

3. does the link of schedule UID to train ID change everyday or usually keep the same for a while ? 

It's different every day - the last two digits of the train_id field are the day of the month.

I guess it's possible that train 1A23 on Sunday 1st will have the same ID (apart from the last two characters) as the same train 1A23 on Sunday 7th, but it varies.  You're best not to rely on it, just in case it confuses matters for you.


Peter

xi sizhe

unread,
Feb 22, 2013, 10:40:28 AM2/22/13
to Peter Hicks, openrail...@googlegroups.com
that helps a lot as well,
I just check the http://nrodwiki.rockshore.net/index.php/Train_Activation, and it says The activation message includes the schedule UID, schedule STP Indicator, and a 10-character ID (unique only within a calendar month) which is seen in all further message for a the train.

But unfortunately I can't tell which element is the schedule UID, is that d1266_record_number being used to represent the schedule UID. 

Moreover, if I know the schedule UID, can I link it to the train's schedule and finally get the train schedule in this day, which is in the schedule data set. or schedule UID doesn't matter a lot, since I can use the train UID and current date to look up the schedule.

One last is about the "assoc_days":"0010000" and "schedule_days_runs":"1111100" in the schedule data, what does its value mean exactly, duration of the schedule ? If I want the duration of schedule, I can of course get it from schedule_start_date and schedule_end_date, right ?

best regards
chris




2013/2/22 Peter Hicks <peter...@poggs.co.uk>
Hi Chris

Peter Hicks

unread,
Feb 22, 2013, 10:46:34 AM2/22/13
to xi sizhe, openrail...@googlegroups.com
Hi Chris

On 22 Feb 2013, at 15:40, xi sizhe <hel...@gmail.com> wrote:

I just check the http://nrodwiki.rockshore.net/index.php/Train_Activation, and it says The activation message includes the schedule UID, schedule STP Indicator, and a 10-character ID (unique only within a calendar month) which is seen in all further message for a the train.

But unfortunately I can't tell which element is the schedule UID, is that d1266_record_number being used to represent the schedule UID.

The d1266_record_number is only used for VSTP trains and - the schedule UID in an activation message is the train_uid field.   "Train" and "Schedule" have different meanings, but are sometimes mixed up depending on the context.

Moreover, if I know the schedule UID, can I link it to the train's schedule and finally get the train schedule in this day, which is in the schedule data set. or schedule UID doesn't matter a lot, since I can use the train UID and current date to look up the schedule.

The composite primary key to access a schedule from an activation message is comprised of the UID, start date and STP indicator.  The good thing about activation messages is that you get the STP indicator passed through, so you just need to do a straightforward database lookup without having to delve in to working out which schedule is valid on a particular day.

One last is about the "assoc_days":"0010000" and "schedule_days_runs":"1111100" in the schedule data, what does its value mean exactly, duration of the schedule ? If I want the duration of schedule, I can of course get it from schedule_start_date and schedule_end_date, right ?

The assoc_days and schedule_days_runs fields refer to the days of the week the schedule runs - the first character being Monday, second being Tuesday and so on.  It's included because you could have a WTT (STP indicator 'P') schedule for UID A12345 valid on Monday - Thursday, and another WTT schedule for the same UID valid on Friday.

You have full permission to run around screaming - there's quite a learning curve, hence setting up a wiki and mailing list to help people!


Peter

xi sizhe

unread,
Feb 22, 2013, 10:50:51 AM2/22/13
to Peter Hicks, openrail...@googlegroups.com
Oh, great explanation, Peter. I just try to put them into the practice now .  


2013/2/22 Peter Hicks <peter...@poggs.co.uk>

acuth

unread,
Feb 22, 2013, 12:24:31 PM2/22/13
to openrail...@googlegroups.com, Peter Hicks
Hi Chris,

I find you can get a pretty good match to the schedule data based on the train-id in the movement message, even if you do miss the original activation message.

For example the train-id 879D43MR22 indicates that the train had an origin station whose STANOX code begins '87' and whose schedule has a 'signalling_id' (at least I think that's what it's called in the JSON) of '9D43'. 

Obviously when reading the SCHEDULE data you're dealing with TIPLOC codes rather than STANOX codes but, since you're already dealing with real-time info, that will be a bridge you've already crossed.

Adrian



Matt Dutton

unread,
Feb 22, 2013, 7:02:38 PM2/22/13
to openrail...@googlegroups.com, xi sizhe
Just to add to what Peter said, Not sure if this has now been fixed but the STP indicator given in the message was wrong (Confirmed to me by Tom Cairns in another thread) So i just use start date and uid and then pick the lowest stp value for all schedules returned.
Reply all
Reply to author
Forward
0 new messages