Spaces:
Sleeping
Sleeping
Update modules/simulator.py
Browse files- modules/simulator.py +15 -2
modules/simulator.py
CHANGED
@@ -8,9 +8,19 @@ def simulate_data(n=50, faults=True):
|
|
8 |
poles = [f"Pole_{i+1:03}" for i in range(n)]
|
9 |
# Distribute poles across 4 locations
|
10 |
locations = ["Hyderabad"] * 12 + ["Gadwal"] * 12 + ["Kurnool"] * 12 + ["Bangalore"] * 14
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
data = []
|
13 |
-
for i, (pole, location) in enumerate(zip(poles, locations)):
|
14 |
solar = round(np.random.uniform(3.0, 7.5), 2)
|
15 |
wind = round(np.random.uniform(0.5, 2.0), 2)
|
16 |
required = round(np.random.uniform(1.0, 1.5), 2)
|
@@ -43,6 +53,9 @@ def simulate_data(n=50, faults=True):
|
|
43 |
"PoleID": pole,
|
44 |
"RFID": rfid,
|
45 |
"Location": location,
|
|
|
|
|
|
|
46 |
"Date": today,
|
47 |
"SolarGen(kWh)": solar,
|
48 |
"WindGen(kWh)": wind,
|
|
|
8 |
poles = [f"Pole_{i+1:03}" for i in range(n)]
|
9 |
# Distribute poles across 4 locations
|
10 |
locations = ["Hyderabad"] * 12 + ["Gadwal"] * 12 + ["Kurnool"] * 12 + ["Bangalore"] * 14
|
11 |
+
# Simulate coordinates and zones for each location
|
12 |
+
coords = {
|
13 |
+
"Hyderabad": [(17.385 + np.random.uniform(-0.05, 0.05), 78.486 + np.random.uniform(-0.05, 0.05), f"Zone_{np.random.choice(['North', 'South', 'Central'])}") for _ in range(12)],
|
14 |
+
"Gadwal": [(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'])}") for _ in range(12)],
|
15 |
+
"Kurnool": [(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'])}") for _ in range(12)],
|
16 |
+
"Bangalore": [(12.971 + np.random.uniform(-0.06, 0.06), 77.594 + np.random.uniform(-0.06, 0.06), f"Zone_{np.random.choice(['Downtown', 'Suburban', 'Industrial'])}") for _ in range(14)]
|
17 |
+
}
|
18 |
+
location_coords = []
|
19 |
+
for loc in locations:
|
20 |
+
coord = coords[loc].pop(0)
|
21 |
+
location_coords.append(coord)
|
22 |
data = []
|
23 |
+
for i, (pole, location, (lat, lon, zone)) in enumerate(zip(poles, locations, location_coords)):
|
24 |
solar = round(np.random.uniform(3.0, 7.5), 2)
|
25 |
wind = round(np.random.uniform(0.5, 2.0), 2)
|
26 |
required = round(np.random.uniform(1.0, 1.5), 2)
|
|
|
53 |
"PoleID": pole,
|
54 |
"RFID": rfid,
|
55 |
"Location": location,
|
56 |
+
"Zone": zone,
|
57 |
+
"Latitude": lat,
|
58 |
+
"Longitude": lon,
|
59 |
"Date": today,
|
60 |
"SolarGen(kWh)": solar,
|
61 |
"WindGen(kWh)": wind,
|