private void HandleEndRun(CSSLEvent e) { // Get finished lot Lot finishedLot = Queue.DequeueFirst(); // Make Resource Available Dispatcher.MakeResourceAvailable(finishedLot); // Send reticle back to dispatcher Dispatcher.HandleReticleArrival(finishedLot.ReticleID1, Name); // Get endRun timestamp CurrentEndRun = GetTime; // HandleEndRun in LithographyArea LithographyArea.HandleEndRun(finishedLot, this); // Notify machine observer NotifyObservers(this); // Check if machine goes Down double rnd = MachineDownRandomNumber.NextDouble(); double total = 0; string nonProductiveTimeType = null; if (LithographyArea.Stochastic) { foreach (KeyValuePair <string, double> entry in NonProductiveTimeProbabilityDictionary) { total += entry.Value; if (rnd < total) { nonProductiveTimeType = entry.Key; break; } } } if (nonProductiveTimeType == "Down") { LithographyArea.MachineStates[Name] = nonProductiveTimeType; StartMachineDown = GetTime; double nonProductiveTime = StochasticNonProductiveTimeDictionary[nonProductiveTimeType].Next(); Dispatcher.HandleMachineDown(this); ScheduleEvent(GetTime + nonProductiveTime, HandleEndMachineDown); } else { DispatchNextLot(); TriggerMachinesWaiting(); //TODO: Change } }
private void HandleEndMachineDown(CSSLEvent e) { LithographyArea.MachineStates[Name] = "Up"; Dispatcher.HandleEndMachineDown(); // Reschedule if needed DispatchNextLot(); TriggerMachinesWaiting(); // Maybe not needed EndMachineDown = GetTime; LithographyArea.HandleEndMachineDown(this); }