Example #1
0
        /// <summary>
        ///  This is a test driver used to develop the SR classes and methods in SRControl, SRTakeDataHandler and the SREventHandler and for driving an asynchronous SR measurement together with LM.
        ///  Take data according to parameters on measurement, modeled after code in take_data.cpp
        /// </summary>
        /// <param name="meas">the measurement, has acq params</param>
        /// <returns>SR.MEAS_TERMINATED: stop and do outliers and sums on existing collected results</returns>
        /// <returns>SR.MEAS_ABORTED: abort and delete existing collected results</returns>
        /// <returns>SR.MEAS_CONTINUE: move forward with the next collect step</returns>
        public int take_sr_data(Measurement meas, Detector det)
        {
            // step 1
            InitializeContext(meas, det);

            // step 2
            int status = InitializeSR(new CancellationTokenSource());

            if (status != sr_h.SR_SUCCESS)
            {
                return(status);
            }

            /* new Measurement should be set up prior to here, or right here, with empty cycle list
             *
             * /* set up window for displaying run data as it is acquired */
            // dev note: replaced with timer callback and progress update events
            tds = new TDState(acquire_num_runs);

            /* See StartLMCAssay for similar steps (NCD file, cycle instance) "create a results record for this measurement" */

            // step 3 should occur at a higher level  (e.g. see StartLMCAssay)

            // step 3, loop until  1) something bad happens, 2) external interrupt, or 3) to completion
            do
            {
                // step 3.a
                status = StartSRDAQ();
                if (status != SR.MEAS_CONTINUE)  // MEAS_ABORT or MEAS_TERMINATE
                {
                    return(status);
                }

                // step 3.b
                status = PollAndGetResults();
                // Added A/S fail to cycle re-do decrement 3.16.2015 HN
                if ((status == SR.ZERO_COUNT_TIME) || (status == SR.SR_TRY_AGAIN) || (status == SR.ACC_SNGL_FAIL))  // dev note: empty cycles are eliminated by this step
                {
                    tds.run_number--;
                    continue;
                }
                else if (status != SR.SUCCESS)  // MEAS_ABORT or MEAS_TERMINATE
                {
                    return(status);
                }

                tds.fraction += meas.AcquireState.run_count_time;
            } while (tds.run_number < acquire_num_runs);

            // step 4
            CloseDownSR();

            //this is the end of the complete measurement, next the 2nd and 3rd phases of calculation kick in (Measurement.CalculateMeasurementResults())
            return(SR.SUCCESS);
        }
Example #2
0
        /// <summary>
        ///  This is a test driver used to develop the SR classes and methods in SRControl, SRTakeDataHandler and the SREventHandler and for driving an asynchronous SR measurement together with LM.
        ///  Take data according to parameters on measurement, modeled after code in take_data.cpp
        /// </summary>
        /// <param name="meas">the measurement, has acq params</param>
        /// <returns>SR.MEAS_TERMINATED: stop and do outliers and sums on existing collected results</returns>
        /// <returns>SR.MEAS_ABORTED: abort and delete existing collected results</returns>
        /// <returns>SR.MEAS_CONTINUE: move forward with the next collect step</returns>
        public int take_sr_data(Measurement meas, Detector det)
        {
            // step 1
            InitializeContext(meas, det);

            // step 2
            int status = InitializeSR(new CancellationTokenSource());
            if (status != sr_h.SR_SUCCESS)
            {
                return status;
            }

            /* new Measurement should be set up prior to here, or right here, with empty cycle list 

            /* set up window for displaying run data as it is acquired */
            // dev note: replaced with timer callback and progress update events
            tds = new TDState(acquire_num_runs);

            /* See StartLMCAssay for similar steps (NCD file, cycle instance) "create a results record for this measurement" */

            // step 3 should occur at a higher level  (e.g. see StartLMCAssay)

            // step 3, loop until  1) something bad happens, 2) external interrupt, or 3) to completion
            do
            {
                // step 3.a
                status = StartSRDAQ();
                if (status != SR.MEAS_CONTINUE)  // MEAS_ABORT or MEAS_TERMINATE
                {
                    return status;
                }

                // step 3.b
                status = PollAndGetResults();
                // Added A/S fail to cycle re-do decrement 3.16.2015 HN
                if ((status == SR.ZERO_COUNT_TIME) || (status == SR.SR_TRY_AGAIN) ||(status == SR.ACC_SNGL_FAIL))  // dev note: empty cycles are eliminated by this step
                {
                    tds.run_number--;
                    continue;
                }
                else if (status != SR.SUCCESS)  // MEAS_ABORT or MEAS_TERMINATE
                {
                    return status;
                }
                
                tds.fraction += meas.AcquireState.run_count_time;
            } while (tds.run_number < acquire_num_runs);

            // step 4 
            CloseDownSR();

            //this is the end of the complete measurement, next the 2nd and 3rd phases of calculation kick in (Measurement.CalculateMeasurementResults())
            return (SR.SUCCESS);

        }
Example #3
0
 public void InitTDState()
 {
     tds = new TDState(acquire_num_runs);
 }
Example #4
0
 public void InitTDState()
 {
     tds = new TDState(acquire_num_runs);
 }