feat: introduce comprehensive simulation analysis module with detailed performance and material flow tracking.

This commit is contained in:
2025-12-18 16:23:14 +05:30
parent b3adb4ea20
commit c072648397
2 changed files with 32 additions and 2 deletions

View File

@@ -203,6 +203,28 @@ function Analyzer() {
>
>({});
const resetAllRefs = () => {
assetCyclesRef.current = {};
assetStateChangesRef.current = {};
materialAdditionsRef.current = {};
materialRemovalsRef.current = {};
materialProcessingTimesRef.current = {};
wipSnapshotsRef.current = {};
throughputSnapshotsRef.current = {};
performanceSnapshotsRef.current = {};
bottleneckEventsRef.current = {};
previousAssetStatesRef.current = {};
materialLifecycleRef.current = {};
setAnalysis(null);
setAnalyzing(false);
};
useEffect(() => {
if (!isPlaying) {
resetAllRefs();
}
}, [isPlaying]);
// ============================================================================
// ENHANCED UTILITY FUNCTIONS
// ============================================================================
@@ -2157,6 +2179,14 @@ function Analyzer() {
performAnalysisRef.current = performAnalysis;
}, [performAnalysis]);
// Trigger analysis when assets or materials change
useEffect(() => {
if (!isPlaying) return;
// Perform analysis when any asset or material state changes
performAnalysisRef.current();
}, [conveyors, vehicles, armBots, machines, humans, cranes, materials, isPlaying]);
// Perform initial analysis and set up interval
useEffect(() => {
if (!isPlaying) return;