diff --git a/app/src/modules/simulation/analyzer/analyzer.tsx b/app/src/modules/simulation/analyzer/analyzer.tsx index 28a3d09..744bac2 100644 --- a/app/src/modules/simulation/analyzer/analyzer.tsx +++ b/app/src/modules/simulation/analyzer/analyzer.tsx @@ -1722,8 +1722,8 @@ function Analyzer() { // Success rates const liftAttempts = totalLifts + errorCount; - const liftSuccessRate = liftAttempts > 0 ? (totalLifts / liftAttempts) * 100 : 100; - const positioningAccuracy = liftSuccessRate * 0.98; // Slightly lower than success rate + const liftSuccessRate = liftAttempts > 0 ? (totalLifts / liftAttempts) * 100 : 0; + const positioningAccuracy = totalLifts > 0 ? liftSuccessRate * 1.0 : 0; // Slightly lower than success rate // Load utilization const maxPickUpCount = crane.point?.actions?.[0]?.maxPickUpCount || 1; @@ -2499,22 +2499,6 @@ function Analyzer() { const previousPhase = previousCranePhasesRef.current[crane.modelUuid]; const currentPhase = crane.currentPhase; - // Check for transition from 'pickup-drop' to 'init' (Cycle completed) - if (previousPhase === "pickup-drop" && currentPhase === "init") { - // Increment cycles completed - if (!completedActionsRef.current[crane.modelUuid]) { - completedActionsRef.current[crane.modelUuid] = 0; - } - completedActionsRef.current[crane.modelUuid]++; - - // Track loads handled (number of materials carried in this cycle) - const loadsInCycle = crane.currentMaterials?.length || 1; - if (!completedActionsRef.current[`${crane.modelUuid}_loads`]) { - completedActionsRef.current[`${crane.modelUuid}_loads`] = 0; - } - completedActionsRef.current[`${crane.modelUuid}_loads`] += loadsInCycle; - } - // Track lifts (picking phase indicates a lift operation) if (previousPhase !== "picking" && currentPhase === "picking") { if (!completedActionsRef.current[`${crane.modelUuid}_lifts`]) { @@ -2528,6 +2512,21 @@ function Analyzer() { completedActionsRef.current[`${crane.modelUuid}_lift_height`] = 0; } completedActionsRef.current[`${crane.modelUuid}_lift_height`] += 5; + + // Track loads handled when picking (each pick is a load) + if (!completedActionsRef.current[`${crane.modelUuid}_loads`]) { + completedActionsRef.current[`${crane.modelUuid}_loads`] = 0; + } + completedActionsRef.current[`${crane.modelUuid}_loads`]++; + } + + // Track cycles completed when dropping is done (transition from 'dropping' to any other phase) + if (previousPhase === "dropping" && currentPhase !== "dropping") { + // Increment cycles completed + if (!completedActionsRef.current[crane.modelUuid]) { + completedActionsRef.current[crane.modelUuid] = 0; + } + completedActionsRef.current[crane.modelUuid]++; } previousCranePhasesRef.current[crane.modelUuid] = currentPhase; diff --git a/app/src/modules/simulation/simulation.tsx b/app/src/modules/simulation/simulation.tsx index cefba91..0bc5bb2 100644 --- a/app/src/modules/simulation/simulation.tsx +++ b/app/src/modules/simulation/simulation.tsx @@ -25,7 +25,7 @@ function Simulation() { const { analysis } = analysisStore(); useEffect(() => { - console.log("analysis: ", analysis); + // console.log("analysis: ", analysis); }, [analysis]); useEffect(() => {