Changeset 314:09f49b9eef64 for src/mlx


Ignore:
Timestamp:
09/30/12 06:53:14 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added support for the landing lights and the NAV frequencies being unreliable and the Digital Aviation F70 model

Location:
src/mlx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r307 r314  
    301301    def _changed(self, oldState, state):
    302302        """Determine if the value has changed."""
    303         return self._getValue(oldState)!=self._getValue(state)
     303        currentValue = self._getValue(state)
     304        return currentValue is not None and self._getValue(oldState)!=currentValue
    304305
    305306#---------------------------------------------------------------------------------------
     
    759760    def isCondition(self, flight, aircraft, oldState, state):
    760761        """Check if the fault condition holds."""
    761         return (flight.stage==const.STAGE_BOARDING and \
    762                 state.landingLightsOn and state.onTheGround) or \
    763                (flight.stage==const.STAGE_TAKEOFF and \
    764                 not state.landingLightsOn and not state.onTheGround) or \
    765                (flight.stage in [const.STAGE_CLIMB, const.STAGE_CRUISE,
    766                                  const.STAGE_DESCENT] and \
    767                 state.landingLightsOn and state.altitude>12500) or \
    768                (flight.stage==const.STAGE_LANDING and \
    769                 not state.landingLightsOn and state.onTheGround) or \
    770                (flight.stage==const.STAGE_PARKING and \
    771                 state.landingLightsOn and state.onTheGround)
     762        return state.landingLightsOn is not None and \
     763               ((flight.stage==const.STAGE_BOARDING and \
     764                 state.landingLightsOn and state.onTheGround) or \
     765                (flight.stage==const.STAGE_TAKEOFF and \
     766                 not state.landingLightsOn and not state.onTheGround) or \
     767                (flight.stage in [const.STAGE_CLIMB, const.STAGE_CRUISE,
     768                                  const.STAGE_DESCENT] and \
     769                 state.landingLightsOn and state.altitude>12500) or \
     770                (flight.stage==const.STAGE_LANDING and \
     771                 not state.landingLightsOn and state.onTheGround) or \
     772                (flight.stage==const.STAGE_PARKING and \
     773                 state.landingLightsOn and state.onTheGround))
    772774               
    773775    def logFault(self, flight, aircraft, logger, oldState, state):
  • src/mlx/fs.py

    r298 r314  
    215215    - antiCollisionLightsOn: a boolean indicating if the anti-collision lights are on
    216216    - strobeLightsOn: a boolean indicating if the strobe lights are on
    217     - landingLightsOn: a boolean indicating if the landing lights are on
     217    - landingLightsOn: a boolean indicating if the landing lights are on. If
     218    the detection of the state of the landing lights is unreliable, and should
     219    not be considered, this is set to None.
    218220    - pitotHeatOn: a boolean indicating if the pitot heat is on
    219221    - parking: a boolean indicating if the parking brake is set
     
    225227    (float)
    226228    - altimeter: the altimeter setting in hPa (float)
    227     - nav1: the frequency of the NAV1 radio in MHz (string)
    228     - nav2: the frequency of the NAV1 radio in MHz (string)
     229    - nav1: the frequency of the NAV1 radio in MHz (string). Can be None, if
     230    the frequency is unreliable or meaningless.
     231    - nav2: the frequency of the NAV1 radio in MHz (string). Can be None, if
     232    the frequency is unreliable or meaningless.
    229233    - squawk: the transponder code (string)
    230234    - windSpeed: the speed of the wind at the aircraft in knots (float)
  • src/mlx/fsuipc.py

    r298 r314  
    896896            return False
    897897
     898        print "fsuipc.Simulator: new aircraft name and air file path: %s, %s" % \
     899              (name, airPath)
     900
    898901        self._aircraftName = aircraftName
    899902        needNew = self._aircraftModel is None
     
    16611664
    16621665        return state
     1666
    16631667#------------------------------------------------------------------------------
    16641668
     
    16961700        """Get the name for this aircraft model."""
    16971701        return "FSUIPC/Generic Fokker 70"
     1702
     1703#------------------------------------------------------------------------------
     1704
     1705class DAF70Model(F70Model):
     1706    """Model for the Digital Aviation F70 implementation on FS9."""
     1707    @staticmethod
     1708    def doesHandle(aircraft, (name, airPath)):
     1709        """Determine if this model handler handles the aircraft with the given
     1710        name."""
     1711        return aircraft.type == const.AIRCRAFT_F70 and \
     1712               (airPath.endswith("fokker70_2k4_v4.1.air") or
     1713                airPath.endswith("fokker70_2k4_v4.3.air"))
     1714
     1715    @property
     1716    def name(self):
     1717        """Get the name for this aircraft model."""
     1718        return "FSUIPC/Digital Aviation Fokker 70"
     1719
     1720    def getAircraftState(self, aircraft, timestamp, data):
     1721        """Get the aircraft state.
     1722
     1723        Get it from the parent, and then invert the pitot heat state."""
     1724        state = super(DAF70Model, self).getAircraftState(aircraft,
     1725                                                         timestamp,
     1726                                                         data)
     1727        state.landingLightsOn = None
     1728        state.nav2 = None
     1729
     1730        return state
    16981731
    16991732#------------------------------------------------------------------------------
     
    18811914AircraftModel.registerSpecial(PMDGBoeing737NGModel)
    18821915AircraftModel.registerSpecial(DreamwingsDH8DModel)
    1883 
    1884 #------------------------------------------------------------------------------
     1916AircraftModel.registerSpecial(DAF70Model)
     1917
     1918#------------------------------------------------------------------------------
  • src/mlx/gui/monitor.py

    r300 r314  
    191191
    192192        self.add(alignment)
     193
     194        self._previousState = None
    193195
    194196        self.setData()
     
    249251            self._antiCollisionLightsOn.set_sensitive(False)
    250252            self._strobeLightsOn.set_sensitive(False)
     253            self._landingLightsOn.set_text("LANDING")
    251254            self._landingLightsOn.set_sensitive(False)
    252255            self._pitotHeatOn.set_sensitive(False)
     
    285288            self._altimeter.set_text("%.0f" % (aircraftState.altimeter,))
    286289            self._squawk.set_text(aircraftState.squawk)
    287             self._nav1.set_text(aircraftState.nav1)
    288             self._nav2.set_text(aircraftState.nav2)
     290            self._nav1.set_text("-" if aircraftState.nav1 is None else aircraftState.nav1)
     291            self._nav2.set_text("-" if aircraftState.nav2 is None else aircraftState.nav2)
    289292
    290293            fuelStr = ""
     
    317320            self._antiCollisionLightsOn.set_sensitive(aircraftState.antiCollisionLightsOn)
    318321            self._strobeLightsOn.set_sensitive(aircraftState.strobeLightsOn)
    319             self._landingLightsOn.set_sensitive(aircraftState.landingLightsOn)
     322
     323            if self._previousState is None or \
     324               ((self._previousState.landingLightsOn is None)!=
     325                (aircraftState.landingLightsOn is None)):
     326                if aircraftState.landingLightsOn is None:
     327                    self._landingLightsOn.set_markup('<span strikethrough="true">LANDING</span>')
     328                else:
     329                    self._landingLightsOn.set_text("LANDING")
     330            self._landingLightsOn.set_sensitive(aircraftState.landingLightsOn is True)
     331           
    320332            self._pitotHeatOn.set_sensitive(aircraftState.pitotHeatOn)
    321333            self._parking.set_sensitive(aircraftState.parking)
  • src/mlx/pyuipc_sim.py

    r298 r314  
    13301330    def do_set(self, args):
    13311331        """Handle the set command."""
    1332         arguments = args.split()
     1332        arguments = []
     1333        inWord = False
     1334        inQuote = False
     1335        word = ""
     1336        for c in args:
     1337            if c.isspace() and not inQuote:
     1338                if inWord:
     1339                    arguments.append(word)
     1340                    word = ""
     1341                    inWord = False
     1342            elif c=='"':
     1343                inQuote = not inQuote
     1344            else:
     1345                inWord = True
     1346                word += c
     1347
     1348        if inWord:
     1349            arguments.append(word)
     1350           
    13331351        names = []
    13341352        data = []
Note: See TracChangeset for help on using the changeset viewer.