private void startButton_Click(object sender, RoutedEventArgs e)
        {
            var w = Window.GetWindow(this) as MainWindow;

            ROSADevice rosa   = w.device as ROSADevice;
            ROSAOutput output = w.output as ROSAOutput;

            if (rosa.VPD_RSSI == "vpd")
            {
                Instruments.instance.OpenRelay(1);
                Instruments.instance.OpenRelay(2);
                Instruments.instance.OpenRelay(4);
            }
            else
            {
                Instruments.instance.CloseRelay(1);
                Instruments.instance.OpenRelay(2);
                Instruments.instance.OpenRelay(4);
            }

            Instruments.instance.SetArroyoLaserOff();
            var power = Instruments.instance.GetThorlabsPower();

            Debug.Print($"Fiber power: {power}");
            output.Fiber_Power = 1000 * power / Instruments.instance.alignmentPowerCalibration;

            powerText.Text            = $"Fiber power: {String.Format("{0:0.00}",(1000 * power / Instruments.instance.alignmentPowerCalibration))}mW";
            successMessage.Visibility = Visibility.Visible;
            powerText.Visibility      = Visibility.Visible;

            startButton.Visibility    = Visibility.Collapsed;
            nextStepButton.Visibility = Visibility.Visible;
        }
Ejemplo n.º 2
0
        private async void Wiggle()
        {
            ROSADevice device = d as ROSADevice;
            ROSAOutput output = o as ROSAOutput;

            bool wiggleTestResult = true;

            WiggleData wiggleData = await TestCalculations.ROSAWiggleTest(device.V_Test, (device.RSSI_VPD == "VPD"), (int)device.Wiggle_Time, wiggleProgress);

            wiggleMin.Text = wiggleData.min.ToString("F") + " mW";
            wiggleMax.Text = wiggleData.max.ToString("F") + " mW";
            wiggleAvg.Text = wiggleData.avg.ToString("F") + " mW";

            double i_wiggle = 10 * Math.Log10(wiggleData.max / wiggleData.min);

            iWiggle.Text = i_wiggle.ToString("F") + " dB";
            bool I_Wiggle_Pass = (i_wiggle <= device.PD_Wiggle_Max);

            output.Wiggle_Pass = I_Wiggle_Pass;

            if (!I_Wiggle_Pass)
            {
                iWiggle.Foreground = Brushes.OrangeRed;
                wiggleTestResult   = false;
            }

            measurementPanel.Visibility = Visibility.Visible;
            var w = Window.GetWindow(this) as MainWindow;

            if (wiggleTestResult)
            {
                passed                  = true;
                testMessage.Text        = "Test Passed";
                testMessage.Foreground  = Brushes.ForestGreen;
                StartTestButton.Content = "End job";
                output.Result           = true;
                MainWindow.Conn.SaveROSAOutput(output);
                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";
                }
            }
        }
        public ReferenceUnits GetROSAReferenceUnits(ROSAOutput output)
        {
            var part = output.Part_Number;

            using (var conn = SimpleDbConnection())
            {
                conn.Open();

                ReferenceUnits units = conn.Query <ReferenceUnits>(
                    @"SELECT X, Y, Z, Part_Number
                        from ROSAReferenceUnits where 
                        Part_Number = @part ;", new { part }).FirstOrDefault();

                return(units);
            }
        }
 public void SaveROSAOutput(ROSAOutput output)
 {
     using (var conn = SimpleDbConnection())
     {
         conn.Open();
         conn.Execute(
             @"INSERT INTO ROSAOutput 
             ( 
                 Part_Number,
                 Job_Number,
                 Unit_Number,
                 Operator,
                 Timestamp,
                 Resp_Shift,
                 Resp,
                 Resp_Post_Cure,
                 Fiber_Power,
                 Passed
             )
             values 
             ( 
                 @part_number, 
                 @job_number,
                 @unit_number, 
                 @op,
                 @timestamp, 
                 @resp_shift,
                 @resp,
                 @resp_post_cure,
                 @fiber_power,
                 @passed
                 )",
             new {
             part_number    = output.Part_Number,
             job_number     = output.Job_Number,
             unit_number    = output.Unit_Number,
             op             = output.Operator,
             timestamp      = DateTime.Now,
             resp_shift     = output.Resp_Shift,
             resp           = output.Resp,
             resp_post_cure = output.Resp_Post_Cure,
             fiber_power    = output.Fiber_Power,
             passed         = output.Passed
         });
     }
 }
Ejemplo n.º 5
0
        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";
                }
            }
        }
Ejemplo n.º 6
0
        public void SaveROSAOutput(ROSAOutput output)
        {
            if (!File.Exists(DbFile))
            {
                return;
            }

            using (var cnn = DataFileConnection())
            {
                cnn.Open();
                cnn.Execute(
                    @"insert into ROSAOutput
                (
                    Part_Number,             
                    Job_Number,            
                    Unit_Number,             
                    Operator,                
                    Timestamp,               
                    Repeat_Number,
                    V_Test,
                    P_Laser, 
                    I_TIA,
                    I_PD,
                    Responsivity,
                    I_Dark,
                    I_TIA_Pass,
                    RESP_Pass,
                    Wiggle_Pass,
                    Result
                ) values (
                    @Part_Number,             
                    @Job_Number,            
                    @Unit_Number,             
                    @Operator,                
                    @Timestamp,               
                    @Repeat_Number,
                    @V_Test,
                    @P_Laser, 
                    @I_TIA,
                    @I_PD,
                    @Responsivity,
                    @I_Dark,
                    @I_TIA_Pass,
                    @RESP_Pass,
                    @Wiggle_Pass,
                    @Result
                )", new
                {
                    Part_Number   = output.Part_Number,
                    Job_Number    = output.Job_Number,
                    Unit_Number   = output.Unit_Number,
                    Operator      = output.Operator,
                    Timestamp     = output.Timestamp,
                    Repeat_Number = output.Repeat_Number,
                    V_Test        = output.V_Test,
                    P_Laser       = output.P_Laser,
                    I_TIA         = output.I_TIA,
                    I_PD          = output.I_PD,
                    Responsivity  = output.Responsivity,
                    I_Dark        = output.I_Dark,
                    I_TIA_Pass    = output.I_TIA_Pass,
                    RESP_Pass     = output.RESP_Pass,
                    Wiggle_Pass   = output.Wiggle_Pass,
                    Result        = output.Result
                }
                    );
            }
        }