DSatishchandra commited on
Commit
2631089
·
verified ·
1 Parent(s): 8c37e65

Update modules/simulator.py

Browse files
Files changed (1) hide show
  1. modules/simulator.py +11 -4
modules/simulator.py CHANGED
@@ -1,12 +1,16 @@
1
  import pandas as pd
2
  import numpy as np
3
  import datetime
 
4
 
5
- def simulate_data(n=10, faults=True):
6
  today = datetime.date.today()
7
  poles = [f"Pole_{i+1:03}" for i in range(n)]
 
 
 
8
  data = []
9
- for pole in poles:
10
  solar = round(np.random.uniform(3.0, 7.5), 2)
11
  wind = round(np.random.uniform(0.5, 2.0), 2)
12
  required = round(np.random.uniform(1.0, 1.5), 2)
@@ -15,6 +19,7 @@ def simulate_data(n=10, faults=True):
15
  tilt = round(np.random.uniform(0, 12), 1)
16
  vib = round(np.random.uniform(0.1, 2.5), 2)
17
  sufficient = "Yes" if total >= required else "No"
 
18
  anomaly = []
19
  if faults:
20
  if solar < 4.0:
@@ -22,9 +27,9 @@ def simulate_data(n=10, faults=True):
22
  if wind < 0.7:
23
  anomaly.append("Low Wind Output")
24
  if tilt > 10:
25
- anomaly.append("Pole Tilt Risk")
26
  if vib > 2.0:
27
- anomaly.append("Vibration Alert")
28
  if cam == "Offline":
29
  anomaly.append("Camera Offline")
30
  if sufficient == "No":
@@ -36,6 +41,8 @@ def simulate_data(n=10, faults=True):
36
  alert = "Red"
37
  data.append({
38
  "PoleID": pole,
 
 
39
  "Date": today,
40
  "SolarGen(kWh)": solar,
41
  "WindGen(kWh)": wind,
 
1
  import pandas as pd
2
  import numpy as np
3
  import datetime
4
+ import uuid
5
 
6
+ def simulate_data(n=50, faults=True):
7
  today = datetime.date.today()
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
+ np.random.shuffle(locations) # Randomize for realism
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)
 
19
  tilt = round(np.random.uniform(0, 12), 1)
20
  vib = round(np.random.uniform(0.1, 2.5), 2)
21
  sufficient = "Yes" if total >= required else "No"
22
+ rfid = str(uuid.uuid4())[:16] # 16-digit unique RFID
23
  anomaly = []
24
  if faults:
25
  if solar < 4.0:
 
27
  if wind < 0.7:
28
  anomaly.append("Low Wind Output")
29
  if tilt > 10:
30
+ anomaly.append("High Pole Tilt Risk")
31
  if vib > 2.0:
32
+ anomaly.append("Excessive Vibration")
33
  if cam == "Offline":
34
  anomaly.append("Camera Offline")
35
  if sufficient == "No":
 
41
  alert = "Red"
42
  data.append({
43
  "PoleID": pole,
44
+ "RFID": rfid,
45
+ "Location": location,
46
  "Date": today,
47
  "SolarGen(kWh)": solar,
48
  "WindGen(kWh)": wind,