Beispiel #1
0
        /// <summary>
        /// Remove data from the queue if necessary and update statistics on the fly
        /// </summary>
        /// <param name="block"></param>
        public void ProcessTransmittedBlock(Block block)
        {
            foreach(var curr in block.Data.Data)
              {
            var pos = Data.Data.FindIndex(p => p.Key == curr.Key);
            var item = Data.Data[pos];

            if (item.Value > curr.Value)
            {
              // only a part of the PDUs have been transferred
              Data.Data[pos] = new KeyValuePair<double, int>(item.Key, item.Value - curr.Value);
            }
            else
            {
              // the last PDU of the packet has been transferred
              Data.Data.RemoveAt(pos);

              // collect stats
              StatLocalWait += Simulation.Time - item.Key;
              StatLocalPackets++;

              // add a point to graph if current
              if (StatLocalPackets == FlowSimulation.Scale)
              {
            // old value at current time to create immediate changes
            var avg = StatLocalWait / (double)StatLocalPackets;
            var pt1 = new Complex(StatWaitGraph.Count == 0 ? 0 : StatWaitGraph[StatWaitGraph.Count - 1].Real, avg);
            var pt2 = new Complex(Simulation.Time, avg);

            StatWaitGraph.Add(pt1);
            StatWaitGraph.Add(pt2);

            StatLocalWait = 0;
            StatLocalPackets = 0;
              }
            }
              }
        }
Beispiel #2
0
 public Symbol()
 {
     Blocks = new Block[FlowSimulation.BlocksPerSymbol];
       for (int idx = 0; idx < FlowSimulation.BlocksPerSymbol; idx++)
     Blocks[idx] = new Block(idx);
 }