Changeset 335:db900a4a0930


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

#139: added a checker for thev transponder state

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r333 r335  
    118118
    119119        self._appendLightsCheckers()
     120
     121        self._checkers.append(checks.TransponderChecker())
    120122
    121123        self._checkers.append(checks.BankChecker())
  • src/mlx/checks.py

    r333 r335  
    927927        """Log the fault."""
    928928        score = 0 if flight.stage==const.STAGE_LANDING else 1
    929         message = "Landing lights were %s" % (("on" if state.landingLightsOn else "off"),)
     929        message = "Landing lights were %s" % \
     930                  (("on" if state.landingLightsOn else "off"),)
    930931        flight.handleFault(LandingLightsChecker, state.timestamp,
     932                           FaultChecker._appendDuring(flight, message),
     933                           score)
     934
     935#---------------------------------------------------------------------------------------
     936
     937class TransponderChecker(PatientFaultChecker):
     938    """Check if the transponder is used properly."""
     939    def isCondition(self, flight, aircraft, oldState, state):
     940        """Check if the fault condition holds."""
     941        return state.xpdrC is not None and \
     942               ((state.xpdrC and flight.stage in
     943                 [const.STAGE_BOARDING, const.STAGE_PARKING]) or \
     944                (not state.xpdrC and flight.stage in
     945                 [const.STAGE_TAKEOFF, const.STAGE_RTO, const.STAGE_CLIMB,
     946                  const.STAGE_CRUISE, const.STAGE_DESCENT,
     947                  const.STAGE_LANDING, const.STAGE_GOAROUND]))
     948
     949    def logFault(self, flight, aircraft, logger, oldState, state):
     950        """Log the fault."""
     951        score = 0
     952        message = "Transponder was %s" % \
     953                  (("mode C" if state.xpdrC else "standby"),)
     954        flight.handleFault(TransponderChecker, state.timestamp,
    931955                           FaultChecker._appendDuring(flight, message),
    932956                           score)
  • src/mlx/const.py

    r329 r335  
    187187    """Convert the given stage to a lower-case string."""
    188188    return _stageStrings[stage] if stage in _stageStrings else None
    189        
     189
    190190#-------------------------------------------------------------------------------
    191191
     
    233233    """Get the string equivalent of the given flight type."""
    234234    return _flightTypeStrings[flightType] \
    235            if flightType in _flightTypeStrings else None   
     235           if flightType in _flightTypeStrings else None
    236236
    237237#-------------------------------------------------------------------------------
     
    325325    """Get the string equivalent of the given message type."""
    326326    return _messageTypeStrings[messageType] \
    327            if messageType in _messageTypeStrings else None   
     327           if messageType in _messageTypeStrings else None
    328328
    329329#-------------------------------------------------------------------------------
     
    358358    """Get the string equivalent of the given message level."""
    359359    return _messageLevelStrings[messageLevel] \
    360            if messageLevel in _messageLevelStrings else None   
     360           if messageLevel in _messageLevelStrings else None
    361361
    362362def string2messageLevel(str):
     
    476476    """Get the string equivalent of the given fuelTank."""
    477477    return _fuelTankStrings[fuelTank] \
    478            if fuelTank in _fuelTankStrings else None   
     478           if fuelTank in _fuelTankStrings else None
    479479
    480480#-------------------------------------------------------------------------------
     
    525525
    526526#-------------------------------------------------------------------------------
    527 
  • test/test1.txt

    r329 r335  
     1set xpdrC=1
    12set lights=0
     3set noseGear=100
     4set flapsControl=0
    25set zfw=46741 hour=7 min=50
    36set latitude=47.44 longitude=19.26
     
    710set gs=10 ias=10
    811set flapsControl=37.5
     12set xpdrC=0
    913set gs=60 ias=60
    1014set lights=21
     
    2327set altitude=22001
    2428set vs=-200
     29set nav1=116.3
    2530set flapsControl=87.5
    2631set ias=130 gs=130
     
    2833set ias=125 gs=125
    2934set radioAltitude=3200
    30 set radioAltitude=3100
    31 set radioAltitude=3000
    32 set radioAltitude=2900
    33 set radioAltitude=2800
    34 set radioAltitude=2700
    35 set radioAltitude=2600
    36 set radioAltitude=2521
    37 set radioAltitude=2510
    38 set radioAltitude=2500
    39 set radioAltitude=2500
    40 set radioAltitude=2499
    41 set radioAltitude=2520
    42 set radioAltitude=2400
    43 set radioAltitude=2300
    44 set radioAltitude=2200
    45 set radioAltitude=2100
    46 set radioAltitude=2018
    47 set radioAltitude=1950
    48 set radioAltitude=1800
    49 set radioAltitude=1600
    50 set radioAltitude=1550
    51 set radioAltitude=1450
    52 set radioAltitude=1590
    53 set radioAltitude=1499
    54 set radioAltitude=1400
    55 set radioAltitude=1300
    56 set radioAltitude=1200
    57 set radioAltitude=1200
    5835set radioAltitude=1100
    59 set radioAltitude=1001
    60 set radioAltitude=912
    61 set radioAltitude=832
    62 set radioAltitude=705
    63 set radioAltitude=599
    64 set radioAltitude=501
    65 set radioAltitude=412
    66 set radioAltitude=331
    67 set radioAltitude=241
    68 set radioAltitude=102
    69 set radioAltitude=90
    7036set noseGear=100
    71 set radioAltitude=80
    72 set radioAltitude=70
    73 set radioAltitude=60
    74 set radioAltitude=51
    75 set radioAltitude=42
    7637set radioAltitude=29
    7738set radioAltitude=9
     
    8243set ias=35 gs=35
    8344set ias=20 gs=20
     45set xpdrC=1
    8446set ias=0 gs=0
    8547set parking=yes
Note: See TracChangeset for help on using the changeset viewer.