source: src/mlx/const.py@ 895:929448cde3f5

Last change on this file since 895:929448cde3f5 was 895:929448cde3f5, checked in by István Váradi <ivaradi@…>, 7 years ago

The Ilyushin Il-62 is supported to some degree.

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