private void btn_compute_Click(object sender, RoutedEventArgs e)
        {
            PublicParamerters.SinkNode.PacketsList.Clear();
            List <EnergyConsmption2> lis = new List <EnergyConsmption2>();
            int    NOS  = Convert.ToInt16(com_nos.Text);
            int    NOP  = Convert.ToInt16(com_nop.Text);
            double dist = Convert.ToDouble(com_distance.Text);
            DoEnergyConsumptionExpermentRandomWithDistance x = new ExpermentsResults.DoEnergyConsumptionExpermentRandomWithDistance(mianWind.myNetWork);

            lis.Add(x.DoExperment(dist, NOS, NOP));

            UiShowLists win = new UiShowLists();

            win.Title = "Randomly selected " + NOS + " Sources each one sends " + NOP + " Packets";
            ListControl ContlList = new ListControl();

            ContlList.lbl_title.Content   = win.Title;
            ContlList.dg_date.ItemsSource = lis;
            win.stack_items.Children.Add(ContlList);
            win.Show();
        }
Пример #2
0
        private void btn_other_Menu(object sender, RoutedEventArgs e)
        {
            MenuItem item   = sender as MenuItem;
            string   Header = item.Header.ToString();

            switch (Header)
            {
            //
            case "_Show Dead Node":
            {
                if (myNetWork.Count > 0)
                {
                    if (PublicParamerters.DeadNodeList.Count > 0)
                    {
                        UiNetworkLifetimeReport xx = new UiNetworkLifetimeReport();
                        xx.Title = "LORA Lifetime report";
                        xx.dg_grid.ItemsSource = PublicParamerters.DeadNodeList;
                        xx.Show();
                    }
                    else
                    {
                        MessageBox.Show("No Dead node.");
                    }
                }
                else
                {
                    MessageBox.Show("No Network is selected.");
                }
            }
            break;

            case "_Show Resultes":
            {
                if (myNetWork.Count > 0)
                {
                    ExpReport xx = new ExpReport(this);
                    xx.Show();
                }
            }
            break;

            case "_Draw Tree":

                break;

            case "_Print Info":
                UIshowSensorsLocations uIlocations = new UIshowSensorsLocations(myNetWork);
                uIlocations.Show();
                break;

            case "_Entir Network Routing Log":
                UiRoutingDetailsLong routingLogs = new ui.UiRoutingDetailsLong(myNetWork);
                routingLogs.Show();
                break;

            case "_Log For Each Sensor":

                break;

            //_Relatives:
            case "_Node Forwarding Probability Distributions":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Forwarding Probability Distributions For Each Node";
                foreach (Sensor source in myNetWork)
                {
                    if (source.MyForwardersShortedList.Count > 0)
                    {
                        ListControl List = new conts.ListControl();
                        List.lbl_title.Content   = "Node:" + source.ID;
                        List.dg_date.ItemsSource = source.MyForwardersShortedList;
                        windsow.stack_items.Children.Add(List);
                    }
                }
                windsow.Show();
                break;
            }

            //
            case "_Expermental Results":
                UIExpermentResults xxxiu = new UIExpermentResults();
                xxxiu.Show();
                break;

            case "_Probability Matrix":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Matrix";
                AdjecentMatrix   mat    = new AdjecentMatrix();
                List <DataTable> Tables = mat.ConvertToTable(myNetWork);
                foreach (DataTable table in Tables)
                {
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = table.TableName;
                    List.dg_date.ItemsSource = table.DefaultView;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
            }
            break;

            //
            case "_Packets Paths":
                UiRecievedPackertsBySink packsInsinkList = new UiRecievedPackertsBySink();
                packsInsinkList.Show();

                break;

            //
            case "_Random Numbers":

                List <KeyValuePair <int, double> > rands = new List <KeyValuePair <int, double> >();
                int index = 0;
                foreach (Sensor sen in myNetWork)
                {
                    foreach (SensorRoutingLog log in sen.Logs)
                    {
                        if (log.IsSend)
                        {
                            index++;
                            rands.Add(new KeyValuePair <int, double>(index, log.ForwardingRandomNumber));
                        }
                    }
                }

                UiRandomNumberGeneration wndsow = new ui.UiRandomNumberGeneration();
                wndsow.chart_x.DataContext = rands;
                wndsow.Show();

                break;

            case "_Nodes Load":
            {
                SegmaManager  sgManager = new SegmaManager();
                Sensor        sink      = PublicParamerters.SinkNode;
                List <string> Paths     = new List <string>();
                if (sink != null)
                {
                    foreach (Datapacket pck in sink.PacketsList)
                    {
                        Paths.Add(pck.Path);
                    }
                }

                sgManager.Filter(Paths);
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Nodes Load";
                SegmaCollection collectionx = sgManager.GetCollection;
                foreach (SegmaSource source in collectionx.GetSourcesList)
                {
                    source.NumberofPacketsGeneratedByMe = myNetWork[source.SourceID].NumberofPacketsGeneratedByMe;
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = "Source:" + source.SourceID + " Pks:" + source.NumberofPacketsGeneratedByMe + " Relays:" + source.RelaysCount + " Hops:" + source.HopsSum + " Mean:" + source.Mean + " Variance:" + source.Veriance + " E:" + source.PathsSpread;
                    List.dg_date.ItemsSource = source.GetRelayNodes;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
                break;
            }

            //_Distintc Paths
            case "_Distintc Paths":
            {
                UiShowLists windsow = new UiShowLists();
                windsow.Title = "Distinct Paths for each Source";
                DisPathConter dip = new DisPathConter();
                List <ClassfyPathsPerSource> classfy = dip.ClassyfyDistinctPathsPerSources();
                foreach (ClassfyPathsPerSource source in classfy)
                {
                    ListControl List = new conts.ListControl();
                    List.lbl_title.Content   = "Source:" + source.SourceID;
                    List.dg_date.ItemsSource = source.DistinctPathsForThisSource;
                    windsow.stack_items.Children.Add(List);
                }
                windsow.Show();
                break;
            }
            }
        }