BPLAN data structure: Difference between revisions

From Open Rail Data Wiki
m Add missing Reference code field
m Change 'twice a year' to 'regularly'
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:PIF File Format}}
= About =
 
See [[Reference_Data#Train_Planning_Data]] for the download link for this data, which is updated twice a year.


The Public Interface Format (PIF) file is a tab-separated, variable record length ASCII file containing the following sets of data:
The Public Interface Format (PIF) file is a tab-separated, variable record length ASCII file containing the following sets of data:
Line 11: Line 9:
* Network Links between TIPLOCs, including distances
* Network Links between TIPLOCs, including distances
* Timing Links between TIPLOCs, including traction type, entry and exit speeds
* Timing Links between TIPLOCs, including traction type, entry and exit speeds
See [[BPLAN_Geography|BPLAN Geography]] for the download link for this data, which is updated frequently.
= Format =


The format of the file is straightforward:
The format of the file is straightforward:


* The first field on a record is a 3-character field identifying the record type.
* The first field on a record is a 3-character field identifying the record type
* The second field is the Action Code, which will always be 'A' - Add.  The action codes 'C' and 'D' should not be seen in PIF files from the Data Feeds platform, as they are extracted as reference data, and not updates to the existing data.
* The second field is the Action Code, which will always be 'A' - Add.  The action codes 'C' and 'D' should not be seen in PIF files from the Data Feeds platform, as they are extracted as reference data, and not updates to the existing data
* The subsequent fields are tab-separated and variable-length.
* The subsequent fields are tab-separated and variable-length
* Records are terminated by CRLF characters (ASCII carriage return and newline characters, DOS-style line terminators)
* The character encoding is, or may contain characters from [https://en.wikipedia.org/wiki/Windows-1252 Windows-1252].
* A single trailer record reports the number of records of each type in the file, and indicates the end of the file
* A single trailer record reports the number of records of each type in the file, and indicates the end of the file


Line 28: Line 32:
Data will be provided for P, A and M fields, but not necessarily for O fields.  However, the field will still be present and will be empty, i.e. the file will have two TAB characters.
Data will be provided for P, A and M fields, but not necessarily for O fields.  However, the field will still be present and will be empty, i.e. the file will have two TAB characters.


= Field formats =
== Field formats ==


The following field formats are used:
The following field formats are used:
Line 41: Line 45:
A single final trailer record defines the number of records of each type in the file.
A single final trailer record defines the number of records of each type in the file.


= Record types =
== Control (PIF) record ==
 
== Control Record ==


{| class="wikitable"
{| class="wikitable"
Line 113: Line 115:
|}
|}


== Reference Codes ==
== Reference (REF) records ==


{| class="wikitable"
{| class="wikitable"
Line 154: Line 156:
|}
|}


The reference code types are as follows:
The reference code types are themselves defined in the REF record section under the REF code type. For convenience, they are extracted from there as follows:


{| class="wikitable"
{| class="wikitable"
Line 162: Line 164:
| Accommodation
| Accommodation
| ACC
| ACC
|-
| Activities at a location
| ACT
|-
|-
| Bank Holidays Excepted codes
| Bank Holidays Excepted codes
Line 183: Line 188:
| Reservation codes
| Reservation codes
| RES
| RES
|-
| Service codes
| SER
|-
|-
| Sleeper codes
| Sleeper codes
Line 207: Line 215:
| Network Rail zones
| Network Rail zones
| ZNE
| ZNE
|-
| Activities at a location
| ACT
|-
|}
|}


== Timing Load ==
== Timing Loads (TLD) ==


There are several point-to-point timings (Timing links) across a Network Link.  When timing a train across a network link, the timing link to use depends on the train formation, as well as its entry and exit speeds.
There are several point-to-point timings (Timing links) across a Network Link.  When timing a train across a network link, the timing link to use depends on the train formation, as well as its entry and exit speeds.
Line 288: Line 292:
|}
|}


== Geographic data ==
== Location (LOC) records ==


Some geography items may be dated, i.e. they may have a start or end date.
Some geography items may be dated, i.e. they may have a start or end date.
Line 381: Line 385:
|}
|}


== Platform/Sidings ==
== Platforms and Sidings (PLT) records ==


'''NOTE: The Platform/Siding Length values for locations are not guaranteed to be accurate'''
'''NOTE: The Platform/Siding Length values for locations are not guaranteed to be accurate'''
Line 454: Line 458:
|}
|}


== Network Link ==
== Network Link (NWK) records ==


'''NOTE: The distance values for are not guaranteed to be accurate'''
'''NOTE: The distance values for are not guaranteed to be accurate'''
Line 581: Line 585:
|}
|}


== Timing Link ==
== Timing Link (TLK) records ==


{| class="wikitable"
{| class="wikitable"
Line 656: Line 660:
| 0 for stopping or -1 for passing at maximum appropriate speed
| 0 for stopping or -1 for passing at maximum appropriate speed
|-
|-
| M
| P
| Start date
| Start date
| Date
| Date
Line 681: Line 685:
|-
|-
|}
|}
== Footer (PIT) record ==
The final record in the file which contains counts of the records in the file to ensure correct transfer and parsing.
{| class="wikitable"
! Type
! Field
! Format
! Length
! Values
|-
| M
| Record Type
| Text
| 3
| PIT
|-
| M
| Record Type code
| Text
| 3
| Any record type code
|-
| M
| Addition count
| Number
| N/A
| Number of addition (A) records
|-
| M
| Change count
| Number
| N/A
| Number of change (C) records
|-
| M
| Delete count
| Number
| N/A
| Number of delete (D) records
|}
The last four fields are repeated for each instance of a record type.  For snapshots, the number of change and delete records will always be zero.


{{Navtable-DataFeeds}}
{{Navtable-DataFeeds}}


[[Category:Reference Data]]
[[Category:3-Alpha Codes]]
[[Category:NLC Codes]]
[[Category:TIPLOC Codes]]
[[Category:TIPLOC Codes]]
[[Category:STANOX Codes]]
[[Category:STANOX Codes]]
[[Category:Identifying Locations]]
[[Category:Identifying Locations]]
[[Category:Train Describer Data]]
[[Category:BPLAN Data]]
[[Category:CORPUS Data]]
[[Category:SMART Data]]

Latest revision as of 09:13, 1 March 2024

About

The Public Interface Format (PIF) file is a tab-separated, variable record length ASCII file containing the following sets of data:

  • Reference codes as used in CIF schedule files
  • Timing Loads used in train planning
  • Location codes (TIPLOCs), their type (TRUST, Mandatory or Optional) and, for many records, the geographical location in Eastings/Northings
  • Platform data, including platform number, length, power supply type
  • Network Links between TIPLOCs, including distances
  • Timing Links between TIPLOCs, including traction type, entry and exit speeds

See BPLAN Geography for the download link for this data, which is updated frequently.

Format

The format of the file is straightforward:

  • The first field on a record is a 3-character field identifying the record type
  • The second field is the Action Code, which will always be 'A' - Add. The action codes 'C' and 'D' should not be seen in PIF files from the Data Feeds platform, as they are extracted as reference data, and not updates to the existing data
  • The subsequent fields are tab-separated and variable-length
  • Records are terminated by CRLF characters (ASCII carriage return and newline characters, DOS-style line terminators)
  • The character encoding is, or may contain characters from Windows-1252.
  • A single trailer record reports the number of records of each type in the file, and indicates the end of the file

Within each record, the 'type' column indicates whether the field is part of a record key, mandatory or optional:

  • P: Primary key - a field, or set of fields, that uniquely identify an entity instance
  • A: Alternate key - an alternate set of fields that also uniquely identify an entity
  • M: Mandatory field
  • O: Optional field

Data will be provided for P, A and M fields, but not necessarily for O fields. However, the field will still be present and will be empty, i.e. the file will have two TAB characters.

Field formats

The following field formats are used:

  • Date: DD-MM-YYYY HH:MM:SS
  • Time: HH:MM:SS
  • Duration: MM'SS
  • SRT: MMM'SS

All measurements are in metric units. Times use the 24 hour clock, with midnight as 00:00:00.

A single final trailer record defines the number of records of each type in the file.

Control (PIF) record

Type Field Format Length Values
M Record type Text 3 'PIF'
M File version Text 3 Interface specification version
M Source system Text 30 Database from which the file was extracted
M TOC ID Text 2 TOC identifier
M Timetable start date Date Start date of the timetable period to which this data applies
M Timetable end date Date End date of the timetable period to which this data applies
M Cycle type Text 1 I - Iterative, or S - Supplemental
M Cycle stage Text 1 0 - Base data from Network Rail
M File creation date Date
M File sequence number Number 4 Unused

Reference (REF) records

Type Field Format Length Values
M Record type Text 3 REF
M Action code Text 1 A
P Reference code type Text 3 See below
P Reference code Text 3 Up to 3 characters long - may be blank
M Description Text 64 Free-format text

The reference code types are themselves defined in the REF record section under the REF code type. For convenience, they are extracted from there as follows:

Code type ID
Accommodation ACC
Activities at a location ACT
Bank Holidays Excepted codes BHX
Service brands BRA
Business sector BUS
Catering codes CAT
Operating characteristics codes OPC
Power supply type PWR
Reservation codes RES
Service codes SER
Sleeper codes SLE
Train class TCL
Train category TCT
Train Operator codes TOC
Train status TRS
Train publication status TST
Reference code types REF
Network Rail zones ZNE

Timing Loads (TLD)

There are several point-to-point timings (Timing links) across a Network Link. When timing a train across a network link, the timing link to use depends on the train formation, as well as its entry and exit speeds.

Point-to-point timings are not needed for every train formation, as many have effectively the same timings. Timings across a network link are defined for a variety of timing loads, each applicable to a number of train formations. The timing load to use for a train may depend on its class/subclass, planned load, planned maximum speed and RA number.

Type Field Format Length Values
M Record Type Text 3 TLD
M Action Code Text 1 A
P Traction type Code 6 Type of traction, e.g. 321, 153, 2x86, EMU
P Trailing Load Code 5 Tonnes (up to 4 digits) plus an empty/loaded character for freight. Blank for trains with a standard trailing load
P Speed Code 3 Maximum permitted speed for the timing load
P RA/Gauge Code 3 First digit is the RA number, then two characters for gauge - may be blank
M Description Text 64 Free-format text
M ITPS Power Type Text 3 The power type as shown in ITPS
M ITPS Load Text 4 The load as shown in ITPS
M Limiting Speed Text 3 The limiting speed as shown in ITPS

Location (LOC) records

Some geography items may be dated, i.e. they may have a start or end date.

NOTE: The Easting and Northing values for locations are not guaranteed to be accurate

Type Field Format Length Values
M Record type Text 3 LOC
M Action Code Text 1 A
P Location Code Text 7 TIPLOC
M Location name Text 32 Free text
M Start date Date
O End date Date
O OS Easting Number 6 Ordnance Survey reference
O OS Northing Number 6 Ordnance Survey reference
M Timing point type T/M/O TRUST, Mandatory or Optional
M Zone Code Zone responsible for maintaining the record
O STANOX code Number 5 Station Number code
M Off-Network indicator Y/N 1 Y if the location is off the Network Rail network, or N if it is on-network
O Force LPB L/P/B/space 1 L if the running line code should appear in the timetable when approaching the location, P if the path should appear in the timetable when leaving the location, B for both, or space for neither

Platforms and Sidings (PLT) records

NOTE: The Platform/Siding Length values for locations are not guaranteed to be accurate

Type Field Format Length Values
M Record Type Text 3 PLT
M Action Code Text 1 A
P Location code Text 7 TIPLOC
P Platform ID Text 3 UID for the platform at the location
M Start date Date
O End date Date
O Platform/Siding length Num 4 Maximum usable length in metres
M Power supply type Code A valid power supply type code
O DOO (Passenger) Y/N Driver-Only Operation allowed for passenger trains?
O DOO (Non-Passenger) Y/N Driver-Only Operation allowed for non-passenger trains?

Network Link (NWK) records

NOTE: The distance values for are not guaranteed to be accurate

Type Field Format Length Values
M Record Type Text 3 NWK
M Action Code Text 1 A
P Origin location Text 7 TIPLOC
P Destination location Text 7 TIPLOC
P Running line code Code 3 e.g. FL, SL to distinguish parallel running lines
O Running line description Text 20 A description for a non-standard running line code
M Start date Date
O End date Date
M Initial direction U/D Up/Down direction indicator - used for timetables and junction reports rather than physical line descriptions
O Final direction U/D May differ from the initial direction, e.g. where an up link merges in to a down link
O Distance Number 5 Distance in metres
O DOO (Passenger) Y/N Driver-Only Operation allowed for passenger trains?
O DOO (Non-Passenger) Y/N Driver-Only Operation allowed for non-passenger trains?
O RETB Y/N Is Radio Electric Token Block in use at this location?
M Zone Code Zone responsible for maintaining the record
M Reversible line B/R/N B - Bi-directional, R - Reversible, or N - Neither
M Power supply type Code A valid power supply type code
P RA Code 2 Route Availability number
O Maximum train length Num 4 Maximum length of train that can use this network link, in metres

Timing Link (TLK) records

Type Field Format Length Values
M Record Type Text 3 TLK
M Action Code Text 1 A
P Origin location Text 7 TIPLOC
P Destination location Text 7 TIPLOC
P Running line code Code 3 e.g. FL, SL to distinguish parallel running lines
P Traction type Code 6 Type of traction, e.g. 321, 153, 2x86, EMU
P Trailing Load Code 5 Tonnes (up to 4 digits) plus an empty/loaded character for freight. Blank for trains with a standard trailing load
P Speed Code 3 Maximum permitted speed for the timing load
P RA/Gauge Code 3 First digit is the RA number, then two characters for gauge - may be blank
P Entry speed Number 3 0 for starting or -1 for passing at maximum appropriate speed
P Exit speed Number 3 0 for stopping or -1 for passing at maximum appropriate speed
P Start date Date
O End date Date
M Sectional Running Time SRT mmm'ss
O Description Text 64

Footer (PIT) record

The final record in the file which contains counts of the records in the file to ensure correct transfer and parsing.

Type Field Format Length Values
M Record Type Text 3 PIT
M Record Type code Text 3 Any record type code
M Addition count Number N/A Number of addition (A) records
M Change count Number N/A Number of change (C) records
M Delete count Number N/A Number of delete (D) records

The last four fields are repeated for each instance of a record type. For snapshots, the number of change and delete records will always be zero.


Network Rail Open Data Feeds
Data Feeds About the Feeds Account States Durable Subscriptions Example Code ( PHP / C# / Java / Ruby / Node.js) • Advanced UsesFAQ Release Notes
RTPPM RTPPM Feed
Train Movements Train Movements Feed Train Activation Train Cancellation Train Movement Train Reinstatement Change of Origin Change of Identity Change of Location TSPEED Field Planned Cancellations Cancellation Codes
TD TD Feed C-Class Messages S-Class Messages Train Describers TD Berths
VSTP VSTP Feed
TSR TSR Feed Route Codes
SCHEDULE SCHEDULE Feed TIPLOC Records Schedule and Location Records Association Records CIF Codes How Scheduling Works Allowances
Reference Data Reference Data Feed TOC Codes CIF Codes Delay Attribution Codes Identifying Locations (STANOX, TIPLOC, NLC and 3-Alpha Codes) STANOX Geographical Areas Train Planning data (BPLAN)