Ignore:
Timestamp:
07/05/12 17:51:58 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Reworked fuel handling so that the model can tell what tanks there are

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r262 r274  
    208208        self._updateFlownDistance(currentState)
    209209       
    210         self.endFuel = sum(currentState.fuel)
     210        self.endFuel = currentState.totalFuel
    211211        if self.startFuel is None:
    212212            self.startFuel = self.endFuel
     
    312312        return "_knots" if self.speedInKnots else "_kmph"
    313313
     314    def logFuel(self, aircraftState):
     315        """Log the amount of fuel"""
     316        fuelStr = ""
     317        for (tank, amount) in aircraftState.fuel:
     318            if fuelStr: fuelStr += " - "
     319            fuelStr += "%s=%.0f kg" % (const.fuelTank2logString(tank), amount)
     320           
     321        self.logger.message(aircraftState.timestamp, "Fuel: " + fuelStr)
     322        self.logger.message(aircraftState.timestamp,
     323                            "Total fuel: %.0f kg" % (aircraftState.totalFuel,))                           
     324
    314325    def _updateFlownDistance(self, currentState):
    315326        """Update the flown distance."""
Note: See TracChangeset for help on using the changeset viewer.