Changeset 211:fbd8dad0b6be
- Timestamp:
- 05/31/12 15:37:24 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r210 r211 73 73 self._checkers.append(checks.SquawkLogger()) 74 74 75 self._checkers.append(checks.AnticollisionLightsLogger()) 76 self._checkers.append(checks.LandingLightsLogger()) 77 self._checkers.append(checks.StrobeLightsLogger()) 78 self._checkers.append(checks.NavLightsLogger()) 75 self._appendLightsLoggers() 79 76 80 77 self._checkers.append(checks.FlapsLogger()) … … 96 93 97 94 # Fault checkers 98 99 self._checkers.append(checks.AntiCollisionLightsChecker()) 100 self._checkers.append(checks.LandingLightsChecker()) 101 self._checkers.append(checks.NavLightsChecker()) 102 self._checkers.append(checks.StrobeLightsChecker()) 95 96 self._appendLightsCheckers() 103 97 104 98 self._checkers.append(checks.BankChecker()) … … 314 308 self._logV1R2() 315 309 310 def _appendLightsLoggers(self): 311 """Append the loggers needed for the lights. 312 313 This default implementation adds the loggers for the anti-collision 314 lights, the landing lights, the strobe lights and the NAV lights.""" 315 self._checkers.append(checks.AnticollisionLightsLogger()) 316 self._checkers.append(checks.LandingLightsLogger()) 317 self._checkers.append(checks.StrobeLightsLogger()) 318 self._checkers.append(checks.NavLightsLogger()) 319 320 def _appendLightsCheckers(self): 321 """Append the checkers needed for the lights. 322 323 This default implementation adds the checkers for the anti-collision 324 lights, the landing lights, the strobe lights and the NAV lights.""" 325 self._checkers.append(checks.AntiCollisionLightsChecker()) 326 self._checkers.append(checks.LandingLightsChecker()) 327 self._checkers.append(checks.NavLightsChecker()) 328 self._checkers.append(checks.StrobeLightsChecker()) 329 316 330 def _logV1R2(self): 317 331 """Log the V1, Vr and V2 value either newly, or by updating the … … 706 720 "Total fuel: %.0f kg" % (sum(aircraftState.fuel),)) 707 721 722 def _appendLightsLoggers(self): 723 """Append the loggers needed for the lights.""" 724 self._checkers.append(checks.AnticollisionLightsLogger()) 725 self._checkers.append(checks.LandingLightsLogger()) 726 self._checkers.append(checks.NavLightsLogger()) 727 728 def _appendLightsCheckers(self): 729 """Append the checkers needed for the lights.""" 730 self._checkers.append(checks.TupolevAntiCollisionLightsChecker()) 731 self._checkers.append(checks.LandingLightsChecker()) 732 self._checkers.append(checks.NavLightsChecker()) 733 708 734 #--------------------------------------------------------------------------------------- 709 735 … … 741 767 "Total fuel: %.0f kg" % (sum(aircraftState.fuel),)) 742 768 769 def _appendLightsLoggers(self): 770 """Append the loggers needed for the lights.""" 771 self._checkers.append(checks.AnticollisionLightsLogger()) 772 self._checkers.append(checks.LandingLightsLogger()) 773 self._checkers.append(checks.NavLightsLogger()) 774 775 def _appendLightsCheckers(self): 776 """Append the checkers needed for the lights.""" 777 self._checkers.append(checks.TupolevAntiCollisionLightsChecker()) 778 self._checkers.append(checks.LandingLightsChecker()) 779 self._checkers.append(checks.NavLightsChecker()) 780 743 781 #--------------------------------------------------------------------------------------- 744 782 … … 772 810 self.logger.message(aircraftState.timestamp, 773 811 "Total fuel: %.0f kg" % (sum(aircraftState.fuel),)) 812 813 def _appendLightsLoggers(self): 814 """Append the loggers needed for the lights.""" 815 self._checkers.append(checks.AnticollisionLightsLogger()) 816 self._checkers.append(checks.LandingLightsLogger()) 817 self._checkers.append(checks.NavLightsLogger()) 818 819 def _appendLightsCheckers(self): 820 """Append the checkers needed for the lights.""" 821 self._checkers.append(checks.AntiCollisionLightsChecker()) 822 self._checkers.append(checks.LandingLightsChecker()) 823 self._checkers.append(checks.NavLightsChecker()) 774 824 775 825 #--------------------------------------------------------------------------------------- -
src/mlx/checks.py
r209 r211 547 547 def isCondition(self, flight, aircraft, oldState, state): 548 548 """Check if the fault condition holds.""" 549 isTupolev = aircraft.type in [const.AIRCRAFT_T134,550 const.AIRCRAFT_T154]551 549 return (flight.stage!=const.STAGE_PARKING or \ 552 550 not flight.config.usingFS2Crew) and \ 553 551 not state.antiCollisionLightsOn and \ 554 ((isTupolev and max(state.n1[1:])>5) or \ 555 (not isTupolev and max(state.n1)>5)) 552 self.isEngineCondition(state) 556 553 557 554 def logFault(self, flight, aircraft, logger, oldState, state): … … 561 558 "Anti-collision lights were off"), 562 559 1) 560 561 def isEngineCondition(self, state): 562 """Determine if the engines are in such a state that the lights should 563 be on.""" 564 return max(state.n1)>5 565 566 #--------------------------------------------------------------------------------------- 567 568 class TupolevAntiCollisionLightsChecker(AntiCollisionLightsChecker): 569 """Check for the anti-collision light for Tuplev planes.""" 570 571 def isEngineCondition(self, state): 572 """Determine if the engines are in such a state that the lights should 573 be on.""" 574 return max(state.n1[1:])>5 575 563 576 564 577 #--------------------------------------------------------------------------------------- … … 923 936 def isCondition(self, flight, aircraft, oldState, state): 924 937 """Check if the fault condition holds.""" 925 if aircraft.type in [const.AIRCRAFT_T134, 926 const.AIRCRAFT_T154, 927 const.AIRCRAFT_YK40]: 928 return False 929 else: 930 return (flight.stage==const.STAGE_BOARDING and \ 931 state.strobeLightsOn and state.onTheGround) or \ 932 (flight.stage==const.STAGE_TAKEOFF and \ 933 not state.strobeLightsOn and not state.gearsDown) or \ 934 (flight.stage in [const.STAGE_CLIMB, const.STAGE_CRUISE, 935 const.STAGE_DESCENT] and \ 936 not state.strobeLightsOn and not state.onTheGround) or \ 937 (flight.stage==const.STAGE_PARKING and \ 938 state.strobeLightsOn and state.onTheGround) 938 return (flight.stage==const.STAGE_BOARDING and \ 939 state.strobeLightsOn and state.onTheGround) or \ 940 (flight.stage==const.STAGE_TAKEOFF and \ 941 not state.strobeLightsOn and not state.gearsDown) or \ 942 (flight.stage in [const.STAGE_CLIMB, const.STAGE_CRUISE, 943 const.STAGE_DESCENT] and \ 944 not state.strobeLightsOn and not state.onTheGround) or \ 945 (flight.stage==const.STAGE_PARKING and \ 946 state.strobeLightsOn and state.onTheGround) 939 947 940 948 def logFault(self, flight, aircraft, logger, oldState, state): -
src/mlx/pyuipc_sim.py
r209 r211 118 118 119 119 # Fuel data index: right tip tank 120 FUEL_RIGHT_ AUX= 6120 FUEL_RIGHT_TIP = 6 121 121 122 122 # Fuel data index: external 1 tank … … 186 186 self.aircraftName = "Cessna 172SP" 187 187 self.flapsNotches = [0, 1, 2, 5, 10, 15, 25, 30, 40] 188 self.fuelCapacities = [10000.0, 5000.0, 5000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 188 self.fuelCapacities = [10000.0, 5000.0, 5000.0, 5000.0, 5000.0, 189 5000.0, 5000.0, 5000.0, 5000.0, 5000.0] 189 190 190 191 self.latitude = 47.5
Note:
See TracChangeset
for help on using the changeset viewer.