Getting late/delayed trains?

300 views
Skip to first unread message

th3d...@gmail.com

unread,
Oct 6, 2015, 10:13:33 AM10/6/15
to A gathering place for the Open Rail Data community
Hi guys,

I've been banging my head against a wall about this one for a couple of days now and wondered where I'm going wrong as I thought I'd cracked it, but actually hadn't.

I'm connecting via FTP and downloading the main pPortData.log via a C# service every 30 minutes.

Now, this badboy has a lot of data in it. I figured the Schedule XML files were the correct way to go, so parsed those schedule results, got a list of scheduled trains, parsed them and brilliant, all fine. I figured I'd match up the "estimated time of arrival" with "working time of arrival" and this would be my delay.

In fact, there's only 2 records throughout all of today which aren't more than a 30 seconds delay which is obviously wrong.

The Forecast XML lines look to have a "delayed" attribute within them so there's plenty of delays in the files, but those XML lines make no sense, such as:

<ns3:Location tpl="CAMBDGE" wta="05:40">
<ns3:arr delayed="true" et="11:07" src="Darwin"/>
<ns3:plat platsup="true">2</ns3:plat>
<ns3:suppr>true</ns3:suppr>
</ns3:Location>

Which is pretty much the same for every delay in the file... I refuse to believe there's 5+ hours delay on each of those delayed trains.

Where am I going wrong here?!

Cheers,
Chris

Paul Kelly

unread,
Oct 6, 2015, 10:29:57 AM10/6/15
to openrail...@googlegroups.com
On 10/06/2015 03:03 PM, th3d...@gmail.com wrote:
>
> In fact, there's only 2 records throughout all of today which aren't more than a 30 seconds delay which is obviously wrong.

Can't help with the main part of your question as I don't use Darwin,
but I suspect what you're looking at here is when a schedule has
specific slack added (performance, pathing or engineering allowance)
immediately prior to the final timing point, and Darwin optimistically
assumes the train is going to going to be affected by neither
performance issues, pathing problems nor temporary speed limits due to
engineering works, and that it will thus make up all the time in the
allowance and arrive early.

Paul

petermount

unread,
Oct 6, 2015, 11:24:22 AM10/6/15
to A gathering place for the Open Rail Data community
No, oddly that's right.

For that one it actually arrived on time at 05:40 http://uktra.in/rtt/train/201510061417279

Looking at the logs it didn't get recorded as such until 12:30:

<?xml version="1.0" encoding="UTF-8"?><Pport xmlns="http://www.thalesgroup.com/rtti/PushPort/v12" xmlns:ns3="http://www.thalesgroup.com/rtti/PushPort/Forecasts/v2" ts="2015-10-06T13:30:43.4971543+01:00" version="12.0"><uR requestSource="Manu" updateOrigin="Trust"><TS rid="201510061417279" ssd="2015-10-06" uid="L08579"><ns3:Location tpl="CAMBDGE" wta="05:40"><ns3:arr at="05:40" src="TRUST" srcInst="Manu"/><ns3:plat platsup="true">2</ns3:plat><ns3:suppr>true</ns3:suppr></ns3:Location></TS></uR></Pport>

You can see someone manually updated Trust. Up until then darwin didn't know it had already arrived so kept updating it's prediction of when it would arrive, hence delayed="true" in the arr element & as platsup was also true it wouldn't show up on any boards either.

Chris Dixon

unread,
Oct 6, 2015, 12:38:07 PM10/6/15
to A gathering place for the Open Rail Data community
Thanks guys for the quick responses here!

Okay, so it looks like I'm on the right tracks (shameless pun) here. Phew.

Due to the Forcecasts not being part of any schedules, I take it these are literally one route trains with no stops? If so, that would make more sense to me and I'd have to be parse these Forecasts individually as one-stop Schedules.

If these Forecasts do somehow link to any schedules in the pPortData, can you guys shed any light into how they do?

Cheers,
Chris



On Tuesday, 6 October 2015 15:13:33 UTC+1, Chris Dixon wrote:

Chris Dixon

unread,
Oct 6, 2015, 12:47:07 PM10/6/15
to A gathering place for the Open Rail Data community
Also Peter, can you guide me in the direction of where you're finding that XML line?

I've checked the current pPortData.log and it doesn't have it, along with the ones today marked at both 12:27 and 12:32, the TS rid's bring up no matches for those lines.

Thanks,
Chris

petermount

unread,
Oct 6, 2015, 12:55:43 PM10/6/15
to A gathering place for the Open Rail Data community
It's from my logs from receiving from the pushport data and simply running a grep of the rid against them for today. It's possible it doesn't match that in the ftp as I record on a per-minute basis & the ftp site iirc is once every 5 minutes, but they should still be there.

Chris Dixon

unread,
Oct 6, 2015, 12:58:06 PM10/6/15
to A gathering place for the Open Rail Data community
Thanks for that, Peter. Been really helpful here. Just the last thing for my queries is the above question; are Forecasts one-stop routes and thus don't apply to any Schedule data?

petermount

unread,
Oct 6, 2015, 1:00:37 PM10/6/15
to A gathering place for the Open Rail Data community
There should still be a schedule associated with it. Either it's only in the ftp timetable or you could see updates in the pport feed.

So if you look at the daily timetable snapshot you should see this one appear in there. I do see there was a schedule update at 12:30 as well in the logs.

Chris Dixon

unread,
Oct 6, 2015, 1:06:13 PM10/6/15
to A gathering place for the Open Rail Data community
Brilliant, looks like I'm doing the okay thing by just parsing the Schedules. Sounds like I have to parse the 5-minute update files rather than the main pPortData file, then try and match on UID for what I'm storing in my DB and update accordingly. I have no idea why that non-timestamped file even exists as I figured it'd be a running collection of all the 5 minute period for today, but doesn't look that way any more.

Andy West

unread,
Mar 11, 2016, 10:25:22 AM3/11/16
to A gathering place for the Open Rail Data community
Hi,

I am trying to do something similar.I have set up the accounts and I can FTP and download the files.

I am coding in C# and putting the data in a sql server database ( I can do the coding bit). I would like to be able to keep the data for 6 months and check if a train was delayed between two stations. 

Can you give me some pointers on how you archived this? 

Which files to download, parse etc.

Thanks in advance

Andy

raj kumar

unread,
Mar 17, 2016, 2:29:32 AM3/17/16
to A gathering place for the Open Rail Data community
Hi guys...!!!

I want to know what data is need for getting train delay information ???? Is that need any STOMP library for delay train data?
I had tried it by php it asked pecl-stomp package , And in ruby i have got real time data and got an error in installing mysql connect to ruby. Please help me to know the step by step procedure and prerequisites for ruby(centOS 7). 
Reply all
Reply to author
Forward
0 new messages