Changeset 13:7cdc145ceef9
- Timestamp:
- 02/11/12 19:53:12 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/checks.py
r11 r13 122 122 """Construct the logger.""" 123 123 self._logged = False 124 self._spoiler Extension = None124 self._spoilersExtension = None 125 125 126 126 def check(self, flight, aircraft, logger, oldState, state): … … 128 128 if flight.stage==const.STAGE_LANDING and not self._logged: 129 129 if state.onTheGround: 130 if state.spoiler Extension!=self._spoilerExtension:130 if state.spoilersExtension!=self._spoilersExtension: 131 131 logger.message(state.timestamp, "Spoilers deployed") 132 132 self._logged = True 133 133 else: 134 self._spoiler Extension = state.spoilerExtension134 self._spoilersExtension = state.spoilersExtension 135 135 136 136 #--------------------------------------------------------------------------------------- … … 456 456 def logFault(self, flight, aircraft, logger, oldState, state): 457 457 """Log the fault.""" 458 logger.fault(AntiCollisionLight Checker, state.timestamp,458 logger.fault(AntiCollisionLightsChecker, state.timestamp, 459 459 FaultChecker._appendDuring(flight, "Anti-collision lights were off"), 460 460 1) … … 486 486 class FlapsRetractChecker(SimpleFaultChecker): 487 487 """Check if the flaps are not retracted too early.""" 488 def __init__(self): 489 """Construct the flaps checker.""" 490 self._timeStart = None 491 488 492 def isCondition(self, flight, aircraft, oldState, state): 489 493 """Check if the fault condition holds. … … 497 501 if state.flapsSet==0 and state.timestamp<=(self._timeStart+2.0): 498 502 return True 503 else: 504 self._timeStart = None 499 505 return False 500 506 … … 542 548 def isCondition(self, flight, aircraft, oldState, state): 543 549 """Check if the fault condition holds.""" 544 return state.gearsDown and state.ias> gearSpeedLimit550 return state.gearsDown and state.ias>aircraft.gearSpeedLimit 545 551 546 552 def logFault(self, flight, aircraft, logger, oldState, state): … … 616 622 if flight.options.compensation is not None: 617 623 limit += flight.options.compensation 618 return s tate.grossWeight>mlw624 return self.getWeight(state)>limit 619 625 620 626 return False … … 622 628 def logFault(self, flight, aircraft, logger, oldState, state): 623 629 """Log the fault.""" 630 mname = "M" + self._name 624 631 logger.noGo(self.__class__, state.timestamp, 625 "%s exceeded: %.0f kg" % (self._name, state.grossWeight), 626 "%s NO GO" % (self._name,)) 632 "%s exceeded: %s is %.0f kg" % \ 633 (mname, self._name, self.getWeight(state)), 634 "%s NO GO" % (mname,)) 635 636 def getWeight(self, state): 637 """Get the weight that is interesting for us.""" 638 return state.grossWeight 627 639 628 640 #--------------------------------------------------------------------------------------- … … 632 644 def __init__(self): 633 645 """Construct the checker.""" 634 super(MLWChecker, self).__init__(" MLW")635 636 def getLimit( flight, aircraft, state):646 super(MLWChecker, self).__init__("LW") 647 648 def getLimit(self, flight, aircraft, state): 637 649 """Get the limit if we are in the right state.""" 638 650 return aircraft.mlw if flight.stage==const.STAGE_LANDING and \ … … 645 657 def __init__(self): 646 658 """Construct the checker.""" 647 super(MTOWChecker, self).__init__(" MTOW")648 649 def getLimit( flight, aircraft, state):659 super(MTOWChecker, self).__init__("TOW") 660 661 def getLimit(self, flight, aircraft, state): 650 662 """Get the limit if we are in the right state.""" 651 663 return aircraft.mtow if flight.stage==const.STAGE_TAKEOFF else None … … 657 669 def __init__(self): 658 670 """Construct the checker.""" 659 super(MZFWChecker, self).__init__(" MZFW")660 661 def getLimit( flight, aircraft, state):671 super(MZFWChecker, self).__init__("ZFW") 672 673 def getLimit(self, flight, aircraft, state): 662 674 """Get the limit if we are in the right state.""" 663 675 return aircraft.mzfw 676 677 def getWeight(self, state): 678 """Get the weight that is interesting for us.""" 679 return state.zfw 664 680 665 681 #--------------------------------------------------------------------------------------- … … 725 741 def isCondition(self, flight, aircraft, oldState, state): 726 742 """Check if the fault condition holds.""" 727 return state.groundSpeed>80 and not current.pitotHeatOn743 return state.groundSpeed>80 and not state.pitotHeatOn 728 744 729 745 def logFault(self, flight, aircraft, logger, oldState, state): … … 765 781 """Log the fault.""" 766 782 logger.fault(SpeedChecker, state.timestamp, 767 FaultChecker._appendDuring(flight, " Reverser used below 60 knots"),783 FaultChecker._appendDuring(flight, "Taxi speed over 50 knots"), 768 784 FaultChecker._getLinearScore(50, 80, 10, 15, state.groundSpeed)) 769 785 … … 821 837 def logFault(self, flight, aircraft, logger, oldState, state): 822 838 """Log the fault.""" 839 print state.n1 823 840 logger.fault(LandingLightsChecker, state.timestamp, 824 841 FaultChecker._appendDuring(flight, "Thrust setting was too high (>97%)"), … … 841 858 return vs < -8000 or vs > 8000 or \ 842 859 (altitude<500 and vs < (VSChecker.BELOW500 * 843 VSC HECKER.TOLERANCE)) or \860 VSChecker.TOLERANCE)) or \ 844 861 (altitude<2500 and vs < (VSChecker.BELOW2500 * 845 VSC HECKER.TOLERANCE)) or \862 VSChecker.TOLERANCE)) or \ 846 863 (altitude<5000 and vs < (VSChecker.BELOW5000 * 847 VSC HECKER.TOLERANCE)) or \864 VSChecker.TOLERANCE)) or \ 848 865 (altitude<10000 and vs < (VSChecker.BELOW10000 * 849 VSC HECKER.TOLERANCE))866 VSChecker.TOLERANCE)) 850 867 851 868 def logFault(self, flight, aircraft, logger, oldState, state):
Note:
See TracChangeset
for help on using the changeset viewer.