參考他人代碼,發(fā)現(xiàn)在wlan_mac進(jìn)程模型中的Simulation Attributes中定義了Wireless LAN Range (meters)屬性,不知從何而來(lái),如圖所示。經(jīng)查證該屬性不存在于wlan_mac進(jìn)程代碼中,疑來(lái)自底層的管道階段代碼。


后來(lái)發(fā)現(xiàn),在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);
    }

該段代碼的作用在于:當(dāng)wlan_max_distance變量未具體定義時(shí),如果Wireless LAN Range (meters)屬性在仿真屬性中定義了,那么將該屬性的值作為最大的無(wú)線傳輸半徑,超過(guò)該傳輸半徑的數(shù)據(jù)包通通丟棄。