public static DLData DarkLightTest(double V_Test, bool VPD) { DLData dl = new DLData(); Instruments.Instance.ROSALimits(); Instruments.Instance.ChannelPower(1, true); Instruments.Instance.ChannelPower(2, true); Instruments.Instance.SourceVoltage(1, V_Test); if (VPD) { Instruments.Instance.SourceVoltage(2, V_Test - 0.1); } else { Instruments.Instance.SourceVoltage(2, 0); } dl.i_tia = Instruments.Instance.GetCurrent(1) * 1000; dl.i_dark = Instruments.Instance.GetCurrent(2) * 1000; // TURN ON SWITCH dl.i_pd = Instruments.Instance.GetCurrent(2) * 1000; // CALCULATE RESPONSIVITY WITH LASER POWER Instruments.Instance.ChannelPower(1, false); Instruments.Instance.ChannelPower(2, false); return(dl); }
private void DarkLight() { ROSADevice device = d as ROSADevice; ROSAOutput output = o as ROSAOutput; bool darkLightResult = true; DLData dl = TestCalculations.DarkLightTest(device.V_Test, (device.RSSI_VPD == "VPD")); foreach (TextBlock tb in Utils.FindVisualChildren <TextBlock>(measurementPanel)) { tb.Foreground = Brushes.White; } vTest.Text = device.V_Test.ToString("F") + " V"; output.V_Test = device.V_Test; iTIA.Text = dl.i_tia.ToString("F") + " mA"; bool I_TIA_Pass = (dl.i_tia <= device.I_TIA_Max); output.I_TIA = dl.i_tia; output.I_TIA_Pass = I_TIA_Pass; if (!I_TIA_Pass) { iTIA.Foreground = Brushes.OrangeRed; darkLightResult = false; } iDark.Text = dl.i_dark.ToString("F") + " mA"; output.I_Dark = dl.i_dark; iPD.Text = dl.i_pd.ToString("F") + " mA"; responsivity.Text = dl.responsivity.ToString("F"); bool Responsivity_Pass = (dl.responsivity >= device.RESP_Min); output.Responsivity = dl.responsivity; output.RESP_Pass = Responsivity_Pass; if (!Responsivity_Pass) { responsivity.Foreground = Brushes.OrangeRed; darkLightResult = false; } measurementPanel.Visibility = Visibility.Visible; var w = Window.GetWindow(this) as MainWindow; darkLightResult = true; if (darkLightResult) { 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.SaveROSAOutput(output); } else { StartTestButton.Content = "Retry test"; } } }