S Class Messages

From Open Rail Data Wiki

S-Class train describer messages provide updates relating to the status of signalling equipment within a train describer area. Not all TD areas provide this information.

There are three types of S-Class message:

Type Name Details
SF Signalling Update Updates the signalling data for a specified set of signalling elements
SG Signalling Refresh Part of a set of SG messages which update the whole set of signalling data for TD area. Terminated by an SH message.
SH Signalling Refresh Finished Last message in a signalling refresh

S-Class messages report the status of the following signalling elements:

  • Signal aspects - whether the signal is displaying its most restrictive aspect or not
  • Points - whether the points are set normal or reverse
  • Route set - the route set from a signal to another signal or bay platform
  • TRTS buttons - the status of a Train Ready to Start button, used by train dispatch staff to indicate to the signaller that platform duties are complete
  • Level crossings - whether they are lowered or raised
  • Track circuits - whether a particular track circuit is occupied or not

Not all train describers support S-Class data, and those that do may only support a subset of the available groups of data. The List of Train Describers shows S-Class support.

Message Format

Messages are sent in JSON format, as follows:

  • {"SF_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SF", "address":"3E", "data":"18", "report_time":"073814"}}
  • {"SG_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SG", "address":"30", "data":"900000C0", "report_time":"073814"}}
  • {"SH_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SH", "address":"30", "data":"900000C0", "report_time":"073814"}}

Message Fields

Field SF SG SH Details
time Message time

UNIX timestamp in milliseconds since the UNIX epoch

area_id Alphanumeric code representing the TD area that the message originates from (see list of train describers)
msg_type Type of message

Can be SF_MSG, SG_MSG or SH_MSG

address Address of the signalling data being updated. For an SF_MSG, this is the individual signalling element. For an SG_MSG or SH_MSG, this is the starting address for the four bytes supplied in the data field.
data Signalling data
report_time Reporting time

Interpreting S-Class data

S-Class data represents the state of individual signalling elements within a TD area as bits within a set of 2,048 bits (numbered from 0x00 to 0xFF). The number of bits needed for a TD area depends on the number of signalling elements within that area. Each time an element changes state, an SF message is sent with the value of the elements in the relevant byte.

Every few hours, the state of all bits is sent as a 'refresh' in a series of SG messages with the value of groups of four bytes. These messages are terminated with an SH message.

To decode the set of addresses and bits in to signalling elements, a mapping table containing a list of bits and the signalling elements to which they refer is needed. To reference this to signals on the track layout, a diagram containing signal numbers, routes available from signals, point numbers and track circuit detail is also needed.


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)