예제 #1
0
        public override void Process(IBaggage baggage)
        {
            var logMessage = $"{Destination} processing - ";

            if (baggage.Flight.FlightState == FlightState.Landed)
            {
                baggage.Destination = typeof(BagCollector).Name;
                if (baggage.Flight.FlightState == FlightState.Departed)
                {
                    double delayInMinutes =
                        (TimerService.GetTimeSinceSimulationStart() - baggage.Flight.TimeToFlightSinceSimulationStart)
                        .TotalMinutes;
                    logMessage += LoggingConstants.BagArrivedLateAtAirportArea + $" with {delayInMinutes:F2} minutes";
                    baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                                        TimerService.ConvertMillisecondsToTimeSpan(1000), logMessage, delayInMinutes);
                }
                else
                {
                    logMessage += LoggingConstants.BagArrivedOnTimeAtAirportArea;
                    baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                                        TimerService.ConvertMillisecondsToTimeSpan(1000), logMessage);
                }
            }
            else
            {
                logMessage += LoggingConstants.BagRedirectedToAnotherFlight;

                baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                                    TimerService.ConvertMillisecondsToTimeSpan(1000), logMessage);
            }
        }
 public override void Process(IBaggage baggage)
 {
     baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                         TimerService.ConvertMillisecondsToTimeSpan(1000),
                         "CheckIn processing");
     baggage.Destination = typeof(Psc).Name;
 }
        public override void Process(IBaggage b)
        {
            System.Diagnostics.Debug.WriteLine("psc" + b.Destination);

            _isFail = _randomGen.Next(0, 101) < _psSettings.PercentageFailedBags;

            b.AddLog(TimerService.GetTimeSinceSimulationStart(), TimerService.ConvertMillisecondsToTimeSpan(_psSettings.ProcessingSpeed),
                     $"Primary security check ID-{NodeId} processing - { (_isFail ? LoggingConstants.PrimarySecurityCheckFailed : LoggingConstants.PrimarySecurityCheckSucceeded)}");
        }
예제 #4
0
        public override void Process(IBaggage baggage)
        {
            var isFail = _randomGen.Next(0, 101) < _ascSettings.AscInvalidationPercentage;

            baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                                TimerService.ConvertMillisecondsToTimeSpan(_ascSettings.ProcessingRateInMilliseconds),
                                $"Advanced security check ID-{NodeId} processing - { (isFail ? LoggingConstants.AscCheckFailed : LoggingConstants.AscCheckSucceeded) }");

            _currentBaggage.Destination = isFail ? typeof(BagCollector).Name : typeof(Mpa).Name;
        }
        public override void PassBaggage(IBaggage b)
        {
            AddBagTransportationLog(b);

            SortBaggageToTransporterNode(b);

            b.AddLog(TimerService.GetTimeSinceSimulationStart(), TimerService.ConvertMillisecondsToTimeSpan(1000), "Mda processing. Sorted to dropoff " + b.Destination);

            _transporterQueues[b.Destination].Enqueue(b);
        }
예제 #6
0
        public override void PassBaggage(IBaggage baggage)
        {
            AddTransportationLog(baggage);

            SortToDestinationDistributor(baggage);

            baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(), TimerService.ConvertMillisecondsToTimeSpan(1000),
                                "MPA processing. Sorted to Gate " + baggage.Destination + ". Enqueuing for distribution.");

            _baggageDistributors[baggage.Destination].Enqueue(baggage);
        }
예제 #7
0
        public void TimerService_ConvertMillisecondsToTimeSpan_ShouldConvertCorrectly()
        {
            var timerService = new TimerService();
            var settingsMock = new Mock <ISimulationSettings>();

            settingsMock.Setup(s => s.IncomingFlights).Returns(new Mock <List <Flight> >().Object);
            settingsMock.Setup(s => s.OutgoingFlights).Returns(new Mock <List <Flight> >().Object);
            settingsMock.Setup(s => s.Multiplier).Returns(1);

            timerService.SetSettings(settingsMock.Object);

            timerService.ConvertMillisecondsToTimeSpan(1000).TotalSeconds.ShouldBe(1);
        }
예제 #8
0
        public void TimerService_CheckForFlightPreparations_GetsTriggered()
        {
            var timerService = new TimerService();
            var settingsMock = new Mock <ISimulationSettings>();

            settingsMock.Setup(s => s.OutgoingFlights).Returns(new List <Flight>()
            {
                new Flight()
                {
                    TimeToFlightSinceSimulationStart            = timerService.ConvertMillisecondsToTimeSpan(4000),
                    TimeToFlightPreparationSinceSimulationStart = timerService.ConvertMillisecondsToTimeSpan(1000),
                    FlightState = FlightState.WaitingForPreparation,
                }
            });
            settingsMock.Setup(s => s.IncomingFlights).Returns(new List <Flight>());
            settingsMock.Setup(s => s.Multiplier).Returns(1);

            timerService.SetSettings(settingsMock.Object);

            timerService.Start();
            Thread.Sleep(2000);

            settingsMock.Object.OutgoingFlights.First().FlightState.ShouldBe(FlightState.InPreparation);
        }
예제 #9
0
        public override void Process(IBaggage b)
        {
            System.Diagnostics.Debug.WriteLine("psc" + b.Destination);

            var isFail = _rand.Next(0, 101) < _psSettings.PercentageFailedBags;

            b.AddLog(TimerService.GetTimeSinceSimulationStart(), TimerService.ConvertMillisecondsToTimeSpan(_psSettings.ProcessingSpeed),
                     $"Final security check ID-{NodeId} processing - { (isFail ? LoggingConstants.FinalSecurityCheckFailed: LoggingConstants.FinalSecurityCheckSucceeded)}");
            if (!isFail)
            {
                b.Destination = typeof(Mda).Name;
                return;
            }

            bagsTaken.Enqueue(b);
            currentBag = null;
            this._dangerousBaggage.Add(b);
        }
예제 #10
0
 public override void Process(IBaggage baggage)
 {
     baggage.AddEventLog(TimerService.GetTimeSinceSimulationStart(),
                         TimerService.ConvertMillisecondsToTimeSpan(1000),
                         string.Format(LoggingConstants.ReceivedInRobotSendingTo, (baggage.Destination == typeof(Mpa).Name ? baggage.Destination : $"{typeof(BaggageBucket).Name} #" + baggage.Destination)));
 }
 public override void PassBaggage(IBaggage b)
 {
     b.Destination = Destination;
     _pickedUpBags.Add(b);
     b.AddLog(TimerService.GetTimeSinceSimulationStart() + new TimeSpan(ProcessingSpeed), TimerService.ConvertMillisecondsToTimeSpan(ProcessingSpeed), "drop off processing");
 }
 public override void Process(IBaggage b)
 {
     System.Diagnostics.Debug.WriteLine("checkin" + b.Destination);
     b.AddLog(TimerService.GetTimeSinceSimulationStart(), TimerService.ConvertMillisecondsToTimeSpan(1000), $"Checkin processing");
     b.Destination = typeof(PrimarySecurity).Name;
 }