Changeset 10:103229d7ace5


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

Spoiler deployment is logged

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TODO

    r9 r10  
    22
    33- Test:
    4    - Mach cruise speed
    5    - ZFW at takeoff
    6    - Speed, heading, pitch at takeoff
  • src/acft.py

    r9 r10  
    4444
    4545        self._checkers.append(checks.GearsLogger())
    46 
    4746        self._checkers.append(checks.CruiseSpeedLogger())
     47        self._checkers.append(checks.SpoilerLogger())
    4848
    4949    @property
  • src/checks.py

    r9 r10  
    109109                if state.altitude>24500.0:
    110110                    logger.message(state.timestamp,
    111                                    "Cruise speed: %.2f mach" % (state.mach,))
     111                                   "Cruise speed: %.3f mach" % (state.mach,))
    112112                else:
    113113                    logger.message(state.timestamp,
    114114                                   "Cruise speed: %.0f knots" % (state.ias,))
    115115                self._lastTime = state.timestamp
     116
     117#---------------------------------------------------------------------------------------
     118
     119class SpoilerLogger(StateChecker):
     120    """Logger for the cruise speed."""
     121    def __init__(self):
     122        """Construct the logger."""
     123        self._logged = False
     124        self._spoilerExtension = None
     125   
     126    def check(self, flight, aircraft, logger, oldState, state):
     127        """Log the cruise speed if necessary."""
     128        if flight.stage==const.STAGE_LANDING and not self._logged:
     129            if state.onTheGround:
     130                if state.spoilerExtension!=self._spoilerExtension:
     131                    logger.message(state.timestamp, "Spoilers deployed")
     132                    self._logged = True
     133            else:
     134                self._spoilerExtension = state.spoilerExtension
    116135
    117136#---------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.