Changeset 368:264ef9c471f3


Ignore:
Timestamp:
12/16/12 14:29:07 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added support for the Project Tupolev Tu-154 and made ADF frequency handling work better (#153)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/fsuipc.py

    r366 r368  
    19581958#------------------------------------------------------------------------------
    19591959
     1960class PTT154Model(T154Model):
     1961    """Project Tupolev Tu-154."""
     1962    @staticmethod
     1963    def doesHandle(aircraft, (name, airPath)):
     1964        """Determine if this model handler handles the aircraft with the given
     1965        name."""
     1966        print "PTT154Model.doesHandle", aircraft.type, name, airPath
     1967        return aircraft.type==const.AIRCRAFT_T154 and \
     1968               name.find("Tu-154")!=-1 and \
     1969               os.path.basename(airPath).startswith("154b_")
     1970
     1971    def __init__(self):
     1972        """Construct the model."""
     1973        super(PTT154Model, self).__init__()
     1974        self._adf1 = None
     1975        self._adf2 = None
     1976        self._lastValue = None
     1977
     1978    @property
     1979    def name(self):
     1980        """Get the name for this aircraft model."""
     1981        return "FSUIPC/Project Tupolev Tu-154"
     1982
     1983    def getAircraftState(self, aircraft, timestamp, data):
     1984        """Get an aircraft state object for the given monitoring data.
     1985
     1986        This removes the reverser value for the middle engine."""
     1987        state = super(PTT154Model, self).getAircraftState(aircraft, timestamp, data)
     1988
     1989        adf1 = state.adf1
     1990        if self._adf1 is None:
     1991            self._adf1 = self._adf2 = adf1
     1992        elif adf1 != self._lastValue and adf1 != self._adf1 and \
     1993             adf1 != self._adf2:
     1994            if self._lastValue==self._adf2:
     1995                self._adf1 = adf1
     1996            else:
     1997                self._adf2 = adf1
     1998
     1999        self._lastValue = adf1
     2000        state.adf1 = self._adf1
     2001        state.adf2 = self._adf2
     2002
     2003        return state
     2004
     2005
     2006#------------------------------------------------------------------------------
     2007
    19602008class YK40Model(GenericAircraftModel):
    19612009    """Generic model for the Yakovlev Yak-40 aircraft."""
     
    19982046AircraftModel.registerSpecial(DreamwingsDH8DModel)
    19992047AircraftModel.registerSpecial(DAF70Model)
    2000 
    2001 #------------------------------------------------------------------------------
     2048AircraftModel.registerSpecial(PTT154Model)
     2049
     2050#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.