예제 #1
0
        public override void RunTest()
        {
            Quasi97.ResultNet Rslt = default(Quasi97.ResultNet);
            System.Diagnostics.Stopwatch sWatch = new System.Diagnostics.Stopwatch();
            float[,,] pdBuffer = null;
            double[] fieldbuf = new double[mvarDataPoints - 1 + 1];
            short Chan = modMain.QST.QSTHardware.MRChannel;
            double[] vBuff = null;

            try
            {
                sWatch.Restart();
                if (modMain.QST.OptionsParameters.AutoClearResults)
                {
                    ClearResults(false); //the menu is going to refresh anyway when we add new results
                }

                Rslt = new Quasi97.ResultNet();
                colResults.Insert(0, Rslt);
                Rslt.Data.Columns.Clear();
                Rslt.Data.Columns.Add("Sample #", typeof(short));
                Rslt.Data.Columns.Add("Resistance (Ohm)", typeof(Single));
                Rslt.Data.Columns.Add("Random", typeof(Single));

                //measuring
                //set 156KHz sampling rate
                modMain.QST.PatGenBoardParameters.DelayCounter = (byte) 0;
                modMain.QST.PatGenBoardParameters.SampleCounter = (byte) 0;
                //set dc level
                modMain.QST.QSTHardware.GenerateLevel(ref fieldbuf, mvarDataPoints, 0, (short) 0);
                //select low gain
                modMain.QST.QSTHardware.TCSplitSelectInput(false);
                pdBuffer = new float[2, (fieldbuf.Length - 1) + 1, 2]; //number of cycles, number of data points, 2 channels
                modMain.QST.QSTHardware.TCSplitCaptureWaveform(ref pdBuffer, (short) 1, (short) 1);
                modMain.QST.QSTHardware.TCSplitScaleWaveform2(ref pdBuffer, 0,false);
                modMain.QST.QSTHardware.ExtractPulseByChannel(ref vBuff, (short) 0, ref pdBuffer, modMain.QST.QSTHardware.MRChannel);

                //storing in the data
                for (var i = 0; i <= (vBuff.Length - 1); i++)
                {
                    Rslt.Data.Rows.Add(1 + i, vBuff[(int) i], 100 * VBMath.Rnd(1));
                }
                base.RaiseNewDataAvailable(colResults.Count, 1, -1, -1);
                base.RaiseNewDataAvailable(colResults.Count, 2, -1, -1);

                //report results
                Rslt.AddParameters(this.colParameters);
                Rslt.AddResult2("Resistance (Ohm)", 0, 1, true); //let next statement calculate statistics
                Rslt.CalcStats2(true, 1);

                //grade results
                Quasi97.clsQSTTestNET temp_test = this;
                modMain.QST.GradingParameters.GradeTestNet(ref temp_test, (short) 0);

                //add information about run
                Quasi97.clsQSTTestNET temp_test2 = this;
                Rslt.AddInfo(ref temp_test2, sWatch.ElapsedMilliseconds, ref modMain.QST.QuasiParameters.CurInfo);

                //notify the form that new results are available
                base.RaiseNewInfoAvailable();
                base.RaiseNewResultsAvailable(new int[] {0});

            }
            catch (Exception ex)
            {
                MessageBox.Show(ThisTestID + " RunTest " + ex.Message);
            }
        }
예제 #2
0
        public override void RunTest()
        {
            Quasi97.ResultNet Rslt = default(Quasi97.ResultNet);
            double MeasuredVal = 0;
            float ib = 0;

            try
            {
                if (modMain.QST.OptionsParameters.AutoClearResults)
                {
                    ClearResults(false); //the menu is going to refresh anyway when we add new results
                }
                //measuring
                for (var i = 1; i <= mvarAverages; i++)
                {
                    MeasuredVal += modMain.QST.ChannelManager.DCChannel.MeasureR(modMain.QST.QSTHardware.MRChannel, (short) 10, 0);
                    ib += modMain.QST.QSTHardware.GetReadBias(modMain.QST.QSTHardware.MRChannel);
                }
                ib /= mvarAverages;
                MeasuredVal /= mvarAverages;

                //report results
                Rslt = new Quasi97.ResultNet();
                Rslt.AddParameters(this.colParameters);
                colResults.Insert(0, Rslt);
                Rslt.AddResult2(objNativeRes.res, MeasuredVal.ToString("F2"), 1, true);
                Rslt.AddResult2(objNativeRes.bv, (ib * MeasuredVal).ToString("F2"), 1, true);
                Rslt.CalcStats2(false, 1);

                //grade results
                Quasi97.clsQSTTestNET temp_test = this;
                modMain.QST.GradingParameters.GradeTestNet(ref temp_test, (short) 0);

                //add information about run
                Quasi97.clsQSTTestNET temp_test2 = this;
                Rslt.AddInfo(ref temp_test2, 0, ref modMain.QST.QuasiParameters.CurInfo);

                //notify the form that new results are available
                base.RaiseNewInfoAvailable();
                base.RaiseNewResultsAvailable(new int[] {0});

            }
            catch (Exception ex)
            {
                MessageBox.Show("clsTest1:RunTest " + ex.Message);
            }
        }