Changeset 140:7f24ede5d214 for src
- Timestamp:
- 05/01/12 09:14:13 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r139 r140 328 328 The aircraft type-specific values in the aircraft state have the following 329 329 structure: 330 - fuel: centre, left, right330 - fuel: left, centre, right 331 331 - n1: left, right 332 332 - reverser: left, right""" 333 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT] 334 333 335 def __init__(self, flight): 334 336 super(Boeing737, self).__init__(flight) … … 435 437 The aircraft type-specific values in the aircraft state have the following 436 438 structure: 437 - fuel: centre,left, right439 - fuel: left, right 438 440 - n1: left, right 439 441 - reverser: left, right.""" 442 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT] 443 440 444 def __init__(self, flight): 441 445 super(DH8D, self).__init__(flight) … … 466 470 The aircraft type-specific values in the aircraft state have the following 467 471 structure: 468 - fuel: centre, left, right472 - fuel: left, centre, right 469 473 - n1: left, right 470 474 - reverser: left, right""" 475 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT] 476 471 477 def __init__(self, flight): 472 478 super(Boeing767, self).__init__(flight) … … 518 524 The aircraft type-specific values in the aircraft state have the following 519 525 structure: 520 - fuel: centre, left, right526 - fuel: left, centre, right 521 527 - n1: left, right 522 528 - reverser: left, right.""" 529 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT] 530 523 531 def __init__(self, flight): 524 532 super(CRJ2, self).__init__(flight) … … 550 558 The aircraft type-specific values in the aircraft state have the following 551 559 structure: 552 - fuel: centre, left, right560 - fuel: left, centre, right 553 561 - n1: left, right 554 562 - reverser: left, right.""" 563 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_CENTRE, const.FUELTANK_RIGHT] 564 555 565 def __init__(self, flight): 556 566 super(F70, self).__init__(flight) … … 583 593 The aircraft type-specific values in the aircraft state have the following 584 594 structure: 585 - fuel: left , right, left aux, right aux595 - fuel: left aux, left, right, right aux 586 596 - rpm: left, right 587 597 - reverser: left, right.""" 598 fuelTanks = [const.FUELTANK_LEFT_AUX, const.FUELTANK_LEFT, 599 const.FUELTANK_RIGHT, const.FUELTANK_RIGHT_AUX] 600 588 601 def __init__(self, flight): 589 602 super(DC3, self).__init__(flight) … … 621 634 The aircraft type-specific values in the aircraft state have the following 622 635 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, 624 637 external 2 625 638 - n1: left, right 626 639 - 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 627 645 def __init__(self, flight): 628 646 super(T134, self).__init__(flight) … … 655 673 The aircraft type-specific values in the aircraft state have the following 656 674 structure: 657 - fuel: centre, left, right, centre 2, left aux, right aux675 - fuel: left aux, left, centre, centre 2, right, right aux 658 676 - n1: left, centre, right 659 677 - 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] 660 681 def __init__(self, flight): 661 682 super(T154, self).__init__(flight) … … 691 712 - n1: left, right 692 713 - reverser: left, right""" 714 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT] 715 693 716 def __init__(self, flight): 694 717 super(YK40, self).__init__(flight) -
src/mlx/const.py
r134 r140 297 297 #------------------------------------------------------------------------------- 298 298 299 # Fuel tank: centre 300 FUELTANK_CENTRE = 1 301 302 # Fuel tank: left 303 FUELTANK_LEFT = 2 304 305 # Fuel tank: right 306 FUELTANK_RIGHT = 3 307 308 # Fuel tank: left aux 309 FUELTANK_LEFT_AUX = 4 310 311 # Fuel tank: right aux 312 FUELTANK_RIGHT_AUX = 5 313 314 # Fuel tank: left tip 315 FUELTANK_LEFT_TIP = 6 316 317 # Fuel tank: right tip 318 FUELTANK_RIGHT_TIP = 7 319 320 # Fuel tank: external 1 321 FUELTANK_EXTERNAL1 = 8 322 323 # Fuel tank: external 2 324 FUELTANK_EXTERNAL2 = 9 325 326 # Fuel tank: centre2 327 FUELTANK_CENTRE2 = 10 328 329 #------------------------------------------------------------------------------- 330 299 331 # The available gates at LHBP 300 332 lhbpGateNumbers = [] -
src/mlx/fsuipc.py
r134 r140 6 6 import const 7 7 import util 8 import acft 8 9 9 10 import threading … … 18 19 else: 19 20 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 } 20 35 21 36 #------------------------------------------------------------------------------ … … 1014 1029 """A generic aircraft model that can handle the fuel levels, the N1 or RPM 1015 1030 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): 1017 1033 """Construct the generic aircraft model with the given data. 1018 1034 … … 1020 1036 notches mean. 1021 1037 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. 1025 1040 1026 1041 numEngines is the number of engines the aircraft has. … … 1030 1045 super(GenericAircraftModel, self).__init__(flapsNotches = flapsNotches) 1031 1046 1032 self._fuel Info = fuelInfo1047 self._fuelTanks = fuelTanks 1033 1048 self._fuelStartIndex = None 1034 1049 self._numEngines = numEngines … … 1049 1064 1050 1065 self._fuelStartIndex = len(data) 1051 for offset in self._fuelInfo: 1066 for tank in self._fuelTanks: 1067 offset = _tank2offset[tank] 1052 1068 self._addOffsetWithIndexMember(data, offset, "u") # tank level 1053 1069 self._addOffsetWithIndexMember(data, offset+4, "u") # tank capacity … … 1071 1087 state.fuel = [] 1072 1088 for i in range(self._fuelStartIndex, 1073 self._fuelStartIndex + 2*len(self._fuel Info), 2):1089 self._fuelStartIndex + 2*len(self._fuelTanks), 2): 1074 1090 fuel = data[i+1]*data[i]*fuelWeight*const.LBSTOKG/128.0/65536.0 1075 1091 state.fuel.append(fuel) … … 1092 1108 super(GenericModel, self). \ 1093 1109 __init__(flapsNotches = [0, 10, 20, 30], 1094 fuel Info = [0x0b74, 0x0b7c, 0xb94],1110 fuelTanks = [const.FUELTANK_LEFT, const.FUELTANK_RIGHT], 1095 1111 numEngines = 2) 1096 1112 … … 1108 1124 super(B737Model, self). \ 1109 1125 __init__(flapsNotches = [0, 1, 2, 5, 10, 15, 25, 30, 40], 1110 fuel Info = [0x0b74, 0x0b7c, 0xb94],1126 fuelTanks = acft.Boeing737.fuelTanks, 1111 1127 numEngines = 2) 1112 1128 … … 1165 1181 super(B767Model, self). \ 1166 1182 __init__(flapsNotches = [0, 1, 5, 15, 20, 25, 30], 1167 fuel Info = [0x0b74, 0x0b7c, 0xb94],1183 fuelTanks = acft.Boeing767.fuelTanks, 1168 1184 numEngines = 2) 1169 1185 … … 1181 1197 super(DH8DModel, self). \ 1182 1198 __init__(flapsNotches = [0, 5, 10, 15, 35], 1183 fuel Info = [0x0b74, 0x0b7c, 0xb94],1199 fuelTanks = acft.DH8D.fuelTanks, 1184 1200 numEngines = 2) 1185 1201 … … 1226 1242 super(CRJ2Model, self). \ 1227 1243 __init__(flapsNotches = [0, 8, 20, 30, 45], 1228 fuel Info = [0x0b74, 0x0b7c, 0xb94],1244 fuelTanks = acft.CRJ2.fuelTanks, 1229 1245 numEngines = 2) 1230 1246 … … 1242 1258 super(F70Model, self). \ 1243 1259 __init__(flapsNotches = [0, 8, 15, 25, 42], 1244 fuel Info = [0x0b74, 0x0b7c, 0xb94],1260 fuelTanks = acft.F70.fuelTanks, 1245 1261 numEngines = 2) 1246 1262 … … 1258 1274 super(DC3Model, self). \ 1259 1275 __init__(flapsNotches = [0, 15, 30, 45], 1260 fuel Info = [0x0b7c, 0x0b84, 0x0b94, 0x0b9c],1276 fuelTanks = acft.DC3.fuelTanks, 1261 1277 numEngines = 2) 1262 1278 … … 1274 1290 super(T134Model, self). \ 1275 1291 __init__(flapsNotches = [0, 10, 20, 30], 1276 fuelInfo = [0x0b74, 1277 0x0b8c, 0x0b84, 1278 0x0ba4, 0x0b9c, 1279 0x1254, 0x125c], 1292 fuelTanks = acft.T134.fuelTanks, 1280 1293 numEngines = 2) 1281 1294 … … 1293 1306 super(T154Model, self). \ 1294 1307 __init__(flapsNotches = [0, 15, 28, 45], 1295 fuelInfo = [0x0b74, 0x0b7c, 0x0b94, 1296 0x1244, 0x0b84, 0x0b9c], 1308 fuelTanks = acft.T154.fuelTanks, 1297 1309 numEngines = 3) 1298 1310 … … 1318 1330 super(YK40Model, self). \ 1319 1331 __init__(flapsNotches = [0, 20, 35], 1320 fuel Info = [0x0b7c, 0x0b94],1332 fuelTanks = acft.YK40.fuelTanks, 1321 1333 numEngines = 2) 1322 1334
Note:
See TracChangeset
for help on using the changeset viewer.