[4] | 1 | # Module for the simulator-independent aircraft classes
|
---|
| 2 |
|
---|
| 3 | #---------------------------------------------------------------------------------------
|
---|
| 4 |
|
---|
[8] | 5 | import const
|
---|
| 6 | import checks
|
---|
[89] | 7 | import util
|
---|
[4] | 8 |
|
---|
[8] | 9 | import time
|
---|
[7] | 10 |
|
---|
[4] | 11 | #---------------------------------------------------------------------------------------
|
---|
| 12 |
|
---|
| 13 | class Aircraft(object):
|
---|
| 14 | """Base class for aircraft."""
|
---|
[8] | 15 | @staticmethod
|
---|
| 16 | def create(flight):
|
---|
| 17 | """Create an aircraft instance for the type in the given flight."""
|
---|
| 18 | return _classes[flight.aircraftType](flight)
|
---|
| 19 |
|
---|
| 20 | def __init__(self, flight):
|
---|
[4] | 21 | """Construct the aircraft for the given type."""
|
---|
[8] | 22 | self._flight = flight
|
---|
[4] | 23 | self._aircraftState = None
|
---|
[9] | 24 |
|
---|
| 25 | self._maxVS = -10000.0
|
---|
| 26 | self._minVS = 10000.0
|
---|
[4] | 27 |
|
---|
[101] | 28 | self._v1r2LineIndex = None
|
---|
[96] | 29 | self._vrefLineIndex = None
|
---|
| 30 |
|
---|
[8] | 31 | self._checkers = []
|
---|
| 32 |
|
---|
[11] | 33 | # Loggers
|
---|
| 34 |
|
---|
[8] | 35 | self._checkers.append(checks.StageChecker())
|
---|
[9] | 36 | self._checkers.append(checks.TakeOffLogger())
|
---|
[8] | 37 |
|
---|
| 38 | self._checkers.append(checks.AltimeterLogger())
|
---|
| 39 |
|
---|
| 40 | self._checkers.append(checks.NAV1Logger())
|
---|
| 41 | self._checkers.append(checks.NAV2Logger())
|
---|
| 42 | self._checkers.append(checks.SquawkLogger())
|
---|
| 43 |
|
---|
| 44 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 45 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 46 | self._checkers.append(checks.StrobeLightsLogger())
|
---|
| 47 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 48 |
|
---|
| 49 | self._checkers.append(checks.FlapsLogger())
|
---|
| 50 |
|
---|
| 51 | self._checkers.append(checks.GearsLogger())
|
---|
[9] | 52 | self._checkers.append(checks.CruiseSpeedLogger())
|
---|
[10] | 53 | self._checkers.append(checks.SpoilerLogger())
|
---|
[9] | 54 |
|
---|
[11] | 55 | # Fault checkers
|
---|
| 56 |
|
---|
| 57 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
| 58 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 59 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 60 | self._checkers.append(checks.StrobeLightsChecker())
|
---|
| 61 |
|
---|
| 62 | self._checkers.append(checks.BankChecker())
|
---|
| 63 |
|
---|
| 64 | self._checkers.append(checks.FlapsRetractChecker())
|
---|
| 65 | self._checkers.append(checks.FlapsSpeedLimitChecker())
|
---|
| 66 |
|
---|
| 67 | self._checkers.append(checks.GearsDownChecker())
|
---|
| 68 | self._checkers.append(checks.GearSpeedLimitChecker())
|
---|
| 69 |
|
---|
| 70 | self._checkers.append(checks.GLoadChecker())
|
---|
| 71 |
|
---|
| 72 | self._checkers.append(checks.MLWChecker())
|
---|
| 73 | self._checkers.append(checks.MTOWChecker())
|
---|
| 74 | self._checkers.append(checks.MZFWChecker())
|
---|
| 75 | self._checkers.append(checks.PayloadChecker())
|
---|
| 76 |
|
---|
| 77 | self._checkers.append(checks.SpeedChecker())
|
---|
| 78 | self._checkers.append(checks.VSChecker())
|
---|
| 79 | self._checkers.append(checks.OverspeedChecker())
|
---|
| 80 | self._checkers.append(checks.StallChecker())
|
---|
| 81 |
|
---|
| 82 | self._checkers.append(checks.PitotChecker())
|
---|
| 83 |
|
---|
| 84 | self._checkers.append(checks.ReverserChecker())
|
---|
| 85 |
|
---|
[4] | 86 | @property
|
---|
| 87 | def type(self):
|
---|
| 88 | """Get the type of the aircraft."""
|
---|
[8] | 89 | return self._flight.aircraftType
|
---|
| 90 |
|
---|
| 91 | @property
|
---|
| 92 | def flight(self):
|
---|
| 93 | """Get the flight the aircraft belongs to."""
|
---|
| 94 | return self._flight
|
---|
[4] | 95 |
|
---|
[8] | 96 | @property
|
---|
| 97 | def logger(self):
|
---|
| 98 | """Get the logger to use for the aircraft."""
|
---|
| 99 | return self._flight.logger
|
---|
| 100 |
|
---|
[11] | 101 | def getFlapsSpeedLimit(self, flaps):
|
---|
| 102 | """Get the speed limit for the given flaps setting."""
|
---|
| 103 | return self.flapSpeedLimits[flaps] if flaps in self.flapSpeedLimits \
|
---|
| 104 | else None
|
---|
| 105 |
|
---|
[8] | 106 | def modelChanged(self, timestamp, aircraftName, modelName):
|
---|
[4] | 107 | """Called when the simulator's aircraft changes."""
|
---|
[8] | 108 | self._flight.logger.message(timestamp,
|
---|
| 109 | "Aircraft: name='%s', model='%s'" % \
|
---|
| 110 | (aircraftName, modelName))
|
---|
[4] | 111 |
|
---|
| 112 | def handleState(self, aircraftState):
|
---|
| 113 | """Called when the state of the aircraft changes."""
|
---|
[8] | 114 | for checker in self._checkers:
|
---|
| 115 | checker.check(self._flight, self, self._flight.logger,
|
---|
| 116 | self._aircraftState, aircraftState)
|
---|
[7] | 117 |
|
---|
[89] | 118 | self._flight.handleState(self._aircraftState, aircraftState)
|
---|
| 119 |
|
---|
[9] | 120 | self._maxVS = max(self._maxVS, aircraftState.vs)
|
---|
| 121 | self._minVS = min(self._minVS, aircraftState.vs)
|
---|
| 122 |
|
---|
[4] | 123 | self._aircraftState = aircraftState
|
---|
[8] | 124 |
|
---|
| 125 | def setStage(self, aircraftState, newStage):
|
---|
| 126 | """Set the given stage as the new one and do whatever should be
|
---|
| 127 | done."""
|
---|
[9] | 128 | if self._flight.setStage(aircraftState.timestamp, newStage):
|
---|
| 129 | if newStage==const.STAGE_PUSHANDTAXI:
|
---|
| 130 | self.logger.message(aircraftState.timestamp, "Block time start")
|
---|
| 131 | self.logFuel(aircraftState)
|
---|
| 132 | self.logger.message(aircraftState.timestamp,
|
---|
| 133 | "Zero-fuel weight: %.0f kg" % (aircraftState.zfw))
|
---|
| 134 | elif newStage==const.STAGE_TAKEOFF:
|
---|
| 135 | self.logger.message(aircraftState.timestamp, "Flight time start")
|
---|
| 136 | self.logger.message(aircraftState.timestamp,
|
---|
| 137 | "Takeoff weight: %.0f kg, MTOW: %.0f kg" % \
|
---|
| 138 | (aircraftState.grossWeight, self.mtow))
|
---|
| 139 | self.logger.message(aircraftState.timestamp,
|
---|
| 140 | "Wind %03.0f degrees at %.0f knots" % \
|
---|
| 141 | (aircraftState.windDirection,
|
---|
| 142 | aircraftState.windSpeed))
|
---|
[101] | 143 | self._logV1R2()
|
---|
[9] | 144 | elif newStage==const.STAGE_TAXIAFTERLAND:
|
---|
| 145 | self.logger.message(aircraftState.timestamp, "Flight time end")
|
---|
| 146 | self.logFuel(aircraftState)
|
---|
| 147 | self.logger.message(aircraftState.timestamp,
|
---|
| 148 | "Landing weight: %.0f kg, MLW: %.0f" % \
|
---|
| 149 | (aircraftState.grossWeight, self.mlw))
|
---|
| 150 | self.logger.message(aircraftState.timestamp,
|
---|
| 151 | "Vertical speed range: %.0f..%.0f feet/min" % \
|
---|
[12] | 152 | (self._minVS, self._maxVS))
|
---|
[9] | 153 | elif newStage==const.STAGE_PARKING:
|
---|
| 154 | self.logger.message(aircraftState.timestamp, "Block time end")
|
---|
[89] | 155 | elif newStage==const.STAGE_END:
|
---|
| 156 | flightLength = self._flight.flightTimeEnd - self._flight.flightTimeStart
|
---|
| 157 | self.logger.message(aircraftState.timestamp,
|
---|
| 158 | "Flight time: " +
|
---|
| 159 | util.getTimeIntervalString(flightLength))
|
---|
| 160 | self.logger.message(aircraftState.timestamp,
|
---|
| 161 | "Flown distance: %.2f NM" % \
|
---|
| 162 | (self._flight.flownDistance,))
|
---|
| 163 | blockLength = self._flight.blockTimeEnd - self._flight.blockTimeStart
|
---|
| 164 | self.logger.message(aircraftState.timestamp,
|
---|
| 165 | "Block time: " +
|
---|
| 166 | util.getTimeIntervalString(blockLength))
|
---|
[8] | 167 |
|
---|
[9] | 168 | def prepareFlare(self):
|
---|
| 169 | """Called when it is detected that we will soon flare.
|
---|
[8] | 170 |
|
---|
| 171 | On the first call, it should start monitoring some parameters more
|
---|
| 172 | closely to determine flare time."""
|
---|
[9] | 173 | self.flight.simulator.startFlare()
|
---|
| 174 |
|
---|
| 175 | def flareStarted(self, windSpeed, windDirection, visibility,
|
---|
| 176 | flareStart, flareStartFS):
|
---|
| 177 | """Called when the flare has started."""
|
---|
| 178 | self.logger.message(self._aircraftState.timestamp, "The flare has begun")
|
---|
| 179 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 180 | "Wind %03.0f degrees at %.0f knots" % \
|
---|
| 181 | (windDirection, windSpeed))
|
---|
| 182 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 183 | "Visibility: %.0f metres" % (visibility,))
|
---|
| 184 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 185 | "Altimeter setting: %.0f hPa" % \
|
---|
| 186 | (self._aircraftState.altimeter,))
|
---|
[101] | 187 | self._logVRef()
|
---|
[9] | 188 | self.flight.flareStarted(flareStart, flareStartFS)
|
---|
| 189 |
|
---|
| 190 | def flareFinished(self, flareEnd, flareEndFS, tdRate, tdRateCalculatedByFS,
|
---|
| 191 | ias, pitch, bank, heading):
|
---|
| 192 | """Called when the flare has finished."""
|
---|
| 193 | (flareTimeFromFS, flareTime) = self.flight.flareFinished(flareEnd,
|
---|
| 194 | flareEndFS)
|
---|
| 195 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 196 | "Flare time: %.1f s (from %s)" % \
|
---|
| 197 | (flareTime,
|
---|
| 198 | "the simulator" if flareTimeFromFS else "real time",))
|
---|
| 199 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 200 | "Touchdown rate: %.0f feet/min" % (tdRate,))
|
---|
| 201 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 202 | "Touchdown rate was calculated by the %s" % \
|
---|
| 203 | ("simulator" if tdRateCalculatedByFS else "logger",))
|
---|
| 204 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 205 | "Touchdown speed: %.0f knots" % (ias,))
|
---|
| 206 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 207 | "Touchdown pitch: %.1f degrees" % (pitch,))
|
---|
| 208 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 209 | "Touchdown bank: %.1f degrees" % (bank,))
|
---|
| 210 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 211 | "Touchdown heading: %03.0f degrees" % (heading,))
|
---|
[8] | 212 |
|
---|
| 213 | def cancelFlare(self):
|
---|
| 214 | """Cancel flare, if it has started."""
|
---|
[9] | 215 | self.flight.simulator.cancelFlare()
|
---|
[8] | 216 |
|
---|
| 217 | def checkFlightEnd(self, aircraftState):
|
---|
| 218 | """Check if the end of the flight has arrived.
|
---|
| 219 |
|
---|
| 220 | This default implementation checks the N1 values, but for
|
---|
| 221 | piston-powered aircraft you need to check the RPMs."""
|
---|
| 222 | for n1 in aircraftState.n1:
|
---|
| 223 | if n1>=0.5: return False
|
---|
| 224 | return True
|
---|
| 225 |
|
---|
[101] | 226 | def updateV1R2(self):
|
---|
| 227 | """Update the V1, Vr and V2 values from the flight, if the these values
|
---|
| 228 | have already been logged."""
|
---|
| 229 | if self._v1r2LineIndex is not None:
|
---|
| 230 | self._logV1R2()
|
---|
| 231 |
|
---|
| 232 | def _logV1R2(self):
|
---|
| 233 | """Log the V1, Vr and V2 value either newly, or by updating the
|
---|
| 234 | corresponding line."""
|
---|
| 235 | message = "Speeds calculated by the pilot: V1: %s, VR: %s, V2: %s" % \
|
---|
| 236 | ("-" if self._flight.v1 is None
|
---|
| 237 | else str(self._flight.v1),
|
---|
| 238 | "-" if self._flight.vr is None
|
---|
| 239 | else str(self._flight.vr),
|
---|
| 240 | "-" if self._flight.v2 is None
|
---|
| 241 | else str(self._flight.v2))
|
---|
| 242 |
|
---|
| 243 | if self._v1r2LineIndex is None:
|
---|
| 244 | self._v1r2LineIndex = \
|
---|
| 245 | self.logger.message(self._aircraftState.timestamp, message)
|
---|
| 246 | else:
|
---|
| 247 | self.logger.updateLine(self._v1r2LineIndex, message)
|
---|
| 248 |
|
---|
[96] | 249 | def updateVRef(self):
|
---|
| 250 | """Update the Vref value from the flight, if the Vref value has already
|
---|
| 251 | been logged."""
|
---|
| 252 | if self._vrefLineIndex is not None:
|
---|
| 253 | self._logVRef()
|
---|
| 254 |
|
---|
| 255 | def _logVRef(self):
|
---|
| 256 | """Log the Vref value either newly, or by updating the corresponding
|
---|
| 257 | line."""
|
---|
| 258 | message = "VRef speed calculated by the pilot: %s" % \
|
---|
| 259 | ("-" if self._flight.vref is None else str(self._flight.vref))
|
---|
| 260 | if self._vrefLineIndex is None:
|
---|
| 261 | self._vrefLineIndex = \
|
---|
| 262 | self.logger.message(self._aircraftState.timestamp, message)
|
---|
| 263 | else:
|
---|
| 264 | self.logger.updateLine(self._vrefLineIndex, message)
|
---|
| 265 |
|
---|
[4] | 266 | #---------------------------------------------------------------------------------------
|
---|
[7] | 267 |
|
---|
| 268 | class Boeing737(Aircraft):
|
---|
| 269 | """Base class for the various aircraft in the Boeing 737 family.
|
---|
| 270 |
|
---|
| 271 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 272 | structure:
|
---|
| 273 | - fuel: centre, left, right
|
---|
| 274 | - n1: left, right
|
---|
| 275 | - reverser: left, right"""
|
---|
[9] | 276 | def __init__(self, flight):
|
---|
| 277 | super(Boeing737, self).__init__(flight)
|
---|
[95] | 278 | self._checkers.append(checks.ThrustChecker())
|
---|
| 279 |
|
---|
[9] | 280 | self.gearSpeedLimit = 270
|
---|
| 281 | self.flapSpeedLimits = { 1 : 260,
|
---|
| 282 | 2 : 260,
|
---|
| 283 | 5 : 250,
|
---|
| 284 | 10 : 210,
|
---|
| 285 | 15 : 200,
|
---|
| 286 | 25 : 190,
|
---|
| 287 | 30 : 175,
|
---|
| 288 | 40 : 162 }
|
---|
[7] | 289 |
|
---|
[9] | 290 | def logFuel(self, aircraftState):
|
---|
| 291 | """Log the amount of fuel"""
|
---|
| 292 | self.logger.message(aircraftState.timestamp,
|
---|
| 293 | "Fuel: left=%.0f kg - centre=%.0f kg - right=%.0f kg" % \
|
---|
| 294 | (aircraftState.fuel[1], aircraftState.fuel[0],
|
---|
| 295 | aircraftState.fuel[2]))
|
---|
| 296 | self.logger.message(aircraftState.timestamp,
|
---|
| 297 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 298 |
|
---|
[7] | 299 | #---------------------------------------------------------------------------------------
|
---|
| 300 |
|
---|
| 301 | class B736(Boeing737):
|
---|
| 302 | """Boeing 737-600 aircraft."""
|
---|
[8] | 303 | def __init__(self, flight):
|
---|
| 304 | super(B736, self).__init__(flight)
|
---|
[9] | 305 | self.dow = 38307
|
---|
| 306 | self.mtow = 58328
|
---|
| 307 | self.mlw = 54657
|
---|
| 308 | self.mzfw = 51482
|
---|
[7] | 309 |
|
---|
| 310 | #---------------------------------------------------------------------------------------
|
---|
| 311 |
|
---|
| 312 | class B737(Boeing737):
|
---|
| 313 | """Boeing 737-700 aircraft."""
|
---|
[8] | 314 | def __init__(self, flight):
|
---|
| 315 | super(B737, self).__init__(flight)
|
---|
[9] | 316 | self.dow = 39250
|
---|
| 317 | self.mtow = 61410
|
---|
| 318 | self.mlw = 58059
|
---|
| 319 | self.mzfw = 54657
|
---|
[7] | 320 |
|
---|
| 321 | #---------------------------------------------------------------------------------------
|
---|
| 322 |
|
---|
| 323 | class B738(Boeing737):
|
---|
| 324 | """Boeing 737-800 aircraft."""
|
---|
[8] | 325 | def __init__(self, flight):
|
---|
| 326 | super(B738, self).__init__(flight)
|
---|
[9] | 327 | self.dow = 42690
|
---|
| 328 | self.mtow = 71709
|
---|
| 329 | self.mlw = 65317
|
---|
| 330 | self.mzfw = 61688
|
---|
| 331 |
|
---|
| 332 | #---------------------------------------------------------------------------------------
|
---|
| 333 |
|
---|
| 334 | class B738Charter(B738):
|
---|
| 335 | """Boeing 737-800 aircraft used for charters."""
|
---|
| 336 | def __init__(self, flight):
|
---|
| 337 | super(B738Charter, self).__init__(flight)
|
---|
| 338 | self.mtow = 77791
|
---|
[7] | 339 |
|
---|
| 340 | #---------------------------------------------------------------------------------------
|
---|
| 341 |
|
---|
| 342 | class B733(Boeing737):
|
---|
| 343 | """Boeing 737-300 aircraft."""
|
---|
[8] | 344 | def __init__(self, flight):
|
---|
| 345 | super(B733, self).__init__(flight)
|
---|
[9] | 346 | self.dow = 32700
|
---|
| 347 | self.mtow = 62820
|
---|
| 348 | self.mlw = 51700
|
---|
| 349 | self.mzfw = 48410
|
---|
[7] | 350 |
|
---|
| 351 | #---------------------------------------------------------------------------------------
|
---|
| 352 |
|
---|
| 353 | class B734(Boeing737):
|
---|
| 354 | """Boeing 737-400 aircraft."""
|
---|
[8] | 355 | def __init__(self, flight):
|
---|
| 356 | super(B734, self).__init__(flight)
|
---|
[9] | 357 | self.dow = 33200
|
---|
| 358 | self.mtow = 68050
|
---|
| 359 | self.mlw = 56200
|
---|
| 360 | self.mzfw = 53100
|
---|
[7] | 361 |
|
---|
| 362 | #---------------------------------------------------------------------------------------
|
---|
| 363 |
|
---|
| 364 | class B735(Boeing737):
|
---|
| 365 | """Boeing 737-500 aircraft."""
|
---|
[8] | 366 | def __init__(self, flight):
|
---|
| 367 | super(B735, self).__init__(flight)
|
---|
[9] | 368 | self.dow = 31300
|
---|
| 369 | self.mtow = 60550
|
---|
| 370 | self.mlw = 50000
|
---|
| 371 | self.mzfw = 46700
|
---|
[7] | 372 |
|
---|
| 373 | #---------------------------------------------------------------------------------------
|
---|
| 374 |
|
---|
| 375 | class DH8D(Aircraft):
|
---|
| 376 | """Bombardier Dash-8 Q400 aircraft.
|
---|
| 377 |
|
---|
| 378 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 379 | structure:
|
---|
| 380 | - fuel: centre, left, right
|
---|
| 381 | - n1: left, right
|
---|
| 382 | - reverser: left, right."""
|
---|
[8] | 383 | def __init__(self, flight):
|
---|
| 384 | super(DH8D, self).__init__(flight)
|
---|
[9] | 385 | self.dow = 17185
|
---|
| 386 | self.mtow = 29257
|
---|
| 387 | self.mlw = 28009
|
---|
| 388 | self.mzfw = 25855
|
---|
| 389 | self.gearSpeedLimit = 215
|
---|
| 390 | self.flapSpeedLimits = { 5 : 200,
|
---|
| 391 | 10 : 181,
|
---|
| 392 | 15 : 172,
|
---|
| 393 | 35 : 158 }
|
---|
| 394 |
|
---|
| 395 | def logFuel(self, aircraftState):
|
---|
| 396 | """Log the amount of fuel"""
|
---|
| 397 | self.logger.message(aircraftState.timestamp,
|
---|
| 398 | "Fuel: left=%.0f kg - centre=%.0f kg - right=%.0f kg" % \
|
---|
| 399 | (aircraftState.fuel[1], aircraftState.fuel[0],
|
---|
| 400 | aircraftState.fuel[2]))
|
---|
| 401 | self.logger.message(aircraftState.timestamp,
|
---|
| 402 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
[7] | 403 |
|
---|
| 404 | #---------------------------------------------------------------------------------------
|
---|
| 405 |
|
---|
| 406 | class Boeing767(Aircraft):
|
---|
| 407 | """Base class for the various aircraft in the Boeing 767 family.
|
---|
| 408 |
|
---|
| 409 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 410 | structure:
|
---|
| 411 | - fuel: centre, left, right
|
---|
| 412 | - n1: left, right
|
---|
| 413 | - reverser: left, right"""
|
---|
[9] | 414 | def __init__(self, flight):
|
---|
| 415 | super(Boeing767, self).__init__(flight)
|
---|
[95] | 416 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 417 | self.gearSpeedLimit = 270
|
---|
| 418 | self.flapSpeedLimits = { 1 : 255,
|
---|
| 419 | 5 : 235,
|
---|
| 420 | 10 : 215,
|
---|
| 421 | 20 : 215,
|
---|
| 422 | 25 : 185,
|
---|
| 423 | 30 : 175 }
|
---|
[7] | 424 |
|
---|
[9] | 425 | def logFuel(self, aircraftState):
|
---|
| 426 | """Log the amount of fuel"""
|
---|
| 427 | self.logger.message(aircraftState.timestamp,
|
---|
| 428 | "Fuel: left=%.0f kg - centre=%.0f kg - right=%.0f kg" % \
|
---|
| 429 | (aircraftState.fuel[1], aircraftState.fuel[0],
|
---|
| 430 | aircraftState.fuel[2]))
|
---|
| 431 | self.logger.message(aircraftState.timestamp,
|
---|
| 432 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 433 |
|
---|
[7] | 434 | #---------------------------------------------------------------------------------------
|
---|
| 435 |
|
---|
| 436 | class B762(Boeing767):
|
---|
| 437 | """Boeing 767-200 aircraft."""
|
---|
[8] | 438 | def __init__(self, flight):
|
---|
| 439 | super(B762, self).__init__(flight)
|
---|
[9] | 440 | self.dow = 84507
|
---|
| 441 | self.mtow = 175540
|
---|
| 442 | self.mlw = 126098
|
---|
| 443 | self.mzfw = 114758
|
---|
[7] | 444 |
|
---|
| 445 | #---------------------------------------------------------------------------------------
|
---|
| 446 |
|
---|
| 447 | class B763(Boeing767):
|
---|
| 448 | """Boeing 767-300 aircraft."""
|
---|
[8] | 449 | def __init__(self, flight):
|
---|
| 450 | super(B763, self).__init__(cflight)
|
---|
[9] | 451 | self.dow = 91311
|
---|
| 452 | self.mtow = 181436
|
---|
| 453 | self.mlw = 137892
|
---|
| 454 | self.mzfw = 130635
|
---|
[7] | 455 |
|
---|
| 456 | #---------------------------------------------------------------------------------------
|
---|
| 457 |
|
---|
| 458 | class CRJ2(Aircraft):
|
---|
| 459 | """Bombardier CRJ-200 aircraft.
|
---|
| 460 |
|
---|
| 461 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 462 | structure:
|
---|
| 463 | - fuel: centre, left, right
|
---|
| 464 | - n1: left, right
|
---|
| 465 | - reverser: left, right."""
|
---|
[8] | 466 | def __init__(self, flight):
|
---|
| 467 | super(CRJ2, self).__init__(flight)
|
---|
[95] | 468 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 469 | self.dow = 14549
|
---|
| 470 | self.mtow = 22995
|
---|
| 471 | self.mlw = 21319
|
---|
| 472 | self.mzfw = 19958
|
---|
| 473 | self.gearSpeedLimit = 240
|
---|
| 474 | self.flapSpeedLimits = { 8 : 260,
|
---|
| 475 | 20 : 220,
|
---|
| 476 | 30 : 190,
|
---|
| 477 | 45 : 175 }
|
---|
[7] | 478 |
|
---|
[9] | 479 | def logFuel(self, aircraftState):
|
---|
| 480 | """Log the amount of fuel"""
|
---|
| 481 | self.logger.message(aircraftState.timestamp,
|
---|
| 482 | "Fuel: left=%.0f kg - centre=%.0f kg - right=%.0f kg" % \
|
---|
| 483 | (aircraftState.fuel[1], aircraftState.fuel[0],
|
---|
| 484 | aircraftState.fuel[2]))
|
---|
| 485 | self.logger.message(aircraftState.timestamp,
|
---|
| 486 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 487 |
|
---|
[7] | 488 | #---------------------------------------------------------------------------------------
|
---|
| 489 |
|
---|
| 490 | class F70(Aircraft):
|
---|
| 491 | """Fokker 70 aircraft.
|
---|
| 492 |
|
---|
| 493 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 494 | structure:
|
---|
| 495 | - fuel: centre, left, right
|
---|
| 496 | - n1: left, right
|
---|
| 497 | - reverser: left, right."""
|
---|
[8] | 498 | def __init__(self, flight):
|
---|
| 499 | super(F70, self).__init__(flight)
|
---|
[95] | 500 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 501 | self.dow = 24283
|
---|
| 502 | self.mtow = 38100 # FIXME: differentiate by registration number,
|
---|
| 503 | # MTOW of HA-LMF: 41955
|
---|
| 504 | self.mlw = 36740
|
---|
| 505 | self.mzfw = 32655
|
---|
| 506 | self.gearSpeedLimit = 200
|
---|
| 507 | self.flapSpeedLimits = { 8 : 250,
|
---|
| 508 | 15 : 220,
|
---|
| 509 | 25 : 220,
|
---|
| 510 | 42 : 180 }
|
---|
[7] | 511 |
|
---|
[9] | 512 | def logFuel(self, aircraftState):
|
---|
| 513 | """Log the amount of fuel"""
|
---|
| 514 | self.logger.message(aircraftState.timestamp,
|
---|
| 515 | "Fuel: left=%.0f kg - centre=%.0f kg - right=%.0f kg" % \
|
---|
| 516 | (aircraftState.fuel[1], aircraftState.fuel[0],
|
---|
| 517 | aircraftState.fuel[2]))
|
---|
| 518 | self.logger.message(aircraftState.timestamp,
|
---|
| 519 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 520 |
|
---|
[7] | 521 | #---------------------------------------------------------------------------------------
|
---|
| 522 |
|
---|
| 523 | class DC3(Aircraft):
|
---|
| 524 | """Lisunov Li-2 (DC-3) aircraft.
|
---|
| 525 |
|
---|
| 526 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 527 | structure:
|
---|
[52] | 528 | - fuel: left, right, left aux, right aux
|
---|
[7] | 529 | - rpm: left, right
|
---|
| 530 | - reverser: left, right."""
|
---|
[8] | 531 | def __init__(self, flight):
|
---|
| 532 | super(DC3, self).__init__(flight)
|
---|
[9] | 533 | self.dow = 8627
|
---|
| 534 | self.mtow = 11884
|
---|
| 535 | self.mlw = 11793
|
---|
| 536 | self.mzfw = 11780
|
---|
| 537 | self.gearSpeedLimit = 148
|
---|
| 538 | self.flapSpeedLimits = { 15 : 135,
|
---|
| 539 | 30 : 99,
|
---|
| 540 | 45 : 97 }
|
---|
[8] | 541 |
|
---|
| 542 | def _checkFlightEnd(self, aircraftState):
|
---|
| 543 | """Check if the end of the flight has arrived.
|
---|
| 544 |
|
---|
| 545 | This implementation checks the RPM values to be 0."""
|
---|
| 546 | for rpm in aircraftState.rpm:
|
---|
[29] | 547 | if rpm>0: return False
|
---|
| 548 | return True
|
---|
[7] | 549 |
|
---|
[9] | 550 | def logFuel(self, aircraftState):
|
---|
| 551 | """Log the amount of fuel"""
|
---|
| 552 | self.logger.message(aircraftState.timestamp,
|
---|
| 553 | "Fuel: left aux=%.0f kg - left=%.0f kg - right=%.0f kg - right aux=%.0f kg" % \
|
---|
| 554 | (aircraftState.fuel[2], aircraftState.fuel[0],
|
---|
| 555 | aircraftState.fuel[1], aircraftState.fuel[3]))
|
---|
| 556 | self.logger.message(aircraftState.timestamp,
|
---|
| 557 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 558 |
|
---|
[7] | 559 | #---------------------------------------------------------------------------------------
|
---|
| 560 |
|
---|
| 561 | class T134(Aircraft):
|
---|
| 562 | """Tupolev Tu-134 aircraft.
|
---|
| 563 |
|
---|
| 564 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 565 | structure:
|
---|
| 566 | - fuel: centre, left tip, left aux, right tip, right aux, external 1,
|
---|
| 567 | external 2
|
---|
| 568 | - n1: left, right
|
---|
| 569 | - reverser: left, right."""
|
---|
[8] | 570 | def __init__(self, flight):
|
---|
| 571 | super(T134, self).__init__(flight)
|
---|
[95] | 572 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 573 | self.dow = 29927
|
---|
| 574 | self.mtow = 47600
|
---|
| 575 | self.mlw = 43000
|
---|
| 576 | self.mzfw = 38500
|
---|
| 577 | self.gearSpeedLimit = 216
|
---|
| 578 | self.flapSpeedLimits = { 10 : 240,
|
---|
| 579 | 20 : 216,
|
---|
| 580 | 30 : 161 }
|
---|
[7] | 581 |
|
---|
[9] | 582 | def logFuel(self, aircraftState):
|
---|
| 583 | """Log the amount of fuel"""
|
---|
| 584 | self.logger.message(aircraftState.timestamp,
|
---|
| 585 | "Fuel: left aux=%.0f kg - left tip=%.0f kg - centre= %.0f kg - right tip=%.0f kg - right aux=%.0f kg - external 1=%.0f kg - external 2=%.0f kg" % \
|
---|
| 586 | (aircraftState.fuel[2], aircraftState.fuel[1],
|
---|
| 587 | aircraftState.fuel[0],
|
---|
| 588 | aircraftState.fuel[3], aircraftState.fuel[4],
|
---|
| 589 | aircraftState.fuel[5], aircraftState.fuel[6]))
|
---|
| 590 | self.logger.message(aircraftState.timestamp,
|
---|
| 591 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
| 592 |
|
---|
[7] | 593 | #---------------------------------------------------------------------------------------
|
---|
| 594 |
|
---|
| 595 | class T154(Aircraft):
|
---|
| 596 | """Tupolev Tu-154 aircraft.
|
---|
| 597 |
|
---|
| 598 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 599 | structure:
|
---|
| 600 | - fuel: centre, left, right, centre 2, left aux, right aux
|
---|
| 601 | - n1: left, centre, right
|
---|
| 602 | - reverser: left, right"""
|
---|
[8] | 603 | def __init__(self, flight):
|
---|
| 604 | super(T154, self).__init__(flight)
|
---|
[95] | 605 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 606 | self.dow = 53259
|
---|
| 607 | self.mtow = 98000
|
---|
| 608 | self.mlw = 78000
|
---|
| 609 | self.mzfw = 72000
|
---|
| 610 | self.gearSpeedLimit = 216
|
---|
| 611 | self.flapSpeedLimits = { 15 : 227,
|
---|
| 612 | 28 : 194,
|
---|
| 613 | 45 : 162 }
|
---|
| 614 |
|
---|
| 615 | def logFuel(self, aircraftState):
|
---|
| 616 | """Log the amount of fuel"""
|
---|
| 617 | self.logger.message(aircraftState.timestamp,
|
---|
| 618 | "Fuel: left aux=%.0f kg - left=%.0f kg - centre=%.0f kg - centre 2=%.0f kg - right=%.0f kg - right aux=%.0f kg" % \
|
---|
| 619 | (aircraftState.fuel[4], aircraftState.fuel[1],
|
---|
| 620 | aircraftState.fuel[0], aircraftState.fuel[3],
|
---|
| 621 | aircraftState.fuel[2], aircraftState.fuel[5]))
|
---|
| 622 | self.logger.message(aircraftState.timestamp,
|
---|
| 623 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
[7] | 624 |
|
---|
| 625 | #---------------------------------------------------------------------------------------
|
---|
| 626 |
|
---|
[9] | 627 |
|
---|
[7] | 628 | class YK40(Aircraft):
|
---|
| 629 | """Yakovlev Yak-40 aircraft.
|
---|
| 630 |
|
---|
| 631 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 632 | structure:
|
---|
| 633 | - fuel: left, right
|
---|
| 634 | - n1: left, right
|
---|
| 635 | - reverser: left, right"""
|
---|
[8] | 636 | def __init__(self, flight):
|
---|
| 637 | super(YK40, self).__init__(flight)
|
---|
[95] | 638 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 639 | self.dow = 9400
|
---|
| 640 | self.mtow = 17200
|
---|
| 641 | self.mlw = 16800
|
---|
| 642 | self.mzfw = 12100
|
---|
| 643 | self.gearSpeedLimit = 165
|
---|
| 644 | self.flapSpeedLimits = { 20 : 165,
|
---|
| 645 | 35 : 135 }
|
---|
| 646 |
|
---|
| 647 | def logFuel(self, aircraftState):
|
---|
| 648 | """Log the amount of fuel"""
|
---|
| 649 | self.logger.message(aircraftState.timestamp,
|
---|
| 650 | "Fuel: left=%.0f kg - right=%.0f kg" % \
|
---|
| 651 | (aircraftState.fuel[0], aircraftState.fuel[1]))
|
---|
| 652 | self.logger.message(aircraftState.timestamp,
|
---|
| 653 | "Total fuel: %.0f kg" % (sum(aircraftState.fuel),))
|
---|
[7] | 654 |
|
---|
| 655 | #---------------------------------------------------------------------------------------
|
---|
| 656 |
|
---|
[8] | 657 | _classes = { const.AIRCRAFT_B736 : B736,
|
---|
| 658 | const.AIRCRAFT_B737 : B737,
|
---|
| 659 | const.AIRCRAFT_B738 : B738,
|
---|
| 660 | const.AIRCRAFT_B733 : B733,
|
---|
| 661 | const.AIRCRAFT_B734 : B734,
|
---|
| 662 | const.AIRCRAFT_B735 : B735,
|
---|
| 663 | const.AIRCRAFT_DH8D : DH8D,
|
---|
| 664 | const.AIRCRAFT_B762 : B762,
|
---|
| 665 | const.AIRCRAFT_B763 : B763,
|
---|
| 666 | const.AIRCRAFT_CRJ2 : CRJ2,
|
---|
| 667 | const.AIRCRAFT_F70 : F70,
|
---|
| 668 | const.AIRCRAFT_DC3 : DC3,
|
---|
| 669 | const.AIRCRAFT_T134 : T134,
|
---|
| 670 | const.AIRCRAFT_T154 : T154,
|
---|
| 671 | const.AIRCRAFT_YK40 : YK40 }
|
---|
| 672 |
|
---|
| 673 | #---------------------------------------------------------------------------------------
|
---|