wlan_ecc.ps.c

来自「opnet环境中实现aodv路由协议建模」· C语言 代码 · 共 67 行

C
67
字号
/* wlan_ecc.ps.c *//* Modified for IEEE802.11										*/		 /* Error correction model for radio link Transceiver Pipeline 	*//****************************************//*		  Copyright (c) 1993			*//*			by MIL 3, Inc.				*//*		(A Delaware Corporation)		*//*	3400 International Drive,  N.W.		*//*		Washington, D.C., U.S.A.		*//*			All Rights Reserved.		*//****************************************/#include <opnet.h>#if defined (__cplusplus)extern "C"#endifvoidwlan_ecc (pkptr)	Packet*		pkptr;    {	int			pklen, num_errs, accept;	Objid		rx_ch_obid; 	double		ecc_thresh;	/** Determine acceptability of given packet at receiver. **/	FIN (wlan_ecc (pkptr));	/* Do not accept packets that were received	*/	/* when the node was disabled.				*/	if (op_td_is_set (pkptr, OPC_TDA_RA_ND_FAIL))		accept = OPC_FALSE;	else		{		/* Obtain the error correction threshold of the receiver. */		ecc_thresh = op_td_get_dbl (pkptr, OPC_TDA_RA_ECC_THRESH);		/* 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_RA_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 accept/reject in the data packet control field. */	op_pk_nfd_set (pkptr, "Accept", accept);    	/* Force the simulation kernel to always accpet the packet. The 			*/	/* actual discarding of the packet will take place at the MAC layer of the  */	/* receiving node receiving this packet.                                  	*/	op_td_set_int (pkptr, OPC_TDA_RA_PK_ACCEPT, OPC_TRUE);	/* In either case the receiver channel is no longer locked. */	rx_ch_obid = op_td_get_int (pkptr, OPC_TDA_RA_RX_CH_OBJID);	op_ima_obj_attr_set (rx_ch_obid, "signal lock", OPC_BOOLINT_DISABLED);	FOUT;	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?