Changeset 635:717c097e0b12


Ignore:
Timestamp:
05/10/15 06:57:21 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The AGL altitude values are logged with aircraft type-specific units (re #264)

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r634 r635  
    242242    def speedInKnots(self):
    243243        """Indicate if the speed is in knots.
     244
     245        This default implementation returns True."""
     246        return True
     247
     248    @property
     249    def aglInFeet(self):
     250        """Indicate if AGL altitudes are to be logged in feet.
    244251
    245252        This default implementation returns True."""
     
    990997        return False
    991998
     999    @property
     1000    def aglInFeet(self):
     1001        """Indicate if AGL altituedes are in feet."""
     1002        return False
     1003
    9921004    def _appendLightsLoggers(self):
    9931005        """Append the loggers needed for the lights."""
     
    10341046
    10351047    @property
     1048    def aglInFeet(self):
     1049        """Indicate if AGL altituedes are in feet."""
     1050        return False
     1051
     1052    @property
    10361053    def derateType(self):
    10371054        """Get the derate type for this type."""
     
    10741091    def speedInKnots(self):
    10751092        """Indicate if the speed is in knots."""
     1093        return False
     1094
     1095    @property
     1096    def aglInFeet(self):
     1097        """Indicate if AGL altituedes are in feet."""
    10761098        return False
    10771099
  • src/mlx/checks.py

    r631 r635  
    185185           flight.stage in [const.STAGE_TAKEOFF, const.STAGE_CLIMB]:
    186186            logger.message(state.timestamp,
    187                            "Initial climb speed: %.0f %s - %.0f ft AGL" % \
     187                           "Initial climb speed: %.0f %s - %.0f %s AGL" % \
    188188                           (flight.speedFromKnots(state.ias),
    189189                            flight.getEnglishSpeedUnit(),
    190                             state.radioAltitude))
     190                            flight.aglFromFeet(state.radioAltitude),
     191                            flight.getEnglishAGLUnit()))
    191192            self._logged = True
    192193
     
    697698        speed = logState.groundSpeed if logState.groundSpeed<80.0 \
    698699                else logState.ias
    699         message = "Flaps %.0f - %.0f %s, %.0f ft AGL, %.0f ft AMSL" % \
     700        message = "Flaps %.0f - %.0f %s, %.0f %s AGL, %.0f ft AMSL" % \
    700701               (logState.flapsSet, flight.speedFromKnots(speed),
    701                 flight.getEnglishSpeedUnit(), logState.radioAltitude,
     702                flight.getEnglishSpeedUnit(),
     703                flight.aglFromFeet(logState.radioAltitude),
     704                flight.getEnglishAGLUnit(),
    702705                logState.altitude)
    703706
     
    715718    def _getMessage(self, flight, state, forced):
    716719        """Get the message to log on a change."""
    717         return "Gears SET to %s at %.0f %s, %.0f ft, %.0f ft AGL" % \
     720        return "Gears SET to %s at %.0f %s, %.0f ft, %.0f %s AGL" % \
    718721            ("DOWN" if state.gearControlDown else "UP",
    719722             flight.speedFromKnots(state.ias),
    720723             flight.getEnglishSpeedUnit(),
    721              state.altitude, state.radioAltitude)
     724             state.altitude,
     725             flight.aglFromFeet(state.radioAltitude),
     726             flight.getEnglishAGLUnit())
    722727
    723728#---------------------------------------------------------------------------------------
  • src/mlx/flight.py

    r609 r635  
    321321        knots."""
    322322        return self.aircraft.speedInKnots if self.aircraft is not None \
     323               else True
     324
     325    @property
     326    def aglInFeet(self):
     327        """Determine if the AGL altutides for the flight are to be expressed in
     328        feet."""
     329        return self.aircraft.aglInFeet if self.aircraft is not None \
    323330               else True
    324331
     
    506513        return knots if self.speedInKnots else knots * const.KNOTSTOKMPH
    507514
     515    def aglFromFeet(self, feet):
     516        """Convert the given AGL altitude value expressed in feet into the
     517        flight's AGL altitude unit."""
     518        return feet if self.aglInFeet else feet * const.FEETTOMETRES
     519
    508520    def speedToKnots(self, speed):
    509521        """Convert the given speed expressed in the flight's speed unit into
     
    514526        """Get the English name of the speed unit used by the flight."""
    515527        return "knots" if self.speedInKnots else "km/h"
     528
     529    def getEnglishAGLUnit(self):
     530        """Get the English name of the AGL unit used by the flight."""
     531        return "ft" if self.aglInFeet else "m"
    516532
    517533    def getI18NSpeedUnit(self):
Note: See TracChangeset for help on using the changeset viewer.