/// <summary> /// Use previous bitmask, plus current run's result, to generate next run's bitmask /// NOTE there's no parameters, all required information are transferred through cross-domain /// </summary> /// <param name="inputparas">Reserved for possible future usage. For now just ignore</param> /// <returns>If algo succeed, return "; otherwise, return string with "RuleRunFailure: "as starting</returns> /// //test public string AdjustBitMask(string inputparas) { #region DO NOT MANUAL TOUCH Dictionary <string, bool> currentAsRuleBitMask = ATFCrossDomainWrapper.GetASRuleBitMask(); Dictionary <string, List <double> > historyResult = ATFCrossDomainWrapper.GetHistoryDUTRunResultSet(); #endregion #region Start of your custom Rule Algorithm // The example Adaptive Sampling Algorithm section. // I just make a simplest case, use the last 3 (if available) runs's run result's average value to decide the new Mask // Always true for #1 currentAsRuleBitMask["Para1"] = true; int completedDuTsCount = historyResult["Para1"].Count; // NOTE here, since this algorithm always test "Para1", so no need to check whether the value is NaN, // Otherwise you need consider possible value is NaN case double para1Last3RunsAvgValue = 0; if (completedDuTsCount == 1) { para1Last3RunsAvgValue = historyResult["Para1"][completedDuTsCount - 1]; } else if (completedDuTsCount == 2) { para1Last3RunsAvgValue = (historyResult["Para1"][completedDuTsCount - 1] + historyResult["Para1"][completedDuTsCount - 2]) / 2; } else { para1Last3RunsAvgValue = (historyResult["Para1"][completedDuTsCount - 1] + historyResult["Para1"][completedDuTsCount - 2] + historyResult["Para1"][completedDuTsCount - 3]) / 3; } // Use #1 value to decide #2 and #3 skip or not if ((para1Last3RunsAvgValue < 1) || (para1Last3RunsAvgValue > 5)) { // #1 not qualified, so let's test #2 and #3 currentAsRuleBitMask["Para2"] = true; currentAsRuleBitMask["Para3"] = true; } else { // Otherwise, for next run, let's skip #2 and #3 currentAsRuleBitMask["Para2"] = false; currentAsRuleBitMask["Para3"] = false; } #endregion #region DO NOT MANUAL TOUCH // All succeed, now update back to CD ATFCrossDomainWrapper.UpdateASRuleBitMask(currentAsRuleBitMask); return(""); #endregion }
public void UnInit() { var processes = from p in System.Diagnostics.Process.GetProcessesByName("EXCEL") select p; DateTime DT = DateTime.Now; foreach (var process in processes) { // All those background un-release process will be closed //Application.IgnoreRemoteRequests = False if (process.MainWindowTitle == "") { process.Kill(); } } if (SnpFile.FileOutputFileName != null) { string strHeaderPath; FileContains.Add("DATE_END=" + DT.ToString("yyyyMMdd") + "\r\n" + "TIME_END=" + DT.ToString("HHmmss")); strHeaderPath = Path.Combine(SnpFile.FileSourcePath, SnpFile.LotID + ".txt"); _myUtility.Generate_SNP_Header(strHeaderPath, FileContains); _myUtility.SNP_SDI_Compression(SnpFile.FileOutputFileName, SnpFile.FileSourcePath, SnpFile.FileOutputPath); } string locSetFilePath = Convert.ToString(_dicCalInfo[DataFilePath.LocSettingPath]); bool blnOcr = (_myUtility.ReadTextFile(locSetFilePath, "OCR", "Enable").ToUpper() == "TRUE")? true: false; if (blnOcr) { switch (MessageBox.Show("Do you want to merge OCR automatically?", "Penang NPI", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { case DialogResult.Cancel: break; case DialogResult.Yes: LibOcr.OCR objOcr = new LibOcr.OCR(); objOcr.SetDateTime = DT; objOcr.SetVisionDefaultPath = _myUtility.ReadTextFile(locSetFilePath, "OCR", "VisionDefaultPath"); objOcr.SetResultDefault = _myUtility.ReadTextFile(locSetFilePath, "OCR", "ResultDefaultPath"); objOcr.SetSite = _myUtility.ReadTextFile(locSetFilePath, "OCR", "Site"); objOcr.SetImageServer = _myUtility.ReadTextFile(locSetFilePath, "OCR", "ImagePath"); objOcr.SetSdiServer = _myUtility.ReadTextFile(locSetFilePath, "OCR", "SdiserverPath"); objOcr.SetResultFile = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_CUR_RESULT_FILE, ""); objOcr.SetLotID = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_LOT_ID, ""); objOcr.SetSublotId = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_SUB_LOT_ID, ""); objOcr.Merge(); break; case DialogResult.No: break; default: break; } } InstrUnInit(); }
private void checkBoxCalFileInterpolate_CheckedChanged(object sender, EventArgs e) { ATFCrossDomainWrapper.Cal_SwitchInterpolationFlag(checkBoxCalFileInterpolate.Checked); }
public ATFReturnResult DoATFTest(string args) { //Debugger.Break(); string err = ""; StringBuilder sb = new StringBuilder(); ATFReturnResult result = new ATFReturnResult(); // ----------- Example for Argument Parsing --------------- // Dictionary <string, string> dict = new Dictionary <string, string>(); if (!ArgParser.parseArgString(args, ref dict)) { err = "Invalid Argument String" + args; MessageBox.Show(err, "Exit Test Plan Run", MessageBoxButtons.OK, MessageBoxIcon.Error); return(new ATFReturnResult(err)); } int simHw; try { simHw = ArgParser.getIntItem(ArgParser.TagSimMode, dict); } catch (Exception ex) { err = ex.Message; MessageBox.Show(err, "Exit Test Plan Run", MessageBoxButtons.OK, MessageBoxIcon.Error); return(new ATFReturnResult(err)); } // ----------- END of Argument Parsing Example --------------- // #region Custom Test Coding Section ////////////////////////////////////////////////////////////////////////////////// // ----------- ONLY provide your Custom Test Coding here --------------- // // Example for build TestPlan Result (Single Site) if (_firstTest == true) { string[] resultFileName = ATFCrossDomainWrapper.GetClothoCurrentResultFileFullPath().Split('_'); if (_guiEnable == true) { if (resultFileName[0] != _initProTag) { _programLoadSuccess = false; MessageBox.Show("Product Tag accidentally changed to: " + resultFileName[0] + "\nPlease re-load program!"); err = "Product Tag accidentally changed to: " + resultFileName[0]; return(new ATFReturnResult(err));; } } } if (!_programLoadSuccess) { MessageBox.Show("Program was not loaded successfully.\nPlease resolve errors and reload program.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); err = "Program was not loaded successfully.\nPlease resolve errors and reload program"; return(new ATFReturnResult(err)); } GU.DoTest_beforeCustomCode(); #region Retrieve lot ID# (for Datalog) //Retrieve lot ID# _tPVersion = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TP_VER, ""); _productTag = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TAG, "").ToUpper(); _lotId = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_LOT_ID, "").ToUpper(); _sublotId = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_SUB_LOT_ID, "").ToUpper(); _waferId = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_WAFER_ID, ""); _opId = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_OP_ID, ""); _handlerSn = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_HANDLER_SN, ""); _testerHostName = System.Net.Dns.GetHostName(); _ipEntry = System.Net.Dns.GetHostEntry(_testerHostName); _testerIp = NetworkHelper.GetStaticIPAddress().Replace(".", ""); //Use Clotho method , original code has issue with IPv6 - 12/03/2015 Shaz if (_myDut.TmpUnitNo == 0) //do this for the 1st unit only { _dt = DateTime.Now; if (_productTag != "") { _newPath = System.IO.Path.Combine(_activeDir, _productTag + "_" + _lotId + "_" + _sublotId + "_" + _testerIp + "\\"); } else { string tempname = "DebugMode_" + _dt.ToString("yyyyMMdd" + "_" + "HHmmss"); _newPath = System.IO.Path.Combine(_activeDir, tempname + "\\"); _productTag = "Debug"; _lotId = "1"; } //Parse information to LibFbar _myDut.SnpFile.FileSourcePath = _newPath; _myDut.SnpFile.FileOutputFileName = _productTag; _myDut.SnpFile.LotID = _lotId; // Added variable to solve issue with datalog when Inari operator using //Tally Generator to close lot instead of unload test plan //WaferId,OpId and HandlerSN are null when 2nd Lot started - make assumption that this 3 param are similar 1st Lot _tempWaferId = _waferId; _tempOpId = _opId; _tempHandlerSn = _handlerSn; _previousLotSubLotId = _currentLotSubLotId; } DateTime DT = DateTime.Now; List <string> FileContains = new List <string>(); FileContains.Add("DATE_START=" + DT.ToString("yyyyMMdd")); FileContains.Add("TIME_START=" + DT.ToString("HHmmss")); FileContains.Add("ENTITY=NA"); FileContains.Add("SOURCE=FBAR"); FileContains.Add("GROUP=DUPLEXER"); FileContains.Add("PRODUCT_TAG=" + _productTag); FileContains.Add("LOT_NUMBER=" + _lotId + "_" + _sublotId); FileContains.Add("WAFER_ID=" + _waferId); FileContains.Add("OPERATOR_NAME=" + _opId); FileContains.Add("TESTER_NAME=FBAR"); FileContains.Add("TESTER_HOST_NAME=" + _testerHostName); FileContains.Add("HANLDER_NAME=" + _handlerSn); FileContains.Add("TEST_PLAN_VERSION=" + _tPVersion); _myDut.FileFileContain = FileContains; #endregion #if (!DEBUG) _myDut.TmpUnitNo = Convert.ToInt32(ATFCrossDomainWrapper.GetClothoCurrentSN()); #else _myDut.TmpUnitNo++; // Need to enable this during debug mode #endif for (GU.runLoop = 1; GU.runLoop <= GU.numRunLoops; GU.runLoop++) { ATFResultBuilder.Reset(); _firstTest = false; _myDut.RunTest(ref result); GU.DoTest_afterCustomCode(ref result); } // ----------- END of Custom Test Coding --------------- // ////////////////////////////////////////////////////////////////////////////////// #endregion Custom Test Coding Section //ATFReturnResult result = new ATFReturnResult(); //ATFResultBuilder.AddResult(ref result, "PARAM", "X", 0.01); return(result); }
public string DoATFInit(string args) { Debugger.Break(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("Enter DoATFInit: {0}\nDo Minimum HW Init:\n{1}\n", args, ATFInitializer.DoMinimumHWInit()); #region Custom Init Coding Section ////////////////////////////////////////////////////////////////////////////////// // ----------- ONLY provide your Custom Init Coding here --------------- // _myDut = new MyDutFbar(ref sb) { TmpUnitNo = 0 }; _programLoadSuccess = _myDut.InitSuccess; _initProTag = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TAG, ""); Clotho.EnableClothoTextBoxes(false); _firstTest = true; //Check boolean status of GUI ENTRY _guiEnable = false; FrmDataInput formInput; if (_guiEnable == true) { #region New InputUI formInput = new FrmDataInput(); //string AssemblyID_ = " "; DialogResult rslt = formInput.ShowDialog(); if (rslt == DialogResult.OK) { ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_OP_ID, formInput.OperatorId + "\t"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_LOT_ID, formInput.LotId + "\t"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_SUB_LOT_ID, formInput.SublotId + "\t"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_DIB_ID, formInput.LoadBoardId + "\t"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_CONTACTOR_ID, formInput.ContactorId + "\t"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_HANDLER_SN, formInput.HandlerId); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_PCB_ID, "NA"); ATFCrossDomainWrapper.StoreStringToCache(PublishTags.PUBTAG_WAFER_ID, "NA"); } #region Lock ClothoUI if (!formInput.AdminLevel) { Thread t1 = new Thread(new ThreadStart(LockClothoInputUi)); t1.Start(); } #endregion #endregion } GU.DoInit_afterCustomCode(true, false, _myDut.ProductTag, @"C:\Avago.ATF.Common\Results"); // ----------- END of Custom Init Coding --------------- // ////////////////////////////////////////////////////////////////////////////////// #endregion Custom Init Coding Section return(sb.ToString()); }
private void Init(ref StringBuilder sb) { try { #region Load TCF var doneEvents = new ManualResetEvent[6]; doneEvents[0] = new ManualResetEvent(false); doneEvents[1] = new ManualResetEvent(false); doneEvents[2] = new ManualResetEvent(false); doneEvents[3] = new ManualResetEvent(false); doneEvents[4] = new ManualResetEvent(false); doneEvents[5] = new ManualResetEvent(false); ThreadWithDelegate thLoadFbarTcf = new ThreadWithDelegate(doneEvents[0]); thLoadFbarTcf.WorkExternal = ReadFbarTcf; ThreadPool.QueueUserWorkItem(thLoadFbarTcf.ThreadPoolCallback, 0); ThreadWithDelegate thReadSegment = new ThreadWithDelegate(doneEvents[1]); thReadSegment.WorkExternal = ReadSegmentTable; ThreadPool.QueueUserWorkItem(thReadSegment.ThreadPoolCallback, 0); ThreadWithDelegate thLoadCalInfoTcf = new ThreadWithDelegate(doneEvents[2]); thLoadCalInfoTcf.WorkExternal = ReadFbarCalInfoTcf; ThreadPool.QueueUserWorkItem(thLoadCalInfoTcf.ThreadPoolCallback, 0); ThreadWithDelegate thFbarCalProcTcf = new ThreadWithDelegate(doneEvents[3]); thFbarCalProcTcf.WorkExternal = ReadFbarCalProcedure; ThreadPool.QueueUserWorkItem(thFbarCalProcTcf.ThreadPoolCallback, 0); ThreadWithDelegate thFbarCalKitStd = new ThreadWithDelegate(doneEvents[4]); thFbarCalKitStd.WorkExternal = ReadTcfCalKitStd; ThreadPool.QueueUserWorkItem(thFbarCalKitStd.ThreadPoolCallback, 0); ThreadWithDelegate thFbarTraceSetting = new ThreadWithDelegate(doneEvents[5]); thFbarTraceSetting.WorkExternal = ReadTcfTraceSetting; ThreadPool.QueueUserWorkItem(thFbarTraceSetting.ThreadPoolCallback, 0); WaitHandle.WaitAll(doneEvents); //ReadFbarTCF(); //ReadSegmentTable(); //ReadFbarCalProcedure(); //ReadTcfTraceSetting(); //ReadTcfCalKitStd(); //ReadTcfTraceSetting(); #endregion #region Retrieve Cal Sheet Info //string CalFilePath = Convert.ToString(DicCalInfo[DataFilePath.CalPathRF]); //H2 Cal Path string locSetFilePath = Convert.ToString(_dicCalInfo[DataFilePath.LocSettingPath]); SnpFile.FileOutputEnable = Convert.ToBoolean(_dicCalInfo[DataFilePath.EnableDataLog]); SnpFile.FileOutputPath = TcfHeader.ConstFBarResultDir; SnpFile.FileOutputCount = int.Parse(_dicCalInfo[DataFilePath.DataLogCount]); SnpFile.ADSFormat = Convert.ToBoolean(_dicCalInfo[DataFilePath.AdsDataLog]); ProductTag = _dicCalInfo[DataFilePath.GuPartNo].ToUpper(); if (ProductTag == string.Empty | !ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TAG, "").ToUpper().Contains(ProductTag)) { InitSuccess = false; MessageBox.Show("TCF Main sheet GuPartNo " + ProductTag + " not match with test package load " + ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TAG, "").ToUpper(), "Read Main Sheet Error", MessageBoxButtons.OK); } #endregion #region Instrument Init InstrInit(locSetFilePath); #endregion #region Verify ENA State InitSuccess = VerifyTraceMatch(); InitSuccess = VerifySegment(); #endregion #region Configure Network Analyzer string cnt_str = Interaction.InputBox ("Do you want to Configure Network Analyzer? If so, please enter \"Yes\".", "Configure Network Analyzer", "No", 100, 100); if (cnt_str.ToUpper() == "YES") { _eqNa.Reset(); _eqNa.SetupCalKit(_fbarCalStdTable); _eqNa.SetupSegmentTable(_segmentParam); for (int i = 0; i < _traceSetting.Length; i++) { _eqNa.SetupTrace(i + 1, _traceSetting[i]); } _eqNa.TriggerSource(naEnum.ETriggerSource.BUS); _eqNa.SaveState(_stateFiles[0].StateFile); InitSuccess = true; } cnt_str = Interaction.InputBox ("Do you want to perform FBAR subcal? If so, please enter \"Yes\".", "Network Analyzer Calibration", "No", 100, 100); if (cnt_str.ToUpper() == "YES") { _eqNa.Calibrate(_fbarCalProcedure, _stateFiles[0].StateFile); _eqNa.SaveState(_stateFiles[0].StateFile); InitSuccess = true; } DialogResult rslt = MessageBox.Show("Switch OFF ENA display?", "ENA Display Setting", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (rslt == DialogResult.Yes) { _eqNa.DisplayOn(true); } else { _eqNa.DisplayOn(false); } #endregion #region Init Sparam Test Case InitTestCase(); #endregion } catch (Exception ex) { InitSuccess = false; MessageBox.Show(ex.Message); } }