Changeset 289:ab76473b8f85


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

Fixed the fuel handling of the DC-3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/fsuipc.py

    r274 r289  
    16651665class DC3Model(GenericAircraftModel):
    16661666    """Generic model for the Lisunov Li-2 (DC-3) aircraft."""
    1667     fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     1667    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE,
     1668                 const.FUELTANK_RIGHT]   
    16681669    # fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT,
    16691670    #              const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX]
     
    16751676                     fuelTanks = DC3Model.fuelTanks,
    16761677                     numEngines = 2, isN1 = False)
     1678        self._leftLevel = 0.0
     1679        self._rightLevel = 0.0
    16771680
    16781681    @property
     
    16961699        if addCapacities:
    16971700            centreCapacity = rawFuelData[1][2]
     1701            self._leftLevel = self._rightLevel = \
     1702                centreAmount / centreCapacity / 2.0
    16981703            fuelData = [(const.FUELTANK_LEFT_AUX,
    16991704                         rawFuelData[0][1], rawFuelData[0][2]),
     
    17181723        implementation assumes to get the four-tank representation,
    17191724        as returned by getFuel()."""
    1720         leftLevel = 0.0
    1721         centreLevel = 0.0
    1722         rightLevel = 0.0
     1725        leftLevel = None
     1726        centreLevel = None
     1727        rightLevel = None
    17231728       
    17241729        for (tank, level) in levels:
    1725             if tank==const.FUELTANK_LEFT_AUX: leftLevel += level
    1726             elif tank==const.FUELTANK_LEFT or  tank==const.FUELTANK_RIGHT:
    1727                 centreLevel += level
    1728             elif tank==const.FUELTANK_RIGHT_AUX: rightLevel += level
    1729 
    1730         super(DC3Model, self).setFuelLevel([(const.FUELTANK_LEFT, leftLevel),
    1731                                             (const.FUELTANK_CENTRE,
    1732                                             centreLevel),
    1733                                             (const.FUELTANK_RIGHT, rightLevel)])
     1730            if tank==const.FUELTANK_LEFT_AUX:
     1731                leftLevel = level if leftLevel is None else (leftLevel + level)
     1732            elif tank==const.FUELTANK_LEFT:
     1733                level /= 2.0
     1734                centreLevel = (self._rightLevel + level) \
     1735                              if centreLevel is None else (centreLevel + level)
     1736                self._leftLevel = level
     1737            elif tank==const.FUELTANK_RIGHT:
     1738                level /= 2.0
     1739                centreLevel = (self._leftLevel + level) \
     1740                              if centreLevel is None else (centreLevel + level)
     1741                self._rightLevel = level
     1742            elif tank==const.FUELTANK_RIGHT_AUX:
     1743                rightLevel = level if rightLevel is None \
     1744                             else (rightLevel + level)
     1745
     1746        levels = []
     1747        if leftLevel is not None: levels.append((const.FUELTANK_LEFT,
     1748                                                 leftLevel))
     1749        if centreLevel is not None: levels.append((const.FUELTANK_CENTRE,
     1750                                                   centreLevel))
     1751        if rightLevel is not None: levels.append((const.FUELTANK_RIGHT,
     1752                                                 rightLevel))
     1753
     1754        super(DC3Model, self).setFuelLevel(handler, levels)
    17341755
    17351756#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.