Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open TTP

A simple C++ program for simulating and decoding 64-byte packed binary telemetry data with integrity validation.

Features:

  • Pragma Packing - ensures zero-padding for binary compatability and packet size assurance
  • Checksum Validation - 64-byte summation algorithm to detect data corruption
  • Fixed-point Conversion - Translating centi-Celsius and milli-Volts into human-readable units
  • TTP (Telemetry Transmission Protocol) implementation (see the documentation).

Build Instructions

  • Requires C++20 and CMake 3.20+
  • Step 1. Build and run generator.cpp first to generate telemetry.dat inside the build folder.
  • Step 2. Run decoder.cpp to validate and output the data.
# create and enter build directory
mkdir build && cd build

# configure and compile both targets
cmake ..
cmake --build .

# execute generator first
./generator

# then execute decoder
./decoder

Example Decoder Output

Data integrity validated...
Temperature 20°C
Voltage 3V

Engineering Decisions

#pragma pack(1)

This directive forces the compiler to remove any padding around variables. This ensures the length of the telemetry data file is constant. By ensuring the frame is exactly 64 bytes long, it allows us to implement checksum logic for data validation and ensures consistency across hardware architectures, which is vital in the case of cross-platform binary communication.

Checksum arithmetic logic

Since we know the frame is guaranteed to be 64 bytes long and the checksum field is of type uint16_t (i.e. 2 bytes), by using sizeof(frame) - 2, it allows us to loop over every byte of data in the file, minus the checksum, so we can test the data for validity.

Fixed-Point Arithmetic

Values such as temperature and voltage are stored as integers using centi-Celsius and milli-Volts as it will allow for greater accuracy over storing floating point directly. If we used a 16-bit signed floating point number (half-precision floating point), we could store nearly the same range as with an unsigned integer. However, using a 16-bit unsigned integer will allow for the benefit of Linear Precision. Unlike the floating point representation, where precision decreases as the value increases, fixed-point integers maintain a constant resolution, leading to no data discrepancies between ground and space-based systems.

About

Simple mock telemetry data decoder written in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages