SimSig WTT and WTR file format

Last modified 2014-04-07

Introduction

This page describes the format of the v2 SimSig WTT timetable files and WTR timetable rules files used in executable simulations. The Loader can read this format but does not generate it.

General concepts

The WTT and WTR files are binary files, not text.

The formats are described in terms of "units"; some types of unit are defined in terms of other types.

The word "must" indicates an absolute requirement. Any file not conforming to this requirement is not a valid SimSig file. The wording "should X but may Y" indicates that either X or Y must apply; software generating files is strongly recommended to choose option X, but software reading files needs to be aware that Y could happen instead. Option Y is more likely to be made invalid if the format changes.

Byte values are shown within boxes; sequences of boxes are read from left to right (that is, the leftmost box comes first in the file). Each box holds one byte unless it contains "..." or otherwise says so. All numbers are decimal. Three letter codes such as BRK are ConvData names for data items.

Adjacent units should be consecutive in the file, but there may be any number of bytes with value 0 between units.

Basic units

The following types of unit are used throughout these format descriptions.

I-unit

An I-unit holds an integer. There are three possible encodings. The shortest possible one should be used for any given value, but longer ones may be used.

2 value
3 lsb msb
4 lsb nlsb nmsb msb

In each case the value is stored in 2s-complement little-endian form. Thus the first format can be used for values between -128 and +127 inclusive, and the second format for values between -32768 and +32767 inclusive. Thus

2 250
represents the value -6
3 16 4
represents the value 1040.

S-unit

An S-unit holds a string. There are two possible encodings. For strings of up to 255 characters, the shorter one should be used but the longer one may be used.

6 length char ... char
the length is an unsigned value from 0 to 255
12 lsb nlsb nmsb msb char ... char
the four bytes form an unsigned little-endian integer giving the length

In both cases the length gives the number of characters in the string. Thus:

6 3 65 66 67
represents the string "ABC"
12 3 0 0 0 65 66 67
also represents the string "ABC"
6 0
represents the empty string ""

Q-unit

A Q-unit holds a truth value or option. There are two possible encodings:

8
represents false, no, or unticked
9
represents true, yes, or ticked

B-unit

A B-unit holds several truth values or options. It is encoded as an I-unit; the value must be positive. The value is broken into individual bits, with 1 meaning the option is chosen and 0 meaning it is not. The bits are numbered from 0 as the least significant bit. Thus:

2 5
represents the options corresponding to bits 0 (value 1) and 2 (value 4)
3 130 1
represents the options corresponding to bits 1, 7, and 8

Unused bit values should be set to 0.

T-unit

A T-unit holds a time in seconds past midnight. It has the same representation as an I-unit. Thus:

2 120
represents the time 00:02
3 242 28
represents the time 02:03H

Counted units

A counted-XXX-unit represents a list of XXX-units. It consists of an I-unit giving the number of XXX-units (which might be zero) followed by that number of XXX-units. For example:

the counted-S-unit
2 2 6 1 65 6 2 66 67
represents the list of strings ("A", "BC")
the counted-I-unit
2 3 3 16 4 2 67 2 254
represents the list of three numbers (1040, 67, -2)
the counted-XXX-unit
2 0
represents an empty list

WTT files

A WTT file consists of:

WTT-header-unit

A WTT-header-unit consists of:

train-type-unit

A train-type-unit consists of:

The SCL and CSH values should be present but may both be omitted (but not only one). The BRK, PWR, and SCL values are encoded as follows:

BRK PWR SCL
Encoding Meaning
0VSlow
1Slow
2Med
3High
4Metro/Light
 
Bit Meaning
0AC
13rd-rail
24th-rail
3Diesel
 
BitMeaningBitMeaningBitMeaning
0EPS-E6CS12Trip
1EPS-D7MGR13Steam
2HST8TGV24X1
3EMU9LH25X2
4DMU10Metro26X3
5SP11WES27X4

timetable-unit

A timetable-unit consists of:

The encodings of BRK and PWR are the same as above; PWS is the same as PWR. SCL should be present but may be omitted.

If ENT does not begin with "E" and the simulation does not have an entry point with that name, the Loader will prefix an "E" and try again.

timing-point-unit

A timing-point-unit consists of:

stopping-unit

A stopping-unit should consist of:

but may consist of:

in which case TLS is false, PPD and NPD are U, STP is Default, and ADJ is 0.

STP is encoded as follows:

Encoding  Meaning
0 Default
1 Near
2 Far
3 NearExact
4 FarExact

action-unit

An action-unit consists of:

The action type is encoded as follows:

Encoding  Meaning
0 Next
1 DR
2 DF
3 Join
4 DER
5 DEF
6 DCR
7 DCF
8 J2
9 PS

The ACI state is encoded as follows:

Encoding  Meaning
0 N (not required)
1 D
2 U
3 U (undetermined)

WTR files

A WTR file consists of:

WTR-header-unit

A WTR-header-unit consists of:

rule-unit

A rule-unit consists of:

The RUL value is encoded as follows:

Encoding  Meaning
0 MAAE
1 MAAL
2 MAAA
3 NOTIF
4 DAA
5 DAE
6 DAL
7 DAJ
8 DAD
9 DAF
10 MX
11 MAAJ
12 MAAD
13 MAAF
14 ALT

Up Back to the SimSig index.Up Back to the Rail index. CDWF Back to Clive's home page.