File size: 2,263 Bytes
bda640c
 
 
 
 
 
 
 
6046a3b
bda640c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6046a3b
 
 
 
bda640c
6046a3b
 
bda640c
6046a3b
bda640c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6046a3b
 
bda640c
 
 
e98f99b
6046a3b
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import pandas as pd
import numpy as np
import datetime

def simulate_data(n=10, faults=True):
    today = datetime.date.today()
    poles = [f"Pole_{i+1:03}" for i in range(n)]

    # Coordinates for sites
    sites = {
        "Hyderabad": (17.3850, 78.4867),
        "Gadwal": (16.2356, 77.7956),
        "Kurnool": (15.8281, 78.0373),
        "Ballari": (15.1394, 76.9214)
    }

    site_names = list(sites.keys())
    data = []

    for pole in poles:
        site = np.random.choice(site_names)
        lat, lon = sites[site]

        solar = round(np.random.uniform(3.0, 7.5), 2)
        wind = round(np.random.uniform(0.5, 2.0), 2)
        required = round(np.random.uniform(1.0, 1.5), 2)
        total = solar + wind
        cam = np.random.choice(['Online', 'Offline'], p=[0.85, 0.15]) if faults else "Online"
        tilt = round(np.random.uniform(0, 12), 1)
        vib = round(np.random.uniform(0.1, 2.5), 2)
        sufficient = "Yes" if total >= required else "No"

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

        if len(anomaly) == 0:
            alert = "Green"
            alert_weight = 1
        elif len(anomaly) == 1:
            alert = "Yellow"
            alert_weight = 2
        else:
            alert = "Red"
            alert_weight = 3

        data.append({
            "Pole ID": pole,
            "Date": today,
            "Site": site,
            "Latitude": lat,
            "Longitude": lon,
            "Solar Gen (kWh)": solar,
            "Wind Gen (kWh)": wind,
            "Power Required (kWh)": required,
            "Power Sufficient": sufficient,
            "Camera Status": cam,
            "Tilt (°)": tilt,
            "Vibration (g)": vib,
            "Anomalies": "; ".join(anomaly) if anomaly else "None",
            "Alert Level": alert,
            "Alert Weight": alert_weight
        })

    return pd.DataFrame(data)