Correct Alignment Problems Caused by Delays in Blocked-Based Operations
Blocks are sensitive to delay because it disrupts signal synchronization, leading to errors in codeword boundary identification and data interpretation. By inserting delays, you can see how to adjust system parameters to ensure accurate data transmission and maintain message integrity. This example show how to apply this technique and meet the need for precise timing between an encoder and decoder.
Open the Model
In this model, the Hamming Encoder and Hamming Decoder create and decode a block code, respectively. The first Variable Integer Delay (Simulink) block, or the Inherent Delay block, represents any delay that occurs between the encoder and the decoder. The second Variable Integer Delay (Simulink) block, or the Added Delay block, represents an explicit delay that you can insert to create an appropriate amount of total delay between encoder and decoder.
Adjust Delays
Set the Delay length parameter in the Added Delay block to 6 and the Receive delay parameter in the Error Rate Calculation block to 4. The additional delay in the Added Delay block aligns the transmitted and received codewords and helps the decoder accurately recover messages without any errors.
Verify Alignment
Run the model. The Error Rate Display block indicates a zero error rate and signifies successful message recovery by the decoder. At the Matlab command line, enter [tx rx] to view the output. The sequence along the first column (tx) appears in the second column (rx) four rows later. To confirm this result, enter isequal(tx(1:end-4),rx(5:end)) at the MATLAB® command line and observe that the result is 1 or true. This command tests if the second column matches a shifted version of the first 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.
Observe Effects of Misalignment
Ignoring delays can create significant alignment problems. In the model, set the Inherent Delay block to 1 and the Added Delay block to 0, introducing a one-bit delay between the encoder and decoder. Rerun the model. The uncorrected delay misaligns the codeword boundaries, causing the decoder to incorrectly process codewords. The decoder might interpret the end of one frame and the beginning of another frame as a continuous codeword, leading to a high error rate and compromised message recovery.
Conclusion
By combining the delays in the Inherent Delay block and Added Delay blocks, you use a full codeword to delay the transmitted data and the decoder starts from the beginning of the new codeword frame. You delay the transmitted data by a full codeword so that the decoding starts from the beginning of a new codeword. By proactively adjusting your model to account for inherent and added delays, you ensure the correct alignment of the transmitted and received signals. This technique not only maintains the integrity of data transmission but also prevents the high error rates associated with delay-induced misalignment.