Exemple #1
0
        private void Arrival(IInputAirport input)
        {
            SystemTime = ArrivalTime;
            GenerateNewArrivalTime();
            var arrivalAirplane     = GenerateAirplane(input.Airplanes);
            var arrivalAirplaneLoad = GenerateLoads(arrivalAirplane);

            arrivalAirplaneLoad.ArrivalTime = SystemTime;
            Airplanes.Add(arrivalAirplaneLoad);
            if (arrivalAirplaneLoad.IsLoadAirplane())
            {
                CountLoads += arrivalAirplaneLoad.Loadsize;
            }
            else
            {
                QuantityPassengers += arrivalAirplaneLoad.Loadsize;
            }
            var emptyTracks = Tracks.NullTracks();

            if (emptyTracks.Count() > 0)
            {
                int newTrack = aleatory.Next(0, emptyTracks.Count());
                Tracks[newTrack]              = arrivalAirplaneLoad;
                TimeEmptyTrack[newTrack]     += SystemTime - TimeDepartuteTime[newTrack];
                arrivalAirplaneLoad.TrackTime = arrivalAirplaneLoad.ArrivalTime;
                ProcessTime[newTrack]         = SystemTime + GenerateTimeProcess(arrivalAirplaneLoad);
            }
            else
            {
                QueueArrival.Enqueue(arrivalAirplaneLoad);
            }
        }
Exemple #2
0
 protected virtual void InitializeSystem(IInputAirport entrada)
 {
     ProcessTime         = new double[CountTracks];
     TimeDepartuteTime   = new double[CountTracks];
     FixedTime           = new double[CountTracks];
     DepartureTime       = new double[CountTracks];
     TimeEmptyTrack      = new double[CountTracks];
     Airplanes           = new List <IAirplaneLoad>();
     Tracks              = new IAirplaneLoad[CountTracks];
     QueueArrival        = new Queue <IAirplaneLoad>();
     aleatory            = new Random();
     exponentialVariable = new ExponentialVariable();
     poissonVariable     = new PoissonVariable();
     normalVariable      = new NormalVariable();
     SystemTime          = 0;
     InitializeArray(ProcessTime, infinity);
     InitializeArray(FixedTime, infinity);
     InitializeArray(DepartureTime, infinity);
     InitializeArray(TimeEmptyTrack, 0);
     InitializeArray(TimeDepartuteTime, 0);
     StopTime           = entrada.Minutes;
     QuantityPassengers = 0;
     CountLoads         = 0;
     ArrivalTime        = GenerateTime();
 }
Exemple #3
0
 public virtual IOutputAirport Simulate(IInputAirport input)
 {
     InitializeSystem(input);
     while (ArrivalTime < StopTime || Tracks.Any(x => x != null))
     {
         int posProcessTime;
         var minProcessTime = ProcessTime.MinPos(out posProcessTime);
         int posFixed;
         var minFixedTime = FixedTime.MinPos(out posFixed);
         int posDeparture;
         var minDepartureTime = DepartureTime.MinPos(out posDeparture);
         if (ArrivalTime <= minProcessTime && ArrivalTime <= minFixedTime && ArrivalTime <= minDepartureTime && ArrivalTime < StopTime)
         {
             // Caso de una llegada
             Arrival(input);
             continue;
         }
         if ((minProcessTime < ArrivalTime || ArrivalTime >= StopTime) && minProcessTime <= minFixedTime && minProcessTime <= minDepartureTime)
         {
             //Caso de procesar carga
             ProcessLoad(posProcessTime);
             continue;
         }
         if ((minFixedTime < ArrivalTime || ArrivalTime >= StopTime) && minFixedTime < minProcessTime && minFixedTime <= minDepartureTime)
         {
             //Caso de una rotura
             Fixed(posFixed);
             continue;
         }
         if ((minDepartureTime < ArrivalTime || ArrivalTime >= StopTime) && minDepartureTime < minProcessTime && minDepartureTime < minFixedTime)
         {
             //Caso de procesar un despegue
             Departure(posDeparture);
         }
     }
     return(new OutputAirport()
     {
         EmptyTrackTime = TimeEmptyTrack,
         CountPassengers = QuantityPassengers,
         LoadSize = CountLoads,
         Airplanes = Airplanes
     });
 }