Changeset 356:a9dd7d794212


Ignore:
Timestamp:
12/13/12 15:49:06 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The radio frequencies are not logged before TAKEOFF and after LANDING (#148)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r355 r356  
    261261    """Base class for classes the instances of which check if a specific change has
    262262    occured in the aircraft's state, and log such change."""
    263     def __init__(self, logInitial = True):
     263    def __init__(self, logInitial = True, excludedStages = None):
    264264        """Construct the logger.
    265265
    266266        If logInitial is True, the initial value will be logged, not just the
    267267        changes later.
     268
     269        If excludedStages is given, it should be a list containing those stages
     270        during which the changes should not be logged.
    268271
    269272        Child classes should define the following functions:
     
    274277        """
    275278        self._logInitial = logInitial
     279        self._excludedStages = [] if excludedStages is None else excludedStages
    276280
    277281    def _getLogTimestamp(self, state, forced):
     
    281285    def check(self, flight, aircraft, logger, oldState, state):
    282286        """Check if the state has changed, and if so, log the new state."""
     287        if flight.stage in self._excludedStages:
     288            return
     289
    283290        shouldLog = False
    284291        if oldState is None:
     
    415422    state possibly with a delay and the logged message comes from a template"""
    416423    def __init__(self, attrName, template, logInitial = True,
    417                  minDelay = 0.0, maxDelay = 0.0):
     424                 excludedStages = None, minDelay = 0.0, maxDelay = 0.0):
    418425        """Construct the object."""
    419426        StateChangeLogger.__init__(self, logInitial = logInitial)
     
    461468
    462469    It also logs the OBS radial set."""
     470    excludedStages = [const.STAGE_BOARDING, const.STAGE_PUSHANDTAXI,
     471                      const.STAGE_RTO, const.STAGE_TAXIAFTERLAND,
     472                      const.STAGE_PARKING]
     473
    463474    @staticmethod
    464475    def getMessage(logName, frequency, obs):
     
    470481    def __init__(self, attrName, logName):
    471482        """Construct the NAV logger."""
    472         StateChangeLogger.__init__(self, logInitial = True)
     483        StateChangeLogger.__init__(self, logInitial = False,
     484                                   excludedStages = self.excludedStages)
    473485        DelayedChangeMixin.__init__(self)
    474486
     
    527539        GenericStateChangeLogger.__init__(self, attr,
    528540                                          "%s: %%s" % (logName,),
     541                                          logInitial = False,
     542                                          excludedStages =
     543                                          NAVLogger.excludedStages,
    529544                                          minDelay = 3.0, maxDelay = 10.0)
    530545
  • test/test1.txt

    r344 r356  
    1313set gs=10 ias=10
    1414set flapsControl=37.5
     15set nav2=112.3
     16set adf1=540
    1517set xpdrC=0
    1618set gs=60 ias=60
     
    2426set noseGear=0
    2527set altitude=2000
     28set nav1=111.5
    2629set flapsControl=0
    2730set altitude=10000
     
    3134set vs=-200
    3235set nav1=116.3
     36set adf2=540
    3337set flapsControl=87.5
    3438set ias=130 gs=130
Note: See TracChangeset for help on using the changeset viewer.