source: src/mlx/const.py@ 1037:687ff2fb8cab

python3
Last change on this file since 1037:687ff2fb8cab was 1037:687ff2fb8cab, checked in by István Váradi <ivaradi@…>, 2 years ago

Stepped version and copyright date (re #357)

File size: 15.7 KB
RevLine 
[298]1
2import sys
[859]3import datetime
[4]4
5#-------------------------------------------------------------------------------
6
[298]7## @package mlx.const
8#
9# The constants used by the program.
10
11#-------------------------------------------------------------------------------
12
13## The version of the program
[1037]14VERSION="0.50.0"
[20]15
16#-------------------------------------------------------------------------------
17
[298]18## The ratio between lbs and kg
[6]19LBSTOKG=0.4536
20
[298]21## The ratio between kgs and lbs
[52]22KGSTOLB=1/LBSTOKG
23
[298]24## The ratio between feet and metre
[6]25FEETTOMETRES=0.3048
26
27#-------------------------------------------------------------------------------
28
[298]29## The ratio between knots and km/h
[241]30KNOTSTOKMPH=1.852
31
[298]32## The ratio between km/h and knots
[241]33KMPHTOKNOTS=1/1.852
34
35#-------------------------------------------------------------------------------
36
[298]37## Flight simulator type: MS Flight Simulator 2004
[6]38SIM_MSFS9 = 1
[4]39
[298]40## Flight simulator type: MS Flight Simulator X
[6]41SIM_MSFSX = 2
[4]42
[298]43## Flight simulator type: X-Plane 9
[6]44SIM_XPLANE9 = 3
[4]45
[298]46## Flight simulator type: X-Plane 10
[6]47SIM_XPLANE10 = 4
[4]48
[657]49## Flight simulator type: Prepar3D
50SIM_P3D = 5
51
[909]52## Flight simulator type: X-Plane 11
53SIM_XPLANE11 = 6
54
[4]55#-------------------------------------------------------------------------------
56
[298]57## Aircraft type: Boeing 737-600
[4]58AIRCRAFT_B736 = 1
59
[298]60## Aircraft type: Boeing 737-700
[4]61AIRCRAFT_B737 = 2
62
[298]63## Aircraft type: Boeing 737-800
[4]64AIRCRAFT_B738 = 3
65
[298]66## Aircraft type: Boeing 737-800 (charter configuration)
[191]67AIRCRAFT_B738C = 16
68
[790]69## Aircraft type: Boeing 737-200
70AIRCRAFT_B732 = 18
71
[298]72## Aircraft type: Boeing 737-300
[7]73AIRCRAFT_B733 = 4
[4]74
[298]75## Aircraft type: Boeing 737-400
[7]76AIRCRAFT_B734 = 5
[4]77
[298]78## Aircraft type: Boeing 737-500
[7]79AIRCRAFT_B735 = 6
80
[298]81## Aircraft type: Dash-8 Q400
[7]82AIRCRAFT_DH8D = 7
[4]83
[298]84## Aircraft type: Boeing 767-200
[4]85AIRCRAFT_B762 = 8
86
[298]87## Aircraft type: Boeing 767-300
[7]88AIRCRAFT_B763 = 9
[4]89
[298]90## Aircraft type: Canadair CRJ-200
[4]91AIRCRAFT_CRJ2 = 10
92
[298]93## Aircraft type: Fokker F-70
[4]94AIRCRAFT_F70 = 11
95
[298]96## Aircraft type: Lisunov Li-2
[4]97AIRCRAFT_DC3 = 12
98
[298]99## Aircraft type: Tupolev Tu-134
[4]100AIRCRAFT_T134 = 13
101
[298]102## Aircraft type: Tupolev Tu-154
[4]103AIRCRAFT_T154 = 14
104
[298]105## Aircraft type: Yakovlev Yak-40
[4]106AIRCRAFT_YK40 = 15
107
[443]108## Aircraft type: British Aerospace BAe-146
[451]109AIRCRAFT_B462 = 17
[443]110
[1032]111## Aircraft type: Ilyushin IL-62
112AIRCRAFT_IL62 = 18
113
[8]114#-------------------------------------------------------------------------------
115
[298]116## The list of aircraft types that we know of
[175]117# The order is mostly from most recent to oldest considering
118# Malev's history
[191]119aircraftTypes = [AIRCRAFT_B736, AIRCRAFT_B737,
120 AIRCRAFT_B738, AIRCRAFT_B738C,
[175]121 AIRCRAFT_DH8D,
122 AIRCRAFT_F70, AIRCRAFT_CRJ2,
123 AIRCRAFT_B762, AIRCRAFT_B763,
[790]124 AIRCRAFT_B732, AIRCRAFT_B733, AIRCRAFT_B734, AIRCRAFT_B735,
[175]125 AIRCRAFT_T154, AIRCRAFT_T134,
[443]126 AIRCRAFT_YK40, AIRCRAFT_DC3,
[1032]127 AIRCRAFT_B462, AIRCRAFT_IL62]
[175]128
129#-------------------------------------------------------------------------------
130
[858]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."""
[919]198 for (family, types) in aircraftFamily2Types.items():
[858]199 if aircraftType in types:
200 return family
201 assert False
202
203#-------------------------------------------------------------------------------
204
[298]205## A mapping of aircraft types to their 'internal' ICAO codes (which are
[191]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",
[790]211 AIRCRAFT_B732 : "B732",
[191]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",
[443]223 AIRCRAFT_YK40 : "YK40",
224 AIRCRAFT_B462 : "B462" }
[175]225
226#-------------------------------------------------------------------------------
227
[298]228## Flight stage: boarding
[8]229STAGE_BOARDING = 1
230
[298]231## Flight stage: pushback, startup and taxi
[8]232STAGE_PUSHANDTAXI = 2
233
[298]234## Flight stage: takeoff
[8]235STAGE_TAKEOFF = 3
236
[298]237## Flight stage: RTO
[8]238STAGE_RTO = 4
239
[298]240## Flight stage: climb
[8]241STAGE_CLIMB = 5
242
[298]243## Flight stage: cruise
[8]244STAGE_CRUISE = 6
245
[298]246## Flight stage: descent
[8]247STAGE_DESCENT = 7
248
[298]249## Flight stage: landing
[8]250STAGE_LANDING = 8
251
[298]252## Flight stage: taxi after landing
[8]253STAGE_TAXIAFTERLAND = 9
254
[298]255## Flight stage: parking
[8]256STAGE_PARKING = 10
257
[298]258## Flight stage: go-around
[8]259STAGE_GOAROUND = 11
260
[298]261## Flight stage: end
[8]262STAGE_END = 12
[11]263
264#-------------------------------------------------------------------------------
265
[132]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
[335]282
[132]283#-------------------------------------------------------------------------------
284
[298]285## Plane status: unknown
[51]286PLANE_UNKNOWN = 0
287
[298]288## Plane status: at home, i.e. LHBP
[51]289PLANE_HOME = 1
290
[298]291## Plane status: away
[51]292PLANE_AWAY = 2
293
[298]294## Plane status: parking
[51]295PLANE_PARKING = 3
296
297#-------------------------------------------------------------------------------
298
[298]299## Flight type: scheduled
[97]300FLIGHTTYPE_SCHEDULED = 0
301
[298]302## Flight type: VIP
[1034]303FLIGHTTYPE_VIP = 1
[97]304
[298]305## Flight type: charter
[1034]306FLIGHTTYPE_CHARTER = 2
307
308## Flight type: old timer (not used anymore)
309FLIGHTTYPE_OLDTIMER = -1
[97]310
311#-------------------------------------------------------------------------------
312
[220]313flightTypes = [ FLIGHTTYPE_SCHEDULED,
314 FLIGHTTYPE_VIP,
[1034]315 FLIGHTTYPE_CHARTER,
316 FLIGHTTYPE_OLDTIMER ]
[220]317
318#-------------------------------------------------------------------------------
319
320_flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled",
321 FLIGHTTYPE_VIP : "vip",
[1034]322 FLIGHTTYPE_CHARTER : "charter",
323 FLIGHTTYPE_OLDTIMER : "ot" }
[220]324
325def flightType2string(flightType):
326 """Get the string equivalent of the given flight type."""
327 return _flightTypeStrings[flightType] \
[335]328 if flightType in _flightTypeStrings else None
[220]329
[835]330def flightType2index(flightType):
331 """Get the index of the given flight type according to the list above"""
332 return flightTypes.index(flightType)
333
[220]334#-------------------------------------------------------------------------------
335
[298]336## Message type: logger error
[133]337# FIXME: cannot set the hotkey
[132]338MESSAGETYPE_LOGGER_ERROR = 1
339
[298]340## Message type: information
[132]341MESSAGETYPE_INFORMATION = 2
342
[315]343## Message type: in-flight information
344MESSAGETYPE_INFLIGHT = 3
345
[298]346## Message type: fault messages
[315]347MESSAGETYPE_FAULT = 4
[132]348
[298]349## Message type: NO-GO fault messages
[315]350MESSAGETYPE_NOGO = 5
[132]351
[298]352## Message type: gate system messages
[315]353MESSAGETYPE_GATE_SYSTEM = 6
[132]354
[298]355## Message type: environment messages
[133]356# FIXME: flight plan closed (5 sec)
[315]357MESSAGETYPE_ENVIRONMENT = 7
[132]358
[298]359## Message type: help messages
[315]360MESSAGETYPE_HELP = 8
[132]361
[298]362## Message type: visibility messages
[315]363MESSAGETYPE_VISIBILITY = 9
[132]364
365#-------------------------------------------------------------------------------
366
367messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
368 MESSAGETYPE_INFORMATION,
[315]369 MESSAGETYPE_INFLIGHT,
[132]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",
[315]381 MESSAGETYPE_INFLIGHT : "inflight",
[132]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] \
[335]392 if messageType in _messageTypeStrings else None
[132]393
394#-------------------------------------------------------------------------------
395
[298]396## Message display level: none
[132]397MESSAGELEVEL_NONE = 0
398
[298]399## Message display level: only message in the simulator
[132]400MESSAGELEVEL_FS = 1
401
[298]402## Message display level: only sound
[132]403MESSAGELEVEL_SOUND = 2
404
[298]405## Message display level: both
[132]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] \
[335]425 if messageLevel in _messageLevelStrings else None
[132]426
427def string2messageLevel(str):
428 """Get the message level for the given string."""
[919]429 for (value, s) in _messageLevelStrings.items():
[132]430 if str==s:
431 return value
432 return MESSAGELEVEL_NONE
433
434#-------------------------------------------------------------------------------
435
[298]436## Sound: ding
[133]437SOUND_DING = "ding.wav"
438
[298]439## Sound: notify
[170]440SOUND_NOTIFY = "notify.wav"
441
[298]442## Sound: NOTAM
[170]443SOUND_NOTAM = "notam.mp3"
444
[298]445## Sound: scream
[170]446SOUND_SCREAM = "sikoly.mp3"
447
[298]448## Sound: boarding
[170]449SOUND_BOARDING = "board.mp3"
450
[298]451## Sound: Malev theme
[170]452SOUND_MALEV = "malev.mp3"
453
[298]454## Sound: taxi: Boeing 737 NG
[170]455SOUND_TAXI_BOEING737NG = "737taxi.mp3"
456
[298]457## Sound: taxi: Boeing 767
[170]458SOUND_TAXI_BOEING767 = "767taxi.mp3"
459
[298]460## Sound: taxi: Fokker F70
[170]461SOUND_TAXI_F70 = "F70taxi.mp3"
462
[298]463## Sound: takeoff preparation request from the captain
[170]464SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
465
[298]466## Sound: cruise
[170]467SOUND_CRUISE = "TOC.mp3"
468
[298]469## Sound: descent
[170]470SOUND_DESCENT = "TOD.mp3"
471
[298]472## Sound: applause
[170]473SOUND_APPLAUSE = "taps.mp3"
474
[298]475## Sound: speedbrake
[170]476SOUND_SPEEDBRAKE = "speed.mp3"
477
[298]478## Sound: taxi after landing
[170]479SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
480
481
[133]482#-------------------------------------------------------------------------------
483
[298]484## Fuel tank: centre
[140]485FUELTANK_CENTRE = 1
486
[298]487## Fuel tank: left
[140]488FUELTANK_LEFT = 2
489
[298]490## Fuel tank: right
[140]491FUELTANK_RIGHT = 3
492
[298]493## Fuel tank: left aux
[140]494FUELTANK_LEFT_AUX = 4
495
[298]496## Fuel tank: right aux
[140]497FUELTANK_RIGHT_AUX = 5
498
[298]499## Fuel tank: left tip
[140]500FUELTANK_LEFT_TIP = 6
501
[298]502## Fuel tank: right tip
[140]503FUELTANK_RIGHT_TIP = 7
504
[298]505## Fuel tank: external 1
[140]506FUELTANK_EXTERNAL1 = 8
507
[298]508## Fuel tank: external 2
[140]509FUELTANK_EXTERNAL2 = 9
510
[298]511## Fuel tank: centre2
[140]512FUELTANK_CENTRE2 = 10
513
514#-------------------------------------------------------------------------------
515
[141]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] \
[335]543 if fuelTank in _fuelTankStrings else None
[141]544
545#-------------------------------------------------------------------------------
546
[274]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
[132]565languages = ["$system", "en_GB", "hu_HU"]
[11]566
[133]567#-------------------------------------------------------------------------------
[859]568
569defaultDate = datetime.date(1900, 1, 1)
570
571#-------------------------------------------------------------------------------
[1033]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.