in agora/contoso_motors/src/mqtt-simulator/data-emulator.py [0:0]
def simulate_equipment_telemetry(current_time):
# Convert time string
current_time = str(current_time)
equipment_telemetry = [
# Assembly Robot
{
"date_time": current_time,
"equipment_id": "EQ-001",
"type": "assembly_robot",
"status": random.choice(["operational", "maintenance_required"]), # Instead of random, use periodic maintenance
"operational_time_hours": random.uniform(10, 12),
"cycles_completed": random.randint(3400, 3500),
"efficiency": random.uniform(93, 97),
"maintenance_alert": random.choice(["none", "scheduled_check", "urgent_maintenance_required"]), # Instead of random, use periodic maintenance alerts
"last_maintenance": "2024-02-20",
"next_scheduled_maintenance": "2024-04-01"
},
# Conveyor Belt
{
"date_time": current_time,
"equipment_id": "EQ-002",
"type": "conveyor_belt",
"status": random.choice(["operational", "maintenance_required"]),
"operational_time_hours": random.uniform(10, 12),
"distance_covered_meters": random.randint(10000, 12000),
"efficiency": random.uniform(98, 99),
"maintenance_alert": random.choice(["none", "scheduled_check"]),
"last_maintenance": "2024-03-15",
"next_scheduled_maintenance": "2024-03-30"
},
# Paint Station
{
"date_time": current_time,
"equipment_id": "EQ-003",
"type": "paint_station",
"status": random.choice(["operational", "maintenance_required"]),
"operational_time_hours": random.uniform(7, 9),
"units_processed": random.randint(400, 500),
"efficiency": random.uniform(90, 93),
"maintenance_alert": random.choice(["none", "urgent_maintenance_required"]),
"last_maintenance": "2024-02-25",
"next_scheduled_maintenance": "Overdue"
},
# Welding-Assembly Robot
{
"date_time": current_time,
"equipment_id": "EQ-004",
"status": random.choice(["operational", "maintenance_required"]),
"operational_time_hours": random.uniform(10, 12),
"cycles_completed": random.randint(3400, 3500),
"efficiency": random.uniform(94, 96),
"maintenance_alert": random.choice(["none", "scheduled_check"]),
"last_maintenance": "2024-03-20",
"next_scheduled_maintenance": "2024-04-01",
"operation_stats": {
"average_cycle_time": "10 seconds",
"failures_last_month": random.randint(1, 3),
"success_rate": random.uniform(98.5, 99.9)
}
},
# Welding Robot
{
"date_time": current_time,
"equipment_id": "WLD-001",
"status": random.choice(["operational", "maintenance_required"]),
"operational_time_hours": random.uniform(9, 11),
"welds_completed": random.randint(5100, 5300),
"efficiency": random.uniform(97, 99),
"maintenance_alert": random.choice(["none", "scheduled_check"]),
"last_maintenance": "2024-03-22",
"next_scheduled_maintenance": "2024-04-05",
"operation_stats": {
"average_weld_time": "30 seconds",
"failures_last_month": random.randint(0, 3),
"success_rate": random.uniform(98, 99.9)
}
}
]
return equipment_telemetry