File size: 1,409 Bytes
04cb255
 
 
 
1a8ba80
04cb255
 
 
1a8ba80
04cb255
 
 
 
c426e1f
 
04cb255
 
 
 
 
 
 
1a8ba80
04cb255
1a8ba80
04cb255
 
c426e1f
 
04cb255
1a8ba80
04cb255
1a8ba80
 
 
 
c426e1f
 
 
04cb255
1a8ba80
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
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)]
    data = []
    for pole in poles:
        solar = round(np.random.uniform(3.0, 7.5), 2)
        wind = round(np.random.uniform(0.5, 2.0), 2)
        tilt = round(np.random.uniform(0, 12), 1)
        vib = round(np.random.uniform(0.1, 2.5), 2)
        cam = np.random.choice(['Online', 'Offline'], p=[0.85, 0.15])
        alert = "Green"
        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")
            alert = "Red" if len(anomaly) > 1 else "Yellow" if anomaly else "Green"
        
        data.append({
            "Pole ID": pole,
            "Date": today,
            "Solar Gen (kWh)": solar,
            "Wind Gen (kWh)": wind,
            "Tilt (°)": tilt,
            "Vibration (g)": vib,
            "Camera Status": cam,
            "Anomalies": "; ".join(anomaly),
            "Alert Level": alert
        })
    return pd.DataFrame(data)