static void Main(string[] args) { string inputDirectory = @"C:\CSSLWaferFab\Input\WSC2021paper"; string outputDirectory = @"C:\CSSLWaferFab\Output\WSC2021paper"; string eptParameterFile = @"FittedEPTParameters - 2019-6-1.csv"; List <string> workcenters = new List <string> { "PHOTOLITH", "FURNACING", "DRY ETCH" }; List <string> SOvsLDO = new List <string> { "SO", "LDO" }; //List<string> SOvsLDO = new List<string> { "LDO"}; foreach (string wc in workcenters) { WaferFabSettings waferFabSettings = Deserializer.DeserializeWaferFabSettings(Path.Combine(inputDirectory, "SerializedFiles", $"WaferFabSettings_{wc}_WithLotStarts.dat")); foreach (string overtaking in SOvsLDO) { bool lotStepOvertaking = overtaking == "SO" ? false : true; #region Initializing simulation Simulation simulation = new Simulation(wc, outputDirectory); #endregion #region Experiment settings simulation.MyExperiment.NumberOfReplications = 10; simulation.MyExperiment.LengthOfReplication = 60 * 60 * 24 * 91; // September and October simulation.MyExperiment.LengthOfWarmUp = 60 * 60 * 24 * 30; DateTime initialDateTime = new DateTime(2019, 08, 01); #endregion #region WaferFab settings EPTDistributionReader distributionReader = new EPTDistributionReader(Path.Combine(inputDirectory, "CSVs"), waferFabSettings.WorkCenters, waferFabSettings.LotStepsPerWorkStation); waferFabSettings.WCServiceTimeDistributions = distributionReader.GetServiceTimeDistributions(eptParameterFile); waferFabSettings.WCOvertakingDistributions = distributionReader.GetOvertakingDistributions(lotStepOvertaking); waferFabSettings.WCDispatcherTypes[wc] = DispatcherBase.Type.EPTOVERTAKING; #endregion #region Make starting lots AutoDataReader dataReader = new AutoDataReader(Path.Combine(inputDirectory, "Auto"), Path.Combine(inputDirectory, "SerializedFiles")); #endregion #region Building the model WaferFab waferFab = new WaferFab(simulation.MyModel, "WaferFab", new ConstantDistribution(60 * 60 * 24), initialDateTime); WorkCenter workCenter = new WorkCenter(waferFab, $"WorkCenter_{wc}", waferFabSettings.WCServiceTimeDistributions[wc], waferFabSettings.LotStepsPerWorkStation[wc]); // Connect workcenter to WIPDependentDistribution EPTDistribution distr = (EPTDistribution)waferFabSettings.WCServiceTimeDistributions[wc]; distr.WorkCenter = workCenter; EPTOvertakingDispatcher dispatcher = new EPTOvertakingDispatcher(workCenter, workCenter.Name + "_EPTOvertakingDispatcher", waferFabSettings.WCOvertakingDistributions[wc]); workCenter.SetDispatcher(dispatcher); // Connect workcenter to OvertakingDistribution waferFabSettings.WCOvertakingDistributions[wc].WorkCenter = workCenter; waferFab.AddWorkCenter(workCenter.Name, workCenter); // Sequences foreach (var sequence in waferFabSettings.Sequences) { waferFab.AddSequence(sequence.Key, sequence.Value); } // LotSteps waferFab.LotSteps = waferFab.Sequences.Select(x => x.Value).Select(x => x.GetCurrentStep(0)).ToDictionary(x => x.Name); // LotGenerator waferFab.SetLotGenerator(new LotGenerator(waferFab, "LotGenerator", new ConstantDistribution(60), true)); // Add lotstarts waferFab.LotStarts = waferFabSettings.LotStarts; // Add observers LotOutObserver lotOutObserver = new LotOutObserver(simulation, wc + "_" + overtaking + "LotOutObserver"); dispatcher.Subscribe(lotOutObserver); OptimiserObserver optimiserObserver = new OptimiserObserver(simulation, "TotalQueueObserver"); workCenter.Subscribe(optimiserObserver); #endregion #region Read initial lots //RealSnapshotReader reader = new RealSnapshotReader(); //List<RealSnapshot> realSnapshots = reader.Read(Path.Combine(inputDirectory, "SerializedFiles", reader.GetRealSnapshotString(initialDateTime)), 1); //RealSnapshot realSnapShot = realSnapshots.Where(x => x.Time == initialDateTime).First(); //List<string> lotSteps = workCenter.LotSteps.Select(x => x.Name).ToList(); //List<RealLot> initialRealLots = realSnapShot.GetRealLots(1).Where(x => lotSteps.Contains(x.IRDGroup)).ToList(); //List<Lot> initialLots = initialRealLots.Select(x => x.ConvertToLotArea(0, waferFabSettings.Sequences, initialDateTime)).ToList(); //waferFab.InitialLots = initialLots; #endregion simulation.Run(); #region Reporting SimulationReporter reporter = simulation.MakeSimulationReporter(); reporter.PrintSummaryToConsole(); #endregion } } }
private void buildWaferFab() { // Build the model WaferFab waferFab = new WaferFab(MySimulation.MyModel, "WaferFab", new ConstantDistribution(MyWaferFabSettings.SampleInterval), MyWaferFabSettings.InitialTime); //// LotStarts waferFab.ManualLotStarts = MyWaferFabSettings.ManualLotStartQtys; //// LotSteps waferFab.LotSteps = MyWaferFabSettings.LotSteps; //// Control if (MyWaferFabSettings.WIPTargets != null) { waferFab.AddWIPTargets(MyWaferFabSettings.WIPTargets); } //// WorkCenters foreach (string wc in MyWaferFabSettings.WorkCenters) { WorkCenter workCenter = new WorkCenter(waferFab, $"WorkCenter_{wc}", MyWaferFabSettings.WCServiceTimeDistributions[wc], MyWaferFabSettings.LotStepsPerWorkStation[wc]); // Connect workcenter to WIPDependentDistribution if (MyWaferFabSettings.WCServiceTimeDistributions[wc] is EPTDistribution) { var distr = (EPTDistribution)MyWaferFabSettings.WCServiceTimeDistributions[wc]; distr.WorkCenter = workCenter; } // Choose dispatcher if (MyWaferFabSettings.WCDispatcherTypes[wc] == DispatcherBase.Type.BQF) { workCenter.SetDispatcher(new BQFDispatcher(workCenter, workCenter.Name + "_BQFDispatcher")); } else if (MyWaferFabSettings.WCDispatcherTypes[wc] == DispatcherBase.Type.EPTOVERTAKING) { workCenter.SetDispatcher(new EPTOvertakingDispatcher(workCenter, workCenter.Name + "_EPTOvertakingDispatcher", MyWaferFabSettings.WCOvertakingDistributions[wc])); // Connect workcenter to OvertakingDistribution MyWaferFabSettings.WCOvertakingDistributions[wc].WorkCenter = workCenter; } else if (MyWaferFabSettings.WCDispatcherTypes[wc] == DispatcherBase.Type.RANDOM) { workCenter.SetDispatcher(new RandomDispatcher(workCenter, workCenter.Name + "_RandomDispatcher")); } else if (MyWaferFabSettings.WCDispatcherTypes[wc] == DispatcherBase.Type.MIVS) { workCenter.SetDispatcher(new MIVSDispatcher(workCenter, workCenter.Name + "_MIVSDisptacher", MyWaferFabSettings.MIVSkStepAhead, MyWaferFabSettings.MIVSjStepBack)); } waferFab.AddWorkCenter(workCenter.Name, workCenter); } //// Sequences foreach (var sequence in MyWaferFabSettings.Sequences) { waferFab.AddSequence(sequence.Key, sequence.Value); } //// LotGenerator waferFab.SetLotGenerator(new LotGenerator(waferFab, "LotGenerator", new ConstantDistribution(MyWaferFabSettings.LotStartsFrequency * 60 * 60), MyWaferFabSettings.UseRealLotStartsFlag)); // Add real LotStarts, copied from fab data if (MyWaferFabSettings.UseRealLotStartsFlag) { waferFab.LotStarts = MyWaferFabSettings.GetLotStarts(); } // Add intial lots (lots present at t = 0) by translating RealLots (from RealSnapshot) to Lots if (MyWaferFabSettings.InitialRealLots.Any() != default) { waferFab.InitialLots = MyWaferFabSettings.InitialRealLots.Select(x => x.ConvertToLot(0, waferFab.Sequences, false, waferFab.InitialDateTime)).Where(x => x != null).ToList(); } // Number of lots between List <Tuple <DateTime, Lot> > selectedLots = waferFab.LotStarts.Where(x => x.Item1 >= new DateTime(2019, 4, 1) && x.Item1 < new DateTime(2019, 12, 1)).ToList(); double avgSteps = selectedLots.Select(x => x.Item2.Sequence.stepCount).Average(); int uniqueProds = selectedLots.Select(x => x.Item2.ProductType).Distinct().Count(); // Add observers WaferFabLotsObserver waferFabObserver = new WaferFabLotsObserver(MySimulation, "WaferFabLotsObserver", waferFab); WaferFabWafersObserver waferFabObserverWafers = new WaferFabWafersObserver(MySimulation, "WaferFabWafersObserver", waferFab); WaferFabTotalQueueObserver waferFabTotalQueueObserver = new WaferFabTotalQueueObserver(MySimulation, "WaferFabTotalQueueObserver", waferFab); waferFab.Subscribe(waferFabObserver); waferFab.Subscribe(waferFabObserverWafers); waferFab.Subscribe(waferFabTotalQueueObserver); foreach (var wc in waferFab.WorkCenters) { TotalQueueObserver totalQueueObs = new TotalQueueObserver(MySimulation, wc.Key + "_TotalQueueObserver"); //SeperateQueuesObserver seperateQueueObs = new SeperateQueuesObserver(MySimulation, wc.Value, wc.Key + "_SeperateQueuesObserver"); wc.Value.Subscribe(totalQueueObs); //wc.Value.Subscribe(seperateQueueObs); LotOutObserver lotOutObserver = new LotOutObserver(MySimulation, "LotOutObserver"); if (wc.Value.Name == "WorkCenter_PACK") { wc.Value.Dispatcher.Subscribe(lotOutObserver); } } }
static void Main(string[] args) { List <string> workcenters = new List <string>() { "BACKGRIND", "BATCH UP", "CMP", "DICE", "DRY ETCH", "ELEC TEST", "EVAPORATION", "FURNACING", "IMPLANT", "INSPECTION", "LPCVD", "MERCURY", "NITRIDE DEP", "OFF LINE INK", "PACK", "PHOTOLITH", "PROBE", "REPORTING", "SAMPLE TEST", "SPUTTERING", "WET ETCH" }; DateTime initialDateTime = new DateTime(2019, 10, 1); string inputDirectory = @"C:\CSSLWaferFab\Input"; string outputDirectory = @"C:\CSSLWaferFab\Output\WaferFabArea"; string eptParameterFile = @"FittedEPTParameters - 2019-6-1.csv"; RealSnapshotReader reader = new RealSnapshotReader(); List <RealSnapshot> realSnapshots = reader.Read(Path.Combine(inputDirectory, "SerializedFiles", reader.GetRealSnapshotString(initialDateTime)), 1); RealSnapshot realSnapShot = realSnapshots.Where(x => x.Time == initialDateTime).First(); //workcenters = new List<string>() {"INSPECTION"}; foreach (string workcenter in workcenters) { #region Parameters string wc = workcenter; bool isFitted = false; // true = fitted, false = optimised bool lotStepOvertaking = true; #endregion #region Initializing simulation Simulation simulation = new Simulation(wc, outputDirectory); #endregion #region Experiment settings simulation.MyExperiment.NumberOfReplications = 30; DateTime finalDateTime = new DateTime(2019, initialDateTime.Month + 2, 1); simulation.MyExperiment.LengthOfReplication = (finalDateTime - initialDateTime).TotalSeconds; // Number of seconds between two months simulation.MyExperiment.LengthOfWarmUp = 60 * 60 * 24 * 0; #endregion #region WaferFab settings WaferFabSettings waferFabSettings = Deserializer.DeserializeWaferFabSettings(Path.Combine(inputDirectory, "SerializedFiles", $"WaferFabSettings_{wc}_WithLotStarts.dat")); EPTDistributionReader distributionReader = new EPTDistributionReader(Path.Combine(inputDirectory, "CSVs"), waferFabSettings.WorkCenters, waferFabSettings.LotStepsPerWorkStation); waferFabSettings.WCServiceTimeDistributions = distributionReader.GetServiceTimeDistributions(eptParameterFile); waferFabSettings.WCOvertakingDistributions = distributionReader.GetOvertakingDistributions(lotStepOvertaking); waferFabSettings.WCDispatcherTypes[workcenter] = DispatcherBase.Type.EPTOVERTAKING; #endregion #region Make starting lots AutoDataReader dataReader = new AutoDataReader(Path.Combine(inputDirectory, "Auto"), Path.Combine(inputDirectory, "SerializedFiles")); #endregion #region Building the model WaferFab waferFab = new WaferFab(simulation.MyModel, "WaferFab", new ConstantDistribution(60 * 60 * 24), initialDateTime); WorkCenter workCenter = new WorkCenter(waferFab, $"WorkCenter_{wc}", waferFabSettings.WCServiceTimeDistributions[wc], waferFabSettings.LotStepsPerWorkStation[wc]); // Connect workcenter to WIPDependentDistribution EPTDistribution distr = (EPTDistribution)waferFabSettings.WCServiceTimeDistributions[wc]; distr.WorkCenter = workCenter; EPTOvertakingDispatcher dispatcher = new EPTOvertakingDispatcher(workCenter, workCenter.Name + "_EPTOvertakingDispatcher", waferFabSettings.WCOvertakingDistributions[wc]); workCenter.SetDispatcher(dispatcher); // Connect workcenter to OvertakingDistribution waferFabSettings.WCOvertakingDistributions[wc].WorkCenter = workCenter; waferFab.AddWorkCenter(workCenter.Name, workCenter); // Sequences foreach (var sequence in waferFabSettings.Sequences) { waferFab.AddSequence(sequence.Key, sequence.Value); } // LotSteps waferFab.LotSteps = waferFab.Sequences.Select(x => x.Value).Select(x => x.GetCurrentStep(0)).ToDictionary(x => x.Name); // LotGenerator waferFab.SetLotGenerator(new LotGenerator(waferFab, "LotGenerator", new ConstantDistribution(60), true)); // Add lotstarts waferFab.LotStarts = waferFabSettings.LotStarts; // Add initial lots List <RealLot> initialRealLots = realSnapShot.GetRealLots(1).Where(x => x.LotActivity.WorkStation == wc).ToList(); waferFab.InitialLots = initialRealLots.Select(x => x.ConvertToLotArea(0, waferFabSettings.Sequences, initialDateTime)).ToList(); // Add observers LotOutObserver lotOutObserver = new LotOutObserver(simulation, wc + "_LotOutObserver"); dispatcher.Subscribe(lotOutObserver); TotalQueueObserver totalQueueObserver = new TotalQueueObserver(simulation, wc + "_TotalQueueObserver"); workCenter.Subscribe(totalQueueObserver); #endregion simulation.Run(); #region Reporting SimulationReporter reporter = simulation.MakeSimulationReporter(); reporter.PrintSummaryToConsole(); #endregion } }
public Tuple <double, double> RunSim(Dictionary <string, Distribution> dict) { EPTDistribution dist = (EPTDistribution)dict.First().Value; WIPDepDistParameters x = dist.Par; waferFabSettings.WCServiceTimeDistributions = new Dictionary <string, Distribution> { { wc, new EPTDistribution(x) } }; #region Initializing simulation Simulation simulation = new Simulation("CSSLWaferFabArea", outputDirectory); #endregion #region Experiment settings simulation.MyExperiment.NumberOfReplications = 10; DateTime finalDateTime = new DateTime(2019, initialDateTime.Month + 2, 1); simulation.MyExperiment.LengthOfReplication = (finalDateTime - initialDateTime).TotalSeconds; // Number of seconds between two months simulation.MyExperiment.LengthOfWarmUp = 60 * 60 * 24 * 0; #endregion #region Building the model WaferFab waferFab = new WaferFab(simulation.MyModel, "WaferFab", new ConstantDistribution(60 * 60 * 24), initialDateTime); WorkCenter workCenter = new WorkCenter(waferFab, $"WorkCenter_{wc}", waferFabSettings.WCServiceTimeDistributions[wc], waferFabSettings.LotStepsPerWorkStation[wc]); // Connect workcenter to WIPDependentDistribution EPTDistribution distr = (EPTDistribution)waferFabSettings.WCServiceTimeDistributions[wc]; distr.WorkCenter = workCenter; EPTOvertakingDispatcher dispatcher = new EPTOvertakingDispatcher(workCenter, workCenter.Name + "_EPTOvertakingDispatcher", waferFabSettings.WCOvertakingDistributions[wc]); workCenter.SetDispatcher(dispatcher); // Connect workcenter to OvertakingDistribution waferFabSettings.WCOvertakingDistributions[wc].WorkCenter = workCenter; waferFab.AddWorkCenter(workCenter.Name, workCenter); // Sequences foreach (var sequence in waferFabSettings.Sequences) { waferFab.AddSequence(sequence.Key, sequence.Value); } // LotSteps waferFab.LotSteps = waferFab.Sequences.Select(x => x.Value).Select(x => x.GetCurrentStep(0)).ToDictionary(x => x.Name); // LotGenerator waferFab.SetLotGenerator(new LotGenerator(waferFab, "LotGenerator", new ConstantDistribution(60), true)); // Add lotstarts waferFab.LotStarts = waferFabSettings.LotStarts; // Add initial lots if (useInitialLots) { List <Lot> initialLotsDeepCopy = initialLots.ConvertAll(x => new Lot(x)); waferFab.InitialLots = initialLotsDeepCopy; } // Add observers OptimiserObserver optimiserObs = new OptimiserObserver(simulation, wc + "_TotalQueueObserver"); workCenter.Subscribe(optimiserObs); // Total queue for workcenter #endregion simulation.Run(); #region Reporting SimulationReporter reporter = simulation.MakeSimulationReporter(); reporter.PrintSummaryToConsole(); #endregion Tuple <double, double> results = new Tuple <double, double>(optimiserObs.QueueLengthStatistic.Average(), optimiserObs.QueueLengthStatistic.StandardDeviation()); return(results); }