📄 wlan_propdel.ps.c
字号:
/* wlan_propdel.ps.c */ /* Modified for IEEE802.11 *//* Propagation delay 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>/***** constants *****//* propagation velocity of radio signal (m/s) */#define PROP_VELOCITY 3.0E+08/* The variable defining a maximum range across which the station can communicate (meters) */ static double wlan_max_distance = OPC_DBL_INFINITY;/***** pipeline procedure *****/#if defined (__cplusplus)extern "C"#endifvoidwlan_propdel (pkptr) Packet* pkptr; { double start_prop_delay, end_prop_delay; double start_prop_distance, end_prop_distance; /** Compute the propagation delay separating the **/ /** radio transmitter from the radio receiver. **/ FIN (wlan_propdel (pkptr)); /* Get the start distance between transmitter and receiver. */ start_prop_distance = op_td_get_dbl (pkptr, OPC_TDA_RA_START_DIST); /* Get the end distance between transmitter and receiver. */ end_prop_distance = op_td_get_dbl (pkptr, OPC_TDA_RA_END_DIST); /* Compute propagation delay to start of reception. */ start_prop_delay = start_prop_distance / PROP_VELOCITY; /* Compute propagation delay to end of reception. */ end_prop_delay = end_prop_distance / PROP_VELOCITY; /* If the maximum transmission range of the station is not already set then extract */ /* it from the user defined simulation attribute. */ if (wlan_max_distance == OPC_DBL_INFINITY) { if (op_ima_sim_attr_exists ("Wireless LAN Range (meters)") == OPC_TRUE) { op_ima_sim_attr_get (OPC_IMA_DOUBLE, "Wireless LAN Range (meters)", &wlan_max_distance); } } /* If the starting and ending propagation distance is more than the maximum transmission */ /* range then discard the packet in the pipeline stage. This will model the physical */ /* transmission boundary of a wireless station. */ if (end_prop_distance > wlan_max_distance || start_prop_distance > wlan_max_distance) { /* Discard the packet if the destination is more than the specified range */ op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE); } /* Place both propagation delays in packet transmission data attributes. */ op_td_set_dbl (pkptr, OPC_TDA_RA_START_PROPDEL, start_prop_delay); op_td_set_dbl (pkptr, OPC_TDA_RA_END_PROPDEL, end_prop_delay); FOUT; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -