private void Dispatch(CSSLEvent e) { NotifyObservers(this); Job job = Queue.DequeueFirst(); job.ServiceTime = serviceTimeDistribution.Next(); if (job.ServiceTime > serviceTimeThreshold) { Job job2 = SplitJobs(job); SendToServerPool(job); SendToServerPool(job2); } else { SendToServerPool(job); } // Schedule next dispatch event, if queue is nonempty if (QueueLength > 0) { ScheduleEvent(GetTime + dispatchTime, Dispatch); } }
public void HandleDispatchRequest(CSSLEvent e) { if (LotInService == null) { WorkStation.Dispatcher.DispatchTo(this); } }
public CSSLEvent Next() { CSSLEvent e = fes.First(); fes.RemoveAt(0); return(e); }
public void DispatchToNextMachine(CSSLEvent e) { Machine machine = freeMachines.First(); freeMachines.Remove(machine); DispatchTo(machine); }
protected void RescheduleAllMachines(CSSLEvent e) { if (!LithographyArea.Dynamic && !FirstScheduleGenerated) { // Set weight of each Lot for (int j = 0; j < Queue.Length; j++) { Lot peekLot = Queue.PeekAt(j); Queue.PeekAt(j).WeightDueDate = GetDueDateWeight(peekLot); Queue.PeekAt(j).WeightWIPBalance = GetWIPBalanceWeight(peekLot); } FirstScheduleGenerated = true; } // Reset all dictionaries ResetDictionaries(); // Reschedule Machine Layer Allocation RescheduleMachineLayerAllocation(); List <Machine> copyList = new List <Machine>(LithographyArea.WaitingMachines); // Trigger HandleStartRun for machines waiting foreach (Machine machine in copyList) { machine.DispatchNextLot(); } // Schedule reschedule event every 4 hours ScheduleEvent(GetTime + 4 * 3600, RescheduleAllMachines); }
private void HandleStartRun(CSSLEvent e) { // Get dispatched lot Lot lot = Queue.PeekFirst(); // Get LotID CurrentLot = lot; // Get startRun timestamp CurrentStartRun = GetTime; double processingTime; if (LithographyArea.Stochastic) { // Get processing time of lot processingTime = GetStochasticProcessingTime(lot); } else { // Get processing time of lot processingTime = GetDeterministicProcessingTime(lot); } // Schedule endRun ScheduleEvent(GetTime + processingTime, HandleEndRun); }
protected void RescheduleEvent(CSSLEvent e) { // Reschedule Machine Layer Allocation RescheduleLotMachineAllocation(); TriggerMachinesWaiting(); ScheduleEvent(GetTime + 1 * 3600, RescheduleEvent); // TODO: Determine interval }
public void HandleLotEndUltratechTitan(CSSLEvent e) { // Get information of Scheduled Lot Array thisLotEndUltratechTitan = UltratechTitanLotEnds[0]; string irdName = (string)thisLotEndUltratechTitan.GetValue(1); int lotQty = (int)thisLotEndUltratechTitan.GetValue(2); // Remove lot from List UltratechTitanLotEnds.Remove(thisLotEndUltratechTitan); // Add Nr. of produced lots to LayerActivity if (LayerActivities.ContainsKey(irdName)) { LayerActivities[irdName] += lotQty; } else { LayerActivities["Other"] += lotQty; } //TotalWafersProducedDay += lotQty; //TotalLotsProducedDay += 1; //TotalLotsProduced += 1; //TotalWafersProduced += lotQty; // Schedule next event on the UltratechTitan if (UltratechTitanLotEnds.Count > 0) { Array nextLotEndUltratechTitan = UltratechTitanLotEnds[0]; double nextLotEndUltratechTitanTime = (double)nextLotEndUltratechTitan.GetValue(3); ScheduleEvent(nextLotEndUltratechTitanTime, HandleLotEndUltratechTitan); } }
// Handle the event of a lot arrival private void HandleLotArrival(CSSLEvent e) { // Get first lot in queue of LotGenerator Lot lot = Queue.DequeueFirst(); // Send lot to dispatcher Dispatcher.HandleArrival(lot); }
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 } }
internal void ScheduleEvent(double time, CSSLEventAction action) { if (time < Time) { throw new Exception("Attempted to schedule an event in the past."); } CSSLEvent e = new CSSLEvent(time, action); calendar.Add(e); }
internal void Execute(CSSLEvent e) { if (e.Time < Time) { throw new Exception("Attempted to execute an event in the past."); } PreviousEventTime = Time; Time = e.Time; e.Execute(); }
protected override void HandleGeneration(CSSLEvent e) { Customer customer = new Customer((int)customerDistribution.Next()); dispatcher.HandleCustomer(customer); if (customers < 600) { ScheduleEvent(NextEventTime(), HandleGeneration); } }
private void HandleEndMachineDown(CSSLEvent e) { LithographyArea.MachineStates[Name] = "Up"; Dispatcher.HandleEndMachineDown(); // Reschedule if needed DispatchNextLot(); TriggerMachinesWaiting(); // Maybe not needed EndMachineDown = GetTime; LithographyArea.HandleEndMachineDown(this); }
protected override void HandleGeneration(CSSLEvent e) { // Schedule the next generation event. ScheduleEvent(NextEventTime(), HandleGeneration); // Instantiate a job. Job job = new Job(GetTime); // Send to dispatcher. dispatcher.HandleArrival(job); }
private void DispatchFirstLot(CSSLEvent e) { Lot lot; // Get lot by dispatching in the dispatcher lot = Dispatcher.Dispatch(this); if (lot != null) { if (PreviousLotIRDName == null) { PreviousLotIRDName = lot.IrdName; PreviousReticleID = lot.ReticleID1; } else { if (PreviousLotIRDName != lot.IrdName) { LithographyArea.TotalLayerSwitches += 1; } if (PreviousReticleID != lot.ReticleID1) { LithographyArea.TotalReticleSwitches += 1; } PreviousLotIRDName = lot.IrdName; PreviousReticleID = lot.ReticleID1; } // Place lot in queue of machine Queue.EnqueueLast(lot); // If machine was waiting if (LithographyArea.WaitingMachines.Contains(this)) { // Remove machine from waiting list LithographyArea.WaitingMachines.Remove(this); } // First nonProductiveTime = 0 double nonProductiveTime = 0; // Schedule next startRun ScheduleEvent(GetTime + nonProductiveTime, HandleStartRun); } else //no lot is in queue which can be produced { // let machine wait if (!LithographyArea.WaitingMachines.Contains(this)) { LithographyArea.WaitingMachines.Add(this); } } }
private void GenerateRandomLot(CSSLEvent e) { while (toyFab.CurrentWIP < TargetWIP) { string randomPT = productTypes[rnd.Next(productTypes.Length)]; Lot newLot = new Lot(GetTime, toyFab.Sequences[randomPT]); toyFab.HandleGeneration(newLot); newLot.SendToNextWorkStation(); } }
protected override void HandleGeneration(CSSLEvent e) { // Schedule next generation ScheduleEvent(NextEventTime(), HandleGeneration); if (!UseRealLotStartsFlag) { StartManualLotStarts(); } else { StartRealLotStarts(); } }
public void TriggerMachinesWaitingEvent(CSSLEvent e) { // If machines are waiting if (LithographyArea.WaitingMachines.Count > 0) { List <Machine> copyList = new List <Machine>(LithographyArea.WaitingMachines); // Trigger HandleStartRun for machines waiting foreach (Machine machine in copyList) { machine.DispatchNextLot(); } } ScheduleEvent(GetTime + 3600, TriggerMachinesWaitingEvent); }
private void HandleDeparture(CSSLEvent e) { dataCenter.HandleDeparture(); NotifyObservers(this); Job job = queue.DequeueFirst(); NrJobsDispatched++; if (job.DepartureTime != GetTime) { throw new Exception($"Departure time of job {job.Id} is {job.DepartureTime} and does not match current time {GetTime}"); } }
public void HandleDeparture(CSSLEvent e) { if (LotStepInService == null) { throw new Exception($"Tried to send lot from {Name}, but there is no type (LotType) in service."); } else { NotifyObservers(this); TotalQueueLength--; dispatcher.HandleDeparture(); } }
public void HandleDeparture(CSSLEvent e) { if (LotStepInService == null) { Dispatcher.HandleFirstDeparture(); } else { IsArrivalFlag = false; Dispatcher.HandleDeparture(); } NotifyObservers(this); }
public void HandleEndDay(CSSLEvent e) { double totalFulfillment = 0; double totalLayers = 0; foreach (KeyValuePair <string, int> layer in LayerTargets) { double fulfillment = (double)LayerActivities[layer.Key] / (double)LayerTargets[layer.Key]; if (fulfillment > 1) { fulfillment = 1; } totalFulfillment += fulfillment; totalLayers += 1; } TotalProductionTargetFulfillment += totalFulfillment / totalLayers; // Read value NotifyObservers(this); LayerActivities = new Dictionary <string, int> { { "OW Photo", 0 }, { "ZL Photo", 0 }, { "DC Photo", 0 }, { "DP Photo", 0 }, { "OD Photo", 0 }, { "OC Photo", 0 }, { "TR Photo", 0 }, { "PS Photo", 0 }, { "AP T3 Photo", 0 }, { "SN Photo", 0 }, { "CO Photo", 0 }, { "IN Photo", 0 }, { "CB Photo", 0 }, { "VI Photo", 0 }, { "TC Photo", 0 }, { "Other", 0 } }; // Schedule event to read and reset the underproduction after 24h ScheduleEvent(GetTime + 24 * 3600, HandleEndDay); }
public void HandleStartReplication(CSSLEvent e) { //string state = "Up"; //(string)startState[0]; //DateTime startDateTime = (DateTime)startState[1]; //ouble startFirstLot = GetTime;//startDateTime.Subtract(LithographyArea.StartDate).TotalSeconds; //if (state == "Down") //{ // LithographyArea.MachineStates[Name] = "Down"; // Dispatcher.HandleMachineDown(this); // ScheduleEvent(GetTime + startFirstLot, HandleEndMachineDown); //} ScheduleEvent(GetTime, DispatchFirstLot); //ScheduleEvent(GetTime + startFirstLot, DispatchFirstLot); }
protected override void HandleGeneration(CSSLEvent e) { // Schedule next generation ScheduleEvent(NextEventTime(), HandleGeneration); // Create lots according to preset quantities in LotStarts and send all lots to first workstation foreach (KeyValuePair <LotType, int> lotStart in waferFab.LotStarts) { Sequence sequence = waferFab.Sequences[lotStart.Key]; for (int i = 0; i < lotStart.Value; i++) { Lot newLot = new Lot(GetTime, sequence); newLot.SendToNextWorkCenter(); } } }
public void HandleDeparture(CSSLEvent e) { Lot lot = LotInService; if (!lot.HasNextStep) { lot.EndTime = GetTime; NotifyObservers(this); ToyFab.HandleDeparture(lot); } LotInService = null; StartTimeCurrentService = -1; lot.SendToNextWorkStation(); ScheduleEvent(GetTime, HandleDispatchRequest); }
public void Add(CSSLEvent e) { if (fes.Count == 0) { fes.Add(e); } else { for (int i = 0; i <= fes.Count; i++) { if (i == fes.Count) { fes.Add(e); break; } else if (fes[i].Time > e.Time) { fes.Insert(i, e); break; } } } }
public void HandleEvent(CSSLEvent e) { int machineIndex = 0; for (int i = 0; i < Length; i++) { if (Machines[i].EventTime < Machines[machineIndex].EventTime) { machineIndex = i; } } int bufferIndex = 1; for (int i = 1; i < Length; i++) { if (Buffers[i].EventTime < Buffers[bufferIndex].EventTime) { bufferIndex = i; } } NotifyObservers(this); UpdateBufferContents(); if (Machines[machineIndex].EventTime < Buffers[bufferIndex].EventTime) { Machines[machineIndex].HandleMachineEvent(); } else { Buffers[bufferIndex].HandleBufferEvent(); } ScheduleEvent(NextEventTime(), HandleEvent); }
public void DispatchNextLotEvent(CSSLEvent e) { DispatchNextLot(); }
public void ScheduleFirstEvent(CSSLEvent e) { ScheduleEvent(NextEventTime(), HandleEvent); }