protected override bool StartTest() { lock (tempAtten) { logoStr = ""; if (AnalysisInputParameters(inputParameters) == false) { OutPutandFlushLog(); return(false); } if (tempps != null && tempAtten != null) { // open apc //CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON)); // open apc Log.SaveLogToTxt("Step3...Start Test RxDmi"); double[] tempRxPowerDmiArray = new double[testRxPowerDmiStruct.ArrayListRxInputPower.Count]; double[] tempRxPowerErrArray = new double[testRxPowerDmiStruct.ArrayListRxInputPower.Count]; double[] tempRxPowerErrRawArray = new double[testRxPowerDmiStruct.ArrayListRxInputPower.Count]; tempAtten.AttnValue(testRxPowerDmiStruct.ArrayListRxInputPower[0].ToString(), 1); Thread.Sleep(3000); for (byte i = 0; i < testRxPowerDmiStruct.ArrayListRxInputPower.Count; i++) { tempAtten.AttnValue(testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString(), 1); tempRxPowerDmiArray[i] = dut.ReadDmiRxp(); tempRxPowerErrArray[i] = Math.Abs(Convert.ToDouble(testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString()) - tempRxPowerDmiArray[i]); tempRxPowerErrRawArray[i] = Convert.ToDouble(testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString()) - tempRxPowerDmiArray[i]; Log.SaveLogToTxt("testRxPowerDmiStruct.ArrayListRxInputPower[" + i.ToString() + "]:" + testRxPowerDmiStruct.ArrayListRxInputPower[i].ToString() + "tempRxPowerDmiArray[" + i.ToString() + "]:" + tempRxPowerDmiArray[i].ToString() + "tempRxPowerErrArray[" + i.ToString() + "]" + tempRxPowerErrArray[i].ToString()); } byte maxIndex; Algorithm.SelectMaxValue(ArrayList.Adapter(tempRxPowerErrArray), out maxIndex); MaxErr = tempRxPowerErrRawArray[maxIndex]; ErrMaxPoint = Convert.ToDouble(testRxPowerDmiStruct.ArrayListRxInputPower[maxIndex].ToString()); Log.SaveLogToTxt("ErrMaxPoint=" + ErrMaxPoint.ToString() + " MaxErr" + MaxErr.ToString()); tempAtten.OutPutSwitch(false); Thread.Sleep(2000); RxNopticalPoint = dut.ReadDmiRxp(); tempAtten.OutPutSwitch(true); OutPutandFlushLog(); return(true); } else { Log.SaveLogToTxt("Equipments are not enough!"); OutPutandFlushLog(); return(false); } } }
protected override bool StartTest() { logoStr = ""; sInputPowerArray = ""; sRXDmiPowArray = ""; sDiffArray = ""; if (AnalysisInputParameters(inputParameters) == false) { OutPutandFlushLog(); return(false); } if (tempps != null && tempAtten != null) { // open apc //CloseandOpenAPC(Convert.ToByte(APCMODE.IBAISandIMODON)); // open apc Log.SaveLogToTxt("Step3...Start Test TestRxDmiPowErrorCurve"); int TestCount; double countMol = (Math.Abs(testRxDmiPowErrorCurveStruct.RxInputPowerMax - testRxDmiPowErrorCurveStruct.RxInputPowerMin)) % testRxDmiPowErrorCurveStruct.AttStep; if (countMol == 0) { TestCount = Convert.ToInt32((Math.Abs(testRxDmiPowErrorCurveStruct.RxInputPowerMax - testRxDmiPowErrorCurveStruct.RxInputPowerMin)) / testRxDmiPowErrorCurveStruct.AttStep); } else { TestCount = Convert.ToInt32((Math.Abs(testRxDmiPowErrorCurveStruct.RxInputPowerMax - testRxDmiPowErrorCurveStruct.RxInputPowerMin) - countMol) / testRxDmiPowErrorCurveStruct.AttStep) + 1; } InputPowerArray = new double[TestCount + 1]; RXDmiPowArray = new double[TestCount + 1]; DiffArray = new double[TestCount + 1]; DiffRawArray = new double[TestCount + 1]; for (int i = 0; i < TestCount + 1; i++) { if (i != TestCount) { InputPowerArray[i] = testRxDmiPowErrorCurveStruct.RxInputPowerMax - i * testRxDmiPowErrorCurveStruct.AttStep; } else { if (testRxDmiPowErrorCurveStruct.RxInputPowerMax - i * testRxDmiPowErrorCurveStruct.AttStep < testRxDmiPowErrorCurveStruct.RxInputPowerMin) { InputPowerArray[i] = testRxDmiPowErrorCurveStruct.RxInputPowerMin; } else { InputPowerArray[i] = testRxDmiPowErrorCurveStruct.RxInputPowerMax - i * testRxDmiPowErrorCurveStruct.AttStep; } } } tempAtten.AttnValue(InputPowerArray[0].ToString(), 1); Thread.Sleep(3000); for (int j = 0; j < InputPowerArray.Length; j++) { tempAtten.AttnValue(InputPowerArray[j].ToString(), 1); RXDmiPowArray[j] = dut.ReadDmiRxp(); DiffArray[j] = Math.Abs(InputPowerArray[j] - RXDmiPowArray[j]); DiffRawArray[j] = InputPowerArray[j] - RXDmiPowArray[j]; if (j != InputPowerArray.Length - 1) { sInputPowerArray += InputPowerArray[j] + ","; sRXDmiPowArray += RXDmiPowArray[j] + ","; sDiffArray += DiffArray[j] + ","; } else { sInputPowerArray += InputPowerArray[j]; sRXDmiPowArray += RXDmiPowArray[j]; sDiffArray += DiffArray[j]; } Log.SaveLogToTxt("InputPowerArray[" + j.ToString() + "]:" + InputPowerArray[j].ToString() + "RXDmiPowArray[" + j.ToString() + "]:" + RXDmiPowArray[j].ToString() + "DiffArray[" + j.ToString() + "]" + DiffArray[j].ToString()); } byte maxIndex; Algorithm.SelectMaxValue(ArrayList.Adapter(DiffArray), out maxIndex); MaxErr = DiffRawArray[maxIndex]; ErrMaxPoint = InputPowerArray[maxIndex]; Log.SaveLogToTxt("ErrMaxPoint=" + ErrMaxPoint.ToString() + " MaxErr" + MaxErr.ToString()); //tempAtten.OutPutSwitch(false); //Thread.Sleep(2000); //RxNopticalPoint=dut.ReadDmiRxp(); //tempAtten.OutPutSwitch(true); OutPutandFlushLog(); return(true); } else { Log.SaveLogToTxt("Equipments are not enough!"); OutPutandFlushLog(); return(false); } }