[298] | 1 |
|
---|
| 2 | import const
|
---|
| 3 | import checks
|
---|
| 4 | import fs
|
---|
| 5 | import util
|
---|
| 6 |
|
---|
| 7 | import sys
|
---|
| 8 | import time
|
---|
| 9 | import traceback
|
---|
| 10 |
|
---|
| 11 | from collections import deque
|
---|
| 12 |
|
---|
| 13 | #---------------------------------------------------------------------------------------
|
---|
| 14 |
|
---|
[297] | 15 | ## @package mlx.acft
|
---|
| 16 | #
|
---|
| 17 | # The simulator-independent aircraft classes.
|
---|
| 18 | #
|
---|
| 19 | # This module contains the aircraft classes that contain some general data
|
---|
| 20 | # about each aircraft type in the MAVA Fleet. The base class, \ref Aircraft
|
---|
| 21 | # also implements some parts of the logging and traces some data. The classes
|
---|
| 22 | # are also responsible for creating the \ref mlx.checks "checkers". Most of
|
---|
| 23 | # them are created by the \ref Aircraft class' constructor, but there can be
|
---|
| 24 | # type-specific differences. For example the lights are different for different
|
---|
| 25 | # types, so there is a \ref Aircraft._appendLightsLoggers "function" which can
|
---|
| 26 | # be reimplemented in child classes, if needed. This class maintains also the
|
---|
| 27 | # \ref SmoothedValue "smoothed values" of the IAS and the VS and set these
|
---|
| 28 | # values in the \ref mlx.fs.AircraftState "aircraft state" when it is received
|
---|
| 29 | # from the simulator.
|
---|
[4] | 30 |
|
---|
| 31 | #---------------------------------------------------------------------------------------
|
---|
| 32 |
|
---|
[197] | 33 | class SmoothedValue(object):
|
---|
| 34 | """A smoothed value."""
|
---|
| 35 | def __init__(self):
|
---|
| 36 | """Construct the value."""
|
---|
| 37 | self._deque = deque()
|
---|
| 38 | self._sum = 0
|
---|
| 39 |
|
---|
| 40 | def add(self, length, value):
|
---|
| 41 | """Add the given value and smooth with the given length."""
|
---|
| 42 | dequeLength = len(self._deque)
|
---|
| 43 | while dequeLength>=length:
|
---|
| 44 | self._sum -= self._deque.popleft()
|
---|
| 45 | dequeLength -= 1
|
---|
| 46 |
|
---|
| 47 | self._sum += value
|
---|
| 48 | self._deque.append(value)
|
---|
| 49 |
|
---|
| 50 | def get(self):
|
---|
| 51 | """Get the average."""
|
---|
| 52 | return self._sum / len(self._deque)
|
---|
[331] | 53 |
|
---|
[4] | 54 | #---------------------------------------------------------------------------------------
|
---|
| 55 |
|
---|
| 56 | class Aircraft(object):
|
---|
| 57 | """Base class for aircraft."""
|
---|
[8] | 58 | @staticmethod
|
---|
| 59 | def create(flight):
|
---|
| 60 | """Create an aircraft instance for the type in the given flight."""
|
---|
| 61 | return _classes[flight.aircraftType](flight)
|
---|
| 62 |
|
---|
| 63 | def __init__(self, flight):
|
---|
[4] | 64 | """Construct the aircraft for the given type."""
|
---|
[8] | 65 | self._flight = flight
|
---|
[4] | 66 | self._aircraftState = None
|
---|
[331] | 67 |
|
---|
[9] | 68 | self._maxVS = -10000.0
|
---|
| 69 | self._minVS = 10000.0
|
---|
[4] | 70 |
|
---|
[101] | 71 | self._v1r2LineIndex = None
|
---|
[96] | 72 | self._vrefLineIndex = None
|
---|
| 73 |
|
---|
[117] | 74 | self.humanWeight = 82.0
|
---|
| 75 |
|
---|
[8] | 76 | self._checkers = []
|
---|
| 77 |
|
---|
[197] | 78 | config = flight.config
|
---|
[11] | 79 | # Loggers
|
---|
| 80 |
|
---|
[8] | 81 | self._checkers.append(checks.StageChecker())
|
---|
[9] | 82 | self._checkers.append(checks.TakeOffLogger())
|
---|
[8] | 83 |
|
---|
| 84 | self._checkers.append(checks.AltimeterLogger())
|
---|
[321] | 85 |
|
---|
| 86 | self._nav1Logger = checks.NAV1Logger()
|
---|
| 87 | self._checkers.append(self._nav1Logger)
|
---|
| 88 | self._nav2Logger = checks.NAV2Logger()
|
---|
| 89 | self._checkers.append(self._nav2Logger)
|
---|
| 90 |
|
---|
| 91 | self._adf1Logger = checks.ADF1Logger()
|
---|
| 92 | self._checkers.append(self._adf1Logger)
|
---|
| 93 | self._adf2Logger = checks.ADF2Logger()
|
---|
| 94 | self._checkers.append(self._adf2Logger)
|
---|
[331] | 95 |
|
---|
[8] | 96 | self._checkers.append(checks.SquawkLogger())
|
---|
| 97 |
|
---|
[211] | 98 | self._appendLightsLoggers()
|
---|
[8] | 99 |
|
---|
| 100 | self._checkers.append(checks.FlapsLogger())
|
---|
| 101 |
|
---|
| 102 | self._checkers.append(checks.GearsLogger())
|
---|
[9] | 103 | self._checkers.append(checks.CruiseSpeedLogger())
|
---|
[10] | 104 | self._checkers.append(checks.SpoilerLogger())
|
---|
[338] | 105 | self._checkers.append(checks.APLogger())
|
---|
[9] | 106 |
|
---|
[197] | 107 | if config.isMessageTypeFS(const.MESSAGETYPE_VISIBILITY):
|
---|
[134] | 108 | self._checkers.append(checks.VisibilityChecker())
|
---|
| 109 |
|
---|
[139] | 110 | # FIXME: we should have a central data model object, and not collect
|
---|
| 111 | # the data from the GUI. However, some pieces of data (e.g. V-speeds,
|
---|
| 112 | # etc. that is entered into the GUI) *should* be a part of the GUI and
|
---|
| 113 | # queried from it, so the model should have a reference to the GUI as
|
---|
| 114 | # well and access such data via the GUI!
|
---|
[215] | 115 | if config.onlineACARS and flight.loggedIn and not flight.entranceExam:
|
---|
[139] | 116 | self._checkers.append(checks.ACARSSender(flight._gui))
|
---|
| 117 |
|
---|
[11] | 118 | # Fault checkers
|
---|
[211] | 119 |
|
---|
| 120 | self._appendLightsCheckers()
|
---|
[11] | 121 |
|
---|
[335] | 122 | self._checkers.append(checks.TransponderChecker())
|
---|
| 123 |
|
---|
[11] | 124 | self._checkers.append(checks.BankChecker())
|
---|
| 125 |
|
---|
| 126 | self._checkers.append(checks.FlapsRetractChecker())
|
---|
| 127 | self._checkers.append(checks.FlapsSpeedLimitChecker())
|
---|
| 128 |
|
---|
| 129 | self._checkers.append(checks.GearsDownChecker())
|
---|
| 130 | self._checkers.append(checks.GearSpeedLimitChecker())
|
---|
| 131 |
|
---|
| 132 | self._checkers.append(checks.GLoadChecker())
|
---|
| 133 |
|
---|
| 134 | self._checkers.append(checks.MLWChecker())
|
---|
| 135 | self._checkers.append(checks.MTOWChecker())
|
---|
| 136 | self._checkers.append(checks.MZFWChecker())
|
---|
| 137 | self._checkers.append(checks.PayloadChecker())
|
---|
| 138 |
|
---|
[350] | 139 | self._appendSpeedChecker()
|
---|
[11] | 140 | self._checkers.append(checks.VSChecker())
|
---|
[197] | 141 |
|
---|
| 142 | timeout = 5.0 + config.realIASSmoothingLength - 1
|
---|
| 143 | self._checkers.append(checks.OverspeedChecker(timeout = timeout))
|
---|
[331] | 144 |
|
---|
[11] | 145 | self._checkers.append(checks.StallChecker())
|
---|
| 146 |
|
---|
| 147 | self._checkers.append(checks.PitotChecker())
|
---|
[331] | 148 |
|
---|
[11] | 149 | self._checkers.append(checks.ReverserChecker())
|
---|
| 150 |
|
---|
[273] | 151 | if flight.aircraftType is not None and config.enableApproachCallouts:
|
---|
| 152 | approachCallouts = flight.config.getApproachCallouts(flight.aircraftType)
|
---|
| 153 | if approachCallouts:
|
---|
| 154 | self._checkers.append(checks.ApproachCalloutsPlayer(approachCallouts))
|
---|
| 155 |
|
---|
[197] | 156 | self._smoothedIAS = SmoothedValue()
|
---|
| 157 | self._smoothedVS = SmoothedValue()
|
---|
| 158 |
|
---|
[4] | 159 | @property
|
---|
| 160 | def type(self):
|
---|
| 161 | """Get the type of the aircraft."""
|
---|
[8] | 162 | return self._flight.aircraftType
|
---|
| 163 |
|
---|
| 164 | @property
|
---|
| 165 | def flight(self):
|
---|
| 166 | """Get the flight the aircraft belongs to."""
|
---|
| 167 | return self._flight
|
---|
[4] | 168 |
|
---|
[8] | 169 | @property
|
---|
| 170 | def logger(self):
|
---|
| 171 | """Get the logger to use for the aircraft."""
|
---|
| 172 | return self._flight.logger
|
---|
| 173 |
|
---|
[139] | 174 | @property
|
---|
| 175 | def state(self):
|
---|
| 176 | """Get the current aircraft state."""
|
---|
| 177 | return self._aircraftState
|
---|
[241] | 178 |
|
---|
| 179 | @property
|
---|
| 180 | def speedInKnots(self):
|
---|
| 181 | """Indicate if the speed is in knots.
|
---|
| 182 |
|
---|
| 183 | This default implementation returns True."""
|
---|
| 184 | return True
|
---|
[304] | 185 |
|
---|
| 186 | @property
|
---|
| 187 | def timestamp(self):
|
---|
| 188 | """Get the timestamp of the current state."""
|
---|
| 189 | return None if self._aircraftState is None \
|
---|
| 190 | else self._aircraftState.timestamp
|
---|
[331] | 191 |
|
---|
[11] | 192 | def getFlapsSpeedLimit(self, flaps):
|
---|
| 193 | """Get the speed limit for the given flaps setting."""
|
---|
| 194 | return self.flapSpeedLimits[flaps] if flaps in self.flapSpeedLimits \
|
---|
| 195 | else None
|
---|
| 196 |
|
---|
[8] | 197 | def modelChanged(self, timestamp, aircraftName, modelName):
|
---|
[4] | 198 | """Called when the simulator's aircraft changes."""
|
---|
[8] | 199 | self._flight.logger.message(timestamp,
|
---|
| 200 | "Aircraft: name='%s', model='%s'" % \
|
---|
| 201 | (aircraftName, modelName))
|
---|
[4] | 202 |
|
---|
| 203 | def handleState(self, aircraftState):
|
---|
[197] | 204 | """Called when the state of the aircraft changes.
|
---|
| 205 |
|
---|
| 206 | This is the function that the simulator calls directly with the new
|
---|
| 207 | state."""
|
---|
[274] | 208 | try:
|
---|
| 209 | config = self._flight.config
|
---|
[197] | 210 |
|
---|
[274] | 211 | self._smoothedIAS.add(config.realIASSmoothingLength, aircraftState.ias)
|
---|
| 212 | aircraftState.smoothedIAS = self._smoothedIAS.get()
|
---|
| 213 |
|
---|
| 214 | self._smoothedVS.add(config.realVSSmoothingLength, aircraftState.vs)
|
---|
| 215 | aircraftState.smoothedVS = self._smoothedVS.get()
|
---|
[197] | 216 |
|
---|
[274] | 217 | for checker in self._checkers:
|
---|
| 218 | try:
|
---|
| 219 | checker.check(self._flight, self, self._flight.logger,
|
---|
| 220 | self._aircraftState, aircraftState)
|
---|
| 221 | except:
|
---|
| 222 | print >> sys.stderr, "Checker", checker, "failed"
|
---|
| 223 | traceback.print_exc()
|
---|
[7] | 224 |
|
---|
[274] | 225 | self._flight.handleState(self._aircraftState, aircraftState)
|
---|
[89] | 226 |
|
---|
[274] | 227 | self._maxVS = max(self._maxVS, aircraftState.vs)
|
---|
| 228 | self._minVS = min(self._minVS, aircraftState.vs)
|
---|
| 229 | except:
|
---|
| 230 | print >> sys.stderr, "Failed to handle the state"
|
---|
| 231 | traceback.print_exc()
|
---|
| 232 | finally:
|
---|
| 233 | self._aircraftState = aircraftState
|
---|
[331] | 234 |
|
---|
[8] | 235 | def setStage(self, aircraftState, newStage):
|
---|
| 236 | """Set the given stage as the new one and do whatever should be
|
---|
| 237 | done."""
|
---|
[9] | 238 | if self._flight.setStage(aircraftState.timestamp, newStage):
|
---|
| 239 | if newStage==const.STAGE_PUSHANDTAXI:
|
---|
| 240 | self.logger.message(aircraftState.timestamp, "Block time start")
|
---|
[274] | 241 | self._flight.logFuel(aircraftState)
|
---|
[331] | 242 | self.logger.message(aircraftState.timestamp,
|
---|
[313] | 243 | "ZFW: %.2f kg" % (aircraftState.zfw))
|
---|
[134] | 244 | flight = self._flight
|
---|
| 245 | if flight.v1 is None or flight.vr is None or flight.v2 is None:
|
---|
| 246 | fs.sendMessage(const.MESSAGETYPE_HELP,
|
---|
| 247 | "Don't forget to set the takeoff V-speeds!",
|
---|
| 248 | 5)
|
---|
[9] | 249 | elif newStage==const.STAGE_TAKEOFF:
|
---|
[241] | 250 | self.logger.message(aircraftState.timestamp,
|
---|
| 251 | "Flight time start")
|
---|
[331] | 252 | self.logger.message(aircraftState.timestamp,
|
---|
[9] | 253 | "Takeoff weight: %.0f kg, MTOW: %.0f kg" % \
|
---|
| 254 | (aircraftState.grossWeight, self.mtow))
|
---|
| 255 | self.logger.message(aircraftState.timestamp,
|
---|
[333] | 256 | "Wind %03.0f/%.0f" % \
|
---|
[331] | 257 | (aircraftState.windDirection,
|
---|
[9] | 258 | aircraftState.windSpeed))
|
---|
[321] | 259 | self._logRadios(aircraftState)
|
---|
[345] | 260 | self._logV1R2(aircraftState)
|
---|
[321] | 261 | elif newStage==const.STAGE_DESCENT or newStage==const.STAGE_LANDING:
|
---|
| 262 | self._logRadios(aircraftState)
|
---|
[9] | 263 | elif newStage==const.STAGE_TAXIAFTERLAND:
|
---|
[184] | 264 | flight = self._flight
|
---|
| 265 | bookedFlight = flight.bookedFlight
|
---|
| 266 | config = flight.config
|
---|
[136] | 267 | if config.onlineGateSystem and \
|
---|
[215] | 268 | flight.loggedIn and \
|
---|
[184] | 269 | not flight.entranceExam and \
|
---|
[136] | 270 | bookedFlight.arrivalICAO=="LHBP" and \
|
---|
| 271 | config.isMessageTypeFS(const.MESSAGETYPE_GATE_SYSTEM):
|
---|
[134] | 272 | self._flight.getFleet(callback = self._fleetRetrieved,
|
---|
| 273 | force = True)
|
---|
[9] | 274 | self.logger.message(aircraftState.timestamp, "Flight time end")
|
---|
[274] | 275 | self._flight.logFuel(aircraftState)
|
---|
[9] | 276 | self.logger.message(aircraftState.timestamp,
|
---|
| 277 | "Landing weight: %.0f kg, MLW: %.0f" % \
|
---|
| 278 | (aircraftState.grossWeight, self.mlw))
|
---|
| 279 | self.logger.message(aircraftState.timestamp,
|
---|
| 280 | "Vertical speed range: %.0f..%.0f feet/min" % \
|
---|
[12] | 281 | (self._minVS, self._maxVS))
|
---|
[359] | 282 | # elif newStage==const.STAGE_PARKING:
|
---|
| 283 | # self.logger.message(aircraftState.timestamp, "Block time end")
|
---|
[89] | 284 | elif newStage==const.STAGE_END:
|
---|
| 285 | flightLength = self._flight.flightTimeEnd - self._flight.flightTimeStart
|
---|
[359] | 286 | self.logger.message(aircraftState.timestamp, "Block time end")
|
---|
[89] | 287 | self.logger.message(aircraftState.timestamp,
|
---|
| 288 | "Flight time: " +
|
---|
| 289 | util.getTimeIntervalString(flightLength))
|
---|
| 290 | self.logger.message(aircraftState.timestamp,
|
---|
| 291 | "Flown distance: %.2f NM" % \
|
---|
[331] | 292 | (self._flight.flownDistance,))
|
---|
[89] | 293 | blockLength = self._flight.blockTimeEnd - self._flight.blockTimeStart
|
---|
| 294 | self.logger.message(aircraftState.timestamp,
|
---|
| 295 | "Block time: " +
|
---|
| 296 | util.getTimeIntervalString(blockLength))
|
---|
[8] | 297 |
|
---|
[9] | 298 | def prepareFlare(self):
|
---|
| 299 | """Called when it is detected that we will soon flare.
|
---|
[8] | 300 |
|
---|
| 301 | On the first call, it should start monitoring some parameters more
|
---|
| 302 | closely to determine flare time."""
|
---|
[9] | 303 | self.flight.simulator.startFlare()
|
---|
| 304 |
|
---|
[331] | 305 | def flareStarted(self, windSpeed, windDirection, visibility,
|
---|
[9] | 306 | flareStart, flareStartFS):
|
---|
| 307 | """Called when the flare has started."""
|
---|
| 308 | self.logger.message(self._aircraftState.timestamp, "The flare has begun")
|
---|
| 309 | self.logger.message(self._aircraftState.timestamp,
|
---|
[333] | 310 | "Wind %03.0f/%.0f" % \
|
---|
[9] | 311 | (windDirection, windSpeed))
|
---|
| 312 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 313 | "Visibility: %.0f metres" % (visibility,))
|
---|
| 314 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 315 | "Altimeter setting: %.0f hPa" % \
|
---|
| 316 | (self._aircraftState.altimeter,))
|
---|
[101] | 317 | self._logVRef()
|
---|
[9] | 318 | self.flight.flareStarted(flareStart, flareStartFS)
|
---|
[134] | 319 | fs.sendMessage(const.MESSAGETYPE_INFORMATION, "Flare-time", 3)
|
---|
[331] | 320 |
|
---|
[9] | 321 | def flareFinished(self, flareEnd, flareEndFS, tdRate, tdRateCalculatedByFS,
|
---|
| 322 | ias, pitch, bank, heading):
|
---|
| 323 | """Called when the flare has finished."""
|
---|
| 324 | (flareTimeFromFS, flareTime) = self.flight.flareFinished(flareEnd,
|
---|
[170] | 325 | flareEndFS,
|
---|
| 326 | tdRate)
|
---|
[9] | 327 | self.logger.message(self._aircraftState.timestamp,
|
---|
[153] | 328 | "Flaretime: %.3f (from %s)" % \
|
---|
[331] | 329 | (flareTime,
|
---|
[9] | 330 | "the simulator" if flareTimeFromFS else "real time",))
|
---|
| 331 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 332 | "Touchdown rate: %.0f feet/min" % (tdRate,))
|
---|
| 333 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 334 | "Touchdown rate was calculated by the %s" % \
|
---|
| 335 | ("simulator" if tdRateCalculatedByFS else "logger",))
|
---|
[241] | 336 | flight = self._flight
|
---|
[9] | 337 | self.logger.message(self._aircraftState.timestamp,
|
---|
[241] | 338 | "Touchdown speed: %.0f %s" % \
|
---|
| 339 | (flight.speedFromKnots(ias),
|
---|
| 340 | flight.getEnglishSpeedUnit()))
|
---|
[9] | 341 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 342 | "Touchdown pitch: %.1f degrees" % (pitch,))
|
---|
| 343 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 344 | "Touchdown bank: %.1f degrees" % (bank,))
|
---|
| 345 | self.logger.message(self._aircraftState.timestamp,
|
---|
| 346 | "Touchdown heading: %03.0f degrees" % (heading,))
|
---|
[331] | 347 | self.logger.message(self._aircraftState.timestamp,
|
---|
[340] | 348 | "CG: %.1f%%" % \
|
---|
[271] | 349 | (self._aircraftState.cog*100.0,))
|
---|
[8] | 350 |
|
---|
| 351 | def cancelFlare(self):
|
---|
| 352 | """Cancel flare, if it has started."""
|
---|
[9] | 353 | self.flight.simulator.cancelFlare()
|
---|
[8] | 354 |
|
---|
| 355 | def checkFlightEnd(self, aircraftState):
|
---|
| 356 | """Check if the end of the flight has arrived.
|
---|
| 357 |
|
---|
| 358 | This default implementation checks the N1 values, but for
|
---|
| 359 | piston-powered aircraft you need to check the RPMs."""
|
---|
| 360 | for n1 in aircraftState.n1:
|
---|
| 361 | if n1>=0.5: return False
|
---|
| 362 | return True
|
---|
| 363 |
|
---|
[101] | 364 | def updateV1R2(self):
|
---|
| 365 | """Update the V1, Vr and V2 values from the flight, if the these values
|
---|
| 366 | have already been logged."""
|
---|
| 367 | if self._v1r2LineIndex is not None:
|
---|
| 368 | self._logV1R2()
|
---|
| 369 |
|
---|
[211] | 370 | def _appendLightsLoggers(self):
|
---|
| 371 | """Append the loggers needed for the lights.
|
---|
| 372 |
|
---|
| 373 | This default implementation adds the loggers for the anti-collision
|
---|
| 374 | lights, the landing lights, the strobe lights and the NAV lights."""
|
---|
| 375 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 376 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 377 | self._checkers.append(checks.StrobeLightsLogger())
|
---|
| 378 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 379 |
|
---|
| 380 | def _appendLightsCheckers(self):
|
---|
| 381 | """Append the checkers needed for the lights.
|
---|
| 382 |
|
---|
| 383 | This default implementation adds the checkers for the anti-collision
|
---|
| 384 | lights, the landing lights, the strobe lights and the NAV lights."""
|
---|
| 385 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
| 386 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 387 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 388 | self._checkers.append(checks.StrobeLightsChecker())
|
---|
| 389 |
|
---|
[350] | 390 | def _appendSpeedChecker(self):
|
---|
| 391 | """Append the speed checker.
|
---|
| 392 |
|
---|
| 393 | This default implementation used the SpeedChecker."""
|
---|
| 394 | self._checkers.append(checks.SpeedChecker())
|
---|
| 395 |
|
---|
[241] | 396 | def _speedToLog(self, speed):
|
---|
| 397 | """Convert the given speed (being either None or expressed in the
|
---|
| 398 | flight's speed unit into a string."""
|
---|
| 399 | if speed is None:
|
---|
| 400 | return "-"
|
---|
| 401 | else:
|
---|
| 402 | return str(speed) + " " + self._flight.getEnglishSpeedUnit()
|
---|
| 403 |
|
---|
[345] | 404 | def _logV1R2(self, state = None):
|
---|
[101] | 405 | """Log the V1, Vr and V2 value either newly, or by updating the
|
---|
| 406 | corresponding line."""
|
---|
| 407 | message = "Speeds calculated by the pilot: V1: %s, VR: %s, V2: %s" % \
|
---|
[241] | 408 | (self._speedToLog(self._flight.v1),
|
---|
| 409 | self._speedToLog(self._flight.vr),
|
---|
| 410 | self._speedToLog(self._flight.v2))
|
---|
[101] | 411 |
|
---|
| 412 | if self._v1r2LineIndex is None:
|
---|
[345] | 413 | if state is None:
|
---|
| 414 | state = self._aircraftState
|
---|
[101] | 415 | self._v1r2LineIndex = \
|
---|
[345] | 416 | self.logger.message(state.timestamp, message)
|
---|
[101] | 417 | else:
|
---|
| 418 | self.logger.updateLine(self._v1r2LineIndex, message)
|
---|
| 419 |
|
---|
[96] | 420 | def updateVRef(self):
|
---|
| 421 | """Update the Vref value from the flight, if the Vref value has already
|
---|
| 422 | been logged."""
|
---|
| 423 | if self._vrefLineIndex is not None:
|
---|
| 424 | self._logVRef()
|
---|
| 425 |
|
---|
| 426 | def _logVRef(self):
|
---|
| 427 | """Log the Vref value either newly, or by updating the corresponding
|
---|
| 428 | line."""
|
---|
| 429 | message = "VRef speed calculated by the pilot: %s" % \
|
---|
[241] | 430 | (self._speedToLog(self._flight.vref),)
|
---|
[96] | 431 | if self._vrefLineIndex is None:
|
---|
| 432 | self._vrefLineIndex = \
|
---|
| 433 | self.logger.message(self._aircraftState.timestamp, message)
|
---|
| 434 | else:
|
---|
| 435 | self.logger.updateLine(self._vrefLineIndex, message)
|
---|
| 436 |
|
---|
[134] | 437 | def _fleetRetrieved(self, fleet):
|
---|
| 438 | """Callback for the fleet retrieval result."""
|
---|
| 439 | if fleet is not None:
|
---|
| 440 | gateList = ""
|
---|
| 441 | occupiedGateNumbers = fleet.getOccupiedGateNumbers()
|
---|
| 442 | for gateNumber in const.lhbpGateNumbers:
|
---|
| 443 | if gateNumber not in occupiedGateNumbers:
|
---|
| 444 | if gateList: gateList += ", "
|
---|
| 445 | gateList += gateNumber
|
---|
| 446 | fs.sendMessage(const.MESSAGETYPE_GATE_SYSTEM,
|
---|
| 447 | "Free gates: " + gateList, 20)
|
---|
[331] | 448 |
|
---|
[134] | 449 |
|
---|
[321] | 450 | def _logRadios(self, aircraftState):
|
---|
| 451 | """Log the radios from the given aircraft state."""
|
---|
| 452 | flight = self._flight
|
---|
| 453 | logger = flight.logger
|
---|
| 454 |
|
---|
| 455 | self._nav1Logger.forceLog(flight, logger, aircraftState)
|
---|
| 456 | self._nav2Logger.forceLog(flight, logger, aircraftState)
|
---|
[329] | 457 | self._adf1Logger.forceLog(flight, logger, aircraftState)
|
---|
| 458 | self._adf2Logger.forceLog(flight, logger, aircraftState)
|
---|
[321] | 459 |
|
---|
[4] | 460 | #---------------------------------------------------------------------------------------
|
---|
[7] | 461 |
|
---|
| 462 | class Boeing737(Aircraft):
|
---|
| 463 | """Base class for the various aircraft in the Boeing 737 family.
|
---|
| 464 |
|
---|
| 465 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 466 | structure:
|
---|
[140] | 467 | - fuel: left, centre, right
|
---|
[7] | 468 | - n1: left, right
|
---|
[331] | 469 | - reverser: left, right"""
|
---|
[9] | 470 | def __init__(self, flight):
|
---|
| 471 | super(Boeing737, self).__init__(flight)
|
---|
[95] | 472 | self._checkers.append(checks.ThrustChecker())
|
---|
| 473 |
|
---|
[9] | 474 | self.gearSpeedLimit = 270
|
---|
| 475 | self.flapSpeedLimits = { 1 : 260,
|
---|
| 476 | 2 : 260,
|
---|
| 477 | 5 : 250,
|
---|
| 478 | 10 : 210,
|
---|
| 479 | 15 : 200,
|
---|
| 480 | 25 : 190,
|
---|
| 481 | 30 : 175,
|
---|
| 482 | 40 : 162 }
|
---|
[7] | 483 |
|
---|
[350] | 484 | # def _appendSpeedChecker(self):
|
---|
| 485 | # """Append the NoStrobeSpeedChecker to the checkers.
|
---|
| 486 |
|
---|
| 487 | # FOR TESTING ONLY, THIS FUNCTION SHOULD NORMALLY BE COMMENTED OUT!!!"""
|
---|
| 488 | # self._checkers.append(checks.NoStrobeSpeedChecker())
|
---|
| 489 |
|
---|
[7] | 490 | #---------------------------------------------------------------------------------------
|
---|
| 491 |
|
---|
| 492 | class B736(Boeing737):
|
---|
| 493 | """Boeing 737-600 aircraft."""
|
---|
[8] | 494 | def __init__(self, flight):
|
---|
| 495 | super(B736, self).__init__(flight)
|
---|
[9] | 496 | self.dow = 38307
|
---|
| 497 | self.mtow = 58328
|
---|
| 498 | self.mlw = 54657
|
---|
| 499 | self.mzfw = 51482
|
---|
[7] | 500 |
|
---|
| 501 | #---------------------------------------------------------------------------------------
|
---|
| 502 |
|
---|
| 503 | class B737(Boeing737):
|
---|
| 504 | """Boeing 737-700 aircraft."""
|
---|
[8] | 505 | def __init__(self, flight):
|
---|
| 506 | super(B737, self).__init__(flight)
|
---|
[9] | 507 | self.dow = 39250
|
---|
| 508 | self.mtow = 61410
|
---|
| 509 | self.mlw = 58059
|
---|
| 510 | self.mzfw = 54657
|
---|
[7] | 511 |
|
---|
| 512 | #---------------------------------------------------------------------------------------
|
---|
| 513 |
|
---|
| 514 | class B738(Boeing737):
|
---|
| 515 | """Boeing 737-800 aircraft."""
|
---|
[8] | 516 | def __init__(self, flight):
|
---|
| 517 | super(B738, self).__init__(flight)
|
---|
[9] | 518 | self.dow = 42690
|
---|
| 519 | self.mtow = 71709
|
---|
| 520 | self.mlw = 65317
|
---|
| 521 | self.mzfw = 61688
|
---|
| 522 |
|
---|
| 523 | #---------------------------------------------------------------------------------------
|
---|
| 524 |
|
---|
| 525 | class B738Charter(B738):
|
---|
| 526 | """Boeing 737-800 aircraft used for charters."""
|
---|
| 527 | def __init__(self, flight):
|
---|
| 528 | super(B738Charter, self).__init__(flight)
|
---|
| 529 | self.mtow = 77791
|
---|
[7] | 530 |
|
---|
| 531 | #---------------------------------------------------------------------------------------
|
---|
| 532 |
|
---|
| 533 | class B733(Boeing737):
|
---|
| 534 | """Boeing 737-300 aircraft."""
|
---|
[8] | 535 | def __init__(self, flight):
|
---|
| 536 | super(B733, self).__init__(flight)
|
---|
[9] | 537 | self.dow = 32700
|
---|
| 538 | self.mtow = 62820
|
---|
| 539 | self.mlw = 51700
|
---|
| 540 | self.mzfw = 48410
|
---|
[7] | 541 |
|
---|
| 542 | #---------------------------------------------------------------------------------------
|
---|
| 543 |
|
---|
| 544 | class B734(Boeing737):
|
---|
| 545 | """Boeing 737-400 aircraft."""
|
---|
[8] | 546 | def __init__(self, flight):
|
---|
| 547 | super(B734, self).__init__(flight)
|
---|
[9] | 548 | self.dow = 33200
|
---|
| 549 | self.mtow = 68050
|
---|
| 550 | self.mlw = 56200
|
---|
| 551 | self.mzfw = 53100
|
---|
[7] | 552 |
|
---|
| 553 | #---------------------------------------------------------------------------------------
|
---|
| 554 |
|
---|
| 555 | class B735(Boeing737):
|
---|
| 556 | """Boeing 737-500 aircraft."""
|
---|
[8] | 557 | def __init__(self, flight):
|
---|
| 558 | super(B735, self).__init__(flight)
|
---|
[9] | 559 | self.dow = 31300
|
---|
| 560 | self.mtow = 60550
|
---|
| 561 | self.mlw = 50000
|
---|
| 562 | self.mzfw = 46700
|
---|
[7] | 563 |
|
---|
| 564 | #---------------------------------------------------------------------------------------
|
---|
| 565 |
|
---|
| 566 | class DH8D(Aircraft):
|
---|
| 567 | """Bombardier Dash-8 Q400 aircraft.
|
---|
| 568 |
|
---|
| 569 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 570 | structure:
|
---|
[140] | 571 | - fuel: left, right
|
---|
[7] | 572 | - n1: left, right
|
---|
| 573 | - reverser: left, right."""
|
---|
[140] | 574 |
|
---|
[8] | 575 | def __init__(self, flight):
|
---|
| 576 | super(DH8D, self).__init__(flight)
|
---|
[9] | 577 | self.dow = 17185
|
---|
| 578 | self.mtow = 29257
|
---|
| 579 | self.mlw = 28009
|
---|
| 580 | self.mzfw = 25855
|
---|
| 581 | self.gearSpeedLimit = 215
|
---|
| 582 | self.flapSpeedLimits = { 5 : 200,
|
---|
| 583 | 10 : 181,
|
---|
| 584 | 15 : 172,
|
---|
| 585 | 35 : 158 }
|
---|
| 586 |
|
---|
[7] | 587 | #---------------------------------------------------------------------------------------
|
---|
| 588 |
|
---|
| 589 | class Boeing767(Aircraft):
|
---|
| 590 | """Base class for the various aircraft in the Boeing 767 family.
|
---|
| 591 |
|
---|
| 592 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 593 | structure:
|
---|
[140] | 594 | - fuel: left, centre, right
|
---|
[7] | 595 | - n1: left, right
|
---|
| 596 | - reverser: left, right"""
|
---|
[140] | 597 |
|
---|
[9] | 598 | def __init__(self, flight):
|
---|
| 599 | super(Boeing767, self).__init__(flight)
|
---|
[95] | 600 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 601 | self.gearSpeedLimit = 270
|
---|
| 602 | self.flapSpeedLimits = { 1 : 255,
|
---|
| 603 | 5 : 235,
|
---|
| 604 | 10 : 215,
|
---|
| 605 | 20 : 215,
|
---|
| 606 | 25 : 185,
|
---|
| 607 | 30 : 175 }
|
---|
[7] | 608 |
|
---|
| 609 | #---------------------------------------------------------------------------------------
|
---|
| 610 |
|
---|
| 611 | class B762(Boeing767):
|
---|
| 612 | """Boeing 767-200 aircraft."""
|
---|
[8] | 613 | def __init__(self, flight):
|
---|
| 614 | super(B762, self).__init__(flight)
|
---|
[9] | 615 | self.dow = 84507
|
---|
| 616 | self.mtow = 175540
|
---|
| 617 | self.mlw = 126098
|
---|
| 618 | self.mzfw = 114758
|
---|
[7] | 619 |
|
---|
| 620 | #---------------------------------------------------------------------------------------
|
---|
| 621 |
|
---|
| 622 | class B763(Boeing767):
|
---|
| 623 | """Boeing 767-300 aircraft."""
|
---|
[8] | 624 | def __init__(self, flight):
|
---|
[331] | 625 | super(B763, self).__init__(flight)
|
---|
[9] | 626 | self.dow = 91311
|
---|
| 627 | self.mtow = 181436
|
---|
| 628 | self.mlw = 137892
|
---|
| 629 | self.mzfw = 130635
|
---|
[7] | 630 |
|
---|
| 631 | #---------------------------------------------------------------------------------------
|
---|
| 632 |
|
---|
| 633 | class CRJ2(Aircraft):
|
---|
| 634 | """Bombardier CRJ-200 aircraft.
|
---|
| 635 |
|
---|
| 636 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 637 | structure:
|
---|
[140] | 638 | - fuel: left, centre, right
|
---|
[7] | 639 | - n1: left, right
|
---|
| 640 | - reverser: left, right."""
|
---|
[8] | 641 | def __init__(self, flight):
|
---|
| 642 | super(CRJ2, self).__init__(flight)
|
---|
[95] | 643 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 644 | self.dow = 14549
|
---|
| 645 | self.mtow = 22995
|
---|
| 646 | self.mlw = 21319
|
---|
| 647 | self.mzfw = 19958
|
---|
| 648 | self.gearSpeedLimit = 240
|
---|
| 649 | self.flapSpeedLimits = { 8 : 260,
|
---|
| 650 | 20 : 220,
|
---|
| 651 | 30 : 190,
|
---|
| 652 | 45 : 175 }
|
---|
[7] | 653 |
|
---|
| 654 | #---------------------------------------------------------------------------------------
|
---|
| 655 |
|
---|
| 656 | class F70(Aircraft):
|
---|
| 657 | """Fokker 70 aircraft.
|
---|
| 658 |
|
---|
| 659 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 660 | structure:
|
---|
[140] | 661 | - fuel: left, centre, right
|
---|
[7] | 662 | - n1: left, right
|
---|
| 663 | - reverser: left, right."""
|
---|
[8] | 664 | def __init__(self, flight):
|
---|
| 665 | super(F70, self).__init__(flight)
|
---|
[95] | 666 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 667 | self.dow = 24283
|
---|
| 668 | self.mtow = 38100 # FIXME: differentiate by registration number,
|
---|
| 669 | # MTOW of HA-LMF: 41955
|
---|
| 670 | self.mlw = 36740
|
---|
| 671 | self.mzfw = 32655
|
---|
| 672 | self.gearSpeedLimit = 200
|
---|
| 673 | self.flapSpeedLimits = { 8 : 250,
|
---|
| 674 | 15 : 220,
|
---|
| 675 | 25 : 220,
|
---|
| 676 | 42 : 180 }
|
---|
[7] | 677 |
|
---|
| 678 | #---------------------------------------------------------------------------------------
|
---|
| 679 |
|
---|
| 680 | class DC3(Aircraft):
|
---|
| 681 | """Lisunov Li-2 (DC-3) aircraft.
|
---|
| 682 |
|
---|
| 683 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 684 | structure:
|
---|
[140] | 685 | - fuel: left aux, left, right, right aux
|
---|
[7] | 686 | - rpm: left, right
|
---|
| 687 | - reverser: left, right."""
|
---|
[8] | 688 | def __init__(self, flight):
|
---|
| 689 | super(DC3, self).__init__(flight)
|
---|
[9] | 690 | self.dow = 8627
|
---|
| 691 | self.mtow = 11884
|
---|
| 692 | self.mlw = 11793
|
---|
| 693 | self.mzfw = 11780
|
---|
| 694 | self.gearSpeedLimit = 148
|
---|
| 695 | self.flapSpeedLimits = { 15 : 135,
|
---|
| 696 | 30 : 99,
|
---|
| 697 | 45 : 97 }
|
---|
[8] | 698 |
|
---|
| 699 | def _checkFlightEnd(self, aircraftState):
|
---|
| 700 | """Check if the end of the flight has arrived.
|
---|
| 701 |
|
---|
| 702 | This implementation checks the RPM values to be 0."""
|
---|
| 703 | for rpm in aircraftState.rpm:
|
---|
[29] | 704 | if rpm>0: return False
|
---|
| 705 | return True
|
---|
[7] | 706 |
|
---|
| 707 | #---------------------------------------------------------------------------------------
|
---|
| 708 |
|
---|
| 709 | class T134(Aircraft):
|
---|
| 710 | """Tupolev Tu-134 aircraft.
|
---|
| 711 |
|
---|
| 712 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 713 | structure:
|
---|
[140] | 714 | - fuel: left tip, left aux, centre, right aux, right tip, external 1,
|
---|
[7] | 715 | external 2
|
---|
| 716 | - n1: left, right
|
---|
| 717 | - reverser: left, right."""
|
---|
[8] | 718 | def __init__(self, flight):
|
---|
| 719 | super(T134, self).__init__(flight)
|
---|
[95] | 720 | self._checkers.append(checks.ThrustChecker())
|
---|
[210] | 721 | self.dow = 29500
|
---|
| 722 | self.mtow = 49000
|
---|
[9] | 723 | self.mlw = 43000
|
---|
| 724 | self.mzfw = 38500
|
---|
| 725 | self.gearSpeedLimit = 216
|
---|
[210] | 726 | self.flapSpeedLimits = { 10 : 450,
|
---|
| 727 | 20 : 400,
|
---|
| 728 | 30 : 300 }
|
---|
[7] | 729 |
|
---|
[241] | 730 | @property
|
---|
| 731 | def speedInKnots(self):
|
---|
| 732 | """Indicate if the speed is in knots."""
|
---|
| 733 | return False
|
---|
[331] | 734 |
|
---|
[211] | 735 | def _appendLightsLoggers(self):
|
---|
| 736 | """Append the loggers needed for the lights."""
|
---|
| 737 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 738 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 739 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 740 |
|
---|
| 741 | def _appendLightsCheckers(self):
|
---|
| 742 | """Append the checkers needed for the lights."""
|
---|
| 743 | self._checkers.append(checks.TupolevAntiCollisionLightsChecker())
|
---|
| 744 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 745 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 746 |
|
---|
[350] | 747 | def _appendSpeedChecker(self):
|
---|
| 748 | """Append the NoStrobeSpeedChecker to the checkers."""
|
---|
| 749 | self._checkers.append(checks.NoStrobeSpeedChecker())
|
---|
| 750 |
|
---|
[7] | 751 | #---------------------------------------------------------------------------------------
|
---|
| 752 |
|
---|
| 753 | class T154(Aircraft):
|
---|
| 754 | """Tupolev Tu-154 aircraft.
|
---|
| 755 |
|
---|
| 756 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 757 | structure:
|
---|
[140] | 758 | - fuel: left aux, left, centre, centre 2, right, right aux
|
---|
[7] | 759 | - n1: left, centre, right
|
---|
| 760 | - reverser: left, right"""
|
---|
[8] | 761 | def __init__(self, flight):
|
---|
| 762 | super(T154, self).__init__(flight)
|
---|
[9] | 763 | self.dow = 53259
|
---|
| 764 | self.mtow = 98000
|
---|
| 765 | self.mlw = 78000
|
---|
| 766 | self.mzfw = 72000
|
---|
| 767 | self.gearSpeedLimit = 216
|
---|
| 768 | self.flapSpeedLimits = { 15 : 227,
|
---|
| 769 | 28 : 194,
|
---|
| 770 | 45 : 162 }
|
---|
| 771 |
|
---|
[241] | 772 | @property
|
---|
| 773 | def speedInKnots(self):
|
---|
| 774 | """Indicate if the speed is in knots."""
|
---|
| 775 | return False
|
---|
[331] | 776 |
|
---|
[211] | 777 | def _appendLightsLoggers(self):
|
---|
| 778 | """Append the loggers needed for the lights."""
|
---|
| 779 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 780 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 781 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 782 |
|
---|
| 783 | def _appendLightsCheckers(self):
|
---|
| 784 | """Append the checkers needed for the lights."""
|
---|
[311] | 785 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
[211] | 786 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 787 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 788 |
|
---|
[7] | 789 | #---------------------------------------------------------------------------------------
|
---|
| 790 |
|
---|
[9] | 791 |
|
---|
[7] | 792 | class YK40(Aircraft):
|
---|
| 793 | """Yakovlev Yak-40 aircraft.
|
---|
| 794 |
|
---|
| 795 | The aircraft type-specific values in the aircraft state have the following
|
---|
| 796 | structure:
|
---|
| 797 | - fuel: left, right
|
---|
| 798 | - n1: left, right
|
---|
| 799 | - reverser: left, right"""
|
---|
[8] | 800 | def __init__(self, flight):
|
---|
| 801 | super(YK40, self).__init__(flight)
|
---|
[95] | 802 | self._checkers.append(checks.ThrustChecker())
|
---|
[9] | 803 | self.dow = 9400
|
---|
| 804 | self.mtow = 17200
|
---|
| 805 | self.mlw = 16800
|
---|
| 806 | self.mzfw = 12100
|
---|
| 807 | self.gearSpeedLimit = 165
|
---|
| 808 | self.flapSpeedLimits = { 20 : 165,
|
---|
| 809 | 35 : 135 }
|
---|
| 810 |
|
---|
[241] | 811 | @property
|
---|
| 812 | def speedInKnots(self):
|
---|
| 813 | """Indicate if the speed is in knots."""
|
---|
| 814 | return False
|
---|
[331] | 815 |
|
---|
[211] | 816 | def _appendLightsLoggers(self):
|
---|
| 817 | """Append the loggers needed for the lights."""
|
---|
| 818 | self._checkers.append(checks.AnticollisionLightsLogger())
|
---|
| 819 | self._checkers.append(checks.LandingLightsLogger())
|
---|
| 820 | self._checkers.append(checks.NavLightsLogger())
|
---|
| 821 |
|
---|
| 822 | def _appendLightsCheckers(self):
|
---|
| 823 | """Append the checkers needed for the lights."""
|
---|
| 824 | self._checkers.append(checks.AntiCollisionLightsChecker())
|
---|
| 825 | self._checkers.append(checks.LandingLightsChecker())
|
---|
| 826 | self._checkers.append(checks.NavLightsChecker())
|
---|
| 827 |
|
---|
[7] | 828 | #---------------------------------------------------------------------------------------
|
---|
| 829 |
|
---|
[274] | 830 | mostFuelTanks = [const.FUELTANK_LEFT_TIP, const.FUELTANK_EXTERNAL1,
|
---|
| 831 | const.FUELTANK_LEFT_AUX,
|
---|
| 832 | const.FUELTANK_CENTRE,
|
---|
| 833 | const.FUELTANK_RIGHT_AUX,
|
---|
| 834 | const.FUELTANK_EXTERNAL2, const.FUELTANK_RIGHT_TIP]
|
---|
[141] | 835 |
|
---|
| 836 | #---------------------------------------------------------------------------------------
|
---|
| 837 |
|
---|
[191] | 838 | _classes = { const.AIRCRAFT_B736 : B736,
|
---|
| 839 | const.AIRCRAFT_B737 : B737,
|
---|
| 840 | const.AIRCRAFT_B738 : B738,
|
---|
| 841 | const.AIRCRAFT_B738C : B738Charter,
|
---|
| 842 | const.AIRCRAFT_B733 : B733,
|
---|
| 843 | const.AIRCRAFT_B734 : B734,
|
---|
| 844 | const.AIRCRAFT_B735 : B735,
|
---|
| 845 | const.AIRCRAFT_DH8D : DH8D,
|
---|
| 846 | const.AIRCRAFT_B762 : B762,
|
---|
| 847 | const.AIRCRAFT_B763 : B763,
|
---|
| 848 | const.AIRCRAFT_CRJ2 : CRJ2,
|
---|
| 849 | const.AIRCRAFT_F70 : F70,
|
---|
| 850 | const.AIRCRAFT_DC3 : DC3,
|
---|
| 851 | const.AIRCRAFT_T134 : T134,
|
---|
| 852 | const.AIRCRAFT_T154 : T154,
|
---|
| 853 | const.AIRCRAFT_YK40 : YK40 }
|
---|
[8] | 854 |
|
---|
| 855 | #---------------------------------------------------------------------------------------
|
---|
[197] | 856 |
|
---|
| 857 | if __name__ == "__main__":
|
---|
| 858 | value = SmoothedValue()
|
---|
| 859 |
|
---|
| 860 | print "Adding 1, 12.0"
|
---|
| 861 | value.add(1, 12.0)
|
---|
| 862 | print value.get()
|
---|
| 863 |
|
---|
| 864 | print "Adding 1, 15.0"
|
---|
| 865 | value.add(1, 15.0)
|
---|
| 866 | print value.get()
|
---|
| 867 |
|
---|
| 868 | print "Adding 2, 18.0"
|
---|
| 869 | value.add(2, 18.0)
|
---|
| 870 | print value.get()
|
---|
| 871 |
|
---|
| 872 | print "Adding 2, 20.0"
|
---|
| 873 | value.add(2, 20.0)
|
---|
| 874 | print value.get()
|
---|
| 875 |
|
---|
| 876 | print "Adding 5, 22.0"
|
---|
| 877 | value.add(5, 22.0)
|
---|
| 878 | print value.get()
|
---|
| 879 |
|
---|
| 880 | print "Adding 5, 25.0"
|
---|
| 881 | value.add(5, 25.0)
|
---|
| 882 | print value.get()
|
---|
| 883 |
|
---|
| 884 | print "Adding 5, 29.0"
|
---|
| 885 | value.add(5, 29.0)
|
---|
| 886 | print value.get()
|
---|
| 887 |
|
---|
| 888 | print "Adding 5, 21.0"
|
---|
| 889 | value.add(5, 21.0)
|
---|
| 890 | print value.get()
|
---|
| 891 |
|
---|
| 892 | print "Adding 5, 26.0"
|
---|
| 893 | value.add(5, 26.0)
|
---|
| 894 | print value.get()
|
---|
| 895 |
|
---|
| 896 | print "Adding 2, 30.0"
|
---|
| 897 | value.add(2, 30.0)
|
---|
| 898 | print value.get()
|
---|
| 899 |
|
---|
| 900 | print "Adding 2, 55.0"
|
---|
| 901 | value.add(2, 55.0)
|
---|
| 902 | print value.get()
|
---|
| 903 |
|
---|
| 904 | #---------------------------------------------------------------------------------------
|
---|