From a0d4a1e0d3e995957cdb90dad5360f2c37ebcc4f Mon Sep 17 00:00:00 2001 From: Sebastian Kramer Date: Thu, 12 Aug 2021 10:21:20 +0200 Subject: [PATCH 1/2] Create initial tcp server --- main.py | 10 ++++++++++ tcp/TCPServer.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 main.py create mode 100644 tcp/TCPServer.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..aef93ef --- /dev/null +++ b/main.py @@ -0,0 +1,10 @@ +from tcp.TCPServer import TCPServer + + +def main(): + server = TCPServer() + server.run() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tcp/TCPServer.py b/tcp/TCPServer.py new file mode 100644 index 0000000..e374f68 --- /dev/null +++ b/tcp/TCPServer.py @@ -0,0 +1,51 @@ +import socket +import _thread + + +class TCPServer(socket.socket): + clients = [] + + def __init__(self): + socket.socket.__init__(self) + self.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + self.bind(('0.0.0.0', 8765)) + self.listen(5) + + def run(self): + print("Starting TCP Server") + try: + self.accept_clients() + except Exception as ex: + print(ex) + finally: + print("Server shutdown") + for client in self.clients: + client.close() + self.close() + + def accept_clients(self): + while True: + (client_socket, address) = self.accept() + self.clients.append(client_socket) + self.on_open(client_socket) + _thread.start_new_thread(self.receive, (client_socket,)) + + def receive(self, client): + while True: + data = client.recv(1024) + if data == '': + break + self.on_message(client, data) + self.clients.remove(client) + self.on_close(client) + client.close() + _thread.exit() + + def on_open(self, client): + pass + + def on_message(self, client, message): + pass + + def on_close(self, client): + pass From c80d23094645edab53bf02915b7ee22d970cd7af Mon Sep 17 00:00:00 2001 From: Sebastian Kramer Date: Fri, 13 Aug 2021 10:41:11 +0200 Subject: [PATCH 2/2] Some general considerations. --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ algorithm/rhcacsass.py | 18 ++++++++++++++++++ icao/recat.py | 22 ++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 algorithm/rhcacsass.py create mode 100644 icao/recat.py diff --git a/README.md b/README.md index 7fb14ec..e67164a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ # aman-sys +Dieses Repository stellt den VATGER AMAN Server bereit, dessen Aufgabe es ist, einen optimalen Arrivalflow für die Flugplätze in der VACC zu errechnen. + + +## RHC-ACS-ASS Algorithm +Step 1: Initialization. Set up parameters for +the RHC, and set the current receding horizon k = 1. + +Step 2: Find out all the M aircraft whose PLTs belong to +the kth receding horizon. + +Step 3: Schedule the M aircraft in the kth receding horizon +by using an ACS. + +Step 4: Assign the aircraft whose ALTs belong to kth scheduled window ω(k) to land on +the runway. + +Step 5: Modify the PLT for those aircraft whose PLT belongs to ω(k) but the ALT does not belong to ω(k). The modification is to set their PLT to kTTI, making them belong to Ω(k + 1), such that they can be scheduled in the next receding horizon. + +Step 6: Termination check. When all the aircraft have been assigned to land at the runway, the algorithm terminates. Otherwise, set k = k + 1 and go to Step 2 for the next receding horizon optimization. + + + +In the preceding steps, Step 3 is the major process of the +algorithm. The flowchart is illustrated on the right side of Fig. 3, +and the details are given below. + +Step 3.1: Schedule the M aircraft by the FCFS approach and +calculate the fitness value through (3). Calculate +the initial pheromone τ0 and set the pheromone for +each aircraft pair as τ0. + +Step 3.2: For each ant, do the following. + + a) Determine the first landing aircraft s and construct the whole landing sequence using the state transition rule as (5) and (6). + + b) Perform the local pheromone updating as (9). + +Step 3.3: Calculate the fitness of each ant and determine +the best solution. Moreover, the current best solution is compared with the historically best solution +to determine the historically best solution. + +Step 3.4: Perform the global pheromone updating as (10). \ No newline at end of file diff --git a/algorithm/rhcacsass.py b/algorithm/rhcacsass.py new file mode 100644 index 0000000..a4a05d3 --- /dev/null +++ b/algorithm/rhcacsass.py @@ -0,0 +1,18 @@ +# RHC-ACS-ASS Algorithm +# This class is written to contain an implementation +# of the Ant Colony System based upon the Receding Horizon +# for Aircraft Arrival Sequencing + +class RhcAcsAss: + k = 1 # Receding horizon counter + N_rhc = 4 # The number of receding horizons + T_ti = 1 # The scheduling window + + def __init__(self, n, t): + self.N_rhc = n + self.T_ti = t + + def find_aircraft_for_horizon(self, ki): + # Omega(k) = [(k-1) * T_ti, (k+N_rhc-1) * T_ti] + pass + \ No newline at end of file diff --git a/icao/recat.py b/icao/recat.py new file mode 100644 index 0000000..d85dd12 --- /dev/null +++ b/icao/recat.py @@ -0,0 +1,22 @@ +# Recat departure separation in seconds +# x = CAT A -> CAT F +# y = CAT A -> CAT F +# https://www.skybrary.aero/index.php/RECAT_-_Wake_Turbulence_Re-categorisation +recatDeparture = [ + [0, 100, 120, 140, 160, 180], + [0, 0, 0, 100, 120, 140], + [0, 0, 0, 80, 100, 120], + [0, 0, 0, 0, 0, 120], + [0, 0, 0, 0, 0, 100], + [0, 0, 0, 0, 0, 80], +] + +#Recat Arrival in NM +recatArrival = [ + [3, 4, 5, 5, 6, 8], + [0, 3, 4, 4, 5, 7], + [0, 0, 3, 3, 4, 6], + [0, 0, 0, 0, 0, 5], + [0, 0, 0, 0, 0, 4], + [0, 0, 0, 0, 0, 3], +] \ No newline at end of file