internal MyCustomDataSource(OplFactory oplF, CSSLQueue <Lot> queue, LithographyArea lithographyArea, CPDispatcher cpDispatcher) : base(oplF) { Queue = queue; LithographyArea = lithographyArea; CPDispatcher = cpDispatcher; }
protected override void OnUpdate(ModelElementBase modelElement) { // Get lithographyArea object LithographyArea l = (LithographyArea)modelElement; endDateDay = startDateRun.AddSeconds(GetTime); if (l.EndedOnDispatcherNoSolution) { Writer.WriteLine($"Ended on error, CP dispatcher did not find a solution for {endDateDay}"); } else { // Write double operationalEfficiency; double rateEffiency = l.TotalTheoreticalProductionTime / l.TotalProductionTime; double totalDowntime = l.TotalDownTime; if (!l.Dynamic) { operationalEfficiency = l.TotalProductionTime / (l.Machines.Count * l.SchedulingHorizon); } else { foreach (Machine machine in l.Machines) { if (machine.StartMachineDown > machine.EndMachineDown && machine.StartMachineDown < GetTime) { totalDowntime += GetTime - machine.StartMachineDown; } } operationalEfficiency = l.TotalProductionTime / (l.Machines.Count * l.GetTime - totalDowntime); } double performanceEfficiency = operationalEfficiency * rateEffiency; Writer.WriteLine($"{replication},{startDateDay},{endDateDay},{l.TotalLotsProduced},{l.TotalWafersProduced}," + $"{rateEffiency},{operationalEfficiency},{performanceEfficiency}," + $"{l.TotalSquaredLateness + l.Dispatcher.GetSquaredLatenessQueue()},{l.TotalSquaredEarliness + l.Dispatcher.GetEarlinessQueue(true)},{l.TotalSquaredTardiness + l.Dispatcher.GetTardinessQueue(true)}," + $"{l.TotalLayerSwitches},{l.TotalReticleSwitches},{l.Dispatcher.GetQueueLength()}," + $"{l.TotalSquaredLateness},{l.TotalSquaredEarliness},{l.TotalSquaredTardiness}," + $"{l.Dispatcher.GetSquaredLatenessQueue()},{l.Dispatcher.GetEarlinessQueue(true)},{l.Dispatcher.GetTardinessQueue(true)}," + $"{l.TotalEarliness},{l.TotalEarliness},{l.TotalTardiness}," + $"{l.Dispatcher.GetTardinessQueue(false) - l.Dispatcher.GetEarlinessQueue(false)},{l.Dispatcher.GetEarlinessQueue(false)},{l.Dispatcher.GetTardinessQueue(false)}," + $"{l.TotalProductionTargetFulfillment},{l.TotalScoreThroughput},{l.TotalScoreDueDate},{l.TotalScoreWIPBalance}," + $"{totalDowntime},{l.TotalLotsProducedEarly},{l.TotalLotsProducedTardy},{l.Dispatcher.GetNrJobsEarly()},{l.Dispatcher.GetNrJobsTardy()}"); ExperimentWriter.WriteLine($"{replication},{startDateDay},{endDateDay},{l.TotalLotsProduced},{l.TotalWafersProduced}," + $"{rateEffiency},{operationalEfficiency},{performanceEfficiency}," + $"{l.TotalSquaredLateness + l.Dispatcher.GetSquaredLatenessQueue()},{l.TotalSquaredEarliness + l.Dispatcher.GetEarlinessQueue(true)},{l.TotalSquaredTardiness + l.Dispatcher.GetTardinessQueue(true)}," + $"{l.TotalLayerSwitches},{l.TotalReticleSwitches},{l.Dispatcher.GetQueueLength()}," + $"{l.TotalSquaredLateness},{l.TotalSquaredEarliness},{l.TotalSquaredTardiness}," + $"{l.Dispatcher.GetSquaredLatenessQueue()},{l.Dispatcher.GetEarlinessQueue(true)},{l.Dispatcher.GetTardinessQueue(true)}," + $"{l.TotalEarliness},{l.TotalEarliness},{l.TotalTardiness}," + $"{l.Dispatcher.GetTardinessQueue(false) - l.Dispatcher.GetEarlinessQueue(false)},{l.Dispatcher.GetEarlinessQueue(false)},{l.Dispatcher.GetTardinessQueue(false)}," + $"{l.TotalProductionTargetFulfillment},{l.TotalScoreThroughput},{l.TotalScoreDueDate},{l.TotalScoreWIPBalance}," + $"{totalDowntime},{l.TotalLotsProducedEarly},{l.TotalLotsProducedTardy},{l.Dispatcher.GetNrJobsEarly()},{l.Dispatcher.GetNrJobsTardy()}"); // Update startDateDay startDateDay = endDateDay; } }
private static void Experiment(string control, DateTime startDate, string experimentOutputDirectory, bool dynamic, bool stochastic, double weightA, double weightB, double weightC, Dictionary <string, double> deterministicNonProductiveTimesRMS, Dictionary <string, double> deterministicNonProductiveTimesARMS, int CPTimeLimit = 0) { string outputDir = experimentOutputDirectory; Simulation sim = new Simulation("LithographyAreaSim", outputDir); // Parameters double simulationLength = 30 * 24 * 3600 + 1; string productionControl = control; // The experiment part sim.MyExperiment.LengthOfReplication = simulationLength; sim.MyExperiment.LengthOfWarmUp = 0; if (stochastic) { sim.MyExperiment.NumberOfReplications = 1; } else { sim.MyExperiment.NumberOfReplications = 1; } // The model part // Create lithographyarea LithographyArea lithographyarea = new LithographyArea(sim.MyModel, "LithographyArea", startDate, simulationLength, dynamic, stochastic, weightA, weightB, weightC, deterministicNonProductiveTimesRMS, deterministicNonProductiveTimesARMS); // Property dispatcherBase DispatcherBase dispatcher = null; // Create chosen dispatcher if (productionControl == "FIFO") { dispatcher = new FIFODispatcher(lithographyarea, "FIFODispatcher"); } else if (productionControl == "EDD") { dispatcher = new EDDDispatcher(lithographyarea, "EDDDispatcher"); } else if (productionControl == "SPT") { dispatcher = new SPTDispatcher(lithographyarea, "SPTDispatcher"); } else if (productionControl == "CurrentProductionControl") { dispatcher = new CurrentDispatcher(lithographyarea, "CurrentDispatcher"); } else if (productionControl == "ILPScheduling") { dispatcher = new ILPSchedulingDispatcher(lithographyarea, "ILPSchedulingDispatcher"); } else if (productionControl == "CPScheduling") { dispatcher = new CPDispatcher(lithographyarea, "CPDispatcher", CPTimeLimit); } // Set dispatcher lithographyarea.SetDispatcher(dispatcher); // Create and set lotGenerator LotGenerator lotGenerator = new LotGenerator(lithographyarea, "LotGenerator", dispatcher); lithographyarea.SetLotGenerator(lotGenerator); // Create and set machines lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#1", dispatcher, 1)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#2", dispatcher, 2)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#3", dispatcher, 3)); lithographyarea.AddMachine(new Machine(lithographyarea, "ASML#4", dispatcher, 4)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#5", dispatcher, 5)); lithographyarea.AddMachine(new Machine(lithographyarea, "ASML#6", dispatcher, 6)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#7", dispatcher, 7)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#8", dispatcher, 8)); lithographyarea.AddMachine(new Machine(lithographyarea, "ASML#9", dispatcher, 9)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#10", dispatcher, 10)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#11", dispatcher, 11)); lithographyarea.AddMachine(new Machine(lithographyarea, "StepCluster#13", dispatcher, 12)); // The observer part LithographyAreaObserver lithographyAreaObserver = new LithographyAreaObserver(sim, startDate); lithographyarea.Subscribe(lithographyAreaObserver); foreach (Machine machine in lithographyarea.Machines) { MachineObserver machineObserver = new MachineObserver(sim, startDate); machine.Subscribe(machineObserver); } // Run sim.Run(); // The reporting part SimulationReporter reporter = sim.MakeSimulationReporter(); reporter.PrintSummaryToFile(); reporter.PrintSummaryToConsole(); }