add the WebUI to the system

This commit is contained in:
Sven Czarnian
2021-11-11 12:57:54 +01:00
parent 7762cbf213
commit ec019d5006
2 changed files with 11 additions and 3 deletions

View File

@@ -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)

View File

@@ -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()