Changeset 384:97052bda0e22 for src/mlx/acft.py
- Timestamp:
- 12/21/12 16:50:01 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r369 r384 3 3 import checks 4 4 import fs 5 from i18n import xstr 5 6 import util 6 7 … … 74 75 75 76 self._v1r2LineIndex = None 77 self._derateLineID = None 76 78 self._vrefLineIndex = None 77 79 … … 197 199 return None if self._aircraftState is None \ 198 200 else self._aircraftState.timestamp 201 202 @property 203 def derateLabels(self): 204 """Get the strings related to the derate entry. 205 206 It returns a tuple of two items: 207 - the label before the entry field, 208 - the label after the entry field, which can be None. 209 210 If both labels are None, the derate value will not be logged or 211 queried. This is the default.""" 212 return (None, None) 213 214 @property 215 def derateTemplate(self): 216 """Get the template for logging the derate value. 217 218 If it returns None (which is the default), no derate value will be 219 logged.""" 220 return None 199 221 200 222 def getFlapsSpeedLimit(self, flaps): … … 271 293 self._logRadios(aircraftState) 272 294 self._logV1R2(aircraftState) 295 self._logDerate(aircraftState) 273 296 elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING: 274 297 self._logRadios(aircraftState) … … 380 403 self._logV1R2() 381 404 405 def updateDerate(self): 406 """Update the derate value from the flight, if the these values 407 have already been logged.""" 408 if self._derateLineID is not None: 409 self._logDerate() 410 382 411 def _appendLightsLoggers(self): 383 412 """Append the loggers needed for the lights. … … 429 458 else: 430 459 self.logger.updateLine(self._v1r2LineIndex, message) 460 461 def _logDerate(self, state = None): 462 """Log the derate values either newly or by updating the corresponding 463 line.""" 464 derateTemplate = self.derateTemplate 465 if derateTemplate is None: 466 return 467 468 derate = self._flight.derate 469 message = derateTemplate % ("-" if derate is None else derate) 470 if self._derateLineID is None: 471 if state is None: 472 state = self._aircraftState 473 self._derateLineID = \ 474 self.logger.message(state.timestamp, message) 475 else: 476 self.logger.updateLine(self._derateLineID, message) 431 477 432 478 def updateVRef(self): … … 502 548 40 : 162 } 503 549 550 @property 551 def derateLabels(self): 552 """Get the derate strings for this type.""" 553 return (xstr("takeoff_derate_boeing"), "%") 554 555 @property 556 def derateTemplate(self): 557 """Get the derate template for this aicraft type.""" 558 return "Derate calculated by the pilot: %s %%" 559 504 560 # def _appendSpeedChecker(self): 505 561 # """Append the NoStrobeSpeedChecker to the checkers. … … 626 682 25 : 185, 627 683 30 : 175 } 684 685 @property 686 def derateLabels(self): 687 """Get the derate strings for this type.""" 688 return (xstr("takeoff_derate_boeing"), "%") 689 690 @property 691 def derateTemplate(self): 692 """Get the derate template for this aicraft type.""" 693 return "Derate calculated by the pilot: %s %%" 628 694 629 695 #--------------------------------------------------------------------------------------- … … 697 763 self.reverseMinSpeed = 50 698 764 765 @property 766 def derateLabels(self): 767 """Get the derate strings for this type.""" 768 return ("EPR", None) 769 770 @property 771 def derateTemplate(self): 772 """Get the derate template for this aicraft type.""" 773 return "EPR calculated by the pilot: %s" 774 699 775 #--------------------------------------------------------------------------------------- 700 776 … … 751 827 752 828 @property 829 def derateLabels(self): 830 """Get the derate strings for this type.""" 831 return (xstr("takeoff_derate_tupolev"), None) 832 833 @property 834 def derateTemplate(self): 835 """Get the derate template for this aicraft type.""" 836 return "Nominal/takeoff power calculated by the pilot: %s" 837 838 @property 753 839 def speedInKnots(self): 754 840 """Indicate if the speed is in knots.""" … … 798 884 return False 799 885 886 @property 887 def derateLabels(self): 888 """Get the derate strings for this type.""" 889 return (xstr("takeoff_derate_tupolev"), None) 890 891 @property 892 def derateTemplate(self): 893 """Get the derate template for this aicraft type.""" 894 return "Nominal/takeoff power calculated by the pilot: %s" 895 800 896 def _appendLightsLoggers(self): 801 897 """Append the loggers needed for the lights.""" … … 811 907 812 908 #--------------------------------------------------------------------------------------- 813 814 909 815 910 class YK40(Aircraft): … … 836 931 """Indicate if the speed is in knots.""" 837 932 return False 933 934 @property 935 def derateLabels(self): 936 """Get the derate strings for this type.""" 937 return (xstr("takeoff_derate_tupolev"), None) 938 939 @property 940 def derateTemplate(self): 941 """Get the derate template for this aicraft type.""" 942 return "Nominal/takeoff power calculated by the pilot: %s" 838 943 839 944 def _appendLightsLoggers(self):
Note:
See TracChangeset
for help on using the changeset viewer.