Changeset 332:9e73697f6981


Ignore:
Timestamp:
11/13/12 16:29:19 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

#137: changed the threshold

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r329 r332  
    3737        This default implementation raises a NotImplementedError."""
    3838        raise NotImplementedError()
    39    
     39
    4040#---------------------------------------------------------------------------------------
    4141
     
    8383                aircraft.setStage(state, const.STAGE_CRUISE)
    8484        elif stage==const.STAGE_LANDING:
    85             if state.onTheGround and state.groundSpeed<50.0:
     85            if state.onTheGround and state.groundSpeed<25.0:
    8686                aircraft.setStage(state, const.STAGE_TAXIAFTERLAND)
    8787            elif not state.gearsDown:
     
    110110    ## The interval at which the ACARS are sent
    111111    INTERVAL = 3*60.0
    112    
     112
    113113    def __init__(self, gui):
    114114        """Construct the ACARS sender."""
     
    119119        """If the time has come to send the ACARS, send it."""
    120120        now = time.time()
    121        
     121
    122122        if self._lastSent is not None and \
    123123           (self._lastSent + ACARSSender.INTERVAL)>now:
    124             return 
     124            return
    125125
    126126        acars = ACARS(self._gui, state)
     
    135135        else:
    136136            print "Failed to send the ACARS"
    137        
     137
    138138#---------------------------------------------------------------------------------------
    139139
     
    143143        """Construct the logger."""
    144144        self._onTheGround = True
    145    
     145
    146146    def check(self, flight, aircraft, logger, oldState, state):
    147147        """Log the cruise speed if necessary."""
     
    156156            logger.message(state.timestamp,
    157157                           "Takeoff pitch: %.1f degrees" % (state.pitch,))
    158             logger.message(state.timestamp, 
     158            logger.message(state.timestamp,
    159159                           "Centre of gravity:  %.1f%%" % (state.cog*100.0,))
    160160            self._onTheGround = False
     
    167167        """Construct the logger."""
    168168        self._lastTime = None
    169    
     169
    170170    def check(self, flight, aircraft, logger, oldState, state):
    171171        """Log the cruise speed if necessary."""
     
    191191        self._logged = False
    192192        self._spoilersExtension = None
    193    
     193
    194194    def check(self, flight, aircraft, logger, oldState, state):
    195195        """Log the cruise speed if necessary."""
     
    238238    It tracks the altitude during the descent and landing phases and
    239239    if the altitude crosses one that has a callout associated with and
    240     the vertical speed is negative, that callout will be played."""   
     240    the vertical speed is negative, that callout will be played."""
    241241    def __init__(self, approachCallouts):
    242242        """Construct the approach callouts player."""
     
    273273        the message to log with the new value
    274274        """
    275         self._logInitial = logInitial   
     275        self._logInitial = logInitial
    276276
    277277    def _getLogTimestamp(self, state, forced):
     
    286286        else:
    287287            shouldLog = self._changed(oldState, state)
    288        
     288
    289289        if shouldLog:
    290290            self.logState(flight, logger, state)
     
    295295        if message is not None:
    296296            logger.message(self._getLogTimestamp(state, forced), message)
    297        
     297
    298298#-------------------------------------------------------------------------------
    299299
     
    321321        """Get the value of the attribute from the state."""
    322322        return getattr(state, self._attrName)
    323    
     323
    324324#---------------------------------------------------------------------------------------
    325325
     
    337337        self._firstChange = None
    338338        self._lastChangeState = None
    339        
     339
    340340    def _changed(self, oldState, state):
    341341        """Determine if the value has changed."""
    342342        if self._oldValue is None:
    343343            self._oldValue = self._getValue(oldState)
    344            
     344
    345345        newValue = self._getValue(state)
    346346        if self._isDifferent(self._oldValue, newValue):
     
    356356                self._firstChange = None
    357357                return True
    358            
     358
    359359        return False
    360360
     
    384384    def _getMessage(self, flight, state, forced):
    385385        """Get the message."""
    386         value = self._getValue(state)       
     386        value = self._getValue(state)
    387387        return None if value is None else self._template % (value,)
    388388
     
    433433        self._logState(flight, logger, state, forced)
    434434        self._lastLoggedState = state
    435    
     435
    436436    def _changed(self, oldState, state):
    437437        """Check if the state has changed.
     
    476476        if obs is not None: message += u" (%d\u00b0)" % (obs,)
    477477        return message
    478    
     478
    479479    def __init__(self, attrName, logName):
    480480        """Construct the NAV logger."""
     
    593593        StateChangeLogger.__init__(self)
    594594        SingleValueMixin.__init__(self, attrName)
    595        
     595
    596596        self._template = template
    597597
     
    599599        """Get the message from the given state."""
    600600        return self._template % ("ON" if self._getValue(state) else "OFF")
    601        
     601
    602602#---------------------------------------------------------------------------------------
    603603
     
    741741        else:
    742742            self._faultStarted = None
    743                
     743
    744744#---------------------------------------------------------------------------------------
    745745
     
    775775    """Check for the anti-collision light for Tuplev planes."""
    776776    def isCondition(self, flight, aircraft, oldState, state):
    777         """Check if the fault condition holds."""       
     777        """Check if the fault condition holds."""
    778778        numEnginesRunning = 0
    779779        for n1 in state.n1:
    780780            if n1>5: numEnginesRunning += 1
    781            
     781
    782782        if flight.stage==const.STAGE_PARKING:
    783783            return numEnginesRunning<len(state.n1) \
     
    816816        """Construct the flaps checker."""
    817817        self._timeStart = None
    818    
     818
    819819    def isCondition(self, flight, aircraft, oldState, state):
    820820        """Check if the fault condition holds.
     
    891891        return state.gLoad>2.0 and (flight.stage!=const.STAGE_LANDING or \
    892892                                    state.radioAltitude>=50)
    893                
     893
    894894    def logFault(self, flight, aircraft, logger, oldState, state):
    895895        """Log the fault."""
     
    923923                (flight.stage==const.STAGE_PARKING and \
    924924                 state.landingLightsOn and state.onTheGround))
    925                
     925
    926926    def logFault(self, flight, aircraft, logger, oldState, state):
    927927        """Log the fault."""
     
    930930        flight.handleFault(LandingLightsChecker, state.timestamp,
    931931                           FaultChecker._appendDuring(flight, message),
    932                            score)   
     932                           score)
    933933
    934934#---------------------------------------------------------------------------------------
     
    10181018               flight.stage!=const.STAGE_PARKING and \
    10191019               not state.navLightsOn
    1020                
     1020
    10211021    def logFault(self, flight, aircraft, logger, oldState, state):
    10221022        """Log the fault."""
     
    10371037        """Check if the fault condition holds."""
    10381038        return state.overspeed
    1039                
     1039
    10401040    def logFault(self, flight, aircraft, logger, oldState, state):
    10411041        """Log the fault."""
    10421042        flight.handleFault(OverspeedChecker, state.timestamp,
    10431043                           FaultChecker._appendDuring(flight, "Overspeed"),
    1044                            20)       
     1044                           20)
    10451045
    10461046#---------------------------------------------------------------------------------------
     
    10541054        """Check if the given aircraft's ZFW is outside of the limits."""
    10551055        return aircraftZFW < (flightZFW - PayloadChecker.TOLERANCE) or \
    1056                aircraftZFW > (flightZFW + PayloadChecker.TOLERANCE)       
    1057    
     1056               aircraftZFW > (flightZFW + PayloadChecker.TOLERANCE)
     1057
    10581058    def isCondition(self, flight, aircraft, oldState, state):
    10591059        """Check if the fault condition holds."""
     
    10611061               flight.stage==const.STAGE_PUSHANDTAXI and \
    10621062               PayloadChecker.isZFWFaulty(state.zfw, flight.zfw)
    1063                
     1063
    10641064    def logFault(self, flight, aircraft, logger, oldState, state):
    10651065        """Log the fault."""
     
    10801080        """Check if the fault condition holds."""
    10811081        return state.groundSpeed>80 and not state.pitotHeatOn
    1082                
     1082
    10831083    def logFault(self, flight, aircraft, logger, oldState, state):
    10841084        """Log the fault."""
     
    10881088        flight.handleFault(PitotChecker, state.timestamp,
    10891089                           FaultChecker._appendDuring(flight, "Pitot heat was off"),
    1090                            score)   
     1090                           score)
    10911091
    10921092#---------------------------------------------------------------------------------------
     
    10991099                                const.STAGE_TAXIAFTERLAND] and \
    11001100            state.groundSpeed<60 and max(state.reverser)
    1101                            
     1101
    11021102    def logFault(self, flight, aircraft, logger, oldState, state):
    11031103        """Log the fault."""
     
    11171117                                const.STAGE_TAXIAFTERLAND] and \
    11181118            state.groundSpeed>50
    1119                            
     1119
    11201120    def logFault(self, flight, aircraft, logger, oldState, state):
    11211121        """Log the fault."""
     
    11361136                                const.STAGE_CRUISE, const.STAGE_DESCENT,
    11371137                                const.STAGE_LANDING] and state.stalled
    1138                
     1138
    11391139    def logFault(self, flight, aircraft, logger, oldState, state):
    11401140        """Log the fault."""
     
    11431143        flight.handleFault(StallChecker, state.timestamp,
    11441144                           FaultChecker._appendDuring(flight, "Stalled"),
    1145                            score)   
     1145                           score)
    11461146
    11471147#---------------------------------------------------------------------------------------
     
    11601160                  (flight.stage==const.STAGE_PARKING and \
    11611161                   state.strobeLightsOn and state.onTheGround)
    1162                
     1162
    11631163    def logFault(self, flight, aircraft, logger, oldState, state):
    11641164        """Log the fault."""
     
    11781178        return flight.stage==const.STAGE_TAKEOFF and \
    11791179               state.n1 is not None and max(state.n1)>97
    1180                
     1180
    11811181    def logFault(self, flight, aircraft, logger, oldState, state):
    11821182        """Log the fault."""
     
    12091209               (altitude<10000 and vs < (VSChecker.BELOW10000 *
    12101210                                         VSChecker.TOLERANCE))
    1211                
     1211
    12121212    def logFault(self, flight, aircraft, logger, oldState, state):
    12131213        """Log the fault."""
Note: See TracChangeset for help on using the changeset viewer.