Communications Blockset    

Delays and Alignment Problems

This section illustrates the sensitivity of block-oriented operations to delays, using a small model that aims to capture the essence of the problem in a simple form. Open the model by typing alignmentdoc in the MATLAB Command Window. Then run the simulation so that the Display blocks show relevant values.

In this model, two coding blocks create and decode a block code. Two copies of the Integer Delay block create a delay between the encoder and decoder. The two Integer Delay blocks have different purposes in this illustrative model:

Observing the Problem

By default, the Delay parameters in the Inherent Delay and Added Delay blocks are set to 1 and 0, respectively. This represents the situation in which some operation causes a one-bit delay between the encoder and decoder, but you have not yet tried to compensate for it. The total delay between the encoder and decoder is one bit. You can see from the blocks labeled Word and Delayed Word that the code word that leaves the encoder is shifted downward by one bit by the time it enters the decoder. The decoder receives a signal in which the boundary of the code word is at the second bit in the frame, instead of coinciding with the beginning of the frame. That is, the code words and the frames that hold them are not aligned with each other.

This nonalignment is problematic because the Hamming Decoder block assumes that each frame begins a new code word. As a result, it tries to decode a word that consists of the last bit of one output frame from the encoder followed by the first six bits of the next output frame from the encoder. You can see from the Error Rate Display block that the error rate from this decoding operation is close to 1/2. That is, the decoder rarely recovers the original message correctly.

To use an analogy, suppose someone corrupts a paragraph of prose by moving each period symbol from the end of the sentence to the end of the first word of the next sentence. If you try to read such a paragraph while assuming that a new sentence begins after a period, then you misunderstand the start and end of each sentence. As a result, you might fail to understand the meaning of the paragraph.

To see how delays of different amounts affect the decoder's performance, vary the values of the Delay parameter in the Added Delay block and the Receive delay parameter in the Error Rate Calculation block and then run the simulation again. Many combinations of parameter values produce error rates that are close to 1/2. Furthermore, if you examine the transmitted and received data by typing

in the MATLAB Command Window, then you might not detect any correlation between the transmitted and received data.

Correcting the Delays

Some combinations of parameter values produce error rates of zero because the delays are appropriate for the system. For example:

The top number in the Error Rate Display block shows that the error rate is zero. That is, the decoder recovered each transmitted message correctly. However, the Word and Displayed Word blocks do not show matching values. It is not immediately clear how the encoder's output and the decoder's input are related to each other. To clarify the matter, examine the output in the MATLAB Command Window. Notice that the sequence along the first column (tx) appears in the second column (rx) four rows later. To confirm this, enter

in the MATLAB Command Window and observe that the result is 1 (true). This last command tests whether the first column matches a shifted version of the second column. Shifting the MATLAB vector rx by four rows corresponds to the Error Rate Calculation block's behavior when its Receive delay parameter is set to 4.

To summarize, these special values of the Delay and Receive delay parameters work for these reasons:


  Manipulating Delays Aligning Words of a Block Code