コード例 #1
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();

            if (File.Exists(AuditionFileName) == false)
            {
                throw new FileLoadException("Specified audition file doesn't exist");
            }

            try
            {
                ((IAudioAnalyzer)Tm.TestClass).AuditionStart(AuditionFileName, AuditionAmplitude, true);

                DlgAudition dlg = new DlgAudition((IAudioAnalyzer)Tm.TestClass, AuditionAmplitude, OperatorInstruction);

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    tr.Pass = true;
                }
                else
                {
                    tr.Pass = false;
                }
            }
            catch
            {
            }

            ((IAudioAnalyzer)Tm.TestClass).AuditionStop();
        }
コード例 #2
0
ファイル: GainSorted3A01.cs プロジェクト: QuantAsylum/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, AnalyzerOutputLevel, TestFrequency);

            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            // Compute the total RMS around the freq of interest
            ((IAudioAnalyzer)Tm.TestClass).ComputePeakDb(TestFrequency * 0.90f, TestFrequency * 1.10f, out tr.Value[0], out tr.Value[1]);
            tr.Value[0] = tr.Value[0] - AnalyzerOutputLevel;
            tr.Value[1] = tr.Value[1] - AnalyzerOutputLevel;

            bool passLeft = false, passRight = false;

            if (LeftChannel)
            {
                passLeft = CheckChannel(0, tr);
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }

            if (RightChannel)
            {
                passRight = CheckChannel(1, tr);
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #3
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);
            ((IProgrammableLoad)Tm.TestClass).SetImpedance(ProgrammableLoadImpedance);

            // Disable generators
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(false, -60, 1000);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(false, -60, 1000);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();


            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(StartFreq, EndFreq, out tr.Value[0], out tr.Value[1]);

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.0") + " dBV";
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.0") + " dBV";
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }

            if (LeftChannel && tr.Value[0] > MinimumPassLevel && tr.Value[0] < MaximumPassLevel && RightChannel && tr.Value[1] > MinimumPassLevel && tr.Value[1] < MaximumPassLevel)
            {
                tr.Pass = true;
            }
            else if (!LeftChannel && RightChannel && tr.Value[1] > MinimumPassLevel && tr.Value[1] < MaximumPassLevel)
            {
                tr.Pass = true;
            }
            else if (!RightChannel && LeftChannel && tr.Value[0] > MinimumPassLevel && tr.Value[0] < MaximumPassLevel)
            {
                tr.Pass = true;
            }

            return;
        }
コード例 #4
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IProgrammableLoad)Tm.TestClass).SetImpedance(ProgrammableLoadImpedance);

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);
            ((IAudioAnalyzer)Tm.TestClass).DoFrAquisition(AnalyzerOutputLevel, 0, SmoothingDenominator);
            ((IAudioAnalyzer)Tm.TestClass).TestMask(MaskFileName, LeftChannel, RightChannel, false, out bool passLeft, out bool passRight, out _);

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            if (LeftChannel)
            {
                tr.StringValue[0] = passLeft.ToString();
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = passRight.ToString();
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #5
0
ファイル: MicCompareA01.cs プロジェクト: QuantAsylum/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            ((IAudioAnalyzer)Tm.TestClass).DoFrAquisition(AnalyzerOutputLevel, WindowingMs / 1000, SmoothingDenominator);
            ((IAudioAnalyzer)Tm.TestClass).TestMask(MaskFileName, false, false, true, out bool passLeft, out bool passRight, out bool passMath);
            ((IAudioAnalyzer)Tm.TestClass).AddMathToDisplay();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            bool passPhase = true;
            int  passCount = 0;

            if (CheckPhase)
            {
                if (((IAudioAnalyzer)Tm.TestClass).LRVerifyPhase((int)FftSize * 1024 / 4))
                {
                    ++passCount;
                }
                if (((IAudioAnalyzer)Tm.TestClass).LRVerifyPhase((int)FftSize * 1024 / 4 + 300))
                {
                    ++passCount;
                }
                if (passCount != 2)
                {
                    passPhase = false;
                }
            }


            tr.Pass = passMath && passPhase;

            if (passPhase == false)
            {
                tr.OperatorMessage += "PHASE ";
            }

            if (passMath == false)
            {
                tr.OperatorMessage += "MASK";
            }

            return;
        }
コード例 #6
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).SetFftLength(FftSize);
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            ((IAudioAnalyzer)Tm.TestClass).DoFrAquisition(AnalyzerOutputLevel);
            ((IAudioAnalyzer)Tm.TestClass).TestMask(MaskFileName, out bool passLeft, out bool passRight);

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            if (LeftChannel)
            {
                tr.StringValue[0] = passLeft.ToString();
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = passRight.ToString();
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #7
0
ファイル: PowerA14.cs プロジェクト: 95rade/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IPowerSupply)Tm.TestClass).SetSupplyState(PowerState);
            Thread.Sleep(1200);
            float current = ((ICurrentMeter)Tm.TestClass).GetDutCurrent(3);


            if ((current > MinimumPassCurrent) && (current < MaximumPassCurrent))
            {
                tr.Pass = true;
            }

            tr.Value[0]       = current;
            tr.StringValue[0] = current.ToString("0.000") + "A";
            tr.StringValue[1] = "SKIP";

            return;
        }
コード例 #8
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(InputRange);

            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, OutputLevel, Freq);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, OutputLevel, Freq);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            ((IAudioAnalyzer)Tm.TestClass).ComputeThdnPct(Freq, StartFreq, StopFreq, out tr.Value[0], out tr.Value[1]);

            // Convert to db
            tr.Value[0] = 20 * (float)Math.Log10(tr.Value[0] / 100);
            tr.Value[1] = 20 * (float)Math.Log10(tr.Value[1] / 100);

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.0") + " dB";
                if ((tr.Value[0] < MinimumOkThdN) || (tr.Value[0] > MaximumOkThdN))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.0") + " dB";
                if ((tr.Value[1] < MinimumOkThdN) || (tr.Value[1] > MaximumOkThdN))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }

            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #9
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetFftLength(FftSize);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(InputRange);
            ((IProgrammableLoad)Tm.TestClass).SetImpedance(LoadImpedance);

            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, OutputLevel, Freq);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, OutputLevel, Freq);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            // Get THD in dB
            ((IAudioAnalyzer)Tm.TestClass).ComputeThdPct(Freq, 20000, out tr.Value[0], out tr.Value[1]);
            tr.Value[0] = 20 * (float)Math.Log10(tr.Value[0] / 100);
            tr.Value[1] = 20 * (float)Math.Log10(tr.Value[1] / 100);

            // Compute peak
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(Freq * 0.98f, Freq * 1.02f, out double peakLDbv, out double peakRDbv);

            // Convert to volts
            double leftVrms  = (float)Math.Pow(10, peakLDbv / 20);
            double rightVrms = (float)Math.Pow(10, peakRDbv / 20);

            // Convert to watts
            double leftWatts  = (leftVrms * leftVrms) / LoadImpedance;
            double rightWatts = (rightVrms * rightVrms) / LoadImpedance;

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = string.Format("{0:N1} dB @ {1:N1} Watts", tr.Value[0], leftWatts);
                if ((tr.Value[0] < MinimumOKThd) || (tr.Value[0] > MaximumOKThd))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = string.Format("{0:N1} dB @ {1:N1} Watts", tr.Value[1], rightWatts);
                if ((tr.Value[1] < MinimumOKThd) || (tr.Value[1] > MaximumOKThd))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #10
0
ファイル: ImdA01.cs プロジェクト: QuantAsylum/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);


            // The RMS of two distinct but equal tones is 3 dBV above level of the tones
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel - 3, 19000);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(true, AnalyzerOutputLevel - 3, 20000);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(18995, 19005, out double l1, out double r1);
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(995, 1005, out double l2, out double r2);

            if (LeftChannel)
            {
                tr.Value[0] = l2 - l1;
            }

            if (RightChannel)
            {
                tr.Value[1] = r2 - r1;
            }

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.0") + " dB";
                if ((tr.Value[0] < MinimumPassLevel) || (tr.Value[0] > MaximumPassLevel))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.0") + " dB";
                if ((tr.Value[1] < MinimumPassLevel) || (tr.Value[1] > MaximumPassLevel))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #11
0
ファイル: GainA01.cs プロジェクト: 95rade/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).SetFftLength(FftSize);
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, AnalyzerOutputLevel, TestFrequency);

            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            // Compute the total RMS around the freq of interest
            ((IAudioAnalyzer)Tm.TestClass).ComputePeak(TestFrequency * 0.90f, TestFrequency * 1.10f, out tr.Value[0], out tr.Value[1]);
            tr.Value[0] = tr.Value[0] + ExternalAnalyzerInputGain - AnalyzerOutputLevel;
            tr.Value[1] = tr.Value[1] + ExternalAnalyzerInputGain - AnalyzerOutputLevel;

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.00") + " dB";
                if ((tr.Value[0] < MinimumPassGain) || (tr.Value[0] > MaximumPassGain))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.00") + " dB";
                if ((tr.Value[1] < MinimumPassGain) || (tr.Value[1] > MaximumPassGain))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #12
0
ファイル: ImpedanceA03.cs プロジェクト: 95rade/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            double[] vOut4 = new double[2] {
                double.NaN, double.NaN
            };
            double[] vOut8 = new double[2] {
                double.NaN, double.NaN
            };

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            // First, we make 8 ohm measurement
            ((IProgrammableLoad)Tm.TestClass).SetImpedance(8);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            // Grab the 8 ohm levels
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(TestFrequency * 0.98f, TestFrequency * 1.02f, out vOut8[0], out vOut8[1]);

            // Now make 4 ohm meausrement
            ((IProgrammableLoad)Tm.TestClass).SetImpedance(4);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            // Grab the 4 ohm circuit levels
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(TestFrequency * 0.98f, TestFrequency * 1.02f, out vOut4[0], out vOut4[1]);

            // Compute impedance
            for (int i = 0; i < 2; i++)
            {
                if (!double.IsNaN(vOut4[i]) && !double.IsNaN(vOut8[i]))
                {
                    tr.Value[i] = CalcImpedance(vOut4[i], vOut8[i]);
                }
            }

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.0000") + " ohms";
                if ((tr.Value[0] < MinimumPassImpedance) || (tr.Value[0] > MaximumPassImpedance))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.0000") + " ohms";
                if ((tr.Value[1] < MinimumPassImpedance) || (tr.Value[1] > MaximumPassImpedance))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #13
0
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);
            ((IAudioAnalyzer)Tm.TestClass).SetFftLength(FftSize);
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);

            ((IProgrammableLoad)Tm.TestClass).SetImpedance(ProgrammableLoadImpedance);

            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            while (((IAudioAnalyzer)Tm.TestClass).AnalyzerIsBusy())
            {
                float current = ((ICurrentMeter)Tm.TestClass).GetDutCurrent();
                Log.WriteLine(LogType.General, "Current: " + current);
            }

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            // Compute the total RMS around the freq of interest
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(TestFrequency * 0.90f, TestFrequency * 1.10f, out tr.Value[0], out tr.Value[1]);
            tr.Value[0] = tr.Value[0] - AnalyzerOutputLevel - ExternalAnalyzerInputGain;
            tr.Value[1] = tr.Value[1] - AnalyzerOutputLevel - ExternalAnalyzerInputGain;

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.00") + " dB";
                if ((tr.Value[0] < MinimumPassGain) || (tr.Value[0] > MaximumPassGain))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.00") + " dB";
                if ((tr.Value[1] < MinimumPassGain) || (tr.Value[1] > MaximumPassGain))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #14
0
ファイル: ImdA03.cs プロジェクト: 95rade/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            ((IProgrammableLoad)Tm.TestClass).SetImpedance(ProgrammableLoadImpedance);

            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel - 3, 19000);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(true, AnalyzerOutputLevel - 3, 20000);
            ((IAudioAnalyzer)Tm.TestClass).DoAcquisition();

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(18995, 19005, out double toneRmsL, out double toneRmsR);
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(990, 1010, out double productLeft, out double productRight);
            tr.Value[0] = toneRmsL + 6 - productLeft;
            tr.Value[1] = toneRmsR + 6 - productRight;

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = tr.Value[0].ToString("0.0") + " dB";
                if ((tr.Value[0] < MinimumPassLevel) || (tr.Value[0] > MaximumPassLevel))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = tr.Value[1].ToString("0.0") + " dB";
                if ((tr.Value[1] < MinimumPassLevel) || (tr.Value[1] > MaximumPassLevel))
                {
                    passRight = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }
コード例 #15
0
ファイル: EfficiencyA07.cs プロジェクト: QuantAsylum/Tractor
        public override void DoTest(string title, out TestResult tr)
        {
            // Two channels of testing
            tr = new TestResult(2);

            Tm.SetToDefaults();
            SetupBaseTests();

            ((IProgrammableLoad)Tm.TestClass).SetImpedance(ProgrammableLoadImpedance);

            ((IAudioAnalyzer)Tm.TestClass).AudioAnalyzerSetTitle(title);
            ((IAudioAnalyzer)Tm.TestClass).SetInputRange(AnalyzerInputRange);

            if (LeftChannel == true && RightChannel == false)
            {
                ((IAudioAnalyzer)Tm.TestClass).SetMuting(false, true);
            }
            if (LeftChannel == false && RightChannel == true)
            {
                ((IAudioAnalyzer)Tm.TestClass).SetMuting(true, false);
            }
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen1(true, AnalyzerOutputLevel, TestFrequency);
            ((IAudioAnalyzer)Tm.TestClass).AudioGenSetGen2(false, AnalyzerOutputLevel, TestFrequency);

            DateTime effStart = DateTime.Now;

            ((IAudioAnalyzer)Tm.TestClass).DoAcquisitionAsync();

            float current = 0;

            while (((IAudioAnalyzer)Tm.TestClass).AnalyzerIsBusy())
            {
                float c = ((ICurrentMeter)Tm.TestClass).GetDutCurrent();
                if (c > current)
                {
                    current = c;
                }

                //Log.WriteLine(LogType.General, string.Format("Elapsed: {0:0.0}  EfficiencyA07() Current: {1:0.000}",
                //    DateTime.Now.Subtract(effStart).TotalMilliseconds, current));

                Thread.Sleep(20);
            }

            TestResultBitmap = ((IAudioAnalyzer)Tm.TestClass).GetBitmap();

            // Get dBV out and adjust based on input gains
            ((IAudioAnalyzer)Tm.TestClass).ComputeRms(TestFrequency * 0.98f, TestFrequency * 1.02f, out double peakLDbv, out double peakRDbv);
            //peakLDbv -= PreAnalyzerInputGain;
            //peakRDbv -= PreAnalyzerInputGain;

            // Convert to Volts RMS
            double leftVrms  = (double)Math.Pow(10, peakLDbv / 20);
            double rightVrms = (double)Math.Pow(10, peakRDbv / 20);

            // Convert to watts
            double wattsL = leftVrms * leftVrms / ProgrammableLoadImpedance;
            double wattsR = rightVrms * rightVrms / ProgrammableLoadImpedance;

            double wattsInPerChannel = AmplifierSupplyVoltage * current;

            // If both channels being testing, then per-channel is half of measured
            if (LeftChannel == true && RightChannel == true)
            {
                wattsInPerChannel = wattsInPerChannel / 2;
            }

            tr.Value[0] = 100 * wattsL / wattsInPerChannel;
            tr.Value[1] = 100 * wattsR / wattsInPerChannel;

            bool passLeft = true, passRight = true;

            if (LeftChannel)
            {
                tr.StringValue[0] = string.Format("{0:N1}% @ {1:N2} W out LPin = {2:N1}", tr.Value[0], wattsL, wattsInPerChannel);
                if ((tr.Value[0] < MinimumPassEfficiency) || (tr.Value[0] > MaximumPassEfficiency))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[0] = "SKIP";
            }

            if (RightChannel)
            {
                tr.StringValue[1] = string.Format("{0:N1}% @ {1:N2} W out RPin = {2:N1}", tr.Value[1], wattsR, wattsInPerChannel);
                if ((tr.Value[1] < MinimumPassEfficiency) || (tr.Value[1] > MaximumPassEfficiency))
                {
                    passLeft = false;
                }
            }
            else
            {
                tr.StringValue[1] = "SKIP";
            }


            if (LeftChannel && RightChannel)
            {
                tr.Pass = passLeft && passRight;
            }
            else if (LeftChannel)
            {
                tr.Pass = passLeft;
            }
            else if (RightChannel)
            {
                tr.Pass = passRight;
            }

            return;
        }