Increased refractory period from 20 minutes to 30 minutes.

This commit is contained in:
John Wiseman 2019-12-14 13:48:02 -08:00
parent 54ef13d817
commit bb89e13737
2 changed files with 11 additions and 9 deletions

View File

@ -33,7 +33,7 @@ The bot will consider an aircraft to be "circling" if:
300 feet or more. 300 feet or more.
5. If an aircraft was previously circling, it must be considered 5. If an aircraft was previously circling, it must be considered
not-circling for at least 20 minutes before it is again eligible to not-circling for at least 30 minutes before it is again eligible to
be considered circling. be considered circling.
There are a lot of weird flight paths that can meet criterion #1, and There are a lot of weird flight paths that can meet criterion #1, and

View File

@ -112,7 +112,7 @@
pruned-db (reduce-kv (fn [m k v] pruned-db (reduce-kv (fn [m k v]
(if (or (> (count (:history v)) 0) (if (or (> (count (:history v)) 0)
(if-let [ended-circling-time (:ended-circling-time v)] (if-let [ended-circling-time (:ended-circling-time v)]
(< (- now ended-circling-time) (* 20 60 1000)))) (< (- now ended-circling-time) (* 30 60 1000))))
(assoc m k v) (assoc m k v)
m)) m))
{} {}
@ -207,7 +207,7 @@
(and currently-circling? (and currently-circling?
(not previously-circling?) (not previously-circling?)
(or (nil? (:ended-circling-time ac)) (or (nil? (:ended-circling-time ac))
(> (- now (:ended-circling-time ac)) (* 20 60 1000)))) (> (- now (:ended-circling-time ac)) (* 30 60 1000))))
(let [new-ac (assoc ac :started-circling-time now)] (let [new-ac (assoc ac :started-circling-time now)]
(recur (rest old-db) (recur (rest old-db)
(assoc new-db icao new-ac) (assoc new-db icao new-ac)
@ -320,12 +320,12 @@
;; If the centroid of the aircraft's positions is less than this close ;; If the centroid of the aircraft's positions is less than this close
;; to an airport, then it's probably just doinf flight training. ;; to an airport, then it's probably just doinf flight training.
(def minimum-airport-distance-miles 2.5) (def minimum-airport-distance-km 2.5)
;;(def minimum-airport-distance-miles 0) ;;(def minimum-airport-distance-miles 0)
(defn process-potential-circle [ac config now] (defn process-potential-circle [ac config now]
(p/let [icao (:icao ac) (p/let [icao (:icao ac)
centroid (geo/centroid (filter #(< (- now (:time %)) (* 3 60 1000)) (:history ac))) centroid (geo/centroid (filter #(< (- now (:time %)) (* 6 60 1000)) (:history ac)))
lat (:lat centroid) lat (:lat centroid)
lon (:lon centroid) lon (:lon centroid)
airport (closest-airport lat lon) airport (closest-airport lat lon)
@ -335,11 +335,11 @@
(log-info "%s: Closest airport is %s, distance: %s" (log-info "%s: Closest airport is %s, distance: %s"
(:icao ac) (:label airport-properties) (:distance airport-properties)) (:icao ac) (:label airport-properties) (:distance airport-properties))
(log-info "%s: No airports nearby" (:icao ac))) (log-info "%s: No airports nearby" (:icao ac)))
(if (and airport-properties (<= (:distance airport-properties) minimum-airport-distance-miles)) (if (and airport-properties (<= (:distance airport-properties) minimum-airport-distance-km))
(log-info "%s: Filtering out because it's %s miles (minimum is %s) from %s" (log-info "%s: Filtering out because it's %s km (minimum is %s) from %s"
(:icao ac) (:icao ac)
(:distance airport-properties) (:distance airport-properties)
minimum-airport-distance-miles minimum-airport-distance-km
(:label airport-properties) (:label airport-properties)
()) ())
(do (do
@ -360,8 +360,10 @@
wiki-nearby (filter feature-has-wikipedia-page? nearby)] wiki-nearby (filter feature-has-wikipedia-page? nearby)]
(log-info "%s: Nearby geo search: %s potential landmarks, %s with wikipedia pages" (log-info "%s: Nearby geo search: %s potential landmarks, %s with wikipedia pages"
icao (count nearby) (count wiki-nearby)) icao (count nearby) (count wiki-nearby))
(doseq [l (take 3 nearby)]
(log-info "%s: Landmark: %s") (:properties l))
(doseq [f wiki-nearby] (doseq [f wiki-nearby]
(log-info "%s: %s %s" (log-info "%s: Wiki landmark: %s %s"
icao icao
(get-in f [:properties :label] f) (get-in f [:properties :label] f)
(get-in f [:properties :addendum] f))) (get-in f [:properties :addendum] f)))