Esempio n. 1
0
        /// <summary>
        /// Compares the CSA mask waveform acquisition value should be greater than this value.
        ///
        /// ACQuire:CURRentcount:MASKWfms?
        /// </summary>
        /// <param name="scope">the SCOPE object</param>
        /// <param name="time">Amount of time to wait inbetween taking counts</param>
        public void IWaitUntilCSAMaskShowsWfmAcquisitions(ISCOPE scope, string time)
        {
            int    currentWfmAcqCount = 0;
            double totalTime          = 0;

            UTILS.HiPerfTimer Timer1  = new UTILS.HiPerfTimer();
            double            maxTime = double.Parse(time);

            //Error checking for a empty string otherwise, parse as normal
            int initialWfmAcqCount = string.IsNullOrWhiteSpace(scope.CSACurrentMaskCount)
                ? 0
                : int.Parse(scope.CSACurrentMaskCount);

            // Start the timer, and wait up to the max number of seconds specified for acqs to appear ever 500ms
            while ((totalTime < maxTime) && (initialWfmAcqCount == currentWfmAcqCount))
            {
                Timer1.Start();
                scope.GetCSACurrentMaskWfmCount();
                //Error checking for a empty string otherwise, parse as normal
                currentWfmAcqCount = string.IsNullOrWhiteSpace(scope.CSACurrentMaskCount)
                    ? 0
                    : int.Parse(scope.CSACurrentMaskCount);
                Thread.Sleep(500); // Have to make sure this is between the start/stop commands
                Timer1.Stop();

                // Add the current interval to the total
                totalTime = totalTime + Timer1.Duration;
            }

            if (initialWfmAcqCount == currentWfmAcqCount)
            {
                Assert.Fail(totalTime + " sec. passed with no acquisitions counted on CSA scope. Max time allowed was " +
                            maxTime + " seconds.");
            }
        }
Esempio n. 2
0
        /// Unkown - 01/01/01
        /// <summary>
        /// Checks if the AWG adds a certain number of waveforms in the specified time limt
        /// </summary>
        /// <param name="awg">The AWG the waveforms will be added to</param>
        /// <param name="numEntries">The number of waveforms to be added</param>
        /// <param name="seconds">Time limit for adding the waveforms</param>
        public void WaitForWfmListToAddWfms(IAWG awg, string numEntries, string seconds)
        {
            // For now going to assume all entries start with 0 as each start with reset Awg
            //int currentEntries = awg.waveform_list_size == "" ? 0 : Int16.Parse(awg.waveform_list_size); //Very convenient short if statement fills currentEntries one way or the other
            // currentEntries++;
            //string nextEntry = currentEntries.ToString();
            var    timer     = new UTILS.HiPerfTimer();
            double totalTime = 0;

            while ((totalTime < double.Parse(seconds)))
            {
                timer.Start();
                GetNumberOfWaveformListEntries(awg);
                if (awg.WaveformListSize == numEntries)
                {
                    return;
                }
                Thread.Sleep(100); // Have to make sure this is between the start/stop commands
                timer.Stop();

                // Add the current interval to the total
                totalTime = totalTime + timer.Duration;
            }
            Assert.Fail("Waveform entries were not added in the " + seconds + " second time limit");
        }
        public void WaitForWfmListToAddWfms(IEXTSOURCE extSource, string numEntries, string seconds)
        {
            UTILS.HiPerfTimer timer     = new UTILS.HiPerfTimer();
            double            totalTime = 0;
            int currentEntries          = Int16.Parse(extSource.ExtSrcWfmListSize);
            int expectedEntries         = Int16.Parse(numEntries) + currentEntries;

            while ((totalTime < double.Parse(seconds)))
            {
                timer.Start();
                extSource.GetExtSrcWfmListSize();
                if (Int16.Parse(extSource.ExtSrcWfmListSize) == expectedEntries)
                {
                    return;
                }
                Thread.Sleep(50); // Have to make sure this is between the start/stop commands
                timer.Stop();
                // Add the current interval to the total
                totalTime = totalTime + timer.Duration;
            }
            Assert.Fail("Waveform entries were not added in the allowed " + seconds + " seconds time limit.  Waveform Entries Found: " + extSource.ExtSrcWfmListSize);
        }
Esempio n. 4
0
        public void SetScopeAcquisitionStateAndWaitFor(ISCOPE scope, string time)
        {
            UTILS.HiPerfTimer Timer1 = new UTILS.HiPerfTimer();
            scope.SetScopeAcquisitonState("ON");
            double maxTime    = double.Parse(time);
            double total_time = 0;

            Thread.Sleep(3000);
            while (total_time < maxTime)
            {
                Timer1.Start();
                scope.GetScopeAcquisitionState();
                scope.SetScopeAcquisitonState("ON");
                Thread.Sleep(1000); // Have to make sure this is between the start/stop commands
                Timer1.Stop();
                // Add the current interval to the total
                total_time = total_time + Timer1.Duration;
            }
            scope.GetScopeAcquisitionState();
            if (scope.ScopeAquisitionState == "0")
            {
                Assert.Fail("Scope was unsuccessfully kept in RUN state");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the number of acquired waveforms from the DPO Scope
        ///
        /// ACQuire:NUMACq?
        /// </summary>
        /// <param name="scope">the SCOPE object</param>
        /// <param name="time">anount of time to wait in seconds, default is 10 seconds</param>
        public void WaitSecondsForDPOScopeToShowAcquisitions(ISCOPE scope, string time = "10")
        {
            int    currentAcqCount = 0;
            double totalTime       = 0;

            UTILS.HiPerfTimer Timer1 = new UTILS.HiPerfTimer();

            // Get initial acq count from scope, initialize the time accumulator
            scope.GetDPOAcquisitionWfmCount();
            //Error checking for a empty string otherwise, parse as normal
            int initialAcqCount = string.IsNullOrWhiteSpace(scope.DPOAcquisitionWfmCount)
                ? 0
                : int.Parse(scope.DPOAcquisitionWfmCount);

            // Start the timer, and wait up to the max number of seconds specified for acqs to appear ever 500ms
            while ((totalTime < double.Parse(time)) && (initialAcqCount == currentAcqCount))
            {
                Timer1.Start();
                scope.GetDPOAcquisitionWfmCount();
                //Error checking for a empty string otherwise, parse as normal
                currentAcqCount = string.IsNullOrWhiteSpace(scope.DPOAcquisitionWfmCount)
                    ? 0
                    : int.Parse(scope.DPOAcquisitionWfmCount);
                Thread.Sleep(500); // Have to make sure this is between the start/stop commands
                Timer1.Stop();

                // Add the current interval to the total
                totalTime = totalTime + Timer1.Duration;
            }

            if (initialAcqCount == currentAcqCount)
            {
                Assert.Fail(totalTime + " sec. passed with no acquisitions counted on DPO scope. Max time allowed was " +
                            time + " seconds.");
            }
        }
Esempio n. 6
0
 public void StarttheTimer()
 {
     _timer = new UTILS.HiPerfTimer();
     _timer.Start();
 }
Esempio n. 7
0
        public void TheScopeStaysInAcquisitionStateFor(ISCOPE scope, string givenState, string time, string units)
        {
            UTILS.HiPerfTimer Timer1 = new UTILS.HiPerfTimer();
            long   timeout           = 0;
            double totalTime         = 0;
            int    value             = Int16.Parse(time);
            string acquireState      = "";
            int    checkInterval     = 500;

            //Convert to milliseconds
            switch (units)
            {
            case "minutes":
            case "min":
                timeout       = value * 60; //Convert to seconds
                checkInterval = 10000;
                //Really no need to tie up TekVisa with calls every half second if the timeout is in minutes change to every 10 seconds
                break;

            case "seconds":
            case "sec":
                timeout = value;
                break;
            }
            //Convert the given state to 1 or 0 to match what the Scope will return
            switch (givenState)
            {
            case "ON":
            case "RUN":
                acquireState = "1";
                break;

            case "OFF":
            case "STOP":
                acquireState = "0";
                break;

            default:
                acquireState = givenState;
                break;
            }
            scope.GetScopeAcquisitionState();
            string state = scope.ScopeAquisitionState;

            if (state != acquireState)
            {
                if (acquireState != "") //Don't view a return of an empty string as a fail
                {
                    Assert.Fail("Scope no longer in " + acquireState + " state");
                }
            }
            // Start the timer, and wait up to the max amount of time
            while (totalTime < timeout)
            {
                Timer1.Start();
                scope.GetScopeAcquisitionState();
                state = scope.ScopeAquisitionState;
                if (state != acquireState)
                {
                    if (acquireState != "")
                    {
                        Assert.Fail("Scope no longer in " + acquireState + " state");
                    }
                }
                Thread.Sleep(checkInterval); // Have to make sure this is between the start/stop commands
                Timer1.Stop();               //CheckInterval is changed if the timeout is in minutes to reduce traffic

                // Add the current interval to the total
                totalTime = totalTime + Timer1.Duration;
            }
        }