Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
TASK
Scenario
Passengers get off their flight, walk to the passport checkpoint area and join a single primary queue. When they get near the front of this queue they are organised into several short secondary queues. Each secondary queue leads to a counter staffed by an attendant, who checks the passenger’s passport and clears them to their journey.
Assumptions
- all queues operates in a First in First Out (FIFO) basis
- there are 2 counters open at the start of the simulation
- Times: all times are independent and
- The interarrival time between flights is exponential with an expected value of 45 minutes
- The number of passengers on each flight who will pass through this passport control area is uniformly distributed between 15 and 25 passengers (similar to the number of foreign arrivals on a plane to Qingdao)
- The transit time for a passenger to walk from the plane to the queueing system is uniformly distributed between 5 and 30 minutes
- The service time for passengers once they reach a counter is Pareto distributed with a minimum time of 2 minutes and an expected value of 4 minutes
- Additional feature 1. Extra counters open when the system is busy, and close when it is less busy
- Let ncounters be the number of counters currently open, and N be the total number of passengers in the queuing system (main queue, all secondary queues and in service). An extra counter will open if N > 10 × ncounters. A counter will close if N < 10 × (ncounters − 2).
- There are a minimum of 2 counters and a maximum of 5 counters
- When a counter “closes” this mean that no more passengers are accepted into its secondary queue. Any passengers currently in the secondary queue will be served as usual.
- Additional feature 2. Attendants regularly rotate so they can take breaks
- Some of the counter attendants rotate every 30 minutes, during which time service at the counter is paused for 1 minute. This means that the service time for any passenger at a rotating counter will increase by 1 minute.
- For odd numbered counters, the first rotation is at 30 minutes from the start of the simulation (and then every 60 minutes)
- For even numbered counters, the first rotation is at 60 minutes from the start of the simulation (and then every 60 minutes)
- Additional feature 3. Passengers may be served at a counter not corresponding to their allocated secondary queue in some circumstances.
- A passenger at the front of their secondary queue, who has been in their secondary queue for more than 20 minutes will be served next at any available open counter. In the case of multiple passengers in this situation, priority is given to the passenger who has spent the longest waiting time in their secondary queue.
- If an open counter is available and its secondary queue is empty, they will serve a passenger from another secondary queue. Priority is given to the passenger with the longest secondary queue waiting time.
- The airport is open 24 hours, 7 days a week.
- The behaviour of the system is not influenced by the time of day.
- The airport has specified that they consider a single simulation running for one day of simulated time (1440 minutes) to be sufficient for statistical relevance.
• Part 1: Modelling (Module 2)• Part 2: Programming (Module 3)• Part 3: Verification and testing (Module 4)
Requirements
• Basic functionality: code implements the basic functionality of this queuing system, as per the specification.• Additional feature 1: code implements this feature correctly.• Additional feature 2: code implements this feature correctly.• Additional feature 3: code implements this feature correctly.• Code style: submission meets general style guidelines for good Julia code.
Part 1: Modelling
The system
You will be simulating a passport (immigration) control queuing system at an airport. This is based on the queuing system for foreign travelers arriving at Qingdao airport.
See page 1 (“Scenario”) of this document for a detailed description of the system.
Tasks for Part 1
- Draw a schematic of the system. This can be a rough sketch on a piece of paper - this is a great way to get an initial understanding of the system.
- Describe the state(s) of the system.
- Hint: What state details are needed to answer supermarket owner’s questions?
- Describe the number of entities in the system in relation to the state(s).
- Hint: A simple equation may be helpful in this description.
- Assume there are four events in the simulation: passengers leaves the aircraft after landing (FlightDisembarks), passenger arrives at queue (Arrival), passenger departs queue (Departure) and attendants rotating for a break (for additional feature 2, RotateAttendants). For each event:
- describe how each event changes the state of the system.
- describe the new events that may be created as a result of this event.
- Draw a state diagram, illustrating the possibly states of the system and how the state changes in response to the various events.
- Draw a flow chart illustrating your simulation structure.
Part 2: Programming
Reminder
Tasks for Part 2
The main task here is to write code to implement a discrete-event simulation of the system.
By the end of this part, you should have a working simulation that can output results.
Specification
This is important. You must set up your code in the manner given, paying particular attention to setting up the data types exactly as described below!!
Here are the required specification details:
• AirportOverseasPassports.jl
This should contain all of your data structures and functions. You will be provided with a file to run this code AirportOverseasPassports_run.jl which will include the first file and run the simulation for a set of parameters.
Do not use any packages other than these.
4. The abstract type Event will have the following subtypes:
• FlightDisembarks . . . an aircraft lands and unloads passengers• Arrival . . . a passenger arrives at the queuing system• Departure . . . a passenger finish their passport check and leaves• RotateAttendants . . . the counter attendants take a break
• FlightDisembarks
– id . . . an integer valued event ID number (Int64)– flight_id . . . the ID of the flight (Int64)– no_passengers . . . the number of passengers from the flight that will be processed by the queuing system, or nothing if the flight has not yet unloaded (Union{Nothing,Int64})
• Arrival
– id . . . an integer valued event ID number (Int64)– flight_id . . . the ID of the passenger’s flight– disembark_time . . . the time the passenger’s flight was unloaded (Float64)– passenger_id . . . an integer valued passenger ID number, or nothing if the event does not yet have a customer allocated (Union{Nothing,Int64})
• Departure
– id . . . an integer valued event ID number (Int64)– passenger_id . . . the ID of the departing passenger (Int64)– counter_id . . . the counter that serviced that serviced the passenger, or nothing if they have not yet been served (Union{Nothing,Int64})
• RotateAttendants
– id . . . an integer valued event ID number (Int64)– odd_attendants . . . true if odd numbered counters are rotating, false if even numbered counters are rotating (Bool)
5. The data structure Passenger should contain fields to record important event times in the lifetime of the passenger. These are
• id . . . an integer valued customer ID number (Int64)• flight_id . . . the ID of the passenger’s flight (Int64)• disembark_time . . . the time the passenger’s flight was unloaded (Float64)• enter_primary_time . . . the time the passenger entered the primary queue (Float64)• enter_secondary_time . . . the time the passenger entered the primary queue (Union{Float64, Nothing})• start_service_time . . . the time the passenger starts service (Union{Float64, Nothing})• end_service_time . . . the time the passenger ends service (Union{Float64, Nothing})• secondary_id . . . the ID of the passenger’s allocated secondary queue (Union{Int64, Nothing})• counter_id . . . the ID of the counter the passenger was served by (Union{Int64, Nothing})• attendant_rotated . . . true if the attendant rotated during service, false if not (Bool)
6. The data structure State will contain an event list (priority queue), queues for all resources in the system
• time . . . the current system time (Float64)• event_list . . . the list of scheduled event (PriorityQueue{Event,Float64}, here priority is the time of the event)• primary_queue . . . queue of passengers waiting in the primary queue (Queue{Passenger})• secondary_queues . . . vector of queues of passengers waiting in the secondary queues (Vector{Queue{Passenger}})• in_service . . . vector of passengers currently being served, or nothing if there is no passenger at a given counter (Vector{Union{Passenger,Nothing}})• n_entities . . . a counter of the number of entities in the simulation so far (Int64)• n_events . . . a counter of the number of events in the simulation so far (Int64)• n_flights . . . a counter of the number of flights that have unloaded passengers (Int64)• n_open_counters . . . the number of currently open counter (Int64)
7. Parameters
|
parameter |
type |
description |
|
seed min_counters max_counters secondary_queue_length mean_interflight min_no_passengers max_no_passengers min_passenger_transit_time max_passenger_transit_time min_service_time expected_service_time final_time
attendant_rotation_interval attendant_rotation_time
secondary_rush_time
helpful_attendants |
Int64 Int64 Int64 Float64 Float64 Float64 Float64
Float64
Float64
Float64
Float64 Float64 Float64 Float64 Float64 Bool |
random seed for the simulation minimum number of counters
maximum number of counters length of the secondary queues mean time between planes unloading minimum number of passengers from plane to queue maximum number of passengers from plane to queue minimum time to get from plane to queuing system minimum time to get from plane to queuing system minimum time for passenger to complete service expected time for passenger to complete service the final time for the simulation the time between attendant rotations the time it takes for attendants to rotate waiting time for a passenger to go to the next available counter
counter will serve passenger from outside their secondary queue
|
|
|
|
|
- Additional feature 1: min_counters and max_counters; feature switched off if these are equal.
- Additional feature 2: attendant_rotation_interval and attendant_rotation_time; feature can be switched off if the interval is set to be greater than the total simulation time.
- Additional features 3: secondary_rush_time and helpful_attendants; feature switched off if helpful_attendants is false.
Your code will use three random number generators. Store these as functions in a data structure struct RandomNGs. For convenience, also store here a function that returns the resolution time. The code todefine this data structure is as follows
rng::StableRNGs.LehmerRNGinterflight_time::Functionno_passengers::Functiontransit_times::Functionservice_time::Function
that takes the parameters structure as input and returns the random number generator and the four functions. Initialise the random number generator as follows
The initialisation function should also create a new system state and inject an initial arrival at time 0.0 and initial problem at time 4.0 minutes. The function should return the system state and the random number structure.
10. Update functions (overall)
Your code must have a set of update! functions with signatures:
function update!( S::State, P::Parameters, R::RandomNGs, E::SomeEvent )
Each update! function should modify the state S appropriately, including
- update any state variables
- allocate a passenger to the event (if appropriate)
- add any new events created from this one to the event list
- move entities between the various queues as appropriate (for example, primary to secondary).
Some additional details of the behaviour of these function can be inferred from the provided example output files.
This should be written from the point of view after the event. For instance, you should report the system that an arriving passenger sees immediately after their arrival.
CSV file should have columns titled:
passenger_id,flight_id,disembark_time,enter_primary,enter_secondary,start_service,end_service,secondary_id,counter_id,attendant_rotated
However, your code may result in some differences. Some are important and others less so. You need to be quite analytical to understand which. That is, what differences occur because of a minor change in the order of actions, and what differences are caused by bugs. If there are differences, you should create some of your own tests to understand what is different from the code that produced the above results.