コード例 #1
0
        public void RandomDeplayment(int sinkIndex)
        {
            PublicParameters.NumberofNodes = myNetWork.Count;
            int rootNodeId = sinkIndex;

            PublicParameters.SinkNode = myNetWork[rootNodeId];
            NeighborsDiscovery overlappingNodesFinder = new NeighborsDiscovery(myNetWork);

            overlappingNodesFinder.GetOverlappingForAllNodes();

            isCoverageSelected       = true;
            PublicParameters.Density = Density.GetDensity(myNetWork);
            DisplaySimulationParameters(rootNodeId, "Random");

            EngageMacAndRadioProcol();

            TopologyConstractor.BuildToplogy(Canvas_SensingFeild, myNetWork);



            double radius;

            radius = (PublicParameters.CommunicationRangeRadius * 1.5);

            double clusterArea = Math.PI * (Math.Pow((radius), 2));


            PublicParameters.cellRadius = radius;

            PublicParameters.myNetwork = myNetWork;

            if (buildMethod == null)
            {
                buildMethod = "center";
            }
            // Tree tree = new Tree();
            //tree.startChanging(Tree_Show);


            CellGroup.getAverageSensors();
            ConvexHullRing.setInitialParameters(radius, 10, Canvas_SensingFeild);
            ConvexHullRing.startRingConstruction(); // RingNodes are all defined
            MobileModel.passField(Canvas_SensingFeild);

            networkInitialized = true;
            SensingFieldArea.GetAreaOfSensingField();
            NetworkConstruction constructor = new NetworkConstruction(Canvas_SensingFeild, "center");

            MyGraph = Graph.ConvertNodeToVertex(myNetWork);
            InitMobileSink();
        }
コード例 #2
0
        public void RandomDeplayment(int sinkIndex)
        {
            PublicParameters.NumberofNodes = myNetWork.Count;
            int rootNodeId = sinkIndex;

            PublicParameters.SinkNode = myNetWork[rootNodeId];
            NeighborsDiscovery overlappingNodesFinder = new NeighborsDiscovery(myNetWork);

            overlappingNodesFinder.GetOverlappingForAllNodes();



            isCoverageSelected       = true;
            PublicParameters.Density = Density.GetDensity(myNetWork);
            DisplaySimulationParameters(rootNodeId, "Random");

            EngageMacAndRadioProcol();

            TopologyConstractor.BuildToplogy(Canvas_SensingFeild, myNetWork);


            double radius;

            //radius = (PublicParameters.Density / 2) * (PublicParameters.CommunicationRangeRadius / 2);
            radius = 100;
            double clusterArea = Math.PI * (Math.Pow((radius), 2));


            PublicParameters.clusterRadius = radius;

            PublicParameters.myNetwork = myNetWork;

            if (buildMethod == null)
            {
                buildMethod = "center";
            }
            Ring.getCenterOfNetwork();
            foreach (Sensor sen in PublicParameters.myNetwork)
            {
                sen.NetworkCenter    = PublicParameters.networkCenter;
                sen.RingNeighborRule = new RingNeighbor(sen);
            }
            Ring.setInitialParameters(radius, 10, Canvas_SensingFeild);
            Ring.startRingConstruction(); // RingNodes are all defined
            // Need to define the neighbors of the ring nodes

            BorderHullRing.setInitialParameters(radius, 10, Canvas_SensingFeild);
            BorderHullRing.startRingConstruction(); // RingNodes are all defined

            // BorderHullRing.setInitialParameters(radius*4, 10, Canvas_SensingFeild);
            //BorderHullRing.startRingConstruction(); // RingNodes are all defined
            MobileModel.passField(Canvas_SensingFeild);
            PublicParameters.InitialRingCount = PublicParameters.RingNodes.Count;
            networkInitialized = true;


            MyGraph = Graph.ConvertNodeToVertex(myNetWork);
            InitMobileSink();

            TrialTimer.Interval = TimeSpan.FromSeconds(20);
            TrialTimer.Tick    += TrialTimer_Tick;
            TrialTimer.Start();
        }