public static OBData OpenBoreTest(double I_Test, double VBR_Test) { OBData ob = new OBData(); Instruments.Instance.TOSALimits(); Instruments.Instance.ChannelPower(1, true); Instruments.Instance.ChannelPower(2, true); Instruments.Instance.ChannelPower(3, true); Instruments.Instance.SourceCurrent(1, I_Test); Instruments.Instance.SourceVoltage(2, 0); Instruments.Instance.SourceVoltage(3, 0); ob.p_test = Instruments.Instance.GetCurrent(3) / RESPONSIVITY * 1000; ob.v_test = Instruments.Instance.GetVoltage(1); ob.ibm_test = Instruments.Instance.GetCurrent(2) * 1000; ob.i_test = Instruments.Instance.GetCurrent(1) * 1000; Instruments.Instance.ChannelPower(1, false); Instruments.Instance.ChannelPower(2, false); Instruments.Instance.ChannelPower(3, false); Instruments.Instance.BreakdownLimits(); Instruments.Instance.ChannelPower(1, true); Instruments.Instance.SourceVoltage(1, VBR_Test); ob.ibr = Instruments.Instance.GetCurrent(1) * 1000000; Instruments.Instance.ChannelPower(1, false); Instruments.Instance.TOSALimits(); return(ob); }
private void OpenBoreTest() { TOSADevice device = d as TOSADevice; TOSAOutput output = o as TOSAOutput; bool openBoreResult = true; OBData ob = TestCalculations.OpenBoreTest(device.I_Test, device.VBR_Test); foreach (TextBlock tb in Utils.FindVisualChildren <TextBlock>(measurementPanel)) { tb.Foreground = Brushes.White; } testCurrent.Text = ob.i_test.ToString("F") + " mA"; output.I_Test = ob.i_test; bool I_Test_Pass = (Math.Abs(device.I_Test - ob.i_test) / device.I_Test <= device.I_Test_Tol); if (!I_Test_Pass) { testCurrent.Foreground = Brushes.OrangeRed; openBoreResult = false; } testPower.Text = ob.p_test.ToString("F") + " mW"; bool P_Test_OB_Pass = (ob.p_test >= device.P_Test_OB_Min && ob.p_test <= device.P_Test_OB_Max); output.P_Test_OB = ob.p_test; output.P_OB_Pass = P_Test_OB_Pass; if (!P_Test_OB_Pass) { testPower.Foreground = Brushes.OrangeRed; openBoreResult = false; } testVoltage.Text = ob.v_test.ToString("F") + " V"; bool V_Test_OB_Pass = (ob.v_test >= device.V_Test_Min && ob.v_test <= device.V_Test_Max); output.V_Test = ob.v_test; output.V_Test_Pass = V_Test_OB_Pass; if (!V_Test_OB_Pass) { testVoltage.Foreground = Brushes.OrangeRed; openBoreResult = false; } monitorCurrent.Text = ob.ibm_test.ToString("F") + " mA"; bool IBM_Test_Pass = (ob.ibm_test >= device.IBM_Min && ob.ibm_test <= device.IBM_Max); if (!IBM_Test_Pass) { monitorCurrent.Foreground = Brushes.OrangeRed; openBoreResult = false; } output.IBM_Test_OB = ob.ibm_test; output.IBM_Pass = IBM_Test_Pass; reverseBreakdownCurrent.Text = ob.ibr.ToString("F") + " µA"; reverseBreakdownVoltage.Text = device.VBR_Test.ToString("F") + " V"; bool IBR_Pass = (Math.Abs(ob.ibr) <= device.IBR_Max); if (!IBR_Pass) { reverseBreakdownCurrent.Foreground = Brushes.OrangeRed; openBoreResult = false; } output.IBR = ob.ibr; output.IBR_Pass = IBR_Pass; measurementPanel.Visibility = Visibility.Visible; var w = Window.GetWindow(this) as MainWindow; if (openBoreResult) { passed = true; testMessage.Text = "Test Passed"; testMessage.Foreground = Brushes.ForestGreen; StartTestButton.Content = "Next step"; d = device; o = output; w.device = d; w.output = o; } else { testMessage.Text = "Test Failed"; testMessage.Foreground = Brushes.OrangeRed; if (numTries >= 3) { StartTestButton.Content = "Go home"; output.Result = false; MainWindow.Conn.SaveTOSAOutput(output); } else { StartTestButton.Content = "Retry test"; } } }