Changeset 263:7ee78a903649


Ignore:
Timestamp:
06/28/12 17:24:45 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

RPM is handled properly and the fuel tanks of Li-2 match the simulator

Location:
src/mlx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r243 r263  
    669669    - rpm: left, right
    670670    - reverser: left, right."""
    671     fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT,
    672                  const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX]
     671    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     672    # fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT,
     673    #              const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX]
    673674
    674675    def __init__(self, flight):
  • src/mlx/checks.py

    r243 r263  
    572572        """Determine if the engines are in such a state that the lights should
    573573        be on."""
    574         return max(state.n1)>5
     574        if state.n1 is not None:
     575            return max(state.n1)>5
     576        elif state.rpm is not None:
     577            return max(state.rpm)>0
     578        else:
     579            return False
    575580
    576581#---------------------------------------------------------------------------------------
     
    582587        """Determine if the engines are in such a state that the lights should
    583588        be on."""
    584         return max(state.n1[1:])>5
    585    
     589        return max(state.n1[1:])>5   
    586590
    587591#---------------------------------------------------------------------------------------
    588592
    589593class BankChecker(SimpleFaultChecker):
    590     """Check for the anti-collision light being off at high N1 values."""
     594    """Check for the bank is within limits."""
    591595    def isCondition(self, flight, aircraft, oldState, state):
    592596        """Check if the fault condition holds."""
     
    973977    def isCondition(self, flight, aircraft, oldState, state):
    974978        """Check if the fault condition holds."""
    975         return flight.stage==const.STAGE_TAKEOFF and max(state.n1)>97
     979        return flight.stage==const.STAGE_TAKEOFF and \
     980               state.n1 is not None and max(state.n1)>97
    976981               
    977982    def logFault(self, flight, aircraft, logger, oldState, state):
    978983        """Log the fault."""
    979         print state.n1
    980984        flight.handleFault(ThrustChecker, state.timestamp,
    981985                           FaultChecker._appendDuring(flight,
  • src/mlx/fs.py

    r243 r263  
    188188    - n1[]: the N1 values of the turbine engines (array of floats
    189189    of as many items as the number of engines, present only for aircraft with
    190     turbines)
     190    turbines, for other aircraft it is None)
    191191    - rpm[]: the RPM values of the piston engines (array of floats
    192192    of as many items as the number of engines, present only for aircraft with
    193     pistons)
     193    pistons, for other aircraft it is None)
    194194    - reverser[]: an array of booleans indicating if the thrust reversers are
    195195    activated on any of the engines. The number of items equals to the number
  • src/mlx/fsuipc.py

    r243 r263  
    13881388            self._addOffsetWithIndexMember(data, offset+4, "u")  # tank capacity
    13891389
    1390         if self._isN1:
    1391             self._engineStartIndex = len(data)
    1392             for i in range(0, self._numEngines):
     1390        self._engineStartIndex = len(data)
     1391        for i in range(0, self._numEngines):
     1392            self._addOffsetWithIndexMember(data, 0x088c + i * 0x98, "h")  # throttle lever
     1393            if self._isN1:
    13931394                self._addOffsetWithIndexMember(data, 0x2000 + i * 0x100, "f")  # N1
    1394                 self._addOffsetWithIndexMember(data, 0x088c + i * 0x98, "h")  # throttle lever
     1395            else:
     1396                self._addOffsetWithIndexMember(data, 0x0898 + i * 0x98, "H")  # RPM
     1397                self._addOffsetWithIndexMember(data, 0x08c8 + i * 0x98, "H")  # RPM scaler
    13951398       
    13961399    def getAircraftState(self, aircraft, timestamp, data):
     
    14101413            state.fuel.append(fuel)
    14111414
    1412         state.n1 = []
     1415
     1416        state.n1 = [] if self._isN1 else None
     1417        state.rpm = None if self._isN1 else []
     1418        itemsPerEngine = 2 if self._isN1 else 3
     1419       
    14131420        state.reverser = []
    14141421        for i in range(self._engineStartIndex,
    1415                        self._engineStartIndex + 2*self._numEngines, 2):
    1416             state.n1.append(data[i])
    1417             state.reverser.append(data[i+1]<0)
     1422                       self._engineStartIndex +
     1423                       itemsPerEngine*self._numEngines,
     1424                       itemsPerEngine):
     1425            state.reverser.append(data[i]<0)
     1426            if self._isN1:
     1427                state.n1.append(data[i+1])
     1428            else:
     1429                state.rpm.append(data[i+1] * data[i+2]/65536.0)
    14181430
    14191431        return state
     
    16051617            __init__(flapsNotches = [0, 15, 30, 45],
    16061618                     fuelTanks = acft.DC3.fuelTanks,
    1607                      numEngines = 2)
     1619                     numEngines = 2, isN1 = False)
    16081620
    16091621    @property
    16101622    def name(self):
    16111623        """Get the name for this aircraft model."""
    1612         return "FSUIPC/Generic Lisunov Li-2"
     1624        return "FSUIPC/Generic Lisunov Li-2 (DC-3)"
    16131625
    16141626#------------------------------------------------------------------------------
  • src/mlx/gui/monitor.py

    r228 r263  
    286286            self._fuel.set_text(fuelStr)
    287287
    288             if hasattr(aircraftState, "n1"):
     288            if aircraftState.n1 is not None:
    289289                n1Str = ""
    290290                for n1 in aircraftState.n1:
    291291                    if n1Str: n1Str += ", "
    292292                    n1Str += "%.0f" % (n1,)
    293             elif hasattr(aircraftState, "rpm"):
     293            elif aircraftState.rpm is not None:
    294294                n1Str = ""
    295295                for rpm in aircraftState.rpm:
Note: See TracChangeset for help on using the changeset viewer.