source: src/mlx/const.py@ 1033:330058d37574

python3
Last change on this file since 1033:330058d37574 was 1033:330058d37574, checked in by István Váradi <ivaradi@…>, 3 years ago

Updates for the new crew and passenger handling (re #357)

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