protected override bool StartTest() { logoStr = ""; if (supply == null || attennuator == null) { return(false); } CloseandOpenAPC(Convert.ToByte(APCMODE.IBIASOFFandIMODON)); dut.FullFunctionEnable(); dut.TxAllChannelEnable(); if (offsetOpticalPath == null) { string configFile = @"Config.xml"; XmlDocument document = new XmlDocument(); document.Load(configFile); string xpath = @"/Config/Node[@Item='EquipmentOffset']/Attennuator"; XmlNodeList nodes = document.DocumentElement.SelectNodes(xpath);//such as xpath="story[author[name='Tang Chao']]" string buf = ""; foreach (XmlNode node in nodes) { if (node is XmlElement) { buf = node.InnerText; break; } return(false); } string[] buffer = buf.Split(','); offsetOpticalPath = new double[buffer.Length]; for (int i = 0; i < buffer.Length; i++) { offsetOpticalPath[i] = Convert.ToDouble(buffer[i]); } } if (dut.MoudleChannel == 1) { attennuator.offsetlist.Clear(); } double sourceLight_dBm = dut.ReadDmiTxp(); if (sourceLight_dBm < -10) { Log.SaveLogToTxt("sourceLight_dBm is less than -10. value is " + sourceLight_dBm.ToString("f2")); return(false); } sourceLight_dBm -= offsetOpticalPath[dut.MoudleChannel - 1]; attennuator.configoffset(dut.MoudleChannel.ToString(), sourceLight_dBm.ToString()); Log.SaveLogToTxt("channel: " + attennuator.CurrentChannel + ". sourceLight_dBm: " + sourceLight_dBm); OutPutandFlushLog(); return(true); }