Commit 06a27d69 by Corey Koval

Fixed some seconds vs milliseconds bugs

parent d1c90e26
...@@ -21,6 +21,7 @@ from czml3.properties import Position, Polyline, PolylineOutlineMaterial, Color, ...@@ -21,6 +21,7 @@ from czml3.properties import Position, Polyline, PolylineOutlineMaterial, Color,
from bottle import route, run, request, get, post, put, response, redirect, template, static_file from bottle import route, run, request, get, post, put, response, redirect, template, static_file
d = 40000 #draw distance of LOBs in meters d = 40000 #draw distance of LOBs in meters
max_age = 5000
receivers = [] receivers = []
############################################### ###############################################
...@@ -618,6 +619,7 @@ def run_receiver(receivers): ...@@ -618,6 +619,7 @@ def run_receiver(receivers):
print("Receiving" + dots*'.') print("Receiving" + dots*'.')
print("Press Control+C to process data and exit.") print("Press Control+C to process data and exit.")
# Main loop to compute intersections between multiple receivers
intersect_list = np.array([]).reshape(0,3) intersect_list = np.array([]).reshape(0,3)
for x in range(len(receivers)): for x in range(len(receivers)):
for y in range(x): for y in range(x):
...@@ -646,14 +648,15 @@ def run_receiver(receivers): ...@@ -646,14 +648,15 @@ def run_receiver(receivers):
c.execute("INSERT INTO intersects VALUES (?,?,?,?)", to_table) c.execute("INSERT INTO intersects VALUES (?,?,?,?)", to_table)
# conn.commit() # conn.commit()
# Loop to compute intersections for a single receiver and update all receivers
for rx in receivers: for rx in receivers:
if (rx.isSingle and rx.isMobile and rx.isActive and if (rx.isSingle and rx.isMobile and rx.isActive and
rx.confidence >= ms.min_conf and rx.confidence >= ms.min_conf and
rx.power >= ms.min_power and rx.power >= ms.min_power and
rx.doa_time >= rx.previous_doa_time + 5): rx.doa_time >= rx.previous_doa_time + 10000):
current_doa = [rx.doa_time, rx.station_id, rx.latitude, current_doa = [rx.doa_time, rx.station_id, rx.latitude,
rx.longitude, rx.confidence, rx.doa] rx.longitude, rx.confidence, rx.doa]
min_time = rx.doa_time - 1800000 #half hour min_time = rx.doa_time - 900000 #15 Minutes
c.execute('''SELECT latitude, longitude, confidence, lob FROM lobs c.execute('''SELECT latitude, longitude, confidence, lob FROM lobs
WHERE station_id = ? AND time > ?''', [rx.station_id, min_time]) WHERE station_id = ? AND time > ?''', [rx.station_id, min_time])
lob_array = c.fetchall() lob_array = c.fetchall()
...@@ -668,7 +671,12 @@ def run_receiver(receivers): ...@@ -668,7 +671,12 @@ def run_receiver(receivers):
lon_rxb = previous[1] lon_rxb = previous[1]
conf_rxb = previous[2] conf_rxb = previous[2]
doa_rxb = previous[3] doa_rxb = previous[3]
if abs(doa_rxa - doa_rxb) > 5: # if abs(doa_rxa - doa_rxb) > 5:
spacial_diversity, z = v.inverse((lat_rxa, lon_rxa), (lat_rxb, lon_rxb))
#print(f"Distance from other points: {spacial_diversity}")
min_diversity = 500
if (spacial_diversity > min_diversity and
abs(doa_rxa - doa_rxb) > 5):
intersection = compute_single_intersections(lat_rxa, lon_rxa, doa_rxa, conf_rxa, intersection = compute_single_intersections(lat_rxa, lon_rxa, doa_rxa, conf_rxa,
lat_rxb, lon_rxb, doa_rxb, conf_rxb) lat_rxb, lon_rxb, doa_rxb, conf_rxb)
if intersection: if intersection:
...@@ -843,8 +851,6 @@ if __name__ == '__main__': ...@@ -843,8 +851,6 @@ if __name__ == '__main__':
ms.receiving = options.disable ms.receiving = options.disable
ms.plotintersects = options.plotintersects ms.plotintersects = options.plotintersects
max_age = 5
web = threading.Thread(target=start_server,args=(options.ipaddr, options.port)) web = threading.Thread(target=start_server,args=(options.ipaddr, options.port))
web.daemon = True web.daemon = True
web.start() web.start()
......
// Update Map ever 5 seconds // Update Map every n milliseconds
var refreshrate = 10000; var refreshrate = 600000;
var autoRefresh = setInterval(function () { updateParams(); }, refreshrate); var autoRefresh = setInterval(function () { updateParams(); }, refreshrate);
// ************************************************* // *************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment