From ec019d500624880e83d8c1e53fea4dcca9b2590d Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 11 Nov 2021 12:57:54 +0100 Subject: [PATCH] add the WebUI to the system --- aman/AMAN.py | 2 +- aman/sys/Worker.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/aman/AMAN.py b/aman/AMAN.py index 3feb05b..962666a 100644 --- a/aman/AMAN.py +++ b/aman/AMAN.py @@ -73,7 +73,7 @@ class AMAN: # initialize the worker thread worker = Worker() - worker.acquire(icao, airportConfig, self.Weather, self.AircraftPerformance) + worker.acquire(icao, airportConfig, self.Weather, self.AircraftPerformance, self.WebUi) self.Workers.append(worker) print('Started worker for ' + icao) diff --git a/aman/sys/Worker.py b/aman/sys/Worker.py index 49dbe5b..fffd95a 100644 --- a/aman/sys/Worker.py +++ b/aman/sys/Worker.py @@ -5,6 +5,7 @@ import sys import time from aman.com import Weather +from aman.com.WebUI import WebUI from aman.config.Airport import Airport from aman.sys.aco.Colony import Colony from aman.sys.aco.Configuration import Configuration @@ -24,11 +25,12 @@ class Worker(Thread): self.ReportQueue = {} self.WeatherModel = None self.RecedingHorizonControl = None + self.WebUi = None def __del__(self): self.release() - def acquire(self, icao : str, configuration : Airport, weather : Weather, performance : PerformanceData): + def acquire(self, icao : str, configuration : Airport, weather : Weather, performance : PerformanceData, webui : WebUI): self.StopThread = None self.Icao = icao self.Configuration = configuration @@ -38,6 +40,7 @@ class Worker(Thread): self.ReportQueue = {} self.WeatherModel = WeatherModel(configuration.GaforId, weather) self.RecedingHorizonControl = RecedingHorizonControl(configuration.RecedingHorizonControl) + self.WebUi = webui # merge the constraint information with the GNG information for runway in self.Configuration.GngData.ArrivalRoutes: @@ -81,7 +84,7 @@ class Worker(Thread): while None == self.StopThread: time.sleep(1) counter += 1 - if 0 != (counter % 60): + if 0 != (counter % 10): continue self.acquireLock() @@ -135,4 +138,9 @@ class Worker(Thread): else: print('No relevant inbounds found for the optimization in ' + self.Icao) + # send the sequence to the GUI + self.WebUi.sendSequence(self.Icao, self.RecedingHorizonControl.sequence()) + + # TODO send the sequence to EuroScope + self.releaseLock()