115 lines
3.2 KiB
TypeScript
115 lines
3.2 KiB
TypeScript
import React from 'react';
|
|
import { Kpi, Alert, CoopZone, EnvironmentData, AlertSeverity } from '../types';
|
|
import {
|
|
ThermometerIcon,
|
|
TrendingUpIcon,
|
|
AlertTriangleIcon,
|
|
UsersIcon,
|
|
UtensilsIcon,
|
|
FeedWastageIcon,
|
|
} from '../components/icons/Icons';
|
|
|
|
export const initialKpis: Record<string, Kpi> = {
|
|
population: {
|
|
title: 'Populasi Total',
|
|
value: 125430,
|
|
unit: 'ekor',
|
|
icon: React.createElement(UsersIcon),
|
|
trend: [125000, 125100, 125200, 125250, 125300, 125350, 125430],
|
|
status: 'ok',
|
|
},
|
|
feedConsumption: {
|
|
title: 'Konsumsi Pakan',
|
|
value: 135,
|
|
unit: 'g/ekor/hari',
|
|
icon: React.createElement(UtensilsIcon),
|
|
trend: [130, 132, 134, 136, 135, 135, 135],
|
|
status: 'ok',
|
|
},
|
|
feedWastage: {
|
|
title: 'Pemborosan Pakan',
|
|
value: 4.8,
|
|
unit: '%',
|
|
icon: React.createElement(FeedWastageIcon),
|
|
trend: [5.2, 5.1, 4.9, 5.0, 4.8, 4.8, 4.8],
|
|
status: 'warning',
|
|
},
|
|
fcr: {
|
|
title: 'FCR (Real-time)',
|
|
value: 1.62,
|
|
unit: '',
|
|
icon: React.createElement(TrendingUpIcon),
|
|
trend: [1.65, 1.64, 1.63, 1.63, 1.62, 1.62, 1.62],
|
|
status: 'ok',
|
|
},
|
|
mortality: {
|
|
title: 'Mortalitas Hari Ini',
|
|
value: 58,
|
|
unit: 'ekor',
|
|
icon: React.createElement(AlertTriangleIcon),
|
|
trend: [65, 68, 62, 64, 59, 61, 58],
|
|
status: 'warning',
|
|
},
|
|
temperature: {
|
|
title: 'Suhu Rata-rata',
|
|
value: 31.8,
|
|
unit: '°C',
|
|
icon: React.createElement(ThermometerIcon),
|
|
trend: [31.5, 31.7, 31.8, 31.9, 31.8, 31.7, 31.8],
|
|
status: 'warning',
|
|
},
|
|
};
|
|
|
|
export const initialAlerts: Alert[] = [
|
|
{
|
|
id: 1,
|
|
severity: AlertSeverity.CRITICAL,
|
|
message: 'Terdeteksi 5 mortalitas baru di Kandang A / Lt 2.',
|
|
timestamp: '3 menit yang lalu',
|
|
},
|
|
{
|
|
id: 2,
|
|
severity: AlertSeverity.WARNING,
|
|
message: 'Kepadatan di Kandang C / Lt 1 (37.1 kg/m²) melebihi ambang batas.',
|
|
timestamp: '10 menit yang lalu',
|
|
},
|
|
{
|
|
id: 4,
|
|
severity: AlertSeverity.CRITICAL,
|
|
message: 'Suhu di Kandang K-01 (Kalimantan) mencapai 33.2°C.',
|
|
timestamp: '25 menit yang lalu',
|
|
},
|
|
{
|
|
id: 5,
|
|
severity: AlertSeverity.WARNING,
|
|
message: 'Sensor Kelembapan K-01-H1 offline selama lebih dari 1 jam.',
|
|
timestamp: '1 jam yang lalu',
|
|
},
|
|
{
|
|
id: 3,
|
|
severity: AlertSeverity.INFO,
|
|
message: 'Siklus pakan otomatis berikutnya akan dimulai dalam 30 menit.',
|
|
timestamp: '2 jam yang lalu',
|
|
},
|
|
];
|
|
|
|
export const initialCoopZones: CoopZone[] = Array.from({ length: 48 }, (_, i) => ({
|
|
id: `Z-${i + 1}`,
|
|
density: 28 + Math.random() * 12, // Random density between 28 and 40
|
|
count: Math.floor(2500 + Math.random() * 200), // Approx 125k total chickens
|
|
}));
|
|
|
|
export const initialEnvironmentData: EnvironmentData[] = Array.from({ length: 12 }, (_, i) => {
|
|
const now = new Date();
|
|
const hoursAgo = new Date(now.getTime() - (11 - i) * 60 * 60 * 1000);
|
|
const hour = hoursAgo.getHours();
|
|
const minute = Math.floor(hoursAgo.getMinutes() / 5) * 5; // Round to 5-minute intervals
|
|
|
|
return {
|
|
time: `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`,
|
|
Suhu: 30 + Math.random() * 2.5 - 1,
|
|
Kelembapan: 65 + Math.random() * 15 - 7,
|
|
Amonia: 15 + Math.random() * 7 - 3,
|
|
};
|
|
});
|