/// <summary>
 /// 计算未知节点加权平均每跳距离
 /// </summary>
 /// <param name="nodeList"></param>
 private static void CalculateNodeHopSize(NodeList nodeList)
 {
     List<Node> beaconNodeList = nodeList.GetAllBeaconNode();
     List<Node> generalNodeList = nodeList.GetAllGeneralNode();
     //对各个未知节点求加权平均每跳距离
     foreach (GeneralNode gn in generalNodeList)
     {
         List<Node> tempBeaconNodeList = new List<Node>();
         int sumHop = 0;
         foreach (int beaconNodeId in gn.HopCountTable.Keys)
         {
             //将gn节点HopCountTable中所有beaconNode取出放入tempBeaconNodeList中,并保存gn到所有beaconNode的跳数和
             if (nodeList.GetNodeById(beaconNodeId).IsBeaconNode == true)
             {
                 tempBeaconNodeList.Add(nodeList.GetNodeById(beaconNodeId));
                 sumHop += gn.HopCountTable[beaconNodeId];
             }
         }
         double temp = 0d;
         int tempHop = 0;
         //将tempBeaconNodeList中AvgHopDistance属性为0的节点去除
         for (int i = 0; i < tempBeaconNodeList.Count; i++)
         {
             if (((BeaconNode)tempBeaconNodeList[i]).AvgHopSize <= 0)
             {
                 tempBeaconNodeList.Remove(tempBeaconNodeList[i]);
             }
         }
         foreach (BeaconNode bn in tempBeaconNodeList)
         {
             tempHop += sumHop - CalculateNodeHop(bn, gn);
             temp += bn.AvgHopSize * (sumHop - CalculateNodeHop(bn, gn));
         }
         if (tempHop != 0)
         {
             gn.AvgHopSize = temp / tempHop;
         }
     }
 }
 /// <summary>
 /// 取得信标节点平均每跳距离
 /// </summary>
 /// <param name="nodeList"></param>
 private static void GetBeaconNodeAvgHopSize(NodeList nodeList)
 {
     List<Node> beaconNodeList = nodeList.GetAllBeaconNode();
     foreach (BeaconNode bn in beaconNodeList)
     {
         int sumHop = 0;
         double sumDistance = 0;
         foreach (Node m in beaconNodeList)
         {
             //保证信标节点之间可联通
             if (bn.Id != m.Id && (CalculateNodeHop(bn, m) > 0))
             {
                 sumDistance += CalculateNodeDistance(bn, m);
                 sumHop += CalculateNodeHop(bn, m);
             }
         }
         if (sumHop != 0)
         {
             bn.AvgHopSize = sumDistance / sumHop;
         }
     }
 }
 /// <summary>
 /// 计算信标节点每跳距离修正值
 /// </summary>
 /// <param name="nodeList"></param>
 private static void CalculateBeaconNodeRevisedHopSize(NodeList nodeList)
 {
     List<Node> beaconNodeList = nodeList.GetAllBeaconNode();
     //分别计算每个信标节点的RevisedValue
     foreach (BeaconNode bn in beaconNodeList)
     {
         foreach (BeaconNode tempNode in beaconNodeList)
         {
             //需要保证信标节点之间可以连通
             if (bn.Id != tempNode.Id && CalculateNodeHop(bn, tempNode) > 0)
             {
                 bn.RevisedValue = (CalculateNodeDistance(bn, tempNode) - CalculateNodeHop(bn, tempNode) * nodeList.AvgHopSize) / beaconNodeList.Count;
             }
         }
     }
     foreach (BeaconNode bn in beaconNodeList)
     {
         nodeList.RevisedSumValue += bn.RevisedValue;
     }
 }