File size: 1,905 Bytes
27e95cd
 
 
bd95f45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pandas as pd
import numpy as np

def simulate_data(n=50, faults=True):
    np.random.seed(42)
    sites = {
        "Hyderabad": (17.385, 78.4867),
        "Ballari": (15.1394, 76.9214),
        "Gadwal": (16.232, 77.795),
        "Kurnool": (15.8281, 78.0373)
    }
    data = []
    for i in range(n):
        site = np.random.choice(list(sites.keys()))
        lat, lon = sites[site]
        solar = np.round(np.random.uniform(3, 7.5), 2)
        wind = np.round(np.random.uniform(0.5, 2.0), 2)
        tilt = np.round(np.random.uniform(0, 15), 1)
        vib = np.round(np.random.uniform(0.1, 3.0), 2)
        cam = np.random.choice(["Online", "Offline"], p=[0.85, 0.15])
        power_required = np.round(np.random.uniform(1.0, 1.5), 2)
        total = solar + wind
        sufficient = "Yes" if total >= power_required else "No"

        anomaly = []
        if faults:
            if solar < 4.0: anomaly.append("Low Solar")
            if wind < 0.7: anomaly.append("Low Wind")
            if tilt > 10: anomaly.append("Tilt Risk")
            if vib > 2.0: anomaly.append("Vibration Alert")
            if cam == "Offline": anomaly.append("Camera Offline")
            if sufficient == "No": anomaly.append("Power Insufficient")

        alert = "Green" if len(anomaly) == 0 else "Yellow" if len(anomaly) == 1 else "Red"

        data.append({
            "Pole ID": f"Pole_{i+1:03}",
            "Site": site,
            "Latitude": lat + np.random.uniform(-0.01, 0.01),
            "Longitude": lon + np.random.uniform(-0.01, 0.01),
            "SolarGen(kWh)": solar,
            "WindGen(kWh)": wind,
            "Tilt(°)": tilt,
            "Vibration(g)": vib,
            "Camera Status": cam,
            "Power Sufficient": sufficient,
            "Anomalies": "; ".join(anomaly) if anomaly else "None",
            "Alert Level": alert
        })
    return pd.DataFrame(data)