📄 wlan_inoise.ps.c
字号:
/* wlan_inoise.ps.c */ /* WLAN interference noise model for radio link Transceiver Pipeline *//****************************************//* Copyright (c) 2007 *//* by OPNET Technologies, Inc. *//* (A Delaware Corporation) *//* 7255 Woodmont Av., Suite 250 *//* Bethesda, MD 20814, U.S.A. *//* All Rights Reserved. *//****************************************/#include "opnet.h"#include "jammers.h"#if defined (__cplusplus)extern "C"#endifvoidwlan_inoise_mt (OP_SIM_CONTEXT_ARG_OPT_COMMA Packet * pkptr_prev, Packet * pkptr_arriv) { int arriv_match, prev_match; double prev_rcvd_power, arriv_rcvd_power; /** Evaluate a collision due to arrival of 'pkptr_arriv' **/ /** where 'pkptr_prev' is the packet that is currently **/ /** being received. **/ FIN_MT (wlan_inoise (pkptr_prev, pkptr_arriv)); /* If the previous packet ends just as the new one begins, this is not */ /* a collision (just a near miss, or perhaps back-to-back packets). */ if (op_td_get_dbl (pkptr_prev, OPC_TDA_RA_END_RX) != op_sim_time ()) { /* Increment the number of collisions in previous packet. */ op_td_increment_int (pkptr_prev, OPC_TDA_RA_NUM_COLLS, 1); /* Increment number of collisions in arriving packet. */ op_td_increment_int (pkptr_arriv, OPC_TDA_RA_NUM_COLLS, 1); /* Determine if previous packet is valid or noise. */ prev_match = op_td_get_int (pkptr_prev, OPC_TDA_RA_MATCH_STATUS); /* Determine if arriving packet is valid or noise. */ arriv_match = op_td_get_int (pkptr_arriv, OPC_TDA_RA_MATCH_STATUS); /* if the current packet is a WLAN and we already marked a jammer packet */ /* as valid, then mark the previous jammer packet as noise */ if ((op_pk_encap_flag_is_set (pkptr_prev, OMSC_JAMMER_ENCAP_FLAG_INDEX) == OPC_TRUE) && prev_match == OPC_TDA_RA_MATCH_VALID && arriv_match == OPC_TDA_RA_MATCH_VALID) { /* The previous packet (jammer) will be dropped in wlan_ecc; */ /* Indicate previous match is noise to prevent unnecessary */ /* computation below */ prev_match = OPC_TDA_RA_MATCH_NOISE; /* use a special TDA to indicate this jammer packet should be */ /* dropped in wlan_ecc stage */ op_td_set_int (pkptr_prev, OPC_TDA_RA_MAX_INDEX + 1, OPC_TRUE); } /* If the arriving packet is valid, calculate */ /* interference of previous packet on arriving one. */ if (arriv_match == OPC_TDA_RA_MATCH_VALID) { prev_rcvd_power = op_td_get_dbl (pkptr_prev, OPC_TDA_RA_RCVD_POWER); op_td_increment_dbl (pkptr_arriv, OPC_TDA_RA_NOISE_ACCUM, prev_rcvd_power); } /* And vice-versa. */ if (prev_match == OPC_TDA_RA_MATCH_VALID) { arriv_rcvd_power = op_td_get_dbl (pkptr_arriv, OPC_TDA_RA_RCVD_POWER); op_td_increment_dbl (pkptr_prev, OPC_TDA_RA_NOISE_ACCUM, arriv_rcvd_power); } } FOUT; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -