private int CalculateDispatchRate(Flight flight) { var millisecondsBetweenStartAndFlight = TimerService.ConvertTimeSpanToMilliseconds(flight.TimeToFlightSinceSimulationStart); var calculatedPreflightBuffer = millisecondsBetweenStartAndFlight * 0.1; if (calculatedPreflightBuffer > DefaultMaxPreflightBufferInMilliseconds) { calculatedPreflightBuffer = DefaultMaxPreflightBufferInMilliseconds; } var timeUntillFlightWithoutPreflightBuffer = millisecondsBetweenStartAndFlight - calculatedPreflightBuffer; var dispatchRate = timeUntillFlightWithoutPreflightBuffer / flight.BaggageCount; return((int)dispatchRate / _simulationSettings.Multiplier); }