The 1090 Megahertz Riddle (second edition)

A Guide to Decoding Mode S and ADS-B Signals
By: Junzi Sun (junzis.com)

Surveillance replies

Surveillance replies consist of short messages (56 bits) that respond to the selective interrogations of the secondary surveillance radar based on the 24-bit transponder addresses of the aircraft. Two types of information are transmitted: altitude (DF=4) and identity (DF=5).

Message structure

The structure of altitude and identity surveillance replies are similar, as shown in Tables 1.1 and 1.2. The main difference is that bits 20 to 32 are used to encode either the altitude or the squawk code.

Surveillance altitude reply (DF=4)
FIELD MSG BITS
Downlink format DF 1–5 5
Flight status FS 6–8 3
Downlink request DR 9–13 5
Utility message UM 14–19 6
Altitude code AC 20–32 13
Address parity AP 33–56 24
Surveillance identity reply (DF=5)
FIELD MSG BITS
Downlink format DF 1–5 5
Flight status FS 6–8 3
Downlink request DR 9–13 5
Utility message UM 14–19 6
Identity code ID 20–32 13
Address parity AP 33–56 24

The definitions of the common fields are:

  • Flight status (FS): 3 bits, shows status of alert, special position pulse (SPI, in Mode A only) and aircraft status (airborne or on-ground). The field is interpreted as:

    000: no alert, no SPI, aircraft is airborne
    001: no alert, no SPI, aircraft is on-ground
    010: alert, no SPI, aircraft is airborne
    011: alert, no SPI, aircraft is on-ground
    100: alert, SPI, aircraft is airborne or on-ground
    101: no alert, SPI, aircraft is airborne or on-ground
    110: reserved
    111: not assigned

  • Downlink request (DR): 5 bits, contains the type of request. In surveillance replies, only values 0, 1, 4, and 5 are used. The field can be decoded as:

    00000: no downlink request
    00001: request to send Comm-B message
    00100: Comm-B broadcast message 1 available
    00101: Comm-B broadcast message 2 available

  • Utility message (UM): 6 bits, contains transponder communication status information.

    • IIS: The first 4 bits of UM indicate the interrogator identifier code.

    • IDS: The last 2 bits indicate the type of reservation made by the interrogator.

      00: no information
      01: IIS contains Comm-B interrogator identifier code
      10: IIS contains Comm-C interrogator identifier code
      11: IIS contains Comm-D interrogator identifier code

Altitude code

The 13-bit altitude code can be encoded in 25 feet increments, 100 feet increments, or in metric unit of meters. The 7th bit (MSG bit 28) is defined as the M bit. When the M bit is set to 0, the 9th bit (MSG bit 30) is defined as the Q bit.

The decoding rules are as follows:

  • When all bits are set to 0, altitude information is not available or invalid.

  • When M=1, removing the M bit, the remaining 12 bits represent the altitude in meters.

  • When M=0 and Q=1, removing the M and Q bits, the remaining 11 bits encode the altitude with 25 feet increments. Denote \(N\) as the decimal value of the remaining 11 bits. The altitude is calculated as \(25 \times N - 1000\) feet.

  • When M=0 and Q=0, the remaining bits are defined as follows:

                                    M        Q
    +----+----+----+----+----+----+---+----+---+----+----+----+----+
    | C1 | A1 | C2 | A2 | C4 | A4 | 0 | B1 | 0 | B2 | D2 | B4 | D4 |
    +----+----+----+----+----+----+---+----+---+----+----+----+----+

    This structure corresponds to the Mode C altitude reply. This structure is used to encode altitudes above 50187.5 feet.

Try it out Using pyModeS, we can calculate the altitude code as:

import pyModeS as pms

msg = "2000171806A983"
altitude = pms.altcode(msg)  # 36000 (ft)

Identity code

The 13-bit identity code encodes the 4 octal digit squawk code (from 0000 to 7777). The structure of this field is shown as follows:

+----+----+----+----+----+----+---+----+----+----+----+----+----+
| C1 | A1 | C2 | A2 | C4 | A4 | X | B1 | D1 | B2 | D2 | B4 | D4 |
+----+----+----+----+----+----+---+----+----+----+----+----+----+

The binary representation of the octal digit is:

A4 A2 A1 | B4 B2 B1 | C4 C2 C1 | D4 D2 D1

Next, we will use an example to explain the decoding of the identity code. The example message is:

MSG HEX: 2A00516D492B80
MSG BIN: 00101 01000000000010 1000101101101 010010010010101110000000
         [DF=5]              [identity code]

The binary identity code can be interpreted as follows:

C1 A1 C2 A2 C4 A4  X  B1 D1 B2 D2 B4 D4
1  0  0  0  1  0   1   1  0  1  1  0  1

Rearranging the bits, we have three groups of binaries:

A4 A2 A1 | B4 B2 B1 | C4 C2 C1 | D4 D2 D1
0  0  0  | 0  1  1  | 1  0  1  | 1  1  0

Finally, the four octal digit squawk code can be decoded from the binary groups as:

0 3 5 6

Try it out Using pyModeS, we can calculate the squawk code as:

import pyModeS as pms

msg = "2A00516D492B80"
squawk = pms.idcode(msg)  # 0356

© Copyright 2021 Junzi Sun. Build with LaTeX, Pandoc, and GitHub