Train Movements: Difference between revisions
PeterHicks (talk | contribs) No edit summary |
PeterHicks (talk | contribs) m Added details of the names of topics |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
=== Topics === | |||
TRUST messages are available on TOC-specific topics. These are named TRAIN_MVT_XX_TOC, where 'XX' represents the '''Business Code''' column from the [[TOC Codes]] page. For example, CrossCountry has business code 'EH', and its topic is TRAIN_MVT_EH_TOC. | |||
In addition, there are other topics which contain aggregated data from multiple TOCs: | |||
{| border="1" | |||
!Topic name | |||
!Description | |||
|- | |||
|TRAIN_MVT_ALL_TOC | |||
|All train operating companies | |||
|- | |||
|TRAIN_MVT_PASSENGER_TOC | |||
|All passenger train operating companies | |||
|- | |||
|TRAIN_MVT_GENERAL | |||
|Messages not specific to a particular operator (very low-volume) | |||
|} | |||
=== Message types === | |||
The train movements feed contains messages produced by [[TRUST]]. These messages are one of eight types, all in JSON format: | The train movements feed contains messages produced by [[TRUST]]. These messages are one of eight types, all in JSON format: | ||
Line 12: | Line 34: | ||
* 0008 - [[Change of Location]] | * 0008 - [[Change of Location]] | ||
== Lifecycle == | === Lifecycle === | ||
Before any action can be taken on a train, the schedule must be activated. An [[Activation]] message will be received, which will link a schedule to a 10-character train identity. This identity is referenced in all other message types, and there is no need to calculate it manually. | Before any action can be taken on a train, the schedule must be activated. An [[Activation]] message will be received, which will link a schedule to a 10-character train identity. This identity is referenced in all other message types, and there is no need to calculate it manually. | ||
Line 20: | Line 42: | ||
One point to note - the [[Change of Identity]] message type is rarely seen. This is used when a train running under one class (e.g. a Class 4 freight with a train identity starting 4---) must run under a different class for some reason - usually because it must run at a lower speed due to the type of load it is carrying. | One point to note - the [[Change of Identity]] message type is rarely seen. This is used when a train running under one class (e.g. a Class 4 freight with a train identity starting 4---) must run under a different class for some reason - usually because it must run at a lower speed due to the type of load it is carrying. | ||
== Format == | === Format === | ||
Each message is represented as a JSON hash with two keys - 'header' and 'body'. Zero or more of these messages is sent out in a JSON list, either every five seconds or when there are 32 messages to be sent. It is perfectly legitimate to receive an empty array. | Each message is represented as a JSON hash with two keys - 'header' and 'body'. Zero or more of these messages is sent out in a JSON list, either every five seconds or when there are 32 messages to be sent. It is perfectly legitimate to receive an empty array. | ||
All timestamp values are in milliseconds since the UNIX epoch. | All timestamp values are in milliseconds since the UNIX epoch. |
Revision as of 18:55, 13 December 2012
Overview
Topics
TRUST messages are available on TOC-specific topics. These are named TRAIN_MVT_XX_TOC, where 'XX' represents the Business Code column from the TOC Codes page. For example, CrossCountry has business code 'EH', and its topic is TRAIN_MVT_EH_TOC.
In addition, there are other topics which contain aggregated data from multiple TOCs:
Topic name | Description |
---|---|
TRAIN_MVT_ALL_TOC | All train operating companies |
TRAIN_MVT_PASSENGER_TOC | All passenger train operating companies |
TRAIN_MVT_GENERAL | Messages not specific to a particular operator (very low-volume) |
Message types
The train movements feed contains messages produced by TRUST. These messages are one of eight types, all in JSON format:
- 0001 - Train Activation
- 0002 - Train Cancellation
- 0003 - Train Movement
- 0004 - Unidentified Train
- 0005 - Train Reinstatement
- 0006 - Change of Origin
- 0007 - Change of Identity
- 0008 - Change of Location
Lifecycle
Before any action can be taken on a train, the schedule must be activated. An Activation message will be received, which will link a schedule to a 10-character train identity. This identity is referenced in all other message types, and there is no need to calculate it manually.
A train may be cancelled (either entirely or from a particular calling point onwards) through a Train Cancellation message, or start from a location other than the originating location through a [Change of Origin] message. A train may be reinstated after cancellation through a Train Reinstatement message.
One point to note - the Change of Identity message type is rarely seen. This is used when a train running under one class (e.g. a Class 4 freight with a train identity starting 4---) must run under a different class for some reason - usually because it must run at a lower speed due to the type of load it is carrying.
Format
Each message is represented as a JSON hash with two keys - 'header' and 'body'. Zero or more of these messages is sent out in a JSON list, either every five seconds or when there are 32 messages to be sent. It is perfectly legitimate to receive an empty array.
All timestamp values are in milliseconds since the UNIX epoch.