Is TrainId/VehicleId in CUF data?

Does the CUF data in the big zip, for tubes, contain any data item corresponding to TrainId/VehicleId?

The only thing that seems unique to a VehicleJourney (except DepartureTime) is PrivateCode, which looks like e.g. tfl-1-PIC-_-y05-265201-55-T0.

Can’t find any way to translate that to a TrainNo/TripNo (using wtt terminology).

Similarly, UnifiedAPI /Timetable/ data also has no TrainId, although LiveArrival Predictions do.
Tried unsuccessfully to parse the wtt pdfs to extract TrainNo and link to a departure time, but that way lies frustration and madness.

TrainId/Vehicle Id is a property of the vehicle rather than the timetable entry. eg. For a bus journey it might the registration number of the bus. You would not expect that to be specified in the timetable.

CUFF timetables for the tube will contain a train number and a trip number. When combined with the line and the time of day this will be unique in the timetable, though it may not be unique out on the railway. There is generally nothing to stop operators renumbering trains and allocating the same train and trip numbers to two different ones, even on the same line(though this would be bad practice). On different lines the same train and trip number may routinely appear across their respective timetables.

This is where TrainId comes it. It will be unique. On modern trains that communicate with the control system it may be a genuine vehicle number. On older lines (Piccadilly, Bakerloo say) it will be an arbitrary value assigned by the control system to a train while it is on the railway. If an operator renumbers a train its TrainId will be unchanged. This enables the control system to distinguish between two trains which may be running at the same time with the same train number.

Hope that makes sense.

1 Like

That does make sense, and thanks.

I get that a Timetable entity can’t contain a vehicle’s physical attribute.

So a bus regn wouldn’t work.

But I think a TrainNo is ‘soft’ so any set of carriges can be assigned TrainNo ‘abc’ when it is assembled (if neccessary) and dispatched from it’s depot.
So TfL could use that in the CUF Timetable, something like TfL-{tubelineid}-TrainNo-TripNo.
But they don’t, and I assume there is a good reason why not.

Just interested. NBD

TrainNo is ‘soft’ as you say, and a set of carriages can be assigned ‘abc’ when it is dispatched from the depot. But in fact it’s even softer than that and once on the railway a set can be assigned a different TrainNo at any time.

One reason might be:

The timetable will say: ‘train ‘abc’ should depart Cockfosters for Heathrow T5 at 14:00’, but at 13:55 train ‘abc’ is still at King’s Cross.

One option for the controllers is to renumber a train that is at Cockfosters to ‘abc’ and send it off at the right time. This would mean there are now two 'abc’s, so in practice they might give the train at King’s Cross the TrainNo of the one that was at Cockfosters (a paired swap).

I don’t know anything about how to run a railway so the above might be a stupid example, but I think the principle is correct. When trains get out of position, operators will swap number between trains to get back to the timetabled order and timings.

The benefits of moving the TrainNos between trains to match the timetable are:

  1. You don’t end up with several trains in a row to the same destination
  2. Drivers have a complicated schedule, getting on and off different trains during the day to take their breaks. If trains get out of position then this process falls apart.

A better solution is an integrated control system which ‘knows’ where all trains and drivers are at all times and can manage the train timetable and crew schedule ‘on the fly’, but I don’t think London Underground is there yet - at least not on all lines.

A more likely situation is that a train has to be taken out of service and a hot stand-by is brought in from a depot. According to ABProTrain (8 January 2022 12:22) at Tube Financial Crisis: Why Closures Rarely Save Money - London Reconnections there is considerable fleet slack to enable hot-standbying. This is timetabled out of active-fleet:

  • 1972 Stock-Bakerloo: 31 of 36 (86.1%)
  • 1973 Stock-Piccadilly: 78 of 86.5 (90.2%)
  • 1992 Stock-Central: 77 of 85 (90.6%)
  • 1992 Stock-W&C: 4 of 5 (80%, previously 5 of 5 for peak service, but sort of an outlier)
  • 1995 Stock-Northern: 97 of 106 (91.5%)
  • 1996 Stock-Jubilee: 57 of 63 (90.5%)
  • 2009 Stock-Victoria: 41 of 47 (87.2%)
  • S7 Stock-Circle/H&C/District: 107 of 133 (80.5%, awaiting greater use with new signalling)
  • S8 Stock-Metropolitan: 48 of 59 (81.4%, awaiting greater use with new signalling)

Good point @netstruggler. ISTM that simply including TripNo would solve that problem without needing to renumber… but that’s not what’s done, so there’s probably a good reason not to.

Thanks additionally @briantist for the incidental pointer to an extremely interesting website that I was unaware of.

1 Like

Just to be clear, is the answer to my original question, Nope, TrainNo (and/or TripNo) are not available from the xml data, nor from a lookup derived from it?

Those data items /were/ present in the no-longer-available csv data - wonder how they did that.

What I’m specifically trying to achieve is a tube departure board for a given station that combines live predictions with timetabled trains that are not yet appearing in live predictions and show TrainNo for all.

Well there is always Trackernet https://content.tfl.gov.uk/trackernet-data-services-guide-beta.pdf such as…

http://cloud.tfl.gov.uk/TrackerNet/PredictionDetailed/V/KXX

Just to be clear, is the answer to my original question, Nope, TrainNo (and/or TripNo) are not available from the xml data, nor from a lookup derived from it?

I thought you asked if it was in the CUFF data? - which it definitely is.

Exactly which xml data are you referring to that doesn’t have it.

1 Like

Most likely I expressed my initial question poorly.
I started here http://timetables.data.tfl.gov.uk/ where the root folder is CUF
That contains a format spec:
CUF Version 4.1 Issued Revised Technical Specification Railway Timetable Data - Common User Format File Uncontolled Copy
It also contains WTTs and TTNs in csv format, but 2+ years old.

Those csvs contain Train Number/Trip Number in addition to timetable data (as do the printed/pdf WTTs and TTNs).
That is exactly what I want, but with current data.
Perhaps I simply need the correct URL and there they will be…?

From comments in a couple of different threads, I concluded (incorrectly?) that the csv CUF (CUFF?) data was no longer produced, and had been replaced by the many xml files within https://tfl.gov.uk/tfl/syndication/feeds/journey-planner-timetables.zip.
I thought that was what briantist was saying in Overground/tram/riverbus CUF timetables?
(“Given that Central Government has opted for Siri-VM for timetable formats, it’s not really worth anyone’s times to convert them to a more limited format…”)

Which seemed to imply that the csv was a conversion from the big zip xmls, but that conversion is no longer done.
On reflection, I must have misunderstood as the csv has data that the big zip xml doesn’t, so can’t be a conversion.

Cutting to the chase, is there an online source of current WTT/TTN data? [not pdf!]

1 Like

The tube timetables etc. have been in much the same format in the zip file for at least ten years; I would imagine that pre-dates decisions on Siri-VM by many years.

For buses, the trip number within the private code in the xml does match what is in the PDF WTT. There is no “trip within bus” hierarchy in the way there seems to be for the tube. I imagine that this is just an accident of history. Incidentally there seem to be lots of gaps in the private code numbers in the tube xml files. The optimist in me wonders if there is some formula that constructs them from train and trip number, there being plenty of numbers that would end up not being used as a result, but that would be too useful!

Incidentally, my observation that TfL Rail and LO timetables are not in the big zip file has not been picked up, so I presume that I am not missing something.

1 Like

Cutting to the chase, is there an online source of current WTT/TTN data? [not pdf!]

I had a look around the API in my lunch hour and I’m starting to think you’re SOL.

It seems that TfL aren’t putting up current timetables in CUF format (I suspect it’s not a very efficient format for their API?), and in the ‘tidying up’ conversion to JSON/XML they’ve removed the information you need.

1 Like

TVM @netstruggler for doing that.
Think you’re spot on - unfortunately.

Seems like parsing the pdf WTT is my only remaining option. And that’s not too useful because TTNs aren’t made publically available, not even in pdf.

Time to abandon this particular project.

The tube WTTs are on the TfL website but they look a lot harder to parse than the bus ones. Not least because some of them have getting on for 200 pages.

AIUI, WTTs are not much use without corresponding TTNs. You simply don’t know which parts of the WTT are currently superceeded.