source: src/mlx/const.py@ 437:750a9bfbc6dd

Last change on this file since 437:750a9bfbc6dd was 437:750a9bfbc6dd, checked in by István Váradi <ivaradi@…>, 12 years ago

The main delay code handling logic is present (re #154)

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