Changeset 539:750f64278751 for src/mlx


Ignore:
Timestamp:
09/18/13 04:52:50 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The no-strobe speed checker also works for models without strobe and transponder (re #211)

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r526 r539  
    113113        self.reverseMinSpeed = 60
    114114
     115        self.needNoStrobeSpeedCheck = False
     116
    115117        self._checkers = []
    116118
     
    178180        self._checkers.append(checks.PayloadChecker())
    179181
    180         self._appendSpeedChecker()
     182        self._checkers.append(checks.NoStrobeSpeedChecker())
     183        self._checkers.append(checks.SpeedChecker())
    181184        self._checkers.append(checks.VSChecker())
    182185
     
    480483        self._checkers.append(checks.StrobeLightsChecker())
    481484
    482     def _appendSpeedChecker(self):
    483         """Append the speed checker.
    484 
    485         This default implementation used the SpeedChecker."""
    486         self._checkers.append(checks.SpeedChecker())
    487 
    488485    def _speedToLog(self, speed):
    489486        """Convert the given speed (being either None or expressed in the
     
    651648        """Get the derate type for this type."""
    652649        return DERATE_BOEING
    653 
    654     # def _appendSpeedChecker(self):
    655     #     """Append the NoStrobeSpeedChecker to the checkers.
    656 
    657     #     FOR TESTING ONLY, THIS FUNCTION SHOULD NORMALLY BE COMMENTED OUT!!!"""
    658     #     self._checkers.append(checks.NoStrobeSpeedChecker())
    659650
    660651#---------------------------------------------------------------------------------------
     
    906897        self.reverseMinSpeed = 50
    907898
     899        self.needNoStrobeSpeedCheck = True
     900
    908901    @property
    909902    def derateType(self):
     
    927920        self._checkers.append(checks.LandingLightsChecker())
    928921        self._checkers.append(checks.NavLightsChecker())
    929 
    930     def _appendSpeedChecker(self):
    931         """Append the NoStrobeSpeedChecker to the checkers."""
    932         self._checkers.append(checks.NoStrobeSpeedChecker())
    933922
    934923#---------------------------------------------------------------------------------------
     
    954943        self.reverseMinSpeed = 50
    955944
     945        self.needNoStrobeSpeedCheck = True
     946
    956947    @property
    957948    def speedInKnots(self):
     
    975966        self._checkers.append(checks.LandingLightsChecker())
    976967        self._checkers.append(checks.NavLightsChecker())
    977 
    978     def _appendSpeedChecker(self):
    979         """Append the NoStrobeSpeedChecker to the checkers."""
    980         self._checkers.append(checks.NoStrobeSpeedChecker())
    981968
    982969#---------------------------------------------------------------------------------------
     
    1000987                                 35 : 135 }
    1001988
     989        self.needNoStrobeSpeedCheck = True
     990
    1002991    @property
    1003992    def speedInKnots(self):
     
    10211010        self._checkers.append(checks.LandingLightsChecker())
    10221011        self._checkers.append(checks.NavLightsChecker())
    1023 
    1024     def _appendSpeedChecker(self):
    1025         """Append the NoStrobeSpeedChecker to the checkers."""
    1026         self._checkers.append(checks.NoStrobeSpeedChecker())
    10271012
    10281013#---------------------------------------------------------------------------------------
  • src/mlx/checks.py

    r529 r539  
    13421342    """Check if the speed is in the prescribed limits."""
    13431343    @staticmethod
     1344    def needNoStrobe(aircraft, state):
     1345        """Determine if the given aircraft and state needs a strobeless speed
     1346        checking."""
     1347        return aircraft.needNoStrobeSpeedCheck or \
     1348               (state.strobeLightsOn is None and state.xpdrC is None)
     1349
     1350    @staticmethod
    13441351    def logSpeedFault(flight, state, stage = None, updateID = None):
    13451352        """Log the speed fault."""
     
    13561363    def isCondition(self, flight, aircraft, oldState, state):
    13571364        """Check if the fault condition holds."""
    1358         return flight.stage in [const.STAGE_PUSHANDTAXI,
    1359                                 const.STAGE_RTO,
    1360                                 const.STAGE_TAXIAFTERLAND] and \
     1365        return not self.needNoStrobe(aircraft, state) and \
     1366            flight.stage in [const.STAGE_PUSHANDTAXI,
     1367                             const.STAGE_RTO,
     1368                             const.STAGE_TAXIAFTERLAND] and \
    13611369            state.groundSpeed>50
    13621370
     
    13891397    def check(self, flight, aircraft, logger, oldState, state):
    13901398        """Check the state as described above."""
    1391         if flight.stage==const.STAGE_PUSHANDTAXI or \
    1392            flight.stage==const.STAGE_RTO:
    1393             self._checkPushAndTaxi(flight, aircraft, state)
    1394         elif flight.stage==const.STAGE_TAXIAFTERLAND:
    1395             if state.groundSpeed>50:
    1396                 SpeedChecker.logSpeedFault(flight, state)
    1397         else:
    1398             self._takeoffState = None
     1399        if SpeedChecker.needNoStrobe(aircraft, state):
     1400            if flight.stage==const.STAGE_PUSHANDTAXI or \
     1401               flight.stage==const.STAGE_RTO:
     1402                self._checkPushAndTaxi(flight, aircraft, state)
     1403            elif flight.stage==const.STAGE_TAXIAFTERLAND:
     1404                if state.groundSpeed>50:
     1405                    SpeedChecker.logSpeedFault(flight, state)
     1406            else:
     1407                self._takeoffState = None
    13991408
    14001409    def _checkPushAndTaxi(self, flight, aircraft, state):
  • src/mlx/fsuipc.py

    r535 r539  
    16261626        return "FSUIPC/Generic Boeing 737"
    16271627
     1628    # Note: the function below should be enabled if testing the speed-based
     1629    # takeoff on Linux
     1630    # def getAircraftState(self, aircraft, timestamp, data):
     1631    #     """Get the aircraft state.
     1632
     1633    #     Get it from the parent, and then check some PMDG-specific stuff."""
     1634    #     state = super(B737Model, self).getAircraftState(aircraft,
     1635    #                                                     timestamp,
     1636    #                                                     data)
     1637    #     state.strobeLightsOn = None
     1638    #     state.xpdrC = None
     1639
     1640    #     return state
     1641
    16281642#------------------------------------------------------------------------------
    16291643
     
    16901704            apalthold = data[self._pmdgidx_apalthold]
    16911705            state.apAltitudeHold = apalthold>=3 and apalthold<=6
     1706            state.xpdrC = data[self._pmdgidx_xpdr]==4
     1707
     1708            # Uncomment the following to test the speed-based takeoff
     1709            # state.strobeLightsOn = None
     1710            # state.xpdrC = None
    16921711        else:
    16931712            state.apMaster = data[self._pmdgidx_cmda]!=0
    16941713            state.apHeadingHold = data[self._pmdgidx_aphdgsel]!=0
    16951714            state.apAltitudeHold = data[self._pmdgidx_apalthold]!=0
    1696             #state.strobeLightsOn = data[self._pmdgidx_lts_positionsw]==0x02
     1715
     1716            # state.strobeLightsOn = data[self._pmdgidx_lts_positionsw]==0x02
     1717            # state.xpdrC = data[self._pmdgidx_xpdr]==4
    16971718            state.strobeLightsOn = None
    1698 
    1699         state.xpdrC = data[self._pmdgidx_xpdr]==4
     1719            state.xpdrC = None
     1720
    17001721        state.apHeading = data[self._pmdgidx_aphdg]
    17011722        state.apAltitude = data[self._pmdgidx_apalt]
Note: See TracChangeset for help on using the changeset viewer.