public static double getRFIFactor(Quantity distance) {
		double result = 1d;
		Double calcDistance = distance.convert(Unit.KILOMETER).getAmount();
		if (calcDistance <= 0) {
			throw new IllegalArgumentException("The distance has to be bigger than 0, was " + distance.toString());
		}

		if (rfiValues.containsKey(calcDistance)) {
			result = rfiValues.get(calcDistance);
		} else {
			Double minKey = null;
			Double maxKey = null;

			for (Double key : rfiValues.keySet()) {
				final double diff = calcDistance - key;
				if (diff < 0) {
					// Since TreeMap is sorted by keys and the actual key is bigger than the distance, maxKey is found
					// and the loop will be stopped
					maxKey = key;
					break;
				} else {
					// key is smaller than distance but bigger than the previous key
					minKey = key;
				}
			}

			if (minKey == null) {
				// Could happen if distance is smaller than the smallest defined key
				result = rfiValues.get(maxKey);
			} else if (maxKey == null) {
				// Could happen if distance is bigger than the highest defined key
				result = rfiValues.get(minKey);
			} else {
				// linear interpolation
				final double minValue = rfiValues.get(minKey);
				final double steep = (rfiValues.get(maxKey) - minValue) / (maxKey - minKey);
				result = minValue + steep * (calcDistance - minKey);
			}
		}

		return result;
	}