source: src/mlx/const.py@ 907:953dc1f27659

Last change on this file since 907:953dc1f27659 was 907:953dc1f27659, checked in by István Váradi <ivaradi@…>, 5 years ago

Stepped version

File size: 16.2 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.1"
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 AIRCRAFT_IL62 : "IL62" }
228
229#-------------------------------------------------------------------------------
230
231## A mapping from ICAO codes to the corresponding aircraft types
232icao2Type = { "B736" : AIRCRAFT_B736,
233 "B737" : AIRCRAFT_B737,
234 "B738" : AIRCRAFT_B738,
235 "B732" : AIRCRAFT_B732,
236 "B733" : AIRCRAFT_B733,
237 "B734" : AIRCRAFT_B734,
238 "B735" : AIRCRAFT_B735,
239 "DH8D" : AIRCRAFT_DH8D,
240 "B762" : AIRCRAFT_B762,
241 "B763" : AIRCRAFT_B763,
242 "CRJ2" : AIRCRAFT_CRJ2,
243 "F70" : AIRCRAFT_F70,
244 "DC3" : AIRCRAFT_DC3,
245 "T134" : AIRCRAFT_T134,
246 "T154" : AIRCRAFT_T154,
247 "YK40" : AIRCRAFT_YK40,
248 "B462" : AIRCRAFT_B462,
249 "IL62" : AIRCRAFT_IL62 }
250
251#-------------------------------------------------------------------------------
252
253## Flight stage: boarding
254STAGE_BOARDING = 1
255
256## Flight stage: pushback, startup and taxi
257STAGE_PUSHANDTAXI = 2
258
259## Flight stage: takeoff
260STAGE_TAKEOFF = 3
261
262## Flight stage: RTO
263STAGE_RTO = 4
264
265## Flight stage: climb
266STAGE_CLIMB = 5
267
268## Flight stage: cruise
269STAGE_CRUISE = 6
270
271## Flight stage: descent
272STAGE_DESCENT = 7
273
274## Flight stage: landing
275STAGE_LANDING = 8
276
277## Flight stage: taxi after landing
278STAGE_TAXIAFTERLAND = 9
279
280## Flight stage: parking
281STAGE_PARKING = 10
282
283## Flight stage: go-around
284STAGE_GOAROUND = 11
285
286## Flight stage: end
287STAGE_END = 12
288
289#-------------------------------------------------------------------------------
290
291_stageStrings = { STAGE_BOARDING : "boarding",
292 STAGE_PUSHANDTAXI : "pushback and taxi",
293 STAGE_TAKEOFF : "takeoff",
294 STAGE_RTO : "RTO",
295 STAGE_CLIMB : "climb",
296 STAGE_CRUISE : "cruise",
297 STAGE_DESCENT : "descent",
298 STAGE_LANDING : "landing",
299 STAGE_TAXIAFTERLAND : "taxi",
300 STAGE_PARKING : "parking",
301 STAGE_GOAROUND : "go-around",
302 STAGE_END : "end" }
303
304def stage2string(stage):
305 """Convert the given stage to a lower-case string."""
306 return _stageStrings[stage] if stage in _stageStrings else None
307
308#-------------------------------------------------------------------------------
309
310## Plane status: unknown
311PLANE_UNKNOWN = 0
312
313## Plane status: at home, i.e. LHBP
314PLANE_HOME = 1
315
316## Plane status: away
317PLANE_AWAY = 2
318
319## Plane status: parking
320PLANE_PARKING = 3
321
322#-------------------------------------------------------------------------------
323
324## Flight type: scheduled
325FLIGHTTYPE_SCHEDULED = 0
326
327## Flight type: old-timer
328FLIGHTTYPE_OLDTIMER = 1
329
330## Flight type: VIP
331FLIGHTTYPE_VIP = 2
332
333## Flight type: charter
334FLIGHTTYPE_CHARTER = 3
335
336#-------------------------------------------------------------------------------
337
338flightTypes = [ FLIGHTTYPE_SCHEDULED,
339 FLIGHTTYPE_OLDTIMER,
340 FLIGHTTYPE_VIP,
341 FLIGHTTYPE_CHARTER ]
342
343#-------------------------------------------------------------------------------
344
345_flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled",
346 FLIGHTTYPE_OLDTIMER : "ot",
347 FLIGHTTYPE_VIP : "vip",
348 FLIGHTTYPE_CHARTER : "charter" }
349
350def flightType2string(flightType):
351 """Get the string equivalent of the given flight type."""
352 return _flightTypeStrings[flightType] \
353 if flightType in _flightTypeStrings else None
354
355def flightType2index(flightType):
356 """Get the index of the given flight type according to the list above"""
357 return flightTypes.index(flightType)
358
359#-------------------------------------------------------------------------------
360
361## Message type: logger error
362# FIXME: cannot set the hotkey
363MESSAGETYPE_LOGGER_ERROR = 1
364
365## Message type: information
366MESSAGETYPE_INFORMATION = 2
367
368## Message type: in-flight information
369MESSAGETYPE_INFLIGHT = 3
370
371## Message type: fault messages
372MESSAGETYPE_FAULT = 4
373
374## Message type: NO-GO fault messages
375MESSAGETYPE_NOGO = 5
376
377## Message type: gate system messages
378MESSAGETYPE_GATE_SYSTEM = 6
379
380## Message type: environment messages
381# FIXME: flight plan closed (5 sec)
382MESSAGETYPE_ENVIRONMENT = 7
383
384## Message type: help messages
385MESSAGETYPE_HELP = 8
386
387## Message type: visibility messages
388MESSAGETYPE_VISIBILITY = 9
389
390#-------------------------------------------------------------------------------
391
392messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
393 MESSAGETYPE_INFORMATION,
394 MESSAGETYPE_INFLIGHT,
395 MESSAGETYPE_FAULT,
396 MESSAGETYPE_NOGO,
397 MESSAGETYPE_GATE_SYSTEM,
398 MESSAGETYPE_ENVIRONMENT,
399 MESSAGETYPE_HELP,
400 MESSAGETYPE_VISIBILITY ]
401
402#-------------------------------------------------------------------------------
403
404_messageTypeStrings = { MESSAGETYPE_LOGGER_ERROR : "loggerError",
405 MESSAGETYPE_INFORMATION : "information",
406 MESSAGETYPE_INFLIGHT : "inflight",
407 MESSAGETYPE_FAULT : "fault",
408 MESSAGETYPE_NOGO : "nogo",
409 MESSAGETYPE_GATE_SYSTEM : "gateSystem",
410 MESSAGETYPE_ENVIRONMENT : "environment",
411 MESSAGETYPE_HELP : "help",
412 MESSAGETYPE_VISIBILITY : "visibility" }
413
414def messageType2string(messageType):
415 """Get the string equivalent of the given message type."""
416 return _messageTypeStrings[messageType] \
417 if messageType in _messageTypeStrings else None
418
419#-------------------------------------------------------------------------------
420
421## Message display level: none
422MESSAGELEVEL_NONE = 0
423
424## Message display level: only message in the simulator
425MESSAGELEVEL_FS = 1
426
427## Message display level: only sound
428MESSAGELEVEL_SOUND = 2
429
430## Message display level: both
431MESSAGELEVEL_BOTH = 3
432
433#-------------------------------------------------------------------------------
434
435messageLevels = [ MESSAGELEVEL_NONE,
436 MESSAGELEVEL_FS,
437 MESSAGELEVEL_SOUND,
438 MESSAGELEVEL_BOTH ]
439
440#-------------------------------------------------------------------------------
441
442_messageLevelStrings = { MESSAGELEVEL_NONE : "none",
443 MESSAGELEVEL_FS : "fs",
444 MESSAGELEVEL_SOUND : "sound",
445 MESSAGELEVEL_BOTH : "both" }
446
447def messageLevel2string(messageLevel):
448 """Get the string equivalent of the given message level."""
449 return _messageLevelStrings[messageLevel] \
450 if messageLevel in _messageLevelStrings else None
451
452def string2messageLevel(str):
453 """Get the message level for the given string."""
454 for (value, s) in _messageLevelStrings.iteritems():
455 if str==s:
456 return value
457 return MESSAGELEVEL_NONE
458
459#-------------------------------------------------------------------------------
460
461## Sound: ding
462SOUND_DING = "ding.wav"
463
464## Sound: notify
465SOUND_NOTIFY = "notify.wav"
466
467## Sound: NOTAM
468SOUND_NOTAM = "notam.mp3"
469
470## Sound: scream
471SOUND_SCREAM = "sikoly.mp3"
472
473## Sound: boarding
474SOUND_BOARDING = "board.mp3"
475
476## Sound: Malev theme
477SOUND_MALEV = "malev.mp3"
478
479## Sound: taxi: Boeing 737 NG
480SOUND_TAXI_BOEING737NG = "737taxi.mp3"
481
482## Sound: taxi: Boeing 767
483SOUND_TAXI_BOEING767 = "767taxi.mp3"
484
485## Sound: taxi: Fokker F70
486SOUND_TAXI_F70 = "F70taxi.mp3"
487
488## Sound: takeoff preparation request from the captain
489SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
490
491## Sound: cruise
492SOUND_CRUISE = "TOC.mp3"
493
494## Sound: descent
495SOUND_DESCENT = "TOD.mp3"
496
497## Sound: applause
498SOUND_APPLAUSE = "taps.mp3"
499
500## Sound: speedbrake
501SOUND_SPEEDBRAKE = "speed.mp3"
502
503## Sound: taxi after landing
504SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
505
506
507#-------------------------------------------------------------------------------
508
509## Fuel tank: centre
510FUELTANK_CENTRE = 1
511
512## Fuel tank: left
513FUELTANK_LEFT = 2
514
515## Fuel tank: right
516FUELTANK_RIGHT = 3
517
518## Fuel tank: left aux
519FUELTANK_LEFT_AUX = 4
520
521## Fuel tank: right aux
522FUELTANK_RIGHT_AUX = 5
523
524## Fuel tank: left tip
525FUELTANK_LEFT_TIP = 6
526
527## Fuel tank: right tip
528FUELTANK_RIGHT_TIP = 7
529
530## Fuel tank: external 1
531FUELTANK_EXTERNAL1 = 8
532
533## Fuel tank: external 2
534FUELTANK_EXTERNAL2 = 9
535
536## Fuel tank: centre2
537FUELTANK_CENTRE2 = 10
538
539#-------------------------------------------------------------------------------
540
541fuelTanks = [ FUELTANK_CENTRE,
542 FUELTANK_LEFT,
543 FUELTANK_RIGHT,
544 FUELTANK_LEFT_AUX,
545 FUELTANK_RIGHT_AUX,
546 FUELTANK_LEFT_TIP,
547 FUELTANK_RIGHT_TIP,
548 FUELTANK_EXTERNAL1,
549 FUELTANK_EXTERNAL2,
550 FUELTANK_CENTRE2 ]
551
552#-------------------------------------------------------------------------------
553
554_fuelTankStrings = { FUELTANK_CENTRE : "centre",
555 FUELTANK_LEFT : "left",
556 FUELTANK_RIGHT : "right",
557 FUELTANK_LEFT_AUX : "left_aux",
558 FUELTANK_RIGHT_AUX : "right_aux",
559 FUELTANK_LEFT_TIP : "left_tip",
560 FUELTANK_RIGHT_TIP : "right_tip",
561 FUELTANK_EXTERNAL1 : "external1",
562 FUELTANK_EXTERNAL2 : "external2",
563 FUELTANK_CENTRE2 : "centre2" }
564
565def fuelTank2string(fuelTank):
566 """Get the string equivalent of the given fuelTank."""
567 return _fuelTankStrings[fuelTank] \
568 if fuelTank in _fuelTankStrings else None
569
570#-------------------------------------------------------------------------------
571
572_fuelTankLogStrings = { FUELTANK_CENTRE : "centre",
573 FUELTANK_LEFT : "left",
574 FUELTANK_RIGHT : "right",
575 FUELTANK_LEFT_AUX : "left aux",
576 FUELTANK_RIGHT_AUX : "right aux",
577 FUELTANK_LEFT_TIP : "left tip",
578 FUELTANK_RIGHT_TIP : "right tip",
579 FUELTANK_EXTERNAL1 : "external 1",
580 FUELTANK_EXTERNAL2 : "external 2",
581 FUELTANK_CENTRE2 : "centre 2" }
582
583def fuelTank2logString(fuelTank):
584 """Get the log string equivalent of the given fuelTank."""
585 return _fuelTankLogStrings[fuelTank] \
586 if fuelTank in _fuelTankLogStrings else "unknown"
587
588#-------------------------------------------------------------------------------
589
590languages = ["$system", "en_GB", "hu_HU"]
591
592#-------------------------------------------------------------------------------
593
594defaultDate = datetime.date(1900, 1, 1)
595
596#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.