define member variables with capital letters

This commit is contained in:
Sven Czarnian
2021-10-13 12:52:29 +02:00
parent 9d69a60396
commit 1e043e2765
15 changed files with 229 additions and 223 deletions

View File

@@ -14,48 +14,46 @@ from aman.types.PerformanceData import PerformanceData
class Worker(Thread):
def __init__(self):
Thread.__init__(self)
self.stopThread = None
self.icao = None
self.configuration = None
self.arrivalRoutes = None
self.performanceData = None
self.updateLock = None
self.reportQueue = {}
self.weatherModel = None
self.StopThread = None
self.Icao = None
self.Configuration = None
self.PerformanceData = None
self.UpdateLock = None
self.ReportQueue = {}
self.WeatherModel = None
self.RecedingHorizonControl = None
def __del__(self):
self.release()
def acquire(self, icao : str, configuration : Airport, weather : Weather, performance : PerformanceData):
self.stopThread = None
self.icao = icao
self.configuration = configuration
self.sequencingConfiguration = self.configuration.DefaultSequencing
self.performanceData = performance
self.arrivalRoutes = configuration.GngData.arrivalRoutes
self.updateLock = Lock()
self.reportQueue = {}
self.weatherModel = WeatherModel(self.configuration.GaforId, weather)
self.RecedingHorizonControl = RecedingHorizonControl(self.configuration.RecedingHorizonControl)
self.StopThread = None
self.Icao = icao
self.Configuration = configuration
self.sequencingConfiguration = configuration.DefaultSequencing
self.PerformanceData = performance
self.UpdateLock = Lock()
self.ReportQueue = {}
self.WeatherModel = WeatherModel(configuration.GaforId, weather)
self.RecedingHorizonControl = RecedingHorizonControl(configuration.RecedingHorizonControl)
self.start()
def acquireLock(self):
if None != self.updateLock:
self.updateLock.acquire()
if None != self.UpdateLock:
self.UpdateLock.acquire()
def release(self):
self.stopThread = True
self.StopThread = True
self.join()
def releaseLock(self):
if None != self.updateLock:
self.updateLock.release()
if None != self.UpdateLock:
self.UpdateLock.release()
def run(self):
counter = 0
while None == self.stopThread:
while None == self.StopThread:
time.sleep(1)
counter += 1
if 0 != (counter % 10):
@@ -67,17 +65,17 @@ class Worker(Thread):
self.RecedingHorizonControl.cleanupWindows()
# update the aircraft information in RHC
for callsign in self.reportQueue:
report = self.reportQueue[callsign]
for callsign in self.ReportQueue:
report = self.ReportQueue[callsign]
if 0 != report.distanceToIAF and '' != report.initialApproachFix:
inbound = Inbound(report, self.sequencingConfiguration, self.configuration.GngData, self.performanceData, self.weatherModel)
inbound = Inbound(report, self.sequencingConfiguration, self.Configuration.GngData, self.PerformanceData, self.WeatherModel)
if None != inbound.PlannedRunway and None != inbound.PlannedStar:
self.RecedingHorizonControl.update(inbound)
else:
print('Unable to find all data of ' + report.aircraft.callsign)
self.reportQueue.clear()
self.ReportQueue.clear()
if 0 != len(self.RecedingHorizonControl.Windows):
print('FCFS run:')
@@ -89,9 +87,9 @@ class Worker(Thread):
# this is required to handle the overlap between windows
preceedingInbounds = {}
for runway in self.sequencingConfiguration.ActiveArrivalRunways:
inbound = self.RecedingHorizonControl.lastFixedInboundOnRunway(runway.Runway.name)
inbound = self.RecedingHorizonControl.lastFixedInboundOnRunway(runway.Runway.Name)
if None != inbound:
preceedingInbounds[runway.Runway.name] = inbound
preceedingInbounds[runway.Runway.Name] = inbound
# search the ACO relevant aircrafts
relevantInbounds = self.RecedingHorizonControl.optimizationRelevantInbounds()
@@ -106,6 +104,6 @@ class Worker(Thread):
# TODO perform the ACO run
# TODO update the RHC stages based on the ACO run result
else:
print('No relevant inbounds found for the optimization in ' + self.icao)
print('No relevant inbounds found for the optimization in ' + self.Icao)
self.releaseLock()