feat: Add comprehensive simulation analyzer component with detailed tracking, configuration, and performance metrics.
This commit is contained in:
@@ -183,43 +183,12 @@ function Analyzer() {
|
|||||||
const stateTransitionsRef = useRef<Record<string, any[]>>({});
|
const stateTransitionsRef = useRef<Record<string, any[]>>({});
|
||||||
|
|
||||||
// Material flow tracking - tracks materials added/removed per asset
|
// Material flow tracking - tracks materials added/removed per asset
|
||||||
const materialAdditionsRef = useRef<
|
const materialAdditionsRef = useRef<Record<string, { materialId: string; materialType: string; timestamp: number; fromAsset?: string }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
materialId: string;
|
|
||||||
materialType: string;
|
|
||||||
timestamp: number;
|
|
||||||
fromAsset?: string;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
const materialRemovalsRef = useRef<
|
const materialRemovalsRef = useRef<Record<string, { materialId: string; materialType: string; timestamp: number; toAsset?: string; processingTime?: number }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
materialId: string;
|
|
||||||
materialType: string;
|
|
||||||
timestamp: number;
|
|
||||||
toAsset?: string;
|
|
||||||
processingTime?: number;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Asset state change tracking with detailed timestamps
|
// Asset state change tracking with detailed timestamps
|
||||||
const assetStateChangesRef = useRef<
|
const assetStateChangesRef = useRef<Record<string, { fromState: string; toState: string; timestamp: number; duration?: number }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
fromState: string;
|
|
||||||
toState: string;
|
|
||||||
timestamp: number;
|
|
||||||
duration?: number;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Cycle tracking for each asset
|
// Cycle tracking for each asset
|
||||||
const assetCyclesRef = useRef<
|
const assetCyclesRef = useRef<
|
||||||
@@ -237,45 +206,13 @@ function Analyzer() {
|
|||||||
>({});
|
>({});
|
||||||
|
|
||||||
// Action completion times for performance analysis
|
// Action completion times for performance analysis
|
||||||
const actionCompletionTimesRef = useRef<
|
const actionCompletionTimesRef = useRef<Record<string, { actionId: string; actionType: string; startTime: number; endTime: number; duration: number; success: boolean }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
actionId: string;
|
|
||||||
actionType: string;
|
|
||||||
startTime: number;
|
|
||||||
endTime: number;
|
|
||||||
duration: number;
|
|
||||||
success: boolean;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Material processing times per asset
|
// Material processing times per asset
|
||||||
const materialProcessingTimesRef = useRef<
|
const materialProcessingTimesRef = useRef<Record<string, { materialId: string; entryTime: number; exitTime?: number; processingDuration?: number; waitTime?: number }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
materialId: string;
|
|
||||||
entryTime: number;
|
|
||||||
exitTime?: number;
|
|
||||||
processingDuration?: number;
|
|
||||||
waitTime?: number;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// WIP (Work In Progress) tracking per asset over time
|
// WIP (Work In Progress) tracking per asset over time
|
||||||
const wipSnapshotsRef = useRef<
|
const wipSnapshotsRef = useRef<Record<string, { timestamp: number; wipCount: number; materialIds: string[] }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
timestamp: number;
|
|
||||||
wipCount: number;
|
|
||||||
materialIds: string[];
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Throughput snapshots for trend analysis
|
// Throughput snapshots for trend analysis
|
||||||
const throughputSnapshotsRef = useRef<
|
const throughputSnapshotsRef = useRef<
|
||||||
@@ -291,44 +228,13 @@ function Analyzer() {
|
|||||||
>({});
|
>({});
|
||||||
|
|
||||||
// Asset performance snapshots
|
// Asset performance snapshots
|
||||||
const performanceSnapshotsRef = useRef<
|
const performanceSnapshotsRef = useRef<Record<string, { timestamp: number; utilization: number; efficiency: number; quality: number; oee: number }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
timestamp: number;
|
|
||||||
utilization: number;
|
|
||||||
efficiency: number;
|
|
||||||
quality: number;
|
|
||||||
oee: number;
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Bottleneck detection tracking
|
// Bottleneck detection tracking
|
||||||
const bottleneckEventsRef = useRef<
|
const bottleneckEventsRef = useRef<Record<string, { timestamp: number; queueLength: number; utilizationRate: number; waitingMaterials: string[] }[]>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
timestamp: number;
|
|
||||||
queueLength: number;
|
|
||||||
utilizationRate: number;
|
|
||||||
waitingMaterials: string[];
|
|
||||||
}[]
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Previous state tracking for delta calculations
|
// Previous state tracking for delta calculations
|
||||||
const previousAssetStatesRef = useRef<
|
const previousAssetStatesRef = useRef<Record<string, { state: string; isActive: boolean; materialCount: number; timestamp: number }>>({});
|
||||||
Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
state: string;
|
|
||||||
isActive: boolean;
|
|
||||||
materialCount: number;
|
|
||||||
timestamp: number;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
>({});
|
|
||||||
|
|
||||||
// Track previous actions for ArmBots to detect cycle completion
|
// Track previous actions for ArmBots to detect cycle completion
|
||||||
const previousArmBotActionsRef = useRef<Record<string, string | undefined>>({});
|
const previousArmBotActionsRef = useRef<Record<string, string | undefined>>({});
|
||||||
@@ -356,12 +262,7 @@ function Analyzer() {
|
|||||||
materialId: string;
|
materialId: string;
|
||||||
createdAt: number;
|
createdAt: number;
|
||||||
completedAt?: number;
|
completedAt?: number;
|
||||||
path: {
|
path: { assetId: string; assetType: string; entryTime: number; exitTime?: number }[];
|
||||||
assetId: string;
|
|
||||||
assetType: string;
|
|
||||||
entryTime: number;
|
|
||||||
exitTime?: number;
|
|
||||||
}[];
|
|
||||||
totalProcessingTime?: number;
|
totalProcessingTime?: number;
|
||||||
totalWaitTime?: number;
|
totalWaitTime?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user