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