Quantcast

SimEvents

Packet Communication within a Go-Back-N ARQ System

Overview

This example shows how to model a go-back-N automatic repeat request (ARQ) system. By modeling the transmission and flow of data frames, the model lets you visualize the system's behavior and analyze its performance under different conditions. The transmitter and receiver subsystems in this model illustrate how to use SimEvents® blocks and Stateflow® blocks together.

Structure of the Model

Packets are created, transmitted over a channel, and affected by errors with a probability determined by the Forward Channel. For each data frame it receives, the receiver uses the return channel to send an acknowledgment (ACK) or nonacknowledgment (NAK) message back to the transmitter, based on a cyclic redundancy code (CRC) check. Upon receiving a NAK message, the transmitter retransmits all frames that have not yet been acknowledged with an ACK.

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.

The transmitter uses a Stateflow chart to control the transmission and retransmission of frames. The transmitter state can have one of these values:

  • Transmitting - Placing a new data frame on the link

  • Retransmitting - Retransmitting data frames across the link

  • WaitingToRetransmit - Waiting for the link to become available in order to start retransmission of rejected frames

  • Idle - Not transmitting because no new data is available or the maximum number of outstanding frames has been reached

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 continues to reject frames until the originally rejected frame is correctly received. A Stateflow chart controls the state of the receiver as either accepting or rejecting data frames.

Results and Displays

Scopes display

  • Result of the CRC check for each received frame, where a value of 0 indicates an error

  • The time and sequence number of transmitted frames

  • The time and sequence number of frames rejected by the receiver

  • The time and sequence number of frames accepted by the receiver

Related Examples