Changeset 57:04d8f6a603ee for src/mlx
- Timestamp:
- 04/03/12 18:00:24 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/pyuipc_sim.py
r56 r57 12 12 import struct 13 13 import cPickle 14 import math 14 15 15 16 #------------------------------------------------------------------------------ … … 266 267 # wind the GS 267 268 return int(self.ias * 65536.0 * 1852.0 / 3600.0) 269 elif offset==0x02b8: # TAS 270 return int(self._getTAS() * 128.0) 268 271 elif offset==0x02bc: # IAS 269 272 return int(self.ias * 128.0) … … 617 620 self.fuelCapacities[index] = value * self.fuelWeight * const.LBSTOKG 618 621 622 def _getTAS(self): 623 """Calculate the true airspeed.""" 624 pressure = 101325 * math.pow(1 - 2.25577e-5 * self.altitude * 625 const.FEETTOMETRES, 626 5.25588) 627 temperature = 15 - self.altitude * 6.5 * const.FEETTOMETRES / 1000.0 628 temperature += 273.15 # Celsius -> Kelvin 629 airDensity = pressure / (temperature * 287.05) 630 print "pressure:", pressure, "temperature:", temperature, "airDensity:", airDensity 631 return self.ias * math.sqrt(1.225 / airDensity) 619 632 620 633 #------------------------------------------------------------------------------ … … 866 879 lambda word: int(float(word) * 65536.0 * 867 880 1852.0 / 3600)) 881 self._valueHandlers["tas"] = (0x02b8, "d", 882 lambda value: value / 128.0, 883 lambda word: None) 868 884 self._valueHandlers["vs"] = (0x02c8, "d", 869 885 lambda value: value * 60 /
Note:
See TracChangeset
for help on using the changeset viewer.