source: src/mlx/acft.py@ 137:f7489252b322

Last change on this file since 137:f7489252b322 was 136:6d206b573dee, checked in by István Váradi <ivaradi@…>, 13 years ago

Added option to enable/disable the online gate system

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