Spaces:
Sleeping
Sleeping
Update modules/simulator.py
Browse files- modules/simulator.py +21 -5
modules/simulator.py
CHANGED
@@ -8,13 +8,29 @@ def simulate_data(n=50, faults=True, update_time=None):
|
|
8 |
update_time = update_time or datetime.datetime.now() # Use provided time or current time
|
9 |
poles = [f"Pole_{i+1:03}" for i in range(n)]
|
10 |
# Distribute poles across 4 locations
|
11 |
-
locations = ["Hyderabad"] * 12 + ["Gadwal"] * 12 + ["Kurnool"] * 12 + ["
|
12 |
# Simulate coordinates and zones for each location
|
|
|
13 |
coords = {
|
14 |
-
"Hyderabad": [
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
location_coords = []
|
20 |
for loc in locations:
|
|
|
8 |
update_time = update_time or datetime.datetime.now() # Use provided time or current time
|
9 |
poles = [f"Pole_{i+1:03}" for i in range(n)]
|
10 |
# Distribute poles across 4 locations
|
11 |
+
locations = ["Hyderabad"] * 12 + ["Gadwal"] * 12 + ["Kurnool"] * 12 + ["Ballari"] * 14
|
12 |
# Simulate coordinates and zones for each location
|
13 |
+
base_hyderabad = (17.329181, 78.610091) # Vacant land space in Hyderabad
|
14 |
coords = {
|
15 |
+
"Hyderabad": [
|
16 |
+
(
|
17 |
+
base_hyderabad[0] + np.random.uniform(-0.00015, 0.00015),
|
18 |
+
base_hyderabad[1] + np.random.uniform(-0.00015, 0.00015),
|
19 |
+
f"Zone_{np.random.choice(['North', 'South', 'Central'])}"
|
20 |
+
) for _ in range(12)
|
21 |
+
],
|
22 |
+
"Gadwal": [
|
23 |
+
(16.235 + np.random.uniform(-0.03, 0.03), 77.795 + np.random.uniform(-0.03, 0.03), f"Zone_{np.random.choice(['East', 'West'])}")
|
24 |
+
for _ in range(12)
|
25 |
+
],
|
26 |
+
"Kurnool": [
|
27 |
+
(15.828 + np.random.uniform(-0.04, 0.04), 78.037 + np.random.uniform(-0.04, 0.04), f"Zone_{np.random.choice(['Urban', 'Rural'])}")
|
28 |
+
for _ in range(12)
|
29 |
+
],
|
30 |
+
"Ballari": [
|
31 |
+
(15.139 + np.random.uniform(-0.04, 0.04), 76.921 + np.random.uniform(-0.04, 0.04), f"Zone_{np.random.choice(['Downtown', 'Industrial', 'Residential'])}")
|
32 |
+
for _ in range(14)
|
33 |
+
]
|
34 |
}
|
35 |
location_coords = []
|
36 |
for loc in locations:
|