Default Error Correction Model (dpt_ecc)

This section describes the functionality and implementation of the default model occupying stage three of the Point-to-Point Link Transceiver Pipeline. This model is named dpt_ecc. Source code is provided in the file dpt_ecc.ps.c, which resides in the <reldir>/models/std/links directory. An alternate version of this stage, for networks using background utilization, is in the file dpt_ecc_bgutil.ps.c.

Invocation Context

The error correction model is the final stage of the point-to-point link transceiver pipeline, and is called immediately after the return of the error model. The simulation time at invocation corresponds to the end of packet reception (i.e., the time at which the last bit of the packet has been received).

The result of the error correction model for each transmitted packet is one Boolean value (i.e., OPC_TRUE or OPC_FALSE) that represents the acceptability of the packet in the destination node. A result of OPC_FALSE indicates to the Simulation Kernel that the packet should be dropped, while a result of OPC_TRUE indicates that the packet should be accepted. The Simulation Kernel expects this result to be placed in the packet's OPC_TDA_PT_PK_ACCEPT transmission data attribute.

Acceptability Test

dpt_ecc determines whether a packet can be accepted by the receiver based on the application of one criterion that compares the proportion of bit errors occurring in the packet and the error correction threshold of the receiver. The source code for this model is shown in Figure 12.

Figure 12: Source Code for Pipeline Procedure dpt_ecc

/* dpt_ecc.ps.c */
/* Default error correction model for pt-to-pt link Transceiver Pipeline */

/**********************************/
/*       Copyright (c) 2013       */
/*   Riverbed Technology, Inc.    */
/*      All Rights Reserved.      */
/**********************************/


#include "opnet.h"


#if defined (__cplusplus)
extern "C"
#endif
void
dpt_ecc (Packet * pkptr)
	{
	Objid				rx_obid;
	OpT_Packet_Size				pklen;
	int				num_errs, accept;
	double				ecc_thresh;

	/** Test if packet arriving over point-to-point link is				  **/
	/** acceptable for recpetion or if it should be discarded.	 **/
	FIN (dpt_ecc (pkptr));

	/* Do not accept packets that were received	*/
	/* when the node was disabled.				  */
	if (op_td_is_set (pkptr, OPC_TDA_PT_ND_FAIL))
		{
		accept = OPC_FALSE;
		}
	else
		{
		/* Obtain object id of receiver accepting transmission. */
		rx_obid = op_td_get_int (pkptr, OPC_TDA_PT_RX_OBJID);

		/* Obtain the error correction threshold of the receiver. */
		if (op_ima_obj_attr_get (rx_obid, "ecc threshold", &ecc_thresh) ==
			OPC_COMPCODE_FAILURE)
			op_sim_end ("Error in point-to-point error correction pipeline stage "
				"(dpt_ecc):",
				"Unable to get error correction threshold from receiver attribute.",
				OPC_NIL, OPC_NIL);

		/* Obtain length of packet. */
		pklen = op_pk_total_size_get (pkptr);

		/* Obtain number of errors in packet. */
		num_errs = op_td_get_int (pkptr, OPC_TDA_PT_NUM_ERRORS);

		/* Test if bit errors exceed threshold. */
		if (pklen == 0)
			accept = OPC_TRUE;
		else
			accept = ((((double) num_errs) / pklen) <= ecc_thresh) ? OPC_TRUE :
				OPC_FALSE;
		}

	/* Place flag indicating acceptance/rejection in packet trans. data attr. */
	op_td_set_int (pkptr, OPC_TDA_PT_PK_ACCEPT, accept);

	FOUT
	}

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com