📄 pdm_chanmatch.ps.c
字号:
/* dra_chanmatch.ps.c */
/* Default channel match model for radio link Transceiver Pipeline */
/****************************************/
/* Copyright (c) 1993-2002 */
/* by OPNET Technologies, Inc. */
/* (A Delaware Corporation) */
/* 7255 Woodmont Av., Suite 250 */
/* Bethesda, MD 20814, U.S.A. */
/* All Rights Reserved. */
/****************************************/
#include "opnet.h"
#if defined (__cplusplus)
extern "C"
#endif
void
pdm_chanmatch_mt (OP_SIM_CONTEXT_ARG_OPT_COMMA Packet * pkptr)
{
double tx_freq, tx_bw, tx_drate, tx_code;
double rx_freq, rx_bw, rx_drate, rx_code;
Vartype tx_mod;
Vartype rx_mod;
/** Determine the compatibility between transmitter and receiver channels. **/
FIN_MT (pdm_chanmatch (pkptr));
/* Obtain transmitting channel attributes. */
tx_freq = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_FREQ);
tx_bw = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_BW);
tx_drate = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_DRATE);
tx_code = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_CODE);
tx_mod = op_td_get_ptr (pkptr, OPC_TDA_RA_TX_MOD);
/* Obtain receiving channel attributes. */
rx_freq = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_FREQ);
rx_bw = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_BW);
rx_drate = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_DRATE);
rx_code = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_CODE);
rx_mod = op_td_get_ptr (pkptr, OPC_TDA_RA_RX_MOD);
//printf("Tx Freq = %lf\n", tx_freq);
// printf("Rx Freq = %lf\n", rx_freq);
// printf("Tx BW = %lf\n", tx_bw);
// printf("Rx BW = %lf\n", rx_bw);
// printf("Tx drate = %lf\n", tx_drate);
// printf("Rx drate = %lf\n", rx_drate);
// printf("Tx Code = %lf\n", tx_code);
// printf("Rx Code = %lf\n", rx_code);
/* For non-overlapping bands, the packet has no */
/* effect; such packets are ignored entirely. */
if ((tx_freq > rx_freq + rx_bw) || (tx_freq + tx_bw < rx_freq))
{
op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE);
// printf("First Rejection!\n");
FOUT
}
/* Otherwise check for channel attribute mismatches which would */
/* cause the in-band packet to be considered as noise. */
if ((tx_freq != rx_freq) || (tx_bw != rx_bw) ||
(tx_drate != rx_drate) || (tx_code != rx_code) || (tx_mod != rx_mod))
{
op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_NOISE);
// printf("Second Rejection!\n");
FOUT
}
/* Otherwise the packet is considered a valid transmission which */
/* could eventually be accepted at the error correction stage. */
op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_VALID);
// printf("VALID\n");
FOUT
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -