Spaces:
Sleeping
Sleeping
Commit
·
455e7aa
1
Parent(s):
7c07482
Subindo arquivos11
Browse files
app.py
CHANGED
@@ -3,14 +3,13 @@ import folium
|
|
3 |
from geopy.distance import geodesic
|
4 |
import numpy as np
|
5 |
import matplotlib.pyplot as plt
|
6 |
-
import matplotlib.figure as Figure
|
7 |
|
8 |
-
#
|
9 |
def calculate_line_of_sight(site1, site2):
|
10 |
distance = geodesic(site1[:2], site2[:2]).km
|
11 |
return distance
|
12 |
|
13 |
-
#
|
14 |
def calculate_propagation_loss(distance, frequency, model):
|
15 |
if model == "Okumura-Hata-Davidson":
|
16 |
loss = 69.55 + 26.16 * np.log10(frequency) - 13.82 * np.log10(30) + (44.9 - 6.55 * np.log10(30)) * np.log10(distance)
|
@@ -30,7 +29,7 @@ def calculate_link_budget(tx_power, rx_sensitivity, propagation_loss):
|
|
30 |
|
31 |
#
|
32 |
def create_map():
|
33 |
-
m = folium.Map(location=[-27.595, -48.558], zoom_start=15
|
34 |
site1 = folium.Marker(location=[-27.5968, -48.5686], tooltip='Site 1', draggable=True, icon=folium.Icon(color='red'))
|
35 |
site2 = folium.Marker(location=[-27.5970, -48.5613], tooltip='Site 2', draggable=True, icon=folium.Icon(color='blue'))
|
36 |
site1.add_to(m)
|
@@ -38,7 +37,7 @@ def create_map():
|
|
38 |
folium.LatLngPopup().add_to(m)
|
39 |
return m._repr_html_()
|
40 |
|
41 |
-
#
|
42 |
def draw_fresnel(site1, site2, distance):
|
43 |
frequency = 2400 #
|
44 |
wavelength = 300 / frequency #
|
@@ -99,7 +98,7 @@ def interactive_propagation_map(site1_coords, site2_coords, site1_height, site2_
|
|
99 |
link_budget2 = calculate_link_budget(tx_power2, rx_sensitivity1, propagation_loss)
|
100 |
|
101 |
#
|
102 |
-
m = folium.Map(location=[(site1_lat + site2_lat) / 2, (site1_lon + site2_lon) / 2], zoom_start=15
|
103 |
folium.Marker(location=[site1_lat, site1_lon], popup='Site 1 Coordenadas: {:.6f}, {:.6f}'.format(site1_lat, site1_lon), tooltip='Site 1', draggable=True, icon=folium.Icon(color='red')).add_to(m)
|
104 |
folium.Marker(location=[site2_lat, site2_lon], popup='Site 2 Coordenadas: {:.6f}, {:.6f}'.format(site2_lat, site2_lon), tooltip='Site 2', draggable=True, icon=folium.Icon(color='blue')).add_to(m)
|
105 |
folium.PolyLine(locations=[[site1_lat, site1_lon], [site2_lat, site2_lon]], color='blue', weight=2.5).add_to(m)
|
@@ -163,7 +162,7 @@ with gr.Blocks() as interface:
|
|
163 |
#
|
164 |
interface.launch()
|
165 |
|
166 |
-
#
|
167 |
js_code = '''
|
168 |
document.addEventListener('DOMContentLoaded', function() {
|
169 |
var iframe = document.querySelector('iframe');
|
|
|
3 |
from geopy.distance import geodesic
|
4 |
import numpy as np
|
5 |
import matplotlib.pyplot as plt
|
|
|
6 |
|
7 |
+
#
|
8 |
def calculate_line_of_sight(site1, site2):
|
9 |
distance = geodesic(site1[:2], site2[:2]).km
|
10 |
return distance
|
11 |
|
12 |
+
#
|
13 |
def calculate_propagation_loss(distance, frequency, model):
|
14 |
if model == "Okumura-Hata-Davidson":
|
15 |
loss = 69.55 + 26.16 * np.log10(frequency) - 13.82 * np.log10(30) + (44.9 - 6.55 * np.log10(30)) * np.log10(distance)
|
|
|
29 |
|
30 |
#
|
31 |
def create_map():
|
32 |
+
m = folium.Map(location=[-27.595, -48.558], zoom_start=15)
|
33 |
site1 = folium.Marker(location=[-27.5968, -48.5686], tooltip='Site 1', draggable=True, icon=folium.Icon(color='red'))
|
34 |
site2 = folium.Marker(location=[-27.5970, -48.5613], tooltip='Site 2', draggable=True, icon=folium.Icon(color='blue'))
|
35 |
site1.add_to(m)
|
|
|
37 |
folium.LatLngPopup().add_to(m)
|
38 |
return m._repr_html_()
|
39 |
|
40 |
+
#
|
41 |
def draw_fresnel(site1, site2, distance):
|
42 |
frequency = 2400 #
|
43 |
wavelength = 300 / frequency #
|
|
|
98 |
link_budget2 = calculate_link_budget(tx_power2, rx_sensitivity1, propagation_loss)
|
99 |
|
100 |
#
|
101 |
+
m = folium.Map(location=[(site1_lat + site2_lat) / 2, (site1_lon + site2_lon) / 2], zoom_start=15)
|
102 |
folium.Marker(location=[site1_lat, site1_lon], popup='Site 1 Coordenadas: {:.6f}, {:.6f}'.format(site1_lat, site1_lon), tooltip='Site 1', draggable=True, icon=folium.Icon(color='red')).add_to(m)
|
103 |
folium.Marker(location=[site2_lat, site2_lon], popup='Site 2 Coordenadas: {:.6f}, {:.6f}'.format(site2_lat, site2_lon), tooltip='Site 2', draggable=True, icon=folium.Icon(color='blue')).add_to(m)
|
104 |
folium.PolyLine(locations=[[site1_lat, site1_lon], [site2_lat, site2_lon]], color='blue', weight=2.5).add_to(m)
|
|
|
162 |
#
|
163 |
interface.launch()
|
164 |
|
165 |
+
# JavaScript
|
166 |
js_code = '''
|
167 |
document.addEventListener('DOMContentLoaded', function() {
|
168 |
var iframe = document.querySelector('iframe');
|