source: src/mlx/acft.py@ 150:0a6ffbd72d7e

Last change on this file since 150:0a6ffbd72d7e was 150:0a6ffbd72d7e, checked in by István Váradi <ivaradi@…>, 13 years ago

Updated the fuel logging to the new order

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