source: src/mlx/const.py@ 295:7340a9356485

Last change on this file since 295:7340a9356485 was 274:b866c39279e8, checked in by István Váradi <ivaradi@…>, 12 years ago

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

File size: 13.5 KB
Line 
1# Various constants used in the logger
2
3#-------------------------------------------------------------------------------
4
5# The version of the program
6VERSION="0.6"
7
8#-------------------------------------------------------------------------------
9
10# The ratio between lbs and kg
11LBSTOKG=0.4536
12
13# The ratio between kgs and lbs
14KGSTOLB=1/LBSTOKG
15
16# The ratio between feet and metre
17FEETTOMETRES=0.3048
18
19#-------------------------------------------------------------------------------
20
21# The ratio between knots and km/h
22KNOTSTOKMPH=1.852
23
24# The ratio between km/h and knots
25KMPHTOKNOTS=1/1.852
26
27#-------------------------------------------------------------------------------
28
29# Flight simulator type: MS Flight Simulator 2004
30SIM_MSFS9 = 1
31
32# Flight simulator type: MS Flight Simulator X
33SIM_MSFSX = 2
34
35# Flight simulator type: X-Plane 9
36SIM_XPLANE9 = 3
37
38# Flight simulator type: X-Plane 10
39SIM_XPLANE10 = 4
40
41#-------------------------------------------------------------------------------
42
43# Aircraft type: Boeing 737-600
44AIRCRAFT_B736 = 1
45
46# Aircraft type: Boeing 737-700
47AIRCRAFT_B737 = 2
48
49# Aircraft type: Boeing 737-800
50AIRCRAFT_B738 = 3
51
52# Aircraft type: Boeing 737-800 (charter configuration)
53AIRCRAFT_B738C = 16
54
55# Aircraft type: Boeing 737-300
56AIRCRAFT_B733 = 4
57
58# Aircraft type: Boeing 737-400
59AIRCRAFT_B734 = 5
60
61# Aircraft type: Boeing 737-500
62AIRCRAFT_B735 = 6
63
64# Aircraft type: Dash-8 Q400
65AIRCRAFT_DH8D = 7
66
67# Aircraft type: Boeing 767-200
68AIRCRAFT_B762 = 8
69
70# Aircraft type: Boeing 767-300
71AIRCRAFT_B763 = 9
72
73# Aircraft type: Canadair CRJ-200
74AIRCRAFT_CRJ2 = 10
75
76# Aircraft type: Fokker F-70
77AIRCRAFT_F70 = 11
78
79# Aircraft type: Lisunov Li-2
80AIRCRAFT_DC3 = 12
81
82# Aircraft type: Tupolev Tu-134
83AIRCRAFT_T134 = 13
84
85# Aircraft type: Tupolev Tu-154
86AIRCRAFT_T154 = 14
87
88# Aircraft type: Yakovlev Yak-40
89AIRCRAFT_YK40 = 15
90
91#-------------------------------------------------------------------------------
92
93# The list of aircraft types that we know of
94# The order is mostly from most recent to oldest considering
95# Malev's history
96aircraftTypes = [AIRCRAFT_B736, AIRCRAFT_B737,
97 AIRCRAFT_B738, AIRCRAFT_B738C,
98 AIRCRAFT_DH8D,
99 AIRCRAFT_F70, AIRCRAFT_CRJ2,
100 AIRCRAFT_B762, AIRCRAFT_B763,
101 AIRCRAFT_B733, AIRCRAFT_B734, AIRCRAFT_B735,
102 AIRCRAFT_T154, AIRCRAFT_T134,
103 AIRCRAFT_YK40, AIRCRAFT_DC3]
104
105#-------------------------------------------------------------------------------
106
107# A mapping of aircraft types to their 'internal' ICAO codes (which are
108# the same as the real ICAO codes, except in a few cases)
109icaoCodes = { AIRCRAFT_B736 : "B736",
110 AIRCRAFT_B737 : "B737",
111 AIRCRAFT_B738 : "B738",
112 AIRCRAFT_B738C : "B738C",
113 AIRCRAFT_B733 : "B733",
114 AIRCRAFT_B734 : "B734",
115 AIRCRAFT_B735 : "B735",
116 AIRCRAFT_DH8D : "DH8D",
117 AIRCRAFT_B762 : "B762",
118 AIRCRAFT_B763 : "B763",
119 AIRCRAFT_CRJ2 : "CRJ2",
120 AIRCRAFT_F70 : "F70",
121 AIRCRAFT_DC3 : "DC3",
122 AIRCRAFT_T134 : "T134",
123 AIRCRAFT_T154 : "T154",
124 AIRCRAFT_YK40 : "YK40" }
125
126#-------------------------------------------------------------------------------
127
128# Flight stage: boarding
129STAGE_BOARDING = 1
130
131# Flight stage: pushback, startup and taxi
132STAGE_PUSHANDTAXI = 2
133
134# Flight stage: takeoff
135STAGE_TAKEOFF = 3
136
137# Flight stage: RTO
138STAGE_RTO = 4
139
140# Flight stage: climb
141STAGE_CLIMB = 5
142
143# Flight stage: cruise
144STAGE_CRUISE = 6
145
146# Flight stage: descent
147STAGE_DESCENT = 7
148
149# Flight stage: landing
150STAGE_LANDING = 8
151
152# Flight stage: taxi after landing
153STAGE_TAXIAFTERLAND = 9
154
155# Flight stage: parking
156STAGE_PARKING = 10
157
158# Flight stage: go-around
159STAGE_GOAROUND = 11
160
161# Flight stage: end
162STAGE_END = 12
163
164#-------------------------------------------------------------------------------
165
166_stageStrings = { STAGE_BOARDING : "boarding",
167 STAGE_PUSHANDTAXI : "pushback and taxi",
168 STAGE_TAKEOFF : "takeoff",
169 STAGE_RTO : "RTO",
170 STAGE_CLIMB : "climb",
171 STAGE_CRUISE : "cruise",
172 STAGE_DESCENT : "descent",
173 STAGE_LANDING : "landing",
174 STAGE_TAXIAFTERLAND : "taxi",
175 STAGE_PARKING : "parking",
176 STAGE_GOAROUND : "go-around",
177 STAGE_END : "end" }
178
179def stage2string(stage):
180 """Convert the given stage to a lower-case string."""
181 return _stageStrings[stage] if stage in _stageStrings else None
182
183#-------------------------------------------------------------------------------
184
185# Plane status: unknown
186PLANE_UNKNOWN = 0
187
188# Plane status: at home, i.e. LHBP
189PLANE_HOME = 1
190
191# Plane status: away
192PLANE_AWAY = 2
193
194# Plane status: parking
195PLANE_PARKING = 3
196
197#-------------------------------------------------------------------------------
198
199# Flight type: scheduled
200FLIGHTTYPE_SCHEDULED = 0
201
202# Flight type: old-timer
203FLIGHTTYPE_OLDTIMER = 1
204
205# Flight type: VIP
206FLIGHTTYPE_VIP = 2
207
208# Flight type: charter
209FLIGHTTYPE_CHARTER = 3
210
211#-------------------------------------------------------------------------------
212
213flightTypes = [ FLIGHTTYPE_SCHEDULED,
214 FLIGHTTYPE_OLDTIMER,
215 FLIGHTTYPE_VIP,
216 FLIGHTTYPE_CHARTER ]
217
218#-------------------------------------------------------------------------------
219
220_flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled",
221 FLIGHTTYPE_OLDTIMER : "ot",
222 FLIGHTTYPE_VIP : "vip",
223 FLIGHTTYPE_CHARTER : "charter" }
224
225def flightType2string(flightType):
226 """Get the string equivalent of the given flight type."""
227 return _flightTypeStrings[flightType] \
228 if flightType in _flightTypeStrings else None
229
230#-------------------------------------------------------------------------------
231
232# Delay code: loading problems
233DELAYCODE_LOADING = 0
234
235# Delay code: VATSIM problem
236DELAYCODE_VATSIM = 1
237
238# Delay code: network problems
239DELAYCODE_NETWORK = 2
240
241# Delay code: controller's fault
242DELAYCODE_CONTROLLER = 3
243
244# Delay code: system crash or freeze
245DELAYCODE_SYSTEM = 4
246
247# Delay code: navigation problem
248DELAYCODE_NAVIGATION = 5
249
250# Delay code: traffic problems
251DELAYCODE_TRAFFIC = 6
252
253# Delay code: apron navigation
254DELAYCODE_APRON = 7
255
256# Delay code: weather problems
257DELAYCODE_WEATHER = 8
258
259# Delay code: personal reasons
260DELAYCODE_PERSONAL = 9
261
262#-------------------------------------------------------------------------------
263
264# Message type: logger error
265# FIXME: cannot set the hotkey
266MESSAGETYPE_LOGGER_ERROR = 1
267
268# Message type: information
269MESSAGETYPE_INFORMATION = 2
270
271# Message type: fault messages
272MESSAGETYPE_FAULT = 3
273
274# Message type: NO-GO fault messages
275MESSAGETYPE_NOGO = 4
276
277# Message type: gate system messages
278MESSAGETYPE_GATE_SYSTEM = 5
279
280# Message type: environment messages
281# FIXME: flight plan closed (5 sec)
282MESSAGETYPE_ENVIRONMENT = 6
283
284# Message type: help messages
285MESSAGETYPE_HELP = 7
286
287# Message type: visibility messages
288MESSAGETYPE_VISIBILITY = 8
289
290#-------------------------------------------------------------------------------
291
292messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
293 MESSAGETYPE_INFORMATION,
294 MESSAGETYPE_FAULT,
295 MESSAGETYPE_NOGO,
296 MESSAGETYPE_GATE_SYSTEM,
297 MESSAGETYPE_ENVIRONMENT,
298 MESSAGETYPE_HELP,
299 MESSAGETYPE_VISIBILITY ]
300
301#-------------------------------------------------------------------------------
302
303_messageTypeStrings = { MESSAGETYPE_LOGGER_ERROR : "loggerError",
304 MESSAGETYPE_INFORMATION : "information",
305 MESSAGETYPE_FAULT : "fault",
306 MESSAGETYPE_NOGO : "nogo",
307 MESSAGETYPE_GATE_SYSTEM : "gateSystem",
308 MESSAGETYPE_ENVIRONMENT : "environment",
309 MESSAGETYPE_HELP : "help",
310 MESSAGETYPE_VISIBILITY : "visibility" }
311
312def messageType2string(messageType):
313 """Get the string equivalent of the given message type."""
314 return _messageTypeStrings[messageType] \
315 if messageType in _messageTypeStrings else None
316
317#-------------------------------------------------------------------------------
318
319# Message display level: none
320MESSAGELEVEL_NONE = 0
321
322# Message display level: only message in the simulator
323MESSAGELEVEL_FS = 1
324
325# Message display level: only sound
326MESSAGELEVEL_SOUND = 2
327
328# Message display level: both
329MESSAGELEVEL_BOTH = 3
330
331#-------------------------------------------------------------------------------
332
333messageLevels = [ MESSAGELEVEL_NONE,
334 MESSAGELEVEL_FS,
335 MESSAGELEVEL_SOUND,
336 MESSAGELEVEL_BOTH ]
337
338#-------------------------------------------------------------------------------
339
340_messageLevelStrings = { MESSAGELEVEL_NONE : "none",
341 MESSAGELEVEL_FS : "fs",
342 MESSAGELEVEL_SOUND : "sound",
343 MESSAGELEVEL_BOTH : "both" }
344
345def messageLevel2string(messageLevel):
346 """Get the string equivalent of the given message level."""
347 return _messageLevelStrings[messageLevel] \
348 if messageLevel in _messageLevelStrings else None
349
350def string2messageLevel(str):
351 """Get the message level for the given string."""
352 for (value, s) in _messageLevelStrings.iteritems():
353 if str==s:
354 return value
355 return MESSAGELEVEL_NONE
356
357#-------------------------------------------------------------------------------
358
359# Sound: ding
360SOUND_DING = "ding.wav"
361
362# Sound: notify
363SOUND_NOTIFY = "notify.wav"
364
365# Sound: NOTAM
366SOUND_NOTAM = "notam.mp3"
367
368# Sound: scream
369SOUND_SCREAM = "sikoly.mp3"
370
371# Sound: boarding
372SOUND_BOARDING = "board.mp3"
373
374# Sound: Malev theme
375SOUND_MALEV = "malev.mp3"
376
377# Sound: taxi: Boeing 737 NG
378SOUND_TAXI_BOEING737NG = "737taxi.mp3"
379
380# Sound: taxi: Boeing 767
381SOUND_TAXI_BOEING767 = "767taxi.mp3"
382
383# Sound: taxi: Fokker F70
384SOUND_TAXI_F70 = "F70taxi.mp3"
385
386# Sound: takeoff preparation request from the captain
387SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
388
389# Sound: cruise
390SOUND_CRUISE = "TOC.mp3"
391
392# Sound: descent
393SOUND_DESCENT = "TOD.mp3"
394
395# Sound: applause
396SOUND_APPLAUSE = "taps.mp3"
397
398# Sound: speedbrake
399SOUND_SPEEDBRAKE = "speed.mp3"
400
401# Sound: taxi after landing
402SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
403
404
405#-------------------------------------------------------------------------------
406
407# Fuel tank: centre
408FUELTANK_CENTRE = 1
409
410# Fuel tank: left
411FUELTANK_LEFT = 2
412
413# Fuel tank: right
414FUELTANK_RIGHT = 3
415
416# Fuel tank: left aux
417FUELTANK_LEFT_AUX = 4
418
419# Fuel tank: right aux
420FUELTANK_RIGHT_AUX = 5
421
422# Fuel tank: left tip
423FUELTANK_LEFT_TIP = 6
424
425# Fuel tank: right tip
426FUELTANK_RIGHT_TIP = 7
427
428# Fuel tank: external 1
429FUELTANK_EXTERNAL1 = 8
430
431# Fuel tank: external 2
432FUELTANK_EXTERNAL2 = 9
433
434# Fuel tank: centre2
435FUELTANK_CENTRE2 = 10
436
437#-------------------------------------------------------------------------------
438
439fuelTanks = [ FUELTANK_CENTRE,
440 FUELTANK_LEFT,
441 FUELTANK_RIGHT,
442 FUELTANK_LEFT_AUX,
443 FUELTANK_RIGHT_AUX,
444 FUELTANK_LEFT_TIP,
445 FUELTANK_RIGHT_TIP,
446 FUELTANK_EXTERNAL1,
447 FUELTANK_EXTERNAL2,
448 FUELTANK_CENTRE2 ]
449
450#-------------------------------------------------------------------------------
451
452_fuelTankStrings = { FUELTANK_CENTRE : "centre",
453 FUELTANK_LEFT : "left",
454 FUELTANK_RIGHT : "right",
455 FUELTANK_LEFT_AUX : "left_aux",
456 FUELTANK_RIGHT_AUX : "right_aux",
457 FUELTANK_LEFT_TIP : "left_tip",
458 FUELTANK_RIGHT_TIP : "right_tip",
459 FUELTANK_EXTERNAL1 : "external1",
460 FUELTANK_EXTERNAL2 : "external2",
461 FUELTANK_CENTRE2 : "centre2" }
462
463def fuelTank2string(fuelTank):
464 """Get the string equivalent of the given fuelTank."""
465 return _fuelTankStrings[fuelTank] \
466 if fuelTank in _fuelTankStrings else None
467
468#-------------------------------------------------------------------------------
469
470_fuelTankLogStrings = { FUELTANK_CENTRE : "centre",
471 FUELTANK_LEFT : "left",
472 FUELTANK_RIGHT : "right",
473 FUELTANK_LEFT_AUX : "left aux",
474 FUELTANK_RIGHT_AUX : "right aux",
475 FUELTANK_LEFT_TIP : "left tip",
476 FUELTANK_RIGHT_TIP : "right tip",
477 FUELTANK_EXTERNAL1 : "external 1",
478 FUELTANK_EXTERNAL2 : "external 2",
479 FUELTANK_CENTRE2 : "centre 2" }
480
481def fuelTank2logString(fuelTank):
482 """Get the log string equivalent of the given fuelTank."""
483 return _fuelTankLogStrings[fuelTank] \
484 if fuelTank in _fuelTankLogStrings else "unknown"
485
486#-------------------------------------------------------------------------------
487
488# The available gates at LHBP
489lhbpGateNumbers = []
490
491for i in range(1, 7):
492 lhbpGateNumbers.append(str(i))
493
494for i in range(10, 19):
495 lhbpGateNumbers.append(str(i))
496
497for i in range(24, 28):
498 lhbpGateNumbers.append(str(i))
499
500for i in range(31, 39):
501 lhbpGateNumbers.append(str(i))
502
503for i in range(42, 47):
504 lhbpGateNumbers.append(str(i))
505
506for i in range(60, 84):
507 if i!=70 and i!=80:
508 lhbpGateNumbers.append(str(i))
509
510#-------------------------------------------------------------------------------
511
512languages = ["$system", "en_GB", "hu_HU"]
513
514#-------------------------------------------------------------------------------
515
Note: See TracBrowser for help on using the repository browser.