Changeset 140:7f24ede5d214 for src


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

Reworked fuel tank handling to be more indirect

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r139 r140  
    328328    The aircraft type-specific values in the aircraft state have the following
    329329    structure:
    330     - fuel: centre, left, right
     330    - fuel: left, centre, right
    331331    - n1: left, right
    332332    - reverser: left, right"""
     333    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     334   
    333335    def __init__(self, flight):
    334336        super(Boeing737, self).__init__(flight)
     
    435437    The aircraft type-specific values in the aircraft state have the following
    436438    structure:
    437     - fuel: centre, left, right
     439    - fuel: left, right
    438440    - n1: left, right
    439441    - reverser: left, right."""
     442    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT]   
     443
    440444    def __init__(self, flight):
    441445        super(DH8D, self).__init__(flight)
     
    466470    The aircraft type-specific values in the aircraft state have the following
    467471    structure:
    468     - fuel: centre, left, right
     472    - fuel: left, centre, right
    469473    - n1: left, right
    470474    - reverser: left, right"""
     475    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     476
    471477    def __init__(self, flight):
    472478        super(Boeing767, self).__init__(flight)
     
    518524    The aircraft type-specific values in the aircraft state have the following
    519525    structure:
    520     - fuel: centre, left, right
     526    - fuel: left, centre, right
    521527    - n1: left, right
    522528    - reverser: left, right."""
     529    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     530
    523531    def __init__(self, flight):
    524532        super(CRJ2, self).__init__(flight)
     
    550558    The aircraft type-specific values in the aircraft state have the following
    551559    structure:
    552     - fuel: centre, left, right
     560    - fuel: left, centre, right
    553561    - n1: left, right
    554562    - reverser: left, right."""
     563    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT]   
     564
    555565    def __init__(self, flight):
    556566        super(F70, self).__init__(flight)
     
    583593    The aircraft type-specific values in the aircraft state have the following
    584594    structure:
    585     - fuel: left, right, left aux, right aux
     595    - fuel: left aux, left, right, right aux
    586596    - rpm: left, right
    587597    - reverser: left, right."""
     598    fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT,
     599                 const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX]
     600
    588601    def __init__(self, flight):
    589602        super(DC3, self).__init__(flight)
     
    621634    The aircraft type-specific values in the aircraft state have the following
    622635    structure:
    623     - fuel: centre, left tip, left aux, right tip, right aux, external 1,
     636    - fuel: left tip, left aux, centre, right aux, right tip, external 1,
    624637    external 2
    625638    - n1: left, right
    626639    - reverser: left, right."""
     640    fuelTanks = [const.FUELTANK_LEFT_TIP, const.FUELTANK_LEFT_AUX,
     641                 const.FUELTANK_CENTRE,
     642                 const.FUELTANK_RIGHT_AUX, const.FUELTANK_RIGHT_TIP,
     643                 const.FUELTANK_EXTERNAL1, const.FUELTANK_EXTERNAL2]
     644
    627645    def __init__(self, flight):
    628646        super(T134, self).__init__(flight)
     
    655673    The aircraft type-specific values in the aircraft state have the following
    656674    structure:
    657     - fuel: centre, left, right, centre 2, left aux, right aux
     675    - fuel: left aux, left, centre, centre 2, right, right aux
    658676    - n1: left, centre, right
    659677    - reverser: left, right"""
     678    fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT,
     679                 const.FUELTANK_CENTRE, const.FUELTANK_CENTRE2,
     680                 const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX]
    660681    def __init__(self, flight):
    661682        super(T154, self).__init__(flight)
     
    691712    - n1: left, right
    692713    - reverser: left, right"""
     714    fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT]
     715   
    693716    def __init__(self, flight):
    694717        super(YK40, self).__init__(flight)
  • src/mlx/const.py

    r134 r140  
    297297#-------------------------------------------------------------------------------
    298298
     299# Fuel tank: centre
     300FUELTANK_CENTRE = 1
     301
     302# Fuel tank: left
     303FUELTANK_LEFT = 2
     304
     305# Fuel tank: right
     306FUELTANK_RIGHT = 3
     307
     308# Fuel tank: left aux
     309FUELTANK_LEFT_AUX = 4
     310
     311# Fuel tank: right aux
     312FUELTANK_RIGHT_AUX = 5
     313
     314# Fuel tank: left tip
     315FUELTANK_LEFT_TIP = 6
     316
     317# Fuel tank: right tip
     318FUELTANK_RIGHT_TIP = 7
     319
     320# Fuel tank: external 1
     321FUELTANK_EXTERNAL1 = 8
     322
     323# Fuel tank: external 2
     324FUELTANK_EXTERNAL2 = 9
     325
     326# Fuel tank: centre2
     327FUELTANK_CENTRE2 = 10
     328
     329#-------------------------------------------------------------------------------
     330
    299331# The available gates at LHBP
    300332lhbpGateNumbers = []
  • src/mlx/fsuipc.py

    r134 r140  
    66import const
    77import util
     8import acft
    89
    910import threading
     
    1819else:
    1920    import pyuipc_sim as pyuipc
     21
     22#------------------------------------------------------------------------------
     23
     24# The mapping of tank types to FSUIPC offsets
     25_tank2offset = { const.FUELTANK_CENTRE : 0x0b74,
     26                 const.FUELTANK_LEFT : 0x0b7c,
     27                 const.FUELTANK_RIGHT : 0x0b94,
     28                 const.FUELTANK_LEFT_AUX : 0x0b84,
     29                 const.FUELTANK_RIGHT_AUX : 0x0b9c,
     30                 const.FUELTANK_LEFT_TIP : 0x0b8c,
     31                 const.FUELTANK_RIGHT_TIP : 0x0ba4,
     32                 const.FUELTANK_EXTERNAL1 : 0x1254,
     33                 const.FUELTANK_EXTERNAL2 : 0x125c,
     34                 const.FUELTANK_CENTRE2 : 0x1244 }
    2035
    2136#------------------------------------------------------------------------------
     
    10141029    """A generic aircraft model that can handle the fuel levels, the N1 or RPM
    10151030    values and some other common parameters in a generic way."""
    1016     def __init__(self, flapsNotches, fuelInfo, numEngines, isN1 = True):
     1031   
     1032    def __init__(self, flapsNotches, fuelTanks, numEngines, isN1 = True):
    10171033        """Construct the generic aircraft model with the given data.
    10181034
     
    10201036        notches mean.
    10211037
    1022         fuelInfo is an array of FSUIPC offsets for the levels of the fuel
    1023         tanks. It is assumed to be a 4-byte value, followed by another 4-byte
    1024         value, which is the fuel tank capacity.
     1038        fuelTanks is an array of const.FUELTANK_XXX constants about the
     1039        aircraft's fuel tanks. They will be converted to offsets.
    10251040
    10261041        numEngines is the number of engines the aircraft has.
     
    10301045        super(GenericAircraftModel, self).__init__(flapsNotches = flapsNotches)
    10311046
    1032         self._fuelInfo = fuelInfo
     1047        self._fuelTanks = fuelTanks
    10331048        self._fuelStartIndex = None
    10341049        self._numEngines = numEngines
     
    10491064
    10501065        self._fuelStartIndex = len(data)
    1051         for offset in self._fuelInfo:
     1066        for tank in self._fuelTanks:
     1067            offset = _tank2offset[tank]
    10521068            self._addOffsetWithIndexMember(data, offset, "u")    # tank level
    10531069            self._addOffsetWithIndexMember(data, offset+4, "u")  # tank capacity
     
    10711087        state.fuel = []
    10721088        for i in range(self._fuelStartIndex,
    1073                        self._fuelStartIndex + 2*len(self._fuelInfo), 2):
     1089                       self._fuelStartIndex + 2*len(self._fuelTanks), 2):
    10741090            fuel = data[i+1]*data[i]*fuelWeight*const.LBSTOKG/128.0/65536.0
    10751091            state.fuel.append(fuel)
     
    10921108        super(GenericModel, self). \
    10931109            __init__(flapsNotches = [0, 10, 20, 30],
    1094                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1110                     fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT],
    10951111                     numEngines = 2)
    10961112
     
    11081124        super(B737Model, self). \
    11091125            __init__(flapsNotches = [0, 1, 2, 5, 10, 15, 25, 30, 40],
    1110                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1126                     fuelTanks = acft.Boeing737.fuelTanks,
    11111127                     numEngines = 2)
    11121128
     
    11651181        super(B767Model, self). \
    11661182            __init__(flapsNotches = [0, 1, 5, 15, 20, 25, 30],
    1167                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1183                     fuelTanks = acft.Boeing767.fuelTanks,
    11681184                     numEngines = 2)
    11691185
     
    11811197        super(DH8DModel, self). \
    11821198            __init__(flapsNotches = [0, 5, 10, 15, 35],
    1183                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1199                     fuelTanks = acft.DH8D.fuelTanks,
    11841200                     numEngines = 2)
    11851201
     
    12261242        super(CRJ2Model, self). \
    12271243            __init__(flapsNotches = [0, 8, 20, 30, 45],
    1228                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1244                     fuelTanks = acft.CRJ2.fuelTanks,
    12291245                     numEngines = 2)
    12301246
     
    12421258        super(F70Model, self). \
    12431259            __init__(flapsNotches = [0, 8, 15, 25, 42],
    1244                      fuelInfo = [0x0b74, 0x0b7c, 0xb94],
     1260                     fuelTanks = acft.F70.fuelTanks,
    12451261                     numEngines = 2)
    12461262
     
    12581274        super(DC3Model, self). \
    12591275            __init__(flapsNotches = [0, 15, 30, 45],
    1260                      fuelInfo = [0x0b7c, 0x0b84, 0x0b94, 0x0b9c],
     1276                     fuelTanks = acft.DC3.fuelTanks,
    12611277                     numEngines = 2)
    12621278
     
    12741290        super(T134Model, self). \
    12751291            __init__(flapsNotches = [0, 10, 20, 30],
    1276                      fuelInfo = [0x0b74,
    1277                                  0x0b8c, 0x0b84,
    1278                                  0x0ba4, 0x0b9c,
    1279                                  0x1254, 0x125c],
     1292                     fuelTanks = acft.T134.fuelTanks,
    12801293                     numEngines = 2)
    12811294
     
    12931306        super(T154Model, self). \
    12941307            __init__(flapsNotches = [0, 15, 28, 45],
    1295                      fuelInfo = [0x0b74, 0x0b7c, 0x0b94,
    1296                                  0x1244, 0x0b84, 0x0b9c],
     1308                     fuelTanks = acft.T154.fuelTanks,
    12971309                     numEngines = 3)
    12981310
     
    13181330        super(YK40Model, self). \
    13191331            __init__(flapsNotches = [0, 20, 35],
    1320                      fuelInfo = [0x0b7c, 0x0b94],
     1332                     fuelTanks = acft.YK40.fuelTanks,
    13211333                     numEngines = 2)
    13221334
Note: See TracChangeset for help on using the changeset viewer.