コード例 #1
0
        public void landing()
        {
            //Establishing communication
            Console.WriteLine(credentials + " is Searching for control tower...");
            //ITuple controlTowerTupleInner = new dotSpace.Objects.Space.Tuple("Control Tower Nr.", typeof(int), typeof(ControlTower));
            //ITuple controlTowerTuple = airport.QueryP("Control Towers", controlTowerTupleInner);
            if (controlTowerSpace != null)
            {
                ITuple controlTowerTuple = controlTowerSpace.Query("Control Tower Nr.", typeof(int), typeof(ControlTower));
                //Console.WriteLine(controlTowerTuple);
                if (controlTowerTuple != null)
                {
                    //Getting landing clearance
                    ControlTower controlTower = (ControlTower)controlTowerTuple[2];
                    Console.WriteLine(credentials + " found control tower and getting landing clearance...");
                    ITuple freeRunwayLock = controlTower.getRunwayClearance();
                    if (freeRunwayLock != null)
                    {
                        //runwaySpace.Get(freeRunwayLock);
                        Console.WriteLine(credentials + " got landing clearance with ID " + freeRunwayLock[0] + freeRunwayLock[1]);

                        //Leave airspace, land in airport
                        //Thread.sleep(5000);

                        //Landing & Taxiway step
                        Console.WriteLine(credentials + " is searching for free landing taxiway...");
                        //ITuple freeTaxiWayTuple = taxiwaySpace.Query("Taxiway Nr.", controlTowerTuple[1], typeof(int), true);
                        //ITuple freeTaxiWayTuple = taxiwayLandingSpace.Get("Taxiway L", controlTowerTuple[1], typeof(int), true);
                        ITuple freeTaxiWayTuple = taxiwayLandingSpace.Get("Taxiway L", freeRunwayLock[1], typeof(int), true);
                        int    barrierLimit     = (int)freeTaxiWayTuple[2] - 1;
                        Console.WriteLine(credentials + " found free landing taxiway with barrier value " + (barrierLimit + 1) + " and getting free taxiway tuple...");
                        //taxiwaySpace.Get((string)freeTaxiWayTuple[0], freeTaxiWayTuple[1], barrierLimit);
                        Console.WriteLine(credentials + " is putting runway lock with ID " + freeRunwayLock[0] + freeRunwayLock[1]);
                        //runwaySpace.Put(freeRunwayLock);
                        controlTower.putRunway(freeRunwayLock);
                        Console.WriteLine(credentials + " is putting free landing taxiway back with new barrier " + barrierLimit);
                        taxiwayLandingSpace.Put((string)freeTaxiWayTuple[0], freeTaxiWayTuple[1], barrierLimit, (barrierLimit) > 0);
                        //System.Threading.Thread.Sleep(2500);

                        //Hanger step
                        Console.WriteLine(credentials + " is searching for same landing taxiway, to increase barrier...");
                        //ITuple usedTaxiWay = taxiwayLandingSpace.Get("Taxiway L", controlTowerTuple[1], typeof(int), typeof(bool));
                        ITuple usedTaxiWay = taxiwayLandingSpace.Get("Taxiway L", freeTaxiWayTuple[1], typeof(int), typeof(bool));
                        barrierLimit = (int)usedTaxiWay[2] + 1;
                        Console.WriteLine(credentials + " is increasing landing taxiway " + usedTaxiWay[1] + "'s barrierLimit to " + barrierLimit);
                        taxiwayLandingSpace.Put((string)freeTaxiWayTuple[0], freeTaxiWayTuple[1], barrierLimit, (barrierLimit) > 0);
                        Console.WriteLine(credentials + " has safely arrived in the hangar!");
                        // Thread kill
                        //return;
                    }
                }
            }
        }
コード例 #2
0
        public void realisticTakeoff()
        {
            //Establishing communication
            Console.WriteLine(credentials + " is searching for control tower...");
            //ITuple controlTowerTupleInner = new dotSpace.Objects.Space.Tuple("Control Tower Nr.", typeof(int), typeof(ControlTower));
            //ITuple controlTowerTuple = airport.QueryP("Control Towers", controlTowerTupleInner);
            if (controlTowerSpace != null)
            {
                ITuple controlTowerTuple = controlTowerSpace.Query("Control Tower Nr.", typeof(int), typeof(ControlTower));
                //Console.WriteLine(controlTowerTuple);
                if (controlTowerTuple != null)
                {
                    ControlTower controlTower = (ControlTower)controlTowerTuple[2];
                    switch (windDirection)
                    {
                    case "S":
                        hangarToTaxiway("Charlie");
                        ITuple freeTakeoffRunwayS = runwaySpace.Query("Runway Nr.", 0);
                        taxiwayToRunway("Charlie", freeTakeoffRunwayS, controlTower, "realistic");
                        break;

                    case "N":
                        hangarToTaxiway("Charlie");
                        taxiwayToTaxiway("Charlie", "Delta");
                        taxiwayToTaxiway("Delta", "Epsilon");
                        ITuple freeTakeoffRunwayN = runwaySpace.Query("Runway Nr.", 0);
                        taxiwayToRunway("Epsilon", freeTakeoffRunwayN, controlTower, "realistic");
                        break;

                    case "W":
                        hangarToTaxiway("Charlie");
                        taxiwayToTaxiway("Charlie", "Delta");
                        ITuple freeTakeoffRunwayW = runwaySpace.Query("Runway Nr.", 90);
                        taxiwayToRunway("Delta", freeTakeoffRunwayW, controlTower, "realistic");
                        break;

                    case "E":
                        hangarToTaxiway("Charlie");
                        taxiwayToTaxiway("Charlie", "Delta");
                        taxiwayToTaxiway("Delta", "Epsilon");
                        taxiwayToTaxiway("Epsilon", "Alfa");
                        ITuple freeTakeoffRunwayE = runwaySpace.Query("Runway Nr.", 90);
                        taxiwayToRunway("Alfa", freeTakeoffRunwayE, controlTower, "realistic");
                        break;
                    }
                }
            }
        }
コード例 #3
0
        private void GetIpService()
        {
            while (true)
            {
                var request        = _getConferences.Get(typeof(string), typeof(string), 0, typeof(string));
                var username       = (string)request[0];
                var conferenceName = (string)request[1];
                var pass           = (string)request[3];
                if (!IsAuthorized(username, pass))
                {
                    Console.WriteLine("User was not authorized");
                    _getConferences.Put(username, "", 0);

                    break;
                }

                var result         = _conferences.Query(typeof(string), conferenceName, typeof(string));
                var ipOfConference = (string)result[2];
                _getConferences.Put(username, ipOfConference, 1);
            }
        }
コード例 #4
0
        public void efficientLanding()
        {
            //Establishing communication
            Console.WriteLine(credentials + " is Searching for control tower...");
            ITuple controlTowerTuple = controlTowerSpace.Query("Control Tower Nr.", typeof(int), typeof(ControlTower));

            //Getting landing clearance
            ControlTower controlTower = (ControlTower)controlTowerTuple[2];

            Console.WriteLine(credentials + " found control tower and getting landing clearance...");
            ITuple freeRunwayForLanding = controlTower.getRunwayClearance(credentials);

            switch ((int)freeRunwayForLanding[1])
            {
            case 0:
                //Leave airspace, land in airport
                runwayToTaxiway("Alfa", controlTower, freeRunwayForLanding);

                // Leaving taxiway Afa, entering taxiway Beta
                taxiwayToTaxiway("Alfa", "Beta");

                // Leaving taxiway Beta, entering hangar
                taxiwayToHangar("Beta");
                break;

            case 18:
                //Leave airspace, land in airport
                runwayToTaxiway("Delta", controlTower, freeRunwayForLanding);

                taxiwayToTaxiway("Delta", "Epsilon");

                taxiwayToTaxiway("Epsilon", "Alfa");

                taxiwayToTaxiway("Alfa", "Beta");
                // Leaving taxiway Charlie, entering hangar
                taxiwayToHangar("Beta");
                break;


            case 90:
                //Leave airspace, land in airport
                runwayToTaxiway("Beta", controlTower, freeRunwayForLanding);

                // Leaving taxiway Beta, entering hangar
                taxiwayToHangar("Beta");
                break;

            case 27:
                // Leave airspace, land in aiport
                runwayToTaxiway("Epsilon", controlTower, freeRunwayForLanding);

                // Leaving taxiway epsilon, entering taxiway Alfa
                taxiwayToTaxiway("Epsilon", "Alfa");

                // Leaving taxiway Alfa, entering taxiway Beta
                taxiwayToTaxiway("Alfa", "Beta");

                // Leaving taxiway Beta, entering hangar
                taxiwayToHangar("Beta");
                break;
            }
        }