Description

The Transmitter is a communication component responsible for encoding, queuing, and transmitting data packets over telemetry links. It extends the base Antenna class and provides the interface between higher-level data sources and the physical communication layer managed by the Telemetry System. The transmitter models realistic packet-based communication including bit rate constraints, packet corruption, and transmission timing. Data can be transmitted as raw bytes, strings, JSON objects, or structured messages, all of which are serialized into discrete packets and queued for transmission at the configured data rate.


Example Use Cases

  • Spacecraft Telemetry Downlink: Transmit housekeeping data, science payloads, or command acknowledgements to ground stations.
  • Inter-Satellite Links: Model data relay between spacecraft in a constellation.
  • Communication System Analysis: Evaluate throughput, latency, and bit error rates under various link conditions.
  • Protocol Testing: Simulate packet corruption to test error detection and correction algorithms.

Module Implementation

The transmitter operates as a packet-based communication system with two internal buffers: a loading buffer for data awaiting transmission, and an outgoing buffer for packets ready to be sent to connected receivers via the Telemetry System.

Data Encoding

The transmitter accepts multiple data formats and converts them into a common packet structure for transmission:

MethodInput TypeDefault Key Prefix
TransmitBytesbyte[]b_
TransmitStringstrings_
TransmitJSONJTokenj_
TransmitMessageMessagem_ + type name

All data is ultimately converted to byte arrays and segmented into fixed-size packets. Each packet is assigned a unique message identifier and sequence number, then queued in the loading buffer for transmission.

Packet Segmentation

Data is divided into packets of a configurable size (default 4 KB). For a byte array of length , the number of packets generated is:

Each packet contains metadata including a unique message identifier, sequence number, total packet count, and a key string for identification at the receiver.

Transmission Timing

Packets are transmitted according to the configured bit rate [bits/s]. The time required to transmit a single packet is determined by its size in bits:

where is the packet size in bytes.

The transmitter maintains a scheduled uplink time for each packet. During each simulation update, packets are dequeued from the loading buffer and transferred to the outgoing buffer only when the simulation time exceeds the scheduled transmission time:

After each packet is transmitted, the next uplink time is updated:

This ensures packets are transmitted sequentially at the correct data rate, regardless of the simulation time step.

Transmission State

The transmitter tracks whether it is actively transmitting data during each update cycle. The IsTransmitting flag is set to true when at least one packet is moved from the loading buffer to the outgoing buffer. This state is propagated to all connected links via the Telemetry System, enabling downstream components to track transmission activity.

A byte counter tracks the cumulative data transmitted over the lifetime of the transmitter:

for each packet successfully queued for transmission.

Packet Corruption Model

To simulate bit errors in the communication channel, the transmitter implements a probabilistic packet corruption model. For each packet being transmitted, a random value is generated and compared against the corruption probability :

When corruption occurs, a single bit within the packet is flipped. The corruption process selects:

  1. A random byte index where is the packet data length
  2. A random bit position within that byte

The bit flip is performed using an XOR operation:

where is the byte at index . This single-bit error will typically cause checksum validation to fail at the receiver, simulating realistic packet loss due to channel noise. This model can be configured in the Transmitter Packet Corruption Error Model.

Transmission Conditions

The transmitter will only process and send packets when the following conditions are met:

  1. Transmission Enabled: The CanTransmit flag must be true (can be controlled by power models or other systems)
  2. Connection Available: At least one link connection exists via the Telemetry System, or ForceTransmit is enabled
  3. Device Active: The parent device must be operational, or ForceTransmit is enabled

When these conditions are not satisfied, packets remain in the loading buffer until transmission becomes possible.

Outgoing Buffer Management

Once packets are placed in the outgoing buffer, they are available for the Telemetry System to fetch and propagate to connected receivers. The telemetry system handles the link budget calculations and determines which receivers successfully acquire the transmitted signal. After each update cycle where connections exist, the outgoing buffer is cleared, as the telemetry system has consumed the packet data.


Assumptions/Limitations

  • Packets are transmitted sequentially; parallel transmission across multiple channels is not modelled.
  • The corruption model assumes independent bit errors; burst errors are not explicitly modelled.
  • Only a single bit is flipped per corrupted packet; multiple bit errors per packet are not simulated.
  • The corruption probability is applied per-packet, not per-bit.
  • Packet fragmentation and reassembly are handled by the encoding layer; the transmitter operates on complete packets.
  • Transmission timing assumes instantaneous packet transfer once the bit rate constraint is satisfied.
  • The model does not account for transmission delays due to hardware latency or protocol overhead.
  • Retransmission logic for corrupted packets must be implemented at a higher protocol layer.
  • The outgoing buffer is cleared each cycle regardless of whether connected receivers successfully decoded the data.
  • The ForceTransmit flag bypasses connection and device state checks, useful for testing but not physically realistic.