Changeset 1102:5f3549b61301


Ignore:
Timestamp:
09/16/23 11:53:25 (14 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Support for the Felis Tu-154-B2 model (re #372, #373)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r1073 r1102  
    22342234#------------------------------------------------------------------------------
    22352235
     2236class FelisT154B2Model(T154Model):
     2237    """Model for Felis' Tupolev Tu-154-B2 aircraft."""
     2238    @staticmethod
     2239    def doesHandle(aircraft, data):
     2240        """Determine if this model handler handles the aircraft with the given
     2241        name."""
     2242        (tailnum, author, description, notes, icao, liveryPath) = data
     2243        return aircraft.type==const.AIRCRAFT_T154 and \
     2244          author.find("Felis")!=-1 and \
     2245          description.find("Tu154B2")!=-1
     2246
     2247    @property
     2248    def name(self):
     2249        """Get the name for this aircraft model."""
     2250        return "X-Plane/Felis Tupolev Tu-154-B2"
     2251
     2252    def addMonitoringData(self, data, fsType):
     2253        """Add the model-specific monitoring data to the given array."""
     2254        super(FelisT154B2Model, self).addMonitoringData(data, fsType)
     2255
     2256        self._parkingBrakeIndex = len(data)
     2257        self._addDatarefWithIndexMember(data,
     2258                                        "sim/custom/controll/parking_brake",
     2259                                        TYPE_INT)
     2260        self._cgIndex = len(data)
     2261        self._addDatarefWithIndexMember(data,
     2262                                        "sim/custom/misc/cg_pos_actual",
     2263                                        TYPE_FLOAT)
     2264
     2265    def getAircraftState(self, aircraft, timestamp, data):
     2266        """Get the aircraft state.
     2267
     2268        Get it from the parent, and then invert the pitot heat state."""
     2269        state = super(FelisT154B2Model, self).getAircraftState(aircraft,
     2270                                                               timestamp,
     2271                                                               data)
     2272
     2273        state.parking = data[self._parkingBrakeIndex]!=0
     2274        state.cog = data[self._cgIndex]/100.0
     2275
     2276        return state
     2277
     2278#------------------------------------------------------------------------------
     2279
    22362280class YK40Model(GenericAircraftModel):
    22372281    """Generic model for the Yakovlev Yak-40 aircraft."""
     
    22792323AircraftModel.registerSpecial(FJSDH8DXPModel)
    22802324AircraftModel.registerSpecial(FelisT154Model)
     2325AircraftModel.registerSpecial(FelisT154B2Model)
    22812326
    22822327#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.