Changeset 344:1374c29962a3


Ignore:
Timestamp:
12/02/12 08:11:57 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added the speed checker for the strobeless planes (#143)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r340 r344  
    138138
    139139        self._checkers.append(checks.SpeedChecker())
     140        #self._checkers.append(checks.NoStrobeSpeedChecker())
    140141        self._checkers.append(checks.VSChecker())
    141142
  • src/mlx/checks.py

    r341 r344  
    5656                aircraft.setStage(state, const.STAGE_PUSHANDTAXI)
    5757        elif stage==const.STAGE_PUSHANDTAXI or stage==const.STAGE_RTO:
    58             if state.landingLightsOn or state.strobeLightsOn or \
    59                state.groundSpeed>80.0:
     58            if state.landingLightsOn or state.strobeLightsOn:
    6059                aircraft.setStage(state, const.STAGE_TAKEOFF)
    6160        elif stage==const.STAGE_TAKEOFF:
     
    12851284class SpeedChecker(SimpleFaultChecker):
    12861285    """Check if the speed is in the prescribed limits."""
     1286    @staticmethod
     1287    def logSpeedFault(flight, state):
     1288        """Log the speed fault."""
     1289        message = "Taxi speed over %.0f %s" % \
     1290                  (flight.speedFromKnots(50), flight.getEnglishSpeedUnit())
     1291        flight.handleFault((SpeedChecker, flight.stage), state.timestamp,
     1292                           FaultChecker._appendDuring(flight, message),
     1293                           FaultChecker._getLinearScore(50, 80, 10, 15,
     1294                                                        state.groundSpeed))
     1295
    12871296    def isCondition(self, flight, aircraft, oldState, state):
    12881297        """Check if the fault condition holds."""
     
    12931302    def logFault(self, flight, aircraft, logger, oldState, state):
    12941303        """Log the fault."""
    1295         message = "Taxi speed over %.0f %s" % \
    1296                   (flight.speedFromKnots(50), flight.getEnglishSpeedUnit())
    1297         flight.handleFault(SpeedChecker, state.timestamp,
    1298                            FaultChecker._appendDuring(flight, message),
    1299                            FaultChecker._getLinearScore(50, 80, 10, 15,
    1300                                                         state.groundSpeed))
     1304        self.logSpeedFault(flight, state)
     1305
     1306#---------------------------------------------------------------------------------------
     1307
     1308class NoStrobeSpeedChecker(StateChecker):
     1309    """Checker for the ground speed of aircraft that have no strobe lights by
     1310    which to detect the takeoff stage.
     1311
     1312    If, during the PUSHANDTAXI stage the speed exceeds 50 knots, the state as
     1313    saved as a provisional takeoff state. If the speed then decreases below 50
     1314    knots, or the plane remains on the ground for more than 20 seconds, a taxi
     1315    speed error is logged with the highest ground speed detected.
     1316
     1317    If the plane becomes airborne within 20 seconds, the stage becomes TAKEOFF,
     1318    and the previously saved takeoff state is logged.
     1319
     1320    During the TAXIAFTERLAND stage, speed is checked as in case of
     1321    SpeedChecker."""
     1322    def __init__(self):
     1323        """Initialize the speed checker."""
     1324        self._takeoffState = None
     1325        self._highestSpeedState = None
     1326
     1327    def check(self, flight, aircraft, logger, oldState, state):
     1328        """Check the state as described above."""
     1329        if flight.stage==const.STAGE_PUSHANDTAXI:
     1330            self._checkPushAndTaxi(flight, aircraft, state)
     1331        elif flight.stage==const.STAGE_TAXIAFTERLAND:
     1332            if state.groundSpeed>50:
     1333                SpeedChecker.logSpeedFault(flight, state)
     1334
     1335    def _checkPushAndTaxi(self, flight, aircraft, state):
     1336        """Check the speed during the push and taxi stage."""
     1337        if state.groundSpeed>50:
     1338            if self._takeoffState is None:
     1339                self._takeoffState = state
     1340                self._highestSpeedState = state
     1341            else:
     1342                if state.groundSpeed>self._highestSpeedState.groundSpeed:
     1343                    self._highestSpeedState = state
     1344
     1345                if state.timestamp > (self._takeoffState.timestamp + 20):
     1346                    SpeedChecker.logSpeedFault(flight, self._highestSpeedState)
     1347                elif not state.onTheGround:
     1348                    aircraft.setStage(self._takeoffState, const.STAGE_TAKEOFF)
     1349                    self._takeoffState = None
     1350        elif self._takeoffState is not None:
     1351            SpeedChecker.logSpeedFault(flight, self._highestSpeedState)
     1352            self._takeoffState = None
    13011353
    13021354#---------------------------------------------------------------------------------------
  • test/test1.txt

    r335 r344  
     1set onTheGround=yes
     2set gs=0
    13set xpdrC=1
    24set lights=0
     
    79set nav1=115.9
    810set adf1=382
     11set parking=yes
    912set parking=no
    1013set gs=10 ias=10
Note: See TracChangeset for help on using the changeset viewer.