예제 #1
0
 public SortingMachine(SimulationTime time, int conveyorBeltLength, CheckinArea checkinArea, TerminalsArea terminalsArea)
 {
     this.time    = time;
     counters     = checkinArea.Counters;
     terminals    = terminalsArea.Terminals;
     ConveyorBelt = new ConveyorBelt <Luggage>(conveyorBeltLength);
 }
 public FlightSchedule(SimulationTime time, int flightScreenLength)
 {
     Time = time;
     FlightScreenLength = flightScreenLength;
     FlightScreen       = new List <Flight>();
     Flights            = new List <Flight>();
 }
        public Simulator(int counterAmount, int terminalAmount, int conveyorBeltLength)
        {
            Time            = new SimulationTime();
            Time.TimeUpdate = OnTimeUpdate;

            CheckinArea    = new CheckinArea(counterAmount);
            TerminalsArea  = new TerminalsArea(terminalAmount);
            SortingMachine = new SortingMachine(Time, conveyorBeltLength, CheckinArea, TerminalsArea);
            FlightSchedule = new FlightSchedule(Time);
        }
예제 #4
0
        /// <summary>
        /// Used to update flight statuses
        /// </summary>
        internal void UpdateFlightStatuses(SimulationTime time)
        {
            // Gets the time until takeoff
            double timeToTakeoff = Departure.Subtract(time.DateTime).TotalMinutes;

            // When reservations count is to small
            // Cancel the flight
            if (Status != FlightStatus.OpenForReservation && Reservations.Count < 20)
            {
                if (ChangeStatusIfNewer(FlightStatus.Canceled))
                {
                    BadFlightInfo?.Invoke($"{Name} got canceled due to reservation amount was < 20");
                }
            }

            // Updates the different flight states
            if (ChangeStatusInsidePeriod(timeToTakeoff, 360, 900, FlightStatus.FarAway))
            {
                FlightInfo?.Invoke($"{Name} is now closed for reservations");
            }
            if (ChangeStatusInsidePeriod(timeToTakeoff, 70, 360, FlightStatus.OnTheWay))
            {
                FlightInfo?.Invoke($"{Name} is 290 min from the airport");
            }
            if (ChangeStatusInsidePeriod(timeToTakeoff, 60, 70, FlightStatus.Landing))
            {
                FlightInfo?.Invoke($"{Name} has just landed");
            }
            if (ChangeStatusInsidePeriod(timeToTakeoff, 30, 60, FlightStatus.Refilling))
            {
                FlightInfo?.Invoke($"{Name} is being filled with luggages");
            }
            if (ChangeStatusInsidePeriod(timeToTakeoff, 5, 30, FlightStatus.Boarding))
            {
                FlightInfo?.Invoke($"{Name} is now boading");
            }
            if (ChangeStatusInsidePeriod(timeToTakeoff, 0, 5, FlightStatus.Takeoff))
            {
                if (GetCheckinAmount() == Reservations.Count)
                {
                    FlightInfo?.Invoke($"{Name} is about to takeoff with all booked passengers");
                }
                else
                {
                    BadFlightInfo?.Invoke($"{Name} is about to takeoff with missing passengers due to bustle");
                }
            }
        }
 public FlightSchedule(SimulationTime time)
 {
     Time          = time;
     ActiveFlights = new List <Flight>();
     Flights       = new List <Flight>();
 }