public void SaveTOSAOutput(TOSAOutput output)
 {
     using (var conn = SimpleDbConnection())
     {
         conn.Open();
         conn.Execute(
             @"INSERT INTO TOSAOutput 
             ( 
                 Part_Number,
                 Job_Number,
                 Unit_Number,
                 Operator,
                 Timestamp,
                 I_Align,
                 P_TO,
                 P_FC,
                 POPCT,
                 POPCT_Post_Cure,
                 POPCT_Shift,
                 Passed
             )
             values 
             ( 
                 @part_number, 
                 @job_number,
                 @unit_number, 
                 @op,
                 @timestamp, 
                 @i_align, 
                 @p_to,
                 @p_fc,
                 @popct,
                 @popct_post_cure,
                 @popct_shift,
                 @passed
                 )",
             new {
             part_number     = output.Part_Number,
             job_number      = output.Job_Number,
             unit_number     = output.Unit_Number,
             op              = output.Operator,
             timestamp       = DateTime.Now,
             i_align         = output.I_Align,
             p_to            = output.P_TO,
             p_fc            = output.P_FC,
             popct           = output.POPCT,
             popct_post_cure = output.POPCT_Post_Cure,
             popct_shift     = output.POPCT_Shift,
             passed          = output.Passed
         });
     }
 }
        public ReferenceUnits GetTOSAReferenceUnits(TOSAOutput output)
        {
            var part = output.Part_Number;

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

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

                return(units);
            }
        }
Ejemplo n.º 3
0
        private async void Sweep()
        {
            TOSADevice device = d as TOSADevice;
            TOSAOutput output = o as TOSAOutput;

            bool sweepResult = true;

            SweepData sweepData = await TestCalculations.SweepTest(device.I_Start, device.I_Stop, device.I_Step, sweepProgress);

            sd = sweepData;

            double r = TestCalculations.FindSlope(sweepData.currents, sweepData.voltages, device.I_OP_Min, device.I_OP_Max) * 1000;

            resistance.Text = r.ToString("F") + " Ω";
            bool R_Pass = (r >= device.RS_Min && r <= device.RS_Max);

            output.RS      = r;
            output.RS_Pass = R_Pass;

            if (!R_Pass)
            {
                resistance.Foreground = Brushes.OrangeRed;
                sweepResult           = false;
            }

            double se = TestCalculations.FindSlope(sweepData.currents, sweepData.powers, device.I_OP_Min, device.I_OP_Max);

            slopeEfficiency.Text = se.ToString("F");

            bool SE_Pass = (se >= device.SE_Min && se <= device.SE_Max);

            output.SE      = se;
            output.SE_Pass = SE_Pass;

            if (!SE_Pass)
            {
                slopeEfficiency.Foreground = Brushes.OrangeRed;
                sweepResult = false;
            }

            double ith = TestCalculations.ThresholdCurrent(sweepData, device.I_OP_Min, device.I_OP_Max);

            thresholdCurrent.Text = ith.ToString("F") + " mA";
            bool ITH_Pass = (ith >= device.Ith_Min && ith <= device.Ith_Max);

            output.Ith      = ith;
            output.Ith_Pass = ITH_Pass;

            measurementPanel.Visibility = Visibility.Visible;

            if (!ITH_Pass)
            {
                thresholdCurrent.Foreground = Brushes.OrangeRed;
                sweepResult = false;
            }

            double p_test = sweepData.powers.ElementAt(sweepData.setcurrents.IndexOf(device.I_Test));

            testPower.Text = p_test.ToString("F") + " mW";
            bool P_Test_Pass = (p_test >= device.P_Test_FC_Min && p_test <= device.P_Test_FC_Max);

            output.P_Test_FC      = p_test;
            output.P_Test_FC_Pass = P_Test_Pass;

            if (!P_Test_Pass)
            {
                testPower.Foreground = Brushes.OrangeRed;
                sweepResult          = false;
            }

            double popct = p_test / output.P_Test_OB;

            POPCT.Text = (100 * popct).ToString("F") + " %";
            bool POPCT_Pass = (popct >= device.POPCT_Min);

            output.POPCT      = popct;
            output.POPCT_Pass = POPCT_Pass;

            if (!POPCT_Pass)
            {
                testPower.Foreground = Brushes.OrangeRed;
                sweepResult          = false;
            }

            double ibm = TestCalculations.IBM_PBM(sweepData, device.P_BM_Test);

            monitorCurrent.Text = ibm.ToString("F") + " mA";
            bool IBM_Pass = (ibm >= device.IBM_Min && ibm <= device.IBM_Max);

            output.I_BM_P_BM_Test      = ibm;
            output.I_BM_P_BM_Test_Pass = IBM_Pass;

            if (!IBM_Pass)
            {
                monitorCurrent.Foreground = Brushes.OrangeRed;
                sweepResult = false;
            }

            double pmin = sweepData.powers.ElementAt(sweepData.setcurrents.IndexOf(device.I_OP_Min));
            double pmax = sweepData.powers.ElementAt(sweepData.setcurrents.IndexOf(device.I_OP_Max));


            double ibmslope = TestCalculations.FindSlope(sweepData.powers, sweepData.ibms, pmin, pmax);

            ibmSlope.Text     = ibmslope.ToString("F") + " A/W";
            output.I_BM_Slope = ibmslope;

            double ibmtrack = TestCalculations.IBM_Track(sweepData, device.I_OP_Min, device.I_OP_Max);

            ibmTrack.Text = ibmtrack.ToString("F");
            bool IBM_Track_Pass = (ibmtrack >= device.IBM_Tracking_Min && ibmtrack <= device.IBM_Tracking_Max);

            output.IBM_Track       = ibmtrack;
            output.I_BM_Track_Pass = IBM_Track_Pass;

            if (!IBM_Track_Pass)
            {
                ibmTrack.Foreground = Brushes.OrangeRed;
                sweepResult         = false;
            }

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

            if (sweepResult)
            {
                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";
                }
            }

            SaveLIButton.Visibility = Visibility.Visible;
        }
Ejemplo n.º 4
0
        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";
                }
            }
        }
Ejemplo n.º 5
0
        private async void Wiggle()
        {
            TOSADevice device = d as TOSADevice;
            TOSAOutput output = o as TOSAOutput;

            bool wiggleTestResult = true;

            WiggleData wiggleData = await TestCalculations.TOSAWiggleTest((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 popct_wiggle = wiggleData.min / output.P_Test_OB;

            popctWiggle.Text = (100 * popct_wiggle).ToString("F") + " %";
            bool POPCT_Wiggle_Pass = (popct_wiggle >= device.POPCT_Wiggle_Min);

            output.POPCT_Wiggle_Min      = popct_wiggle;
            output.POPCT_Wiggle_Min_Pass = POPCT_Wiggle_Pass;

            if (!POPCT_Wiggle_Pass)
            {
                popctWiggle.Foreground = Brushes.OrangeRed;
                wiggleTestResult       = false;
            }

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

            wiggleDb.Text = pwiggle.ToString("F") + " dB";
            bool Pwiggle_Pass = (pwiggle <= device.Pwiggle_Max);

            output.Wiggle_dB      = pwiggle;
            output.Wiggle_dB_Pass = Pwiggle_Pass;

            if (!Pwiggle_Pass)
            {
                wiggleDb.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.SaveTOSAOutput(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.SaveTOSAOutput(output);
                }
                else
                {
                    StartTestButton.Content = "Retry test";
                }
            }

            NextDeviceButton.Visibility = Visibility.Visible;
        }
Ejemplo n.º 6
0
        public void SaveTOSAOutput(TOSAOutput output)
        {
            if (!File.Exists(DbFile))
            {
                return;
            }

            using (var cnn = DataFileConnection())
            {
                cnn.Open();
                cnn.Execute(
                    @" insert into TOSAOutput 
                (                      
                    Part_Number,             
                    Job_Number,            
                    Unit_Number,             
                    Operator,                
                    Timestamp,               
                    Repeat_Number,           
                    I_Test,                  
                    P_Test_OB,               
                    P_OB_Pass,              
                    V_Test,                  
                    V_Test_Pass,             
                    IBM_Test_OB,             
                    IBM_Pass,                
                    VBR_Test,                
                    IBR,                    
                    IBR_Pass,                
                    P_Test_FC,               
                    P_Test_FC_Pass,          
                    RS,                      
                    RS_Pass,                 
                    SE,                      
                    SE_Pass,                 
                    Ith,                     
                    Ith_Pass,                
                    POPCT,                   
                    POPCT_Pass,              
                    I_BM_Slope,              
                    I_BM_P_BM_Test,          
                    I_BM_P_BM_Test_Pass,     
                    IBM_Track,               
                    I_BM_Track_Pass,         
                    POPCT_Wiggle_Min,        
                    POPCT_Wiggle_Min_Pass,   
                    Wiggle_dB,               
                    Wiggle_dB_Pass,          
                    Result
                ) values (                    
                    @Part_Number,             
                    @Job_Number,            
                    @Unit_Number,             
                    @Operator,                
                    @Timestamp,               
                    @Repeat_Number,           
                    @I_Test,                  
                    @P_Test_OB,               
                    @P_OB_Pass,              
                    @V_Test,                  
                    @V_Test_Pass,             
                    @IBM_Test_OB,             
                    @IBM_Pass,                
                    @VBR_Test,                
                    @IBR,                    
                    @IBR_Pass,                
                    @P_Test_FC,               
                    @P_Test_FC_Pass,          
                    @RS,                      
                    @RS_Pass,                 
                    @SE,                      
                    @SE_Pass,                 
                    @Ith,                     
                    @Ith_Pass,                
                    @POPCT,                   
                    @POPCT_Pass,              
                    @I_BM_Slope,              
                    @I_BM_P_BM_Test,          
                    @I_BM_P_BM_Test_Pass,     
                    @IBM_Track,               
                    @I_BM_Track_Pass,         
                    @POPCT_Wiggle_Min,        
                    @POPCT_Wiggle_Min_Pass,   
                    @Wiggle_dB,               
                    @Wiggle_dB_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,
                    I_Test                = output.I_Test,
                    P_Test_OB             = output.P_Test_OB,
                    P_OB_Pass             = output.P_OB_Pass,
                    V_Test                = output.V_Test,
                    V_Test_Pass           = output.V_Test_Pass,
                    IBM_Test_OB           = output.IBM_Test_OB,
                    IBM_Pass              = output.IBM_Pass,
                    VBR_Test              = output.VBR_Test,
                    IBR                   = output.IBR,
                    IBR_Pass              = output.IBR_Pass,
                    P_Test_FC             = output.P_Test_FC,
                    P_Test_FC_Pass        = output.P_Test_FC_Pass,
                    RS                    = output.RS,
                    RS_Pass               = output.RS_Pass,
                    SE                    = output.SE,
                    SE_Pass               = output.SE_Pass,
                    Ith                   = output.Ith,
                    Ith_Pass              = output.Ith_Pass,
                    POPCT                 = output.POPCT,
                    POPCT_Pass            = output.POPCT_Pass,
                    I_BM_Slope            = output.I_BM_Slope,
                    I_BM_P_BM_Test        = output.I_BM_P_BM_Test,
                    I_BM_P_BM_Test_Pass   = output.I_BM_P_BM_Test_Pass,
                    IBM_Track             = output.IBM_Track,
                    I_BM_Track_Pass       = output.I_BM_Track_Pass,
                    POPCT_Wiggle_Min      = output.POPCT_Wiggle_Min,
                    POPCT_Wiggle_Min_Pass = output.POPCT_Wiggle_Min_Pass,
                    Wiggle_dB             = output.Wiggle_dB,
                    Wiggle_dB_Pass        = output.Wiggle_dB_Pass,
                    Result                = output.Result
                }
                    );
            }
        }