本文整理汇总了Python中Units.timeIncrement方法的典型用法代码示例。如果您正苦于以下问题:Python Units.timeIncrement方法的具体用法?Python Units.timeIncrement怎么用?Python Units.timeIncrement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Units
的用法示例。
在下文中一共展示了Units.timeIncrement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simulateFlight
# 需要导入模块: import Units [as 别名]
# 或者: from Units import timeIncrement [as 别名]
def simulateFlight(coreFunctions, simParams, airportEnvironment, airspace, costParameters, weather,
state, flightParams, instructions):
# (coreFunctions:SimulationCoreFunctions) (simParams:SimulationParameters) airportEnvironment airspace
# costParameters (weather:WeatherState) (state:FlightState) (flightParams:FlightParameters) (instructions:Route) =
instructionStatus, remainingSteps, log, endState = Flight.runInstructions(
coreFunctions, simParams, flightParams, weather, airspace, state, instructions)
reachedArrivalPoint = (instructionStatus != 'Failed' and
simParams['LandingMode'] != SimulationParameters.LandingMode.NoLanding \
and Arrival.withinArrivalZone(flightParams, endState))
landed = False
if reachedArrivalPoint:
weight = coreFunctions.WeightModel(flightParams, endState)
time = Units.timeIncrement(flightParams.ActualGateDepartureTime, endState.TimeElapsed)
landingState = coreFunctions.ArrivalModel(flightParams) #airportEnvironment, FuelModel.flightFunctions,
# flightParams, endState.AircraftPosition, weight,
# time)
updatedState = Flight.updateSimulationState(endState, landingState)
# // Check that fuel tank was not exhausted during arrival
if updatedState.FuelConsumed > flightParams.InitialFuel:
airport = flightParams.DestinationAirport
message = Messages.FuelExhausted(flightParams.FlightId, endState.AircraftPosition)
Flight.addMessageToState(updatedState, message)
else:
landed = True
results = updatedState
else:
airport = flightParams.DestinationAirport
# print airport
message = Messages.CannotLand(
flightParams.FlightId, endState.AircraftPosition,
airport.Code)
Flight.addMessageToState(endState, message)
results = endState
fuelConsumed = Units.fuelPoundsToFuelGallons(results.FuelConsumed)
delay = None
if landed:
arrivalTime = Units.timeIncrement(flightParams.ActualGateDepartureTime,
results.TimeElapsed)
delay = Units.timeDifference(arrivalTime, flightParams.ScheduledGateArrivalTime)
costs = CostModel.flightCost(costParameters, instructions, flightParams.Payload,
fuelConsumed, delay, results.TimeElapsedInTurbulence)
# // Add final record to flight log
(east,north,altitude) = results.AircraftPosition
finalLogEntry = FlightTypes.FlightLogEntry(
FlightId = flightParams.FlightId,
Latitude = 0.0, # <Latitude>
Longitude = 0.0, # <Longitude>
Easting = east,
Northing = north,
ElapsedTime = results.TimeElapsed,
AirSpeed = 0.0, # <Knots>
GroundSpeed = 0.0, #<Knots>
Altitude = altitude,
FuelConsumed = results.FuelConsumed,
Weight = coreFunctions.WeightModel(flightParams, results),
InRestrictedZones = False,
InTurbulentZones = False,
Status = 'Landed' if landed else 'Crashed'
)
updatedLog = log.append(finalLogEntry)
return {
'FlightId' : flightParams.FlightId,
'Duration' : results.TimeElapsed,
'FuelBurned' : results.FuelConsumed,
'Messages' : results.Messages,
'Log' : updatedLog,
'ReachedDestination' : landed,
'CostDetail' : costs,
'Cost' : CostModel.accumulateCosts(costs)
}