This model shows a go-back-N automatic repeat request (ARQ) system, which is built upon the "Go-Back-N Automatic Repeat Request" example in SimEvents®. The main purpose of this example is to simulate multiple layers of the Open System Interconnection (OSI) protocol stack using one Simulink® model. You must have a SimEvents license to run this model.
Structure of the Example
The model in this example includes a transmitter that creates packets and transmits them over a physical link using BPSK modulation and BCH (63, 51) coding. An AWGN channel introduces noise to the transmitted signals before they arrive at the receiver. For each data frame, the receiver sends an acknowledgement (ACK) or non-acknowledgement (NAK) message back to the transmitter, through the return channel, based on a parity check. Upon receiving a NAK message, the transmitter retransmits all frames that have not yet been acknowledged with an ACK. By modeling the transmission and flow of data frames, this model lets you visualize the system's behavior and analyze its performance under different error conditions.
This model's frame transmission and reception subsystems also illustrate joint usage of SimEvents, the Communications System Toolbox™, and Stateflow®. This example uses the term "frame" in a generic sense that is unrelated to frame-based signals in Simulink.
The frame creation subsystem generates data frames with an exponential intergeneration time. Each frame has a unique sequence number that identifies it. The entity payload is the content of the frame, whose number of bits can be specified. The subsystem also generates a 1-bit trailer to store the parity check result.
The frame transmission subsystem controls the transmission and retransmission of data bursts, based on ACK and NAK messaging. An entity with an 'ack' attribute of 1 corresponds to an ACK message, while 0 corresponds to an NAK message.
This subsystem 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
Physical Layer Forward Channel
This example explicitly models the physical layer and combines it with the data link layer at the physical layer forward channel subsystem.
PHY Link - This subsystem employs straightforward modulation and coding techniques. It places a new frame on the link, using BCH (63, 51) encoding, and then applies BPSK modulation. The subsystem transmits the modulated symbol through the AWGN channel, with an SNR value you specify. On the other end of the AWGN channel, the subsystem applies a BPSK demodulator and BCH decoder to recover the frame. Based on this PHY link, an error rate calculation display shows the BER statistics.
Packet Comparison - The output of this subsystem becomes the input to the data link layer receiver. This subsystem compares each input frame with each output frame, determining parity bit. The model assumes that the receiver detects an error via a parity check, but that it cannot correct any errors it detects.
PER - This MATLAB function calculates a running tally of the packet error rate (PER). A top-level display shows the PER.
The frame reception subsystem sends an ACK or NAK message back to the frame transmission subsystem for each frame it receives. This subsystem then accepts or rejects each frame, according to the parity check. Upon rejecting a frame, the receiver continues rejecting subsequent frames, until the frame that was originally rejected is correctly received. A Stateflow chart controls the state of the receiver as either accepting or rejecting data frames.
Ideal Reverse Channel
The forward and reverse channels represent the propagation delay, which is assumed to be longer than the transmission delay. That is, the transmitter finishes sending a complete frame before the frame arrives at the receiver. While packets might be potentially corrupted, they are not dropped during transmission. This example assumes the reverse channel is error-free.
The figure below illustrates the model.
Results and Displays
In this example, scopes display:
The result of the parity 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
Exploring the Example
Comparison with other Coding Schemes
You can compare BCH (63, 51) coding with other coding schemes. In order to do this, modify the PHY Link to replace BCH (63, 51) encoder and decoder with other coding schemes. You may also need to change the frame length, so that it can be used as the input to the new encoder.
Comparison with other Data Link Layer Protocols
You can compare go-back-N ARQ with other network protocols, for example, selective-repeat ARQ. In order to do this, modify the Stateflow in both the frame transmitter and frame receiver. As a starting point, SimEvents includes a selective-repeat ARQ example, entitled sedemo_arq_selective_repeat.slxsedemo_arq_selective_repeat.slx
Unreliable Reverse Channel
This example assumes that the reverse channel is a noiseless channel, and does not create any errors. According to the forward channel, you can construct a similar PHY link on the reverse channel and observe the simulation results.