Contents

Packet Communication within a Selective Repeat ARQ System

Overview

This example shows a selective-repeat automatic repeat request (ARQ) system. Packets are created, transmitted over a channel and affected by errors with a probability determined by the Forward Channel. This model allows you to visualize the system's behavior and analyze its performance under different conditions.

Structure of the Model

The model simulates the following processes:

  • Generating frames

  • Transmitting frames through the forward channel

  • Introducing errors to frames

  • Receiving frames and returning messages through the return channel

For each received frame, the receiver sends an acknowledgment (ACK) or nonacknowledgment (NAK) message back to the transmitter based on a cyclic redundancy code (CRC) check. The transmitter retransmits only the frames corresponding to NAK messages.

Frame Creation

This subsystem generates data frames with an exponential intergeneration time. Each frame has a unique sequence number that identifies it. (Note: This example uses the term "frame" in an abstract sense that is unrelated to frame-based signals in Simulink® software.)

Transmitter

The transmitter transmits frames and also retransmits corrupted frames based on ACK and NAK messages from the receiver. An entity whose ack attribute is 1 corresponds to an ACK message, while 0 corresponds to a NAK message. Logic inside a discrete event subsystem controls the retransmission of frames. Flow control is handled through the retransmission queue, which becomes full when the number of unacknowledged frames equals the model's Sliding window size parameter.

Forward Channel and Reverse Channel

The forward and reverse channels represent the propagation delay, assumed to be longer than the delay associated with transmission. That is, the transmitter finishes sending the complete frame before the receiver begins receiving it. Packets are potentially corrupted, but not dropped, during transmission. The reverse channel is assumed to be error-free.

Addition of Errors

This subsystem corrupts packets with a given probability. The model assumes that the receiver can detect an error via a CRC check but cannot correct the error.

Receiver

The receiver sends an ACK or NAK message back to the transmitter for each frame and either accepts or rejects the frame according to the CRC check. After rejecting a frame, the receiver buffers subsequent frames until it correctly receives the rejected frame. At that point, the receiver reconstructs the frame sequence using the sequence numbers. The logic for the reconstruction is in the MATLAB® Function block in the Discrete Event Subsystem block in the Sort Frames subsystem.

Results and Displays

Scopes show the time and sequence number of four types of frames:

  • Transmitted frames

  • Frames accepted by the receiver

  • Frames rejected by the receiver

  • Frames in the reconstructed sequence

  • An additional scope displays the result of the CRC check for each received frame, where a value of 0 indicates an error.

Related Examples

Packet Communication within a Go-Back-N ARQ SystemPacket Communication within a Go-Back-N ARQ System

Was this topic helpful?