provide shall-should-may information
This commit is contained in:
		| @@ -76,7 +76,7 @@ class Ant: | ||||
|  | ||||
|     def associateInbound(self, node : Node, earliestArrivalTime : datetime): | ||||
|         # prepare the statistics | ||||
|         rwy, eta, _ = self.RunwayManager.selectArrivalRunway(node, self.Configuration.EarliestArrivalTime) | ||||
|         _, _, rwy, eta, _ = self.RunwayManager.selectArrivalRunway(node, self.Configuration.EarliestArrivalTime) | ||||
|         eta = max(earliestArrivalTime, eta) | ||||
|  | ||||
|         node.Inbound.PlannedRunway = rwy | ||||
|   | ||||
| @@ -18,7 +18,7 @@ from aman.types.Inbound import Inbound | ||||
| # https://sci-hub.mksa.top/10.1109/cec.2019.8790135 | ||||
| class Colony: | ||||
|     def associateInbound(rwyManager : RunwayManager, node : Node, earliestArrivalTime : datetime): | ||||
|         rwy, eta, _ = rwyManager.selectArrivalRunway(node, earliestArrivalTime) | ||||
|         type, expectedRwy, rwy, eta, _ = rwyManager.selectArrivalRunway(node, earliestArrivalTime) | ||||
|         if None == eta: | ||||
|             return False | ||||
|         eta = max(earliestArrivalTime, eta) | ||||
| @@ -29,6 +29,8 @@ class Colony: | ||||
|         node.Inbound.PlannedArrivalTime = eta | ||||
|         node.Inbound.InitialArrivalTime = node.ArrivalCandidates[rwy.Name].InitialArrivalTime | ||||
|         node.Inbound.PlannedTrackmiles = node.ArrivalCandidates[rwy.Name].Trackmiles | ||||
|         node.Inbound.AssignmentMode = type | ||||
|         node.Inbound.ExpectedRunway = expectedRwy | ||||
|         rwyManager.registerNode(node, rwy.Name) | ||||
|  | ||||
|         return True | ||||
|   | ||||
| @@ -68,23 +68,28 @@ class RunwayManager: | ||||
|         shallRunways = [] | ||||
|         shouldRunways = [] | ||||
|         mayRunways = [] | ||||
|         expectedRunway = None | ||||
|  | ||||
|         for runway in self.Configuration.RunwayConstraints.ActiveArrivalRunways: | ||||
|             # test the shall assignments | ||||
|             if RunwayAssignmentType.AircraftType in runway.ShallAssignments: | ||||
|                 if node.Inbound.Report.aircraft.type in runway.ShallAssignments[RunwayAssignmentType.AircraftType]: | ||||
|                     shallRunways.append(runway) | ||||
|                     expectedRunway = runway.Runway.Name | ||||
|             if RunwayAssignmentType.GateAssignment in runway.ShallAssignments: | ||||
|                 if node.Inbound.Report.plannedGate in runway.ShallAssignments[RunwayAssignmentType.GateAssignment]: | ||||
|                     shallRunways.append(runway) | ||||
|                     expectedRunway = runway.Runway.Name | ||||
|  | ||||
|             # test the should assignments | ||||
|             if RunwayAssignmentType.AircraftType in runway.ShouldAssignments: | ||||
|                 if node.Inbound.Report.aircraft.type in runway.ShouldAssignments[RunwayAssignmentType.AircraftType]: | ||||
|                     shouldRunways.append(runway) | ||||
|                     expectedRunway = runway.Runway.Name | ||||
|             if RunwayAssignmentType.GateAssignment in runway.ShouldAssignments: | ||||
|                 if node.Inbound.Report.plannedGate in runway.ShouldAssignments[RunwayAssignmentType.GateAssignment]: | ||||
|                     shouldRunways.append(runway) | ||||
|                     expectedRunway = runway.Runway.Name | ||||
|  | ||||
|             # test the may assignments | ||||
|             if RunwayAssignmentType.AircraftType in runway.MayAssignments: | ||||
| @@ -92,41 +97,46 @@ class RunwayManager: | ||||
|                     eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, earliestArrivalTime) | ||||
|                     if (eta - node.ArrivalCandidates[runway.Runway.Name].InitialArrivalTime) <= self.Configuration.AirportConfiguration.MaxDelayMay: | ||||
|                         mayRunways.append(runway) | ||||
|                         expectedRunway = runway.Runway.Name | ||||
|             if RunwayAssignmentType.GateAssignment in runway.MayAssignments: | ||||
|                 if node.Inbound.Report.plannedGate in runway.MayAssignments[RunwayAssignmentType.GateAssignment]: | ||||
|                     eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, earliestArrivalTime) | ||||
|                     if (eta - node.ArrivalCandidates[runway.Runway.Name].InitialArrivalTime) <= self.Configuration.AirportConfiguration.MaxDelayMay: | ||||
|                         mayRunways.append(runway) | ||||
|                         expectedRunway = runway.Runway.Name | ||||
|  | ||||
|         runway = self.selectShallShouldMayArrivalRunway(node, shallRunways, earliestArrivalTime) | ||||
|         if None != runway: | ||||
|             return [ runway ] | ||||
|             return 'shall', expectedRunway, [ runway ] | ||||
|         runway = self.selectShallShouldMayArrivalRunway(node, shouldRunways, earliestArrivalTime) | ||||
|         if None != runway: | ||||
|             return [ runway ] | ||||
|             return 'should', expectedRunway, [ runway ] | ||||
|         runway = self.selectShallShouldMayArrivalRunway(node, mayRunways, earliestArrivalTime) | ||||
|         if None != runway: | ||||
|             return [ runway ] | ||||
|             return 'may', expectedRunway, [ runway ] | ||||
|  | ||||
|         return self.Configuration.RunwayConstraints.ActiveArrivalRunways | ||||
|         return 'other', None, self.Configuration.RunwayConstraints.ActiveArrivalRunways | ||||
|  | ||||
|     def selectArrivalRunway(self, node : Node, earliestArrivalTime : datetime): | ||||
|         availableRunways = self.Configuration.RunwayConstraints.ActiveArrivalRunways | ||||
|         if 0 == len(availableRunways): | ||||
|             return None, None, None | ||||
|             return None, None, None, None, None | ||||
|  | ||||
|         expectedRunway = None | ||||
|  | ||||
|         if True == self.Configuration.RunwayConstraints.UseShallShouldMay and None == node.Inbound.RequestedRunway: | ||||
|             availableRunways = self.executeShallShouldMayAssignment(node, earliestArrivalTime) | ||||
|             type, expectedRunway, availableRunways = self.executeShallShouldMayAssignment(node, earliestArrivalTime) | ||||
|         elif None != node.Inbound.RequestedRunway: | ||||
|             for runway in availableRunways: | ||||
|                 if node.Inbound.RequestedRunway == runway.Runway.Name: | ||||
|                     availableRunways = [ runway ] | ||||
|                     type = 'other' | ||||
|                     break | ||||
|  | ||||
|         if 0 == len(availableRunways): | ||||
|             runway = self.Configuration.RunwayConstraints.ActiveArrivalRunways[0] | ||||
|             eta, delta = self.calculateEarliestArrivalTime(runway.Runway.Name, node, earliestArrivalTime) | ||||
|             return runway, eta, delta | ||||
|             return 'other', None, runway, eta, delta | ||||
|  | ||||
|         # start with the beginning | ||||
|         selectedRunway = None | ||||
| @@ -176,7 +186,7 @@ class RunwayManager: | ||||
|                             eta = eta + (timeSpacing - currentTimeSpacing) | ||||
|                             lostTime += (timeSpacing - currentTimeSpacing) | ||||
|  | ||||
|         return selectedRunway, eta, lostTime | ||||
|         return type, expectedRunway, selectedRunway, eta, lostTime | ||||
|  | ||||
|     def registerNode(self, node : Node, runway : str): | ||||
|         self.RunwayInbounds[runway] = node | ||||
|   | ||||
| @@ -23,6 +23,8 @@ class Inbound: | ||||
|         self.PlannedArrivalRoute = None | ||||
|         self.PlannedTrackmiles = None | ||||
|         self.FixedSequence = False | ||||
|         self.ExpectedRunway = None | ||||
|         self.AssignmentMode = None | ||||
|         self.WTC = None | ||||
|  | ||||
|         # analyze the WTC | ||||
|   | ||||
		Reference in New Issue
	
	Block a user