参考他人代码,发现在wlan_mac进程模型中的Simulation Attributes中定义了Wireless LAN Range (meters)属性,不知从何而来,如图所示。经查证该属性不存在于wlan_mac进程代码中,疑来自底层的管道阶段代码。
后来发现,在wlan_port_tx.propdel model管道阶段的wlan_propdel程序中有这么一段代码:
/* 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)
{
op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE);
}
该段代码的作用在于:当wlan_max_distance变量未具体定义时,如果Wireless LAN Range (meters)属性在仿真属性中定义了,那么将该属性的值作为最大的无线传输半径,超过该传输半径的数据包通通丢弃。