[298] | 1 |
|
---|
| 2 | import const
|
---|
| 3 | import checks
|
---|
| 4 | import fs
|
---|
[384] | 5 | from i18n import xstr
|
---|
[298] | 6 | import util
|
---|
| 7 |
|
---|
| 8 | import sys
|
---|
| 9 | import time
|
---|
| 10 | import traceback
|
---|
| 11 |
|
---|
| 12 | from collections import deque
|
---|
| 13 |
|
---|
| 14 | #---------------------------------------------------------------------------------------
|
---|
| 15 |
|
---|
[297] | 16 | ## @package mlx.acft
|
---|
| 17 | #
|
---|
| 18 | # The simulator-independent aircraft classes.
|
---|
| 19 | #
|
---|
| 20 | # This module contains the aircraft classes that contain some general data
|
---|
| 21 | # about each aircraft type in the MAVA Fleet. The base class, \ref Aircraft
|
---|
| 22 | # also implements some parts of the logging and traces some data. The classes
|
---|
| 23 | # are also responsible for creating the \ref mlx.checks "checkers". Most of
|
---|
| 24 | # them are created by the \ref Aircraft class' constructor, but there can be
|
---|
| 25 | # type-specific differences. For example the lights are different for different
|
---|
| 26 | # types, so there is a \ref Aircraft._appendLightsLoggers "function" which can
|
---|
| 27 | # be reimplemented in child classes, if needed. This class maintains also the
|
---|
| 28 | # \ref SmoothedValue "smoothed values" of the IAS and the VS and set these
|
---|
| 29 | # values in the \ref mlx.fs.AircraftState "aircraft state" when it is received
|
---|
| 30 | # from the simulator.
|
---|
[4] | 31 |
|
---|
| 32 | #---------------------------------------------------------------------------------------
|
---|
| 33 |
|
---|
[197] | 34 | class SmoothedValue(object):
|
---|
| 35 | """A smoothed value."""
|
---|
| 36 | def __init__(self):
|
---|
| 37 | """Construct the value."""
|
---|
| 38 | self._deque = deque()
|
---|
| 39 | self._sum = 0
|
---|
| 40 |
|
---|
| 41 | def add(self, length, value):
|
---|
| 42 | """Add the given value and smooth with the given length."""
|
---|
| 43 | dequeLength = len(self._deque)
|
---|
| 44 | while dequeLength>=length:
|
---|
| 45 | self._sum -= self._deque.popleft()
|
---|
| 46 | dequeLength -= 1
|
---|
| 47 |
|
---|
| 48 | self._sum += value
|
---|
| 49 | self._deque.append(value)
|
---|
| 50 |
|
---|
| 51 | def get(self):
|
---|
| 52 | """Get the average."""
|
---|
| 53 | return self._sum / len(self._deque)
|
---|
[331] | 54 |
|
---|
[4] | 55 | #---------------------------------------------------------------------------------------
|
---|
| 56 |
|
---|
| 57 | class Aircraft(object):
|
---|
| 58 | """Base class for aircraft."""
|
---|
[8] | 59 | @staticmethod
|
---|
| 60 | def create(flight):
|
---|
| 61 | """Create an aircraft instance for the type in the given flight."""
|
---|
| 62 | return _classes[flight.aircraftType](flight)
|
---|
| 63 |
|
---|
| 64 | def __init__(self, flight):
|
---|
[4] | 65 | """Construct the aircraft for the given type."""
|
---|
[8] | 66 | self._flight = flight
|
---|
[369] | 67 |
|
---|
| 68 | self._name = None
|
---|
| 69 | self._modelName = None
|
---|
| 70 |
|
---|
[4] | 71 | self._aircraftState = None
|
---|
[331] | 72 |
|
---|
[9] | 73 | self._maxVS = -10000.0
|
---|
| 74 | self._minVS = 10000.0
|
---|
[4] | 75 |
|
---|
[101] | 76 | self._v1r2LineIndex = None
|
---|
[384] | 77 | self._derateLineID = None
|
---|
[96] | 78 | self._vrefLineIndex = None
|
---|
| 79 |
|
---|
[117] | 80 | self.humanWeight = 82.0
|
---|
| 81 |
|
---|
[360] | 82 | self.reverseMinSpeed = 60
|
---|
| 83 |
|
---|
[8] | 84 | self._checkers = []
|
---|
| 85 |
|
---|
[197] | 86 | config = flight.config
|
---|
[11] | 87 | # Loggers
|
---|
| 88 |
|
---|
[8] | 89 | self._checkers.append(checks.StageChecker())
|
---|
[9] | 90 | self._checkers.append(checks.TakeOffLogger())
|
---|
[8] | 91 |
|
---|
| 92 | self._checkers.append(checks.AltimeterLogger())
|
---|
[321] | 93 |
|
---|
[366] | 94 | self._ilsLogger = checks.ILSLogger()
|
---|
| 95 | self._checkers.append(self._ilsLogger)
|
---|
[321] | 96 | self._nav1Logger = checks.NAV1Logger()
|
---|
| 97 | self._checkers.append(self._nav1Logger)
|
---|
| 98 | self._nav2Logger = checks.NAV2Logger()
|
---|
| 99 | self._checkers.append(self._nav2Logger)
|
---|
| 100 |
|
---|
| 101 | self._adf1Logger = checks.ADF1Logger()
|
---|
| 102 | self._checkers.append(self._adf1Logger)
|
---|
| 103 | self._adf2Logger = checks.ADF2Logger()
|
---|
| 104 | self._checkers.append(self._adf2Logger)
|
---|
[331] | 105 |
|
---|
[8] | 106 | self._checkers.append(checks.SquawkLogger())
|
---|
| 107 |
|
---|
[211] | 108 | self._appendLightsLoggers()
|
---|
[8] | 109 |
|
---|
| 110 | self._checkers.append(checks.FlapsLogger())
|
---|
| 111 |
|
---|
| 112 | self._checkers.append(checks.GearsLogger())
|
---|
[9] | 113 | self._checkers.append(checks.CruiseSpeedLogger())
|
---|
[10] | 114 | self._checkers.append(checks.SpoilerLogger())
|
---|
[338] | 115 | self._checkers.append(checks.APLogger())
|
---|
[9] | 116 |
|
---|
[197] | 117 | if config.isMessageTypeFS(const.MESSAGETYPE_VISIBILITY):
|
---|
[134] | 118 | self._checkers.append(checks.VisibilityChecker())
|
---|
| 119 |
|
---|
[139] | 120 | # FIXME: we should have a central data model object, and not collect
|
---|
| 121 | # the data from the GUI. However, some pieces of data (e.g. V-speeds,
|
---|
| 122 | # etc. that is entered into the GUI) *should* be a part of the GUI and
|
---|
| 123 | # queried from it, so the model should have a reference to the GUI as
|
---|
| 124 | # well and access such data via the GUI!
|
---|
[215] | 125 | if config.onlineACARS and flight.loggedIn and not flight.entranceExam:
|
---|
[139] | 126 | self._checkers.append(checks.ACARSSender(flight._gui))
|
---|
| 127 |
|
---|
[11] | 128 | # Fault checkers
|
---|
[211] | 129 |
|
---|
| 130 | self._appendLightsCheckers()
|
---|
[11] | 131 |
|
---|
[335] | 132 | self._checkers.append(checks.TransponderChecker())
|
---|
| 133 |
|
---|
[11] | 134 | self._checkers.append(checks.BankChecker())
|
---|
| 135 |
|
---|
| 136 | self._checkers.append(checks.FlapsRetractChecker())
|
---|
| 137 | self._checkers.append(checks.FlapsSpeedLimitChecker())
|
---|
| 138 |
|
---|
| 139 | self._checkers.append(checks.GearsDownChecker())
|
---|
| 140 | self._checkers.append(checks.GearSpeedLimitChecker())
|
---|
| 141 |
|
---|
| 142 | self._checkers.append(checks.GLoadChecker())
|
---|
| 143 |
|
---|
| 144 | self._checkers.append(checks.MLWChecker())
|
---|
| 145 | self._checkers.append(checks.MTOWChecker())
|
---|
| 146 | self._checkers.append(checks.MZFWChecker())
|
---|
| 147 | self._checkers.append(checks.PayloadChecker())
|
---|
| 148 |
|
---|
[350] | 149 | self._appendSpeedChecker()
|
---|
[11] | 150 | self._checkers.append(checks.VSChecker())
|
---|
[197] | 151 |
|
---|
| 152 | timeout = 5.0 + config.realIASSmoothingLength - 1
|
---|
| 153 | self._checkers.append(checks.OverspeedChecker(timeout = timeout))
|
---|
[331] | 154 |
|
---|
[11] | 155 | self._checkers.append(checks.StallChecker())
|
---|
| 156 |
|
---|
| 157 | self._checkers.append(checks.PitotChecker())
|
---|
[331] | 158 |
|
---|
[11] | 159 | self._checkers.append(checks.ReverserChecker())
|
---|
| 160 |
|
---|
[273] | 161 | if flight.aircraftType is not None and config.enableApproachCallouts:
|
---|
| 162 | approachCallouts = flight.config.getApproachCallouts(flight.aircraftType)
|
---|
| 163 | if approachCallouts:
|
---|
| 164 | self._checkers.append(checks.ApproachCalloutsPlayer(approachCallouts))
|
---|
| 165 |
|
---|
[197] | 166 | self._smoothedIAS = SmoothedValue()
|
---|
| 167 | self._smoothedVS = SmoothedValue()
|
---|
| 168 |
|
---|
[4] | 169 | @property
|
---|
| 170 | def type(self):
|
---|
| 171 | """Get the type of the aircraft."""
|
---|
[8] | 172 | return self._flight.aircraftType
|
---|
| 173 |
|
---|
| 174 | @property
|
---|
| 175 | def flight(self):
|
---|
| 176 | """Get the flight the aircraft belongs to."""
|
---|
| 177 | return self._flight
|
---|
[4] | 178 |
|
---|
[8] | 179 | @property
|
---|
| 180 | def logger(self):
|
---|
| 181 | """Get the logger to use for the aircraft."""
|
---|
| 182 | return self._flight.logger
|
---|
| 183 |
|
---|
[139] | 184 | @property
|
---|
| 185 | def state(self):
|
---|
| 186 | """Get the current aircraft state."""
|
---|
| 187 | return self._aircraftState
|
---|
[241] | 188 |
|
---|
| 189 | @property
|
---|
| 190 | def speedInKnots(self):
|
---|
| 191 | """Indicate if the speed is in knots.
|
---|
| 192 |
|
---|
| 193 | This default implementation returns True."""
|
---|
| 194 | return True
|
---|
[304] | 195 |
|
---|
| 196 | @property
|
---|
| 197 | def timestamp(self):
|
---|
| 198 | """Get the timestamp of the current state."""
|
---|
| 199 | return None if self._aircraftState is None \
|
---|
| 200 | else self._aircraftState.timestamp
|
---|
[331] | 201 |
|
---|
[384] | 202 | @property
|
---|
| 203 | def derateLabels(self):
|
---|
| 204 | """Get the strings related to the derate entry.
|
---|
| 205 |
|
---|
| 206 | It returns a tuple of two items:
|
---|
| 207 | - the label before the entry field,
|
---|
| 208 | - the label after the entry field, which can be None.
|
---|
| 209 |
|
---|
| 210 | If both labels are None, the derate value will not be logged or
|
---|
| 211 | queried. This is the default."""
|
---|
| 212 | return (None, None)
|
---|
| 213 |
|
---|
| 214 | @property
|
---|
| 215 | def derateTemplate(self):
|
---|
| 216 | """Get the template for logging the derate value.
|
---|
| 217 |
|
---|
| 218 | If it returns None (which is the default), no derate value will be
|
---|
| 219 | logged."""
|
---|
| 220 | return None
|
---|
| 221 |
|
---|
[11] | 222 | def getFlapsSpeedLimit(self, flaps):
|
---|
| 223 | """Get the speed limit for the given flaps setting."""
|
---|
| 224 | return self.flapSpeedLimits[flaps] if flaps in self.flapSpeedLimits \
|
---|
| 225 | else None
|
---|
| 226 |
|
---|
[8] | 227 | def modelChanged(self, timestamp, aircraftName, modelName):
|
---|
[4] | 228 | """Called when the simulator's aircraft changes."""
|
---|
[369] | 229 | self._name = aircraftName
|
---|
| 230 | self._modelName = modelName
|
---|
| 231 | if self._flight.stage is not None:
|
---|
| 232 | self._logNameAndModel(timestamp)
|
---|
[4] | 233 |
|
---|
| 234 | def handleState(self, aircraftState):
|
---|
[197] | 235 | """Called when the state of the aircraft changes.
|
---|
| 236 |
|
---|
| 237 | This is the function that the simulator calls directly with the new
|
---|
| 238 | state."""
|
---|
[274] | 239 | try:
|
---|
| 240 | config = self._flight.config
|
---|
[197] | 241 |
|
---|
[274] | 242 | self._smoothedIAS.add(config.realIASSmoothingLength, aircraftState.ias)
|
---|
| 243 | aircraftState.smoothedIAS = self._smoothedIAS.get()
|
---|
| 244 |
|
---|
| 245 | self._smoothedVS.add(config.realVSSmoothingLength, aircraftState.vs)
|
---|
| 246 | aircraftState.smoothedVS = self._smoothedVS.get()
|
---|
[197] | 247 |
|
---|
[274] | 248 | for checker in self._checkers:
|
---|
| 249 | try:
|
---|
| 250 | checker.check(self._flight, self, self._flight.logger,
|
---|
| 251 | self._aircraftState, aircraftState)
|
---|
| 252 | except:
|
---|
| 253 | print >> sys.stderr, "Checker", checker, "failed"
|
---|
| 254 | traceback.print_exc()
|
---|
[7] | 255 |
|
---|
[274] | 256 | self._flight.handleState(self._aircraftState, aircraftState)
|
---|
[89] | 257 |
|
---|
[274] | 258 | self._maxVS = max(self._maxVS, aircraftState.vs)
|
---|
| 259 | self._minVS = min(self._minVS, aircraftState.vs)
|
---|
| 260 | except:
|
---|
| 261 | print >> sys.stderr, "Failed to handle the state"
|
---|
| 262 | traceback.print_exc()
|
---|
| 263 | finally:
|
---|
| 264 | self._aircraftState = aircraftState
|
---|
[331] | 265 |
|
---|
[8] | 266 | def setStage(self, aircraftState, newStage):
|
---|
| 267 | """Set the given stage as the new one and do whatever should be
|
---|
| 268 | done."""
|
---|
[369] | 269 | if newStage==const.STAGE_BOARDING:
|
---|
| 270 | self._logNameAndModel(aircraftState.timestamp)
|
---|
| 271 |
|
---|
[9] | 272 | if self._flight.setStage(aircraftState.timestamp, newStage):
|
---|
| 273 | if newStage==const.STAGE_PUSHANDTAXI:
|
---|
| 274 | self.logger.message(aircraftState.timestamp, "Block time start")
|
---|
[274] | 275 | self._flight.logFuel(aircraftState)
|
---|
[331] | 276 | self.logger.message(aircraftState.timestamp,
|
---|
[313] | 277 | "ZFW: %.2f kg" % (aircraftState.zfw))
|
---|
[134] | 278 | flight = self._flight
|
---|
| 279 | if flight.v1 is None or flight.vr is None or flight.v2 is None:
|
---|
| 280 | fs.sendMessage(const.MESSAGETYPE_HELP,
|
---|
| 281 | "Don't forget to set the takeoff V-speeds!",
|
---|
| 282 | 5)
|
---|
[9] | 283 | elif newStage==const.STAGE_TAKEOFF:
|
---|
[241] | 284 | self.logger.message(aircraftState.timestamp,
|
---|
| 285 | "Flight time start")
|
---|
[331] | 286 | self.logger.message(aircraftState.timestamp,
|
---|
[9] | 287 | "Takeoff weight: %.0f kg, MTOW: %.0f kg" % \
|
---|
| 288 | (aircraftState.grossWeight, self.mtow))
|
---|
| 289 | self.logger.message(aircraftState.timestamp,
|
---|
[333] | 290 | "Wind %03.0f/%.0f" % \
|
---|
[331] | 291 | (aircraftState.windDirection,
|
---|
[9] | 292 | aircraftState.windSpeed))
|
---|
[321] | 293 | self._logRadios(aircraftState)
|
---|
[345] | 294 | self._logV1R2(aircraftState)
|
---|
[384] | 295 | self._logDerate(aircraftState)
|
---|
[321] | 296 | elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING:
|
---|
| 297 | self._logRadios(aircraftState)
|
---|
[9] | 298 | elif newStage==const.STAGE_TAXIAFTERLAND:
|
---|
[184] | 299 | flight = self._flight
|
---|
| 300 | bookedFlight = flight.bookedFlight
|
---|
| 301 | config = flight.config
|
---|
[136] | 302 | if config.onlineGateSystem and \
|
---|
[215] | 303 | flight.loggedIn and \
|
---|
[184] | 304 | not flight.entranceExam and \
|
---|
[136] | 305 | bookedFlight.arrivalICAO=="LHBP" and \
|
---|
| 306 | config.isMessageTypeFS(const.MESSAGETYPE_GATE_SYSTEM):
|
---|
[134] | 307 | self._flight.getFleet(callback = self._fleetRetrieved,
|
---|
| 308 | force = True)
|
---|
[9] | 309 | self.logger.message(aircraftState.timestamp, "Flight time end")
|
---|
[274] | 310 | self._flight.logFuel(aircraftState)
|
---|
[9] | 311 | self.logger.message(aircraftState.timestamp,
|
---|
| 312 | "Landing weight: %.0f kg, MLW: %.0f" % \
|
---|
| 313 | (aircraftState.grossWeight, self.mlw))
|
---|
| 314 | self.logger.message(aircraftState.timestamp,
|
---|
| 315 | "Vertical speed range: %.0f..%.0f feet/min" % \
|
---|
[12] | 316 | (self._minVS, self._maxVS))
|
---|
[359] | 317 | # elif newStage==const.STAGE_PARKING:
|
---|
| 318 | # self.logger.message(aircraftState.timestamp, "Block time end")
|
---|
[89] | 319 | elif newStage==const.STAGE_END:
|
---|
| 320 | flightLength = self._flight.flightTimeEnd - self._flight.flightTimeStart
|
---|
[359] | 321 | self.logger.message(aircraftState.timestamp, "Block time end")
|
---|
[89] | 322 | self.logger.message(aircraftState.timestamp,
|
---|
| 323 | "Flight time: " +
|
---|
| 324 | util.getTimeIntervalString(flightLength))
|
---|
| 325 | self.logger.message(aircraftState.timestamp,
|
---|
| 326 | "Flown distance: %.2f NM" % \
|
---|
[331] | 327 | (self._flight.flownDistance,))
|
---|
[89] | 328 | blockLength = self._flight.blockTimeEnd - self._flight.blockTimeStart
|
---|
| 329 | self.logger.message(aircraftState.timestamp,
|
---|
| 330 | "Block time: " +
|
---|
| 331 | util.getTimeIntervalString(blockLength))
|
---|
[8] | 332 |
|
---|
[9] | 333 | def prepareFlare(self):
|
---|
| 334 | """Called when it is detected that we will soon flare.
|
---|
[8] | 335 |
|
---|
| 336 | On the first call, it should start monitoring some parameters more
|
---|
| 337 | closely to determine flare time."""
|
---|
[9] | 338 | self.flight.simulator.startFlare()
|
---|
| 339 |
|
---|
[331] | 340 | def flareStarted(self, windSpeed, windDirection, visibility,
|
---|
[9] | 341 | flareStart, flareStartFS):
|
---|
| 342 | """Called when the flare has started."""
|
---|
| 343 | self.logger.message(self._aircraftState.timestamp, "The flare has begun")
|
---|
| 344 | self.logger.message(self._aircraftState.timestamp,
|
---|
[333] | 345 | "Wind %03.0f/%.0f" % \
|
---|
[9] | 346 | (windDirection, windSpeed))
|
---|
| 347 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 348 | "Visibility: %.0f metres" % (visibility,))
|
---|
| 349 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 350 | "Altimeter setting: %.0f hPa" % \
|
---|
| 351 | (self._aircraftState.altimeter,))
|
---|
[101] | 352 | self._logVRef()
|
---|
[9] | 353 | self.flight.flareStarted(flareStart, flareStartFS)
|
---|
[134] | 354 | fs.sendMessage(const.MESSAGETYPE_INFORMATION, "Flare-time", 3)
|
---|
[331] | 355 |
|
---|
[9] | 356 | def flareFinished(self, flareEnd, flareEndFS, tdRate, tdRateCalculatedByFS,
|
---|
| 357 | ias, pitch, bank, heading):
|
---|
| 358 | """Called when the flare has finished."""
|
---|
| 359 | (flareTimeFromFS, flareTime) = self.flight.flareFinished(flareEnd,
|
---|
[170] | 360 | flareEndFS,
|
---|
| 361 | tdRate)
|
---|
[9] | 362 | self.logger.message(self._aircraftState.timestamp,
|
---|
[153] | 363 | "Flaretime: %.3f (from %s)" % \
|
---|
[331] | 364 | (flareTime,
|
---|
[9] | 365 | "the simulator" if flareTimeFromFS else "real time",))
|
---|
| 366 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 367 | "Touchdown rate: %.0f feet/min" % (tdRate,))
|
---|
| 368 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 369 | "Touchdown rate was calculated by the %s" % \
|
---|
| 370 | ("simulator" if tdRateCalculatedByFS else "logger",))
|
---|
[241] | 371 | flight = self._flight
|
---|
[9] | 372 | self.logger.message(self._aircraftState.timestamp,
|
---|
[241] | 373 | "Touchdown speed: %.0f %s" % \
|
---|
| 374 | (flight.speedFromKnots(ias),
|
---|
| 375 | flight.getEnglishSpeedUnit()))
|
---|
[9] | 376 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 377 | "Touchdown pitch: %.1f degrees" % (pitch,))
|
---|
| 378 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 379 | "Touchdown bank: %.1f degrees" % (bank,))
|
---|
| 380 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 381 | "Touchdown heading: %03.0f degrees" % (heading,))
|
---|
[331] | 382 | self.logger.message(self._aircraftState.timestamp,
|
---|
[340] | 383 | "CG: %.1f%%" % \
|
---|
[271] | 384 | (self._aircraftState.cog*100.0,))
|
---|
[8] | 385 |
|
---|
| 386 | def cancelFlare(self):
|
---|
| 387 | """Cancel flare, if it has started."""
|
---|
[9] | 388 | self.flight.simulator.cancelFlare()
|
---|
[8] | 389 |
|
---|
| 390 | def checkFlightEnd(self, aircraftState):
|
---|
| 391 | """Check if the end of the flight has arrived.
|
---|
| 392 |
|
---|
| 393 | This default implementation checks the N1 values, but for
|
---|
| 394 | piston-powered aircraft you need to check the RPMs."""
|
---|
| 395 | for n1 in aircraftState.n1:
|
---|
| 396 | if n1>=0.5: return False
|
---|
| 397 | return True
|
---|
| 398 |
|
---|
[101] | 399 | def updateV1R2(self):
|
---|
| 400 | """Update the V1, Vr and V2 values from the flight, if the these values
|
---|
| 401 | have already been logged."""
|
---|
| 402 | if self._v1r2LineIndex is not None:
|
---|
| 403 | self._logV1R2()
|
---|
| 404 |
|
---|
[384] | 405 | def updateDerate(self):
|
---|
| 406 | """Update the derate value from the flight, if the these values
|
---|
| 407 | have already been logged."""
|
---|
| 408 | if self._derateLineID is not None:
|
---|
| 409 | self._logDerate()
|
---|
| 410 |
|
---|
[211] | 411 | def _appendLightsLoggers(self):
|
---|
| 412 | """Append the loggers needed for the lights.
|
---|
| 413 |
|
---|
| 414 | This default implementation adds the loggers for the anti-collision
|
---|
| 415 | lights, the landing lights, the strobe lights and the NAV lights."""
|
---|
| 416 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 417 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 418 | self._checkers.append(checks.StrobeLightsLogger())
|
---|
| 419 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 420 |
|
---|
| 421 | def _appendLightsCheckers(self):
|
---|
| 422 | """Append the checkers needed for the lights.
|
---|
| 423 |
|
---|
| 424 | This default implementation adds the checkers for the anti-collision
|
---|
| 425 | lights, the landing lights, the strobe lights and the NAV lights."""
|
---|
| 426 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
| 427 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 428 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 429 | self._checkers.append(checks.StrobeLightsChecker())
|
---|
| 430 |
|
---|
[350] | 431 | def _appendSpeedChecker(self):
|
---|
| 432 | """Append the speed checker.
|
---|
| 433 |
|
---|
| 434 | This default implementation used the SpeedChecker."""
|
---|
| 435 | self._checkers.append(checks.SpeedChecker())
|
---|
| 436 |
|
---|
[241] | 437 | def _speedToLog(self, speed):
|
---|
| 438 | """Convert the given speed (being either None or expressed in the
|
---|
| 439 | flight's speed unit into a string."""
|
---|
| 440 | if speed is None:
|
---|
| 441 | return "-"
|
---|
| 442 | else:
|
---|
| 443 | return str(speed) + " " + self._flight.getEnglishSpeedUnit()
|
---|
| 444 |
|
---|
[345] | 445 | def _logV1R2(self, state = None):
|
---|
[101] | 446 | """Log the V1, Vr and V2 value either newly, or by updating the
|
---|
| 447 | corresponding line."""
|
---|
| 448 | message = "Speeds calculated by the pilot: V1: %s, VR: %s, V2: %s" % \
|
---|
[241] | 449 | (self._speedToLog(self._flight.v1),
|
---|
| 450 | self._speedToLog(self._flight.vr),
|
---|
| 451 | self._speedToLog(self._flight.v2))
|
---|
[101] | 452 |
|
---|
| 453 | if self._v1r2LineIndex is None:
|
---|
[345] | 454 | if state is None:
|
---|
| 455 | state = self._aircraftState
|
---|
[101] | 456 | self._v1r2LineIndex = \
|
---|
[345] | 457 | self.logger.message(state.timestamp, message)
|
---|
[101] | 458 | else:
|
---|
| 459 | self.logger.updateLine(self._v1r2LineIndex, message)
|
---|
| 460 |
|
---|
[384] | 461 | def _logDerate(self, state = None):
|
---|
| 462 | """Log the derate values either newly or by updating the corresponding
|
---|
| 463 | line."""
|
---|
| 464 | derateTemplate = self.derateTemplate
|
---|
| 465 | if derateTemplate is None:
|
---|
| 466 | return
|
---|
| 467 |
|
---|
| 468 | derate = self._flight.derate
|
---|
| 469 | message = derateTemplate % ("-" if derate is None else derate)
|
---|
| 470 | if self._derateLineID is None:
|
---|
| 471 | if state is None:
|
---|
| 472 | state = self._aircraftState
|
---|
| 473 | self._derateLineID = \
|
---|
| 474 | self.logger.message(state.timestamp, message)
|
---|
| 475 | else:
|
---|
| 476 | self.logger.updateLine(self._derateLineID, message)
|
---|
| 477 |
|
---|
[96] | 478 | def updateVRef(self):
|
---|
| 479 | """Update the Vref value from the flight, if the Vref value has already
|
---|
| 480 | been logged."""
|
---|
| 481 | if self._vrefLineIndex is not None:
|
---|
| 482 | self._logVRef()
|
---|
| 483 |
|
---|
| 484 | def _logVRef(self):
|
---|
| 485 | """Log the Vref value either newly, or by updating the corresponding
|
---|
| 486 | line."""
|
---|
| 487 | message = "VRef speed calculated by the pilot: %s" % \
|
---|
[241] | 488 | (self._speedToLog(self._flight.vref),)
|
---|
[96] | 489 | if self._vrefLineIndex is None:
|
---|
| 490 | self._vrefLineIndex = \
|
---|
| 491 | self.logger.message(self._aircraftState.timestamp, message)
|
---|
| 492 | else:
|
---|
| 493 | self.logger.updateLine(self._vrefLineIndex, message)
|
---|
| 494 |
|
---|
[134] | 495 | def _fleetRetrieved(self, fleet):
|
---|
| 496 | """Callback for the fleet retrieval result."""
|
---|
| 497 | if fleet is not None:
|
---|
| 498 | gateList = ""
|
---|
| 499 | occupiedGateNumbers = fleet.getOccupiedGateNumbers()
|
---|
| 500 | for gateNumber in const.lhbpGateNumbers:
|
---|
| 501 | if gateNumber not in occupiedGateNumbers:
|
---|
| 502 | if gateList: gateList += ", "
|
---|
| 503 | gateList += gateNumber
|
---|
| 504 | fs.sendMessage(const.MESSAGETYPE_GATE_SYSTEM,
|
---|
| 505 | "Free gates: " + gateList, 20)
|
---|
[331] | 506 |
|
---|
[134] | 507 |
|
---|
[321] | 508 | def _logRadios(self, aircraftState):
|
---|
| 509 | """Log the radios from the given aircraft state."""
|
---|
| 510 | flight = self._flight
|
---|
| 511 | logger = flight.logger
|
---|
| 512 |
|
---|
[366] | 513 | self._ilsLogger.forceLog(flight, logger, aircraftState)
|
---|
[321] | 514 | self._nav1Logger.forceLog(flight, logger, aircraftState)
|
---|
| 515 | self._nav2Logger.forceLog(flight, logger, aircraftState)
|
---|
[329] | 516 | self._adf1Logger.forceLog(flight, logger, aircraftState)
|
---|
| 517 | self._adf2Logger.forceLog(flight, logger, aircraftState)
|
---|
[321] | 518 |
|
---|
[369] | 519 | def _logNameAndModel(self, timestamp):
|
---|
| 520 | """Log the aircraft's name and model with taking the timestamp from the
|
---|
| 521 | given state."""
|
---|
| 522 | self._flight.logger.message(timestamp,
|
---|
| 523 | "Aircraft: name='%s', model='%s'" % \
|
---|
| 524 | (self._name, self._modelName))
|
---|
| 525 |
|
---|
[4] | 526 | #---------------------------------------------------------------------------------------
|
---|
[7] | 527 |
|
---|
| 528 | class Boeing737(Aircraft):
|
---|
| 529 | """Base class for the various aircraft in the Boeing 737 family.
|
---|
| 530 |
|
---|
| 531 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 532 | structure:
|
---|
[140] | 533 | - fuel: left, centre, right
|
---|
[7] | 534 | - n1: left, right
|
---|
[331] | 535 | - reverser: left, right"""
|
---|
[9] | 536 | def __init__(self, flight):
|
---|
| 537 | super(Boeing737, self).__init__(flight)
|
---|
[95] | 538 | self._checkers.append(checks.ThrustChecker())
|
---|
| 539 |
|
---|
[9] | 540 | self.gearSpeedLimit = 270
|
---|
| 541 | self.flapSpeedLimits = { 1 : 260,
|
---|
| 542 | 2 : 260,
|
---|
| 543 | 5 : 250,
|
---|
| 544 | 10 : 210,
|
---|
| 545 | 15 : 200,
|
---|
| 546 | 25 : 190,
|
---|
| 547 | 30 : 175,
|
---|
| 548 | 40 : 162 }
|
---|
[7] | 549 |
|
---|
[384] | 550 | @property
|
---|
| 551 | def derateLabels(self):
|
---|
| 552 | """Get the derate strings for this type."""
|
---|
| 553 | return (xstr("takeoff_derate_boeing"), "%")
|
---|
| 554 |
|
---|
| 555 | @property
|
---|
| 556 | def derateTemplate(self):
|
---|
| 557 | """Get the derate template for this aicraft type."""
|
---|
| 558 | return "Derate calculated by the pilot: %s %%"
|
---|
| 559 |
|
---|
[350] | 560 | # def _appendSpeedChecker(self):
|
---|
| 561 | # """Append the NoStrobeSpeedChecker to the checkers.
|
---|
| 562 |
|
---|
| 563 | # FOR TESTING ONLY, THIS FUNCTION SHOULD NORMALLY BE COMMENTED OUT!!!"""
|
---|
| 564 | # self._checkers.append(checks.NoStrobeSpeedChecker())
|
---|
| 565 |
|
---|
[7] | 566 | #---------------------------------------------------------------------------------------
|
---|
| 567 |
|
---|
| 568 | class B736(Boeing737):
|
---|
| 569 | """Boeing 737-600 aircraft."""
|
---|
[8] | 570 | def __init__(self, flight):
|
---|
| 571 | super(B736, self).__init__(flight)
|
---|
[9] | 572 | self.dow = 38307
|
---|
| 573 | self.mtow = 58328
|
---|
| 574 | self.mlw = 54657
|
---|
| 575 | self.mzfw = 51482
|
---|
[7] | 576 |
|
---|
| 577 | #---------------------------------------------------------------------------------------
|
---|
| 578 |
|
---|
| 579 | class B737(Boeing737):
|
---|
| 580 | """Boeing 737-700 aircraft."""
|
---|
[8] | 581 | def __init__(self, flight):
|
---|
| 582 | super(B737, self).__init__(flight)
|
---|
[9] | 583 | self.dow = 39250
|
---|
| 584 | self.mtow = 61410
|
---|
| 585 | self.mlw = 58059
|
---|
| 586 | self.mzfw = 54657
|
---|
[7] | 587 |
|
---|
| 588 | #---------------------------------------------------------------------------------------
|
---|
| 589 |
|
---|
| 590 | class B738(Boeing737):
|
---|
| 591 | """Boeing 737-800 aircraft."""
|
---|
[8] | 592 | def __init__(self, flight):
|
---|
| 593 | super(B738, self).__init__(flight)
|
---|
[9] | 594 | self.dow = 42690
|
---|
| 595 | self.mtow = 71709
|
---|
| 596 | self.mlw = 65317
|
---|
| 597 | self.mzfw = 61688
|
---|
| 598 |
|
---|
| 599 | #---------------------------------------------------------------------------------------
|
---|
| 600 |
|
---|
| 601 | class B738Charter(B738):
|
---|
| 602 | """Boeing 737-800 aircraft used for charters."""
|
---|
| 603 | def __init__(self, flight):
|
---|
| 604 | super(B738Charter, self).__init__(flight)
|
---|
| 605 | self.mtow = 77791
|
---|
[7] | 606 |
|
---|
| 607 | #---------------------------------------------------------------------------------------
|
---|
| 608 |
|
---|
| 609 | class B733(Boeing737):
|
---|
| 610 | """Boeing 737-300 aircraft."""
|
---|
[8] | 611 | def __init__(self, flight):
|
---|
| 612 | super(B733, self).__init__(flight)
|
---|
[9] | 613 | self.dow = 32700
|
---|
| 614 | self.mtow = 62820
|
---|
| 615 | self.mlw = 51700
|
---|
| 616 | self.mzfw = 48410
|
---|
[7] | 617 |
|
---|
| 618 | #---------------------------------------------------------------------------------------
|
---|
| 619 |
|
---|
| 620 | class B734(Boeing737):
|
---|
| 621 | """Boeing 737-400 aircraft."""
|
---|
[8] | 622 | def __init__(self, flight):
|
---|
| 623 | super(B734, self).__init__(flight)
|
---|
[9] | 624 | self.dow = 33200
|
---|
| 625 | self.mtow = 68050
|
---|
| 626 | self.mlw = 56200
|
---|
| 627 | self.mzfw = 53100
|
---|
[7] | 628 |
|
---|
| 629 | #---------------------------------------------------------------------------------------
|
---|
| 630 |
|
---|
| 631 | class B735(Boeing737):
|
---|
| 632 | """Boeing 737-500 aircraft."""
|
---|
[8] | 633 | def __init__(self, flight):
|
---|
| 634 | super(B735, self).__init__(flight)
|
---|
[9] | 635 | self.dow = 31300
|
---|
| 636 | self.mtow = 60550
|
---|
| 637 | self.mlw = 50000
|
---|
| 638 | self.mzfw = 46700
|
---|
[7] | 639 |
|
---|
| 640 | #---------------------------------------------------------------------------------------
|
---|
| 641 |
|
---|
| 642 | class DH8D(Aircraft):
|
---|
| 643 | """Bombardier Dash-8 Q400 aircraft.
|
---|
| 644 |
|
---|
| 645 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 646 | structure:
|
---|
[140] | 647 | - fuel: left, right
|
---|
[7] | 648 | - n1: left, right
|
---|
| 649 | - reverser: left, right."""
|
---|
[140] | 650 |
|
---|
[8] | 651 | def __init__(self, flight):
|
---|
| 652 | super(DH8D, self).__init__(flight)
|
---|
[9] | 653 | self.dow = 17185
|
---|
| 654 | self.mtow = 29257
|
---|
| 655 | self.mlw = 28009
|
---|
| 656 | self.mzfw = 25855
|
---|
| 657 | self.gearSpeedLimit = 215
|
---|
| 658 | self.flapSpeedLimits = { 5 : 200,
|
---|
| 659 | 10 : 181,
|
---|
| 660 | 15 : 172,
|
---|
| 661 | 35 : 158 }
|
---|
| 662 |
|
---|
[7] | 663 | #---------------------------------------------------------------------------------------
|
---|
| 664 |
|
---|
| 665 | class Boeing767(Aircraft):
|
---|
| 666 | """Base class for the various aircraft in the Boeing 767 family.
|
---|
| 667 |
|
---|
| 668 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 669 | structure:
|
---|
[140] | 670 | - fuel: left, centre, right
|
---|
[7] | 671 | - n1: left, right
|
---|
| 672 | - reverser: left, right"""
|
---|
[140] | 673 |
|
---|
[9] | 674 | def __init__(self, flight):
|
---|
| 675 | super(Boeing767, self).__init__(flight)
|
---|
[95] | 676 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 677 | self.gearSpeedLimit = 270
|
---|
| 678 | self.flapSpeedLimits = { 1 : 255,
|
---|
| 679 | 5 : 235,
|
---|
| 680 | 10 : 215,
|
---|
| 681 | 20 : 215,
|
---|
| 682 | 25 : 185,
|
---|
| 683 | 30 : 175 }
|
---|
[7] | 684 |
|
---|
[384] | 685 | @property
|
---|
| 686 | def derateLabels(self):
|
---|
| 687 | """Get the derate strings for this type."""
|
---|
| 688 | return (xstr("takeoff_derate_boeing"), "%")
|
---|
| 689 |
|
---|
| 690 | @property
|
---|
| 691 | def derateTemplate(self):
|
---|
| 692 | """Get the derate template for this aicraft type."""
|
---|
| 693 | return "Derate calculated by the pilot: %s %%"
|
---|
| 694 |
|
---|
[7] | 695 | #---------------------------------------------------------------------------------------
|
---|
| 696 |
|
---|
| 697 | class B762(Boeing767):
|
---|
| 698 | """Boeing 767-200 aircraft."""
|
---|
[8] | 699 | def __init__(self, flight):
|
---|
| 700 | super(B762, self).__init__(flight)
|
---|
[9] | 701 | self.dow = 84507
|
---|
| 702 | self.mtow = 175540
|
---|
| 703 | self.mlw = 126098
|
---|
| 704 | self.mzfw = 114758
|
---|
[7] | 705 |
|
---|
| 706 | #---------------------------------------------------------------------------------------
|
---|
| 707 |
|
---|
| 708 | class B763(Boeing767):
|
---|
| 709 | """Boeing 767-300 aircraft."""
|
---|
[8] | 710 | def __init__(self, flight):
|
---|
[331] | 711 | super(B763, self).__init__(flight)
|
---|
[9] | 712 | self.dow = 91311
|
---|
| 713 | self.mtow = 181436
|
---|
| 714 | self.mlw = 137892
|
---|
| 715 | self.mzfw = 130635
|
---|
[7] | 716 |
|
---|
| 717 | #---------------------------------------------------------------------------------------
|
---|
| 718 |
|
---|
| 719 | class CRJ2(Aircraft):
|
---|
| 720 | """Bombardier CRJ-200 aircraft.
|
---|
| 721 |
|
---|
| 722 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 723 | structure:
|
---|
[140] | 724 | - fuel: left, centre, right
|
---|
[7] | 725 | - n1: left, right
|
---|
| 726 | - reverser: left, right."""
|
---|
[8] | 727 | def __init__(self, flight):
|
---|
| 728 | super(CRJ2, self).__init__(flight)
|
---|
[95] | 729 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 730 | self.dow = 14549
|
---|
| 731 | self.mtow = 22995
|
---|
| 732 | self.mlw = 21319
|
---|
| 733 | self.mzfw = 19958
|
---|
| 734 | self.gearSpeedLimit = 240
|
---|
| 735 | self.flapSpeedLimits = { 8 : 260,
|
---|
| 736 | 20 : 220,
|
---|
| 737 | 30 : 190,
|
---|
| 738 | 45 : 175 }
|
---|
[7] | 739 |
|
---|
| 740 | #---------------------------------------------------------------------------------------
|
---|
| 741 |
|
---|
| 742 | class F70(Aircraft):
|
---|
| 743 | """Fokker 70 aircraft.
|
---|
| 744 |
|
---|
| 745 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 746 | structure:
|
---|
[140] | 747 | - fuel: left, centre, right
|
---|
[7] | 748 | - n1: left, right
|
---|
| 749 | - reverser: left, right."""
|
---|
[8] | 750 | def __init__(self, flight):
|
---|
| 751 | super(F70, self).__init__(flight)
|
---|
[95] | 752 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 753 | self.dow = 24283
|
---|
| 754 | self.mtow = 38100 # FIXME: differentiate by registration number,
|
---|
| 755 | # MTOW of HA-LMF: 41955
|
---|
| 756 | self.mlw = 36740
|
---|
| 757 | self.mzfw = 32655
|
---|
| 758 | self.gearSpeedLimit = 200
|
---|
| 759 | self.flapSpeedLimits = { 8 : 250,
|
---|
| 760 | 15 : 220,
|
---|
| 761 | 25 : 220,
|
---|
| 762 | 42 : 180 }
|
---|
[360] | 763 | self.reverseMinSpeed = 50
|
---|
[7] | 764 |
|
---|
[384] | 765 | @property
|
---|
| 766 | def derateLabels(self):
|
---|
| 767 | """Get the derate strings for this type."""
|
---|
| 768 | return ("EPR", None)
|
---|
| 769 |
|
---|
| 770 | @property
|
---|
| 771 | def derateTemplate(self):
|
---|
| 772 | """Get the derate template for this aicraft type."""
|
---|
| 773 | return "EPR calculated by the pilot: %s"
|
---|
| 774 |
|
---|
[7] | 775 | #---------------------------------------------------------------------------------------
|
---|
| 776 |
|
---|
| 777 | class DC3(Aircraft):
|
---|
| 778 | """Lisunov Li-2 (DC-3) aircraft.
|
---|
| 779 |
|
---|
| 780 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 781 | structure:
|
---|
[140] | 782 | - fuel: left aux, left, right, right aux
|
---|
[7] | 783 | - rpm: left, right
|
---|
| 784 | - reverser: left, right."""
|
---|
[8] | 785 | def __init__(self, flight):
|
---|
| 786 | super(DC3, self).__init__(flight)
|
---|
[9] | 787 | self.dow = 8627
|
---|
| 788 | self.mtow = 11884
|
---|
| 789 | self.mlw = 11793
|
---|
| 790 | self.mzfw = 11780
|
---|
| 791 | self.gearSpeedLimit = 148
|
---|
| 792 | self.flapSpeedLimits = { 15 : 135,
|
---|
| 793 | 30 : 99,
|
---|
| 794 | 45 : 97 }
|
---|
[8] | 795 |
|
---|
| 796 | def _checkFlightEnd(self, aircraftState):
|
---|
| 797 | """Check if the end of the flight has arrived.
|
---|
| 798 |
|
---|
| 799 | This implementation checks the RPM values to be 0."""
|
---|
| 800 | for rpm in aircraftState.rpm:
|
---|
[29] | 801 | if rpm>0: return False
|
---|
| 802 | return True
|
---|
[7] | 803 |
|
---|
| 804 | #---------------------------------------------------------------------------------------
|
---|
| 805 |
|
---|
| 806 | class T134(Aircraft):
|
---|
| 807 | """Tupolev Tu-134 aircraft.
|
---|
| 808 |
|
---|
| 809 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 810 | structure:
|
---|
[140] | 811 | - fuel: left tip, left aux, centre, right aux, right tip, external 1,
|
---|
[7] | 812 | external 2
|
---|
| 813 | - n1: left, right
|
---|
| 814 | - reverser: left, right."""
|
---|
[8] | 815 | def __init__(self, flight):
|
---|
| 816 | super(T134, self).__init__(flight)
|
---|
[95] | 817 | self._checkers.append(checks.ThrustChecker())
|
---|
[210] | 818 | self.dow = 29500
|
---|
| 819 | self.mtow = 49000
|
---|
[9] | 820 | self.mlw = 43000
|
---|
| 821 | self.mzfw = 38500
|
---|
| 822 | self.gearSpeedLimit = 216
|
---|
[210] | 823 | self.flapSpeedLimits = { 10 : 450,
|
---|
| 824 | 20 : 400,
|
---|
| 825 | 30 : 300 }
|
---|
[360] | 826 | self.reverseMinSpeed = 50
|
---|
[7] | 827 |
|
---|
[241] | 828 | @property
|
---|
[384] | 829 | def derateLabels(self):
|
---|
| 830 | """Get the derate strings for this type."""
|
---|
| 831 | return (xstr("takeoff_derate_tupolev"), None)
|
---|
| 832 |
|
---|
| 833 | @property
|
---|
| 834 | def derateTemplate(self):
|
---|
| 835 | """Get the derate template for this aicraft type."""
|
---|
| 836 | return "Nominal/takeoff power calculated by the pilot: %s"
|
---|
| 837 |
|
---|
| 838 | @property
|
---|
[241] | 839 | def speedInKnots(self):
|
---|
| 840 | """Indicate if the speed is in knots."""
|
---|
| 841 | return False
|
---|
[331] | 842 |
|
---|
[211] | 843 | def _appendLightsLoggers(self):
|
---|
| 844 | """Append the loggers needed for the lights."""
|
---|
| 845 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 846 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 847 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 848 |
|
---|
| 849 | def _appendLightsCheckers(self):
|
---|
| 850 | """Append the checkers needed for the lights."""
|
---|
| 851 | self._checkers.append(checks.TupolevAntiCollisionLightsChecker())
|
---|
| 852 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 853 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 854 |
|
---|
[350] | 855 | def _appendSpeedChecker(self):
|
---|
| 856 | """Append the NoStrobeSpeedChecker to the checkers."""
|
---|
| 857 | self._checkers.append(checks.NoStrobeSpeedChecker())
|
---|
| 858 |
|
---|
[7] | 859 | #---------------------------------------------------------------------------------------
|
---|
| 860 |
|
---|
| 861 | class T154(Aircraft):
|
---|
| 862 | """Tupolev Tu-154 aircraft.
|
---|
| 863 |
|
---|
| 864 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 865 | structure:
|
---|
[140] | 866 | - fuel: left aux, left, centre, centre 2, right, right aux
|
---|
[7] | 867 | - n1: left, centre, right
|
---|
| 868 | - reverser: left, right"""
|
---|
[8] | 869 | def __init__(self, flight):
|
---|
| 870 | super(T154, self).__init__(flight)
|
---|
[9] | 871 | self.dow = 53259
|
---|
| 872 | self.mtow = 98000
|
---|
| 873 | self.mlw = 78000
|
---|
| 874 | self.mzfw = 72000
|
---|
| 875 | self.gearSpeedLimit = 216
|
---|
| 876 | self.flapSpeedLimits = { 15 : 227,
|
---|
| 877 | 28 : 194,
|
---|
| 878 | 45 : 162 }
|
---|
[360] | 879 | self.reverseMinSpeed = 50
|
---|
[9] | 880 |
|
---|
[241] | 881 | @property
|
---|
| 882 | def speedInKnots(self):
|
---|
| 883 | """Indicate if the speed is in knots."""
|
---|
| 884 | return False
|
---|
[331] | 885 |
|
---|
[384] | 886 | @property
|
---|
| 887 | def derateLabels(self):
|
---|
| 888 | """Get the derate strings for this type."""
|
---|
| 889 | return (xstr("takeoff_derate_tupolev"), None)
|
---|
| 890 |
|
---|
| 891 | @property
|
---|
| 892 | def derateTemplate(self):
|
---|
| 893 | """Get the derate template for this aicraft type."""
|
---|
| 894 | return "Nominal/takeoff power calculated by the pilot: %s"
|
---|
| 895 |
|
---|
[211] | 896 | def _appendLightsLoggers(self):
|
---|
| 897 | """Append the loggers needed for the lights."""
|
---|
| 898 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 899 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 900 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 901 |
|
---|
| 902 | def _appendLightsCheckers(self):
|
---|
| 903 | """Append the checkers needed for the lights."""
|
---|
[311] | 904 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
[211] | 905 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 906 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 907 |
|
---|
[7] | 908 | #---------------------------------------------------------------------------------------
|
---|
| 909 |
|
---|
| 910 | class YK40(Aircraft):
|
---|
| 911 | """Yakovlev Yak-40 aircraft.
|
---|
| 912 |
|
---|
| 913 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 914 | structure:
|
---|
| 915 | - fuel: left, right
|
---|
| 916 | - n1: left, right
|
---|
| 917 | - reverser: left, right"""
|
---|
[8] | 918 | def __init__(self, flight):
|
---|
| 919 | super(YK40, self).__init__(flight)
|
---|
[95] | 920 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 921 | self.dow = 9400
|
---|
| 922 | self.mtow = 17200
|
---|
| 923 | self.mlw = 16800
|
---|
| 924 | self.mzfw = 12100
|
---|
| 925 | self.gearSpeedLimit = 165
|
---|
| 926 | self.flapSpeedLimits = { 20 : 165,
|
---|
| 927 | 35 : 135 }
|
---|
| 928 |
|
---|
[241] | 929 | @property
|
---|
| 930 | def speedInKnots(self):
|
---|
| 931 | """Indicate if the speed is in knots."""
|
---|
| 932 | return False
|
---|
[331] | 933 |
|
---|
[384] | 934 | @property
|
---|
| 935 | def derateLabels(self):
|
---|
| 936 | """Get the derate strings for this type."""
|
---|
| 937 | return (xstr("takeoff_derate_tupolev"), None)
|
---|
| 938 |
|
---|
| 939 | @property
|
---|
| 940 | def derateTemplate(self):
|
---|
| 941 | """Get the derate template for this aicraft type."""
|
---|
| 942 | return "Nominal/takeoff power calculated by the pilot: %s"
|
---|
| 943 |
|
---|
[211] | 944 | def _appendLightsLoggers(self):
|
---|
| 945 | """Append the loggers needed for the lights."""
|
---|
| 946 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 947 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 948 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 949 |
|
---|
| 950 | def _appendLightsCheckers(self):
|
---|
| 951 | """Append the checkers needed for the lights."""
|
---|
| 952 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
| 953 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 954 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 955 |
|
---|
[7] | 956 | #---------------------------------------------------------------------------------------
|
---|
| 957 |
|
---|
[274] | 958 | mostFuelTanks = [const.FUELTANK_LEFT_TIP, const.FUELTANK_EXTERNAL1,
|
---|
| 959 | const.FUELTANK_LEFT_AUX,
|
---|
| 960 | const.FUELTANK_CENTRE,
|
---|
| 961 | const.FUELTANK_RIGHT_AUX,
|
---|
| 962 | const.FUELTANK_EXTERNAL2, const.FUELTANK_RIGHT_TIP]
|
---|
[141] | 963 |
|
---|
| 964 | #---------------------------------------------------------------------------------------
|
---|
| 965 |
|
---|
[191] | 966 | _classes = { const.AIRCRAFT_B736 : B736,
|
---|
| 967 | const.AIRCRAFT_B737 : B737,
|
---|
| 968 | const.AIRCRAFT_B738 : B738,
|
---|
| 969 | const.AIRCRAFT_B738C : B738Charter,
|
---|
| 970 | const.AIRCRAFT_B733 : B733,
|
---|
| 971 | const.AIRCRAFT_B734 : B734,
|
---|
| 972 | const.AIRCRAFT_B735 : B735,
|
---|
| 973 | const.AIRCRAFT_DH8D : DH8D,
|
---|
| 974 | const.AIRCRAFT_B762 : B762,
|
---|
| 975 | const.AIRCRAFT_B763 : B763,
|
---|
| 976 | const.AIRCRAFT_CRJ2 : CRJ2,
|
---|
| 977 | const.AIRCRAFT_F70 : F70,
|
---|
| 978 | const.AIRCRAFT_DC3 : DC3,
|
---|
| 979 | const.AIRCRAFT_T134 : T134,
|
---|
| 980 | const.AIRCRAFT_T154 : T154,
|
---|
| 981 | const.AIRCRAFT_YK40 : YK40 }
|
---|
[8] | 982 |
|
---|
| 983 | #---------------------------------------------------------------------------------------
|
---|
[197] | 984 |
|
---|
| 985 | if __name__ == "__main__":
|
---|
| 986 | value = SmoothedValue()
|
---|
| 987 |
|
---|
| 988 | print "Adding 1, 12.0"
|
---|
| 989 | value.add(1, 12.0)
|
---|
| 990 | print value.get()
|
---|
| 991 |
|
---|
| 992 | print "Adding 1, 15.0"
|
---|
| 993 | value.add(1, 15.0)
|
---|
| 994 | print value.get()
|
---|
| 995 |
|
---|
| 996 | print "Adding 2, 18.0"
|
---|
| 997 | value.add(2, 18.0)
|
---|
| 998 | print value.get()
|
---|
| 999 |
|
---|
| 1000 | print "Adding 2, 20.0"
|
---|
| 1001 | value.add(2, 20.0)
|
---|
| 1002 | print value.get()
|
---|
| 1003 |
|
---|
| 1004 | print "Adding 5, 22.0"
|
---|
| 1005 | value.add(5, 22.0)
|
---|
| 1006 | print value.get()
|
---|
| 1007 |
|
---|
| 1008 | print "Adding 5, 25.0"
|
---|
| 1009 | value.add(5, 25.0)
|
---|
| 1010 | print value.get()
|
---|
| 1011 |
|
---|
| 1012 | print "Adding 5, 29.0"
|
---|
| 1013 | value.add(5, 29.0)
|
---|
| 1014 | print value.get()
|
---|
| 1015 |
|
---|
| 1016 | print "Adding 5, 21.0"
|
---|
| 1017 | value.add(5, 21.0)
|
---|
| 1018 | print value.get()
|
---|
| 1019 |
|
---|
| 1020 | print "Adding 5, 26.0"
|
---|
| 1021 | value.add(5, 26.0)
|
---|
| 1022 | print value.get()
|
---|
| 1023 |
|
---|
| 1024 | print "Adding 2, 30.0"
|
---|
| 1025 | value.add(2, 30.0)
|
---|
| 1026 | print value.get()
|
---|
| 1027 |
|
---|
| 1028 | print "Adding 2, 55.0"
|
---|
| 1029 | value.add(2, 55.0)
|
---|
| 1030 | print value.get()
|
---|
| 1031 |
|
---|
| 1032 | #---------------------------------------------------------------------------------------
|
---|