Ejemplo n.º 1
0
        public UiRecievedPackertsBySink()
        {
            InitializeComponent();
            Sensor sink = PublicParamerters.SinkNode;

            if (sink != null)
            {
                List <UnVisualizedDataPacket> recivedpackets = new List <DataPacket.UnVisualizedDataPacket>();
                foreach (Datapacket pck in sink.PacketsList)
                {
                    UnVisualizedDataPacket pp = new UnVisualizedDataPacket()
                    {
                        Distance                    = pck.DistanceFromSourceToSink,
                        Path                        = pck.Path,
                        RoutingDistance             = pck.RoutingDistance,
                        SID                         = pck.SourceNodeID,
                        Hops                        = pck.Hops,
                        UsedEnergy_Joule            = pck.UsedEnergy_Joule,
                        Delay                       = pck.Delay,
                        PrepDistanceDistCnt         = pck.PrepDistanceDistCnt,
                        TransDistanceDistCnt        = pck.TransDistanceDistCnt,
                        EnergyDistCnt               = pck.EnergyDistCnt,
                        DirectionDistCnt            = pck.DirectionDistCnt,
                        AverageTransDistrancePerHop = pck.AverageTransDistrancePerHop,
                        RoutingDistanceEffiecncy    = pck.RoutingDistanceEfficiency,
                        RoutingEfficiency           = pck.RoutingEfficiency,
                        TransDistanceEfficiency     = pck.TransDistanceEfficiency,
                        RoutingZoneWidthCnt         = pck.RoutingZoneWidthCnt,
                        RoutingProbabilityForPath   = pck.PathLinksQualityEstimator,
                        PID                         = pck.PacektSequentID,
                        IsDelivered                 = pck.IsDelivered,
                        MaxHops                     = pck.MaxHops,
                        PacketWaitingTimes          = pck.PacketWaitingTimes
                    };
                    recivedpackets.Add(pp);
                }



                dg_packets.ItemsSource = recivedpackets;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// y: the Efficiency: 1-100%.
        /// x: is the index of the node. that is when the ith index node is the source.
        /// this to evalute when the ith node sended a packet, we see the qulity of the path.
        ///
        ///
        /// </summary>
        /// <returns></returns>
        public static List <List <KeyValuePair <int, double> > > BuildPathEfficiencyAndDelayChart()
        {
            List <List <KeyValuePair <int, double> > > overAll = new List <List <KeyValuePair <int, double> > >();
            Sensor sink = PublicParamerters.SinkNode;

            if (sink != null)
            {
                List <KeyValuePair <int, double> > ListValuesPathEfficiency = new List <KeyValuePair <int, double> >();
                List <KeyValuePair <int, double> > ListValuesDelay          = new List <KeyValuePair <int, double> >();

                List <UnVisualizedDataPacket> recivedpackets = new List <DataPacket.UnVisualizedDataPacket>();
                foreach (Datapacket pck in sink.PacketsList)
                {
                    UnVisualizedDataPacket pp = new UnVisualizedDataPacket()
                    {
                        Distance         = pck.Distance,
                        Path             = pck.Path,
                        RoutingDistance  = pck.RoutingDistance,
                        SID              = pck.SourceNodeID,
                        Hops             = pck.Hops,
                        UsedEnergy_Joule = pck.UsedEnergy_Joule,
                        Delay            = pck.Delay
                    };

                    KeyValuePair <int, double> rowPath = new KeyValuePair <int, double>(pp.SID, pp.RoutingDistanceEffiecncy);
                    ListValuesPathEfficiency.Add(rowPath);

                    KeyValuePair <int, double> rowDelay = new KeyValuePair <int, double>(pp.SID, pp.Delay * 1000); // ms.
                    ListValuesDelay.Add(rowDelay);
                }

                overAll.Add(ListValuesPathEfficiency); // 0;
                overAll.Add(ListValuesDelay);          // 1;
            }

            return(overAll);
        }