public static void TogglePFILine(NIRfsg rfsgHandle, RfsgMarkerEventToggleInitialState toggleDirection = RfsgMarkerEventToggleInitialState.DigitalLow)
        {
            rfsgHandle.Abort();

            //Ensure that the terminal is configured to the proper toggle state
            rfsgHandle.DeviceEvents.MarkerEvents[1].ExportedOutputTerminal = RfsgMarkerEventExportedOutputTerminal.Pfi0;
            rfsgHandle.DeviceEvents.MarkerEvents[1].OutputBehaviour        = RfsgMarkerEventOutputBehaviour.Toggle;
            rfsgHandle.DeviceEvents.MarkerEvents[1].ToggleInitialState     = toggleDirection;

            //Create a script that doesn't do anything, but ensures that the requested intitial toggle behavior
            //is applied to the hardware to toggle the PFI line correctly
            string cachedScriptName = rfsgHandle.Arb.Scripting.SelectedScriptName;
            string toggleScript     =
                @"script toggleScript
                    wait 10
                end script";

            rfsgHandle.Arb.Scripting.WriteScript(toggleScript);
            rfsgHandle.Arb.Scripting.SelectedScriptName = "ToggleScript";

            rfsgHandle.Initiate();
            rfsgHandle.Abort();

            //Return the active script to the previous
            rfsgHandle.Arb.Scripting.SelectedScriptName = cachedScriptName;
            rfsgHandle.Utility.Commit();
        }
Example #2
0
        public void UpdateGeneration()
        {
            if (!Environs.Debug)
            {
                _rfsgSession.Abort();

                // Configure the instrument
                _rfsgSession.RF.Configure(_frequency, _amplitude);

                // Initiate Generation
                _rfsgSession.Initiate();
            }
        }
 public void AbortSequence()
 {
     if (!session.IsDisposed)
     {
         session.Abort();
     }
 }
Example #4
0
        void UpdateGeneration()
        {
            double frequency, power;

            try
            {
                // Stop the status checking timer
                EnableControls(true);

                // Read in all the control values
                frequency = (double)frequencyNumeric.Value;
                power     = (double)powerLevelNumeric.Value;

                // Abort generation
                _rfsgSession.Abort();

                // Configure the instrument
                _rfsgSession.RF.Configure(frequency, power);

                // Initiate Generation
                _rfsgSession.Initiate();

                // Start the status checking timer
                EnableControls(false);
            }
            catch (Exception ex)
            {
                ShowError("UpdateGeneration()", ex);
            }
        }
        public static void DownloadWaveform(NIRfsg rfsgHandle, Waveform waveform)
        {
            IntPtr rfsgPtr = rfsgHandle.GetInstrumentHandle().DangerousGetHandle();

            rfsgHandle.Abort();

            rfsgHandle.RF.PowerLevelType = RfsgRFPowerLevelType.PeakPower;

            try
            {
                rfsgHandle.Arb.ClearWaveform(waveform.WaveformName); //Clear existing waveform to avoid erros
            }
            catch (Ivi.Driver.OutOfRangeException)
            { //Intentionally ignore this exception; clearing the waveform failed because it doesn't exist
            }

            rfsgHandle.Arb.WriteWaveform(waveform.WaveformName, waveform.WaveformData);

            //Store loaded parameters
            NIRfsgPlayback.StoreWaveformSignalBandwidth(rfsgPtr, waveform.WaveformName, waveform.SignalBandwidth_Hz);
            NIRfsgPlayback.StoreWaveformPapr(rfsgPtr, waveform.WaveformName, waveform.PAPR_dB);
            NIRfsgPlayback.StoreWaveformBurstStartLocations(rfsgPtr, waveform.WaveformName, waveform.BurstStartLocations);
            NIRfsgPlayback.StoreWaveformBurstStopLocations(rfsgPtr, waveform.WaveformName, waveform.BurstStopLocations);
            NIRfsgPlayback.StoreWaveformSampleRate(rfsgPtr, waveform.WaveformName, waveform.SampleRate);

            //Manually configure additional settings
            NIRfsgPlayback.StoreWaveformLOOffsetMode(rfsgPtr, waveform.WaveformName, NIRfsgPlaybackLOOffsetMode.Disabled);
            NIRfsgPlayback.StoreWaveformRuntimeScaling(rfsgPtr, waveform.WaveformName, -1.5);
            NIRfsgPlayback.StoreWaveformRFBlankingEnabled(rfsgPtr, waveform.WaveformName, false);
        }
        private void AbortGeneration()
        {
            SetButtonState(false);

            if (rfsg?.IsDisposed == false)
            {
                rfsg.Abort();
            }
        }
        private void AbortGeneration()
        {
            SetButtonState(false);

            if (_rfsgSession?.IsDisposed == false)
            {
                _rfsgSession.Abort();
            }
        }
Example #8
0
 public void PauseGeneration()
 {
     try
     {
         // Abort current generation
         _rfsgSession.Abort();
     }
     catch (Exception ex)
     {
         ShowError("PauseGeneration()", ex);
     }
 }
Example #9
0
 void UpdateGeneration()
 {
     try
     {
         // Abort current generation
         _rfsgSession.Abort();
     }
     catch (Exception ex)
     {
         ShowError("UpdateGeneration()", ex);
     }
 }
Example #10
0
 void StopGeneration()
 {
     try
     {
         if (rfsgSession != null)
         {
             rfsgSession.Abort();
             rfsgSession.RF.OutputEnabled = false;
             rfsgSession.Close();
             rfsgSession = null;
         }
     }
     catch (Exception ohNo)
     {
         ShowError("StopGeneration", ohNo);
     }
     // Stop the status checking timer
     EnableControls(true);
 }
        /// <summary>Acquires the incoming signal, trains the DPD model, applies the memory polynomial to the reference waveform, and downloads the predistorted waveform to the generator.
        ///  If generation is in progress when this function is called, generation will resume with the predistorted waveform.</summary>
        /// <param name="specAn">Specifies the SpecAn signal to configure.</param>
        /// <param name="rfsgSession">Specifies the open RFSG session to configure.</param>
        /// <param name="referenceWaveform">Specifies the <see cref="Waveform"/> whose data defines the complex baseband equivalent of the RF signal applied at the input
        /// port of the device under test when performing the measurement. See the RFmx help for more documention of this parameter.</param>
        /// <param name="selectorString">Pass an empty string. The signal name that is passed when creating the signal configuration is used.
        /// See the RFmx help for more documention of this parameter.</param>
        /// <returns>Common results after the application of memory polynomial based DPD.</returns>
        public static MemoryPolynomialResults PerformMemoryPolynomial(RFmxSpecAnMX specAn, NIRfsg rfsgSession, MemoryPolynomialConfiguration mpConfig,
                                                                      Waveform referenceWaveform, string selectorString = "")
        {
            //Instantiate new waveform with reference waveform properties
            MemoryPolynomialResults mpResults = new MemoryPolynomialResults()
            {
                PredistortedWaveform = referenceWaveform
            };

            mpResults.PredistortedWaveform.Data = referenceWaveform.Data.Clone(); // clone waveform so RFmx can't act on reference waveform
            mpResults.PredistortedWaveform.UpdateNameAndScript(referenceWaveform.Name + "postMpDpd");

            RFmxSpecAnMXDpdApplyDpdIdleDurationPresent idlePresent = referenceWaveform.IdleDurationPresent ? RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.True : RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.False;

            RfsgGenerationStatus preDpdGenerationStatus = rfsgSession.CheckGenerationStatus();

            rfsgSession.Abort(); // abort so we don't mess with the loop logic

            for (int i = 0; i < mpConfig.NumberOfIterations; i++)
            {
                specAn.Dpd.Configuration.ConfigurePreviousDpdPolynomial(selectorString, mpResults.Polynomial);
                rfsgSession.Initiate();
                specAn.Initiate(selectorString, "");
                specAn.WaitForMeasurementComplete(selectorString, 10.0); // wait for polynomial coefficients to be calculated
                                                                         //waveform data and PAPR are overwritten in post DPD waveform
                specAn.Dpd.ApplyDpd.ApplyDigitalPredistortion(selectorString, referenceWaveform.Data, idlePresent, 10.0, ref mpResults.PredistortedWaveform.Data,
                                                              out mpResults.PowerResults.WaveformTruePapr_dB, out mpResults.PowerResults.WaveformPowerOffset_dB);
                //Waveform's PAPR is modified to adjust the output power of the waveform on a per waveform basis rather than changing the
                //user's configured output power on the instrument
                mpResults.PredistortedWaveform.PAPR_dB = mpResults.PowerResults.WaveformPowerOffset_dB + mpResults.PowerResults.WaveformTruePapr_dB;
                DownloadWaveform(rfsgSession, mpResults.PredistortedWaveform); // implicit abort
                ApplyWaveformAttributes(rfsgSession, mpResults.PredistortedWaveform);
                specAn.Dpd.Results.FetchDpdPolynomial(selectorString, 10.0, ref mpResults.Polynomial);
            }

            mpResults.PowerResults.TrainingPower_dBm = rfsgSession.RF.PowerLevel;
            if (preDpdGenerationStatus == RfsgGenerationStatus.InProgress)
            {
                rfsgSession.Initiate(); // restart generation if it was running on function call
            }
            return(mpResults);
        }
Example #12
0
        /// <summary>Notifies running scripts configured with <see cref="ConfigureContinuousGeneration(NIRfsg, Waveform, string)"/> or
        /// <see cref="ConfigureBurstedGeneration(NIRfsg, Waveform, WaveformTimingConfiguration, PAENConfiguration, out double, out double)"/>
        /// to enter the cleanup state, and then aborts generation. This function ensures that these scripts always reach a finished state before
        /// aborting, so as to ensure the DUT is in the desired state at the end of generation.</summary>
        /// <param name="rfsgHandle">The open RFSG session to configure.</param>
        /// <param name="timeOut_ms">(Optional) The timeout to wait for generation to complete before manually aborting.</param>
        public static void AbortGeneration(NIRfsg rfsgHandle, int timeOut_ms = 1000)
        {
            //This should trigger the generator to stop infinite generation and trigger any post
            //generation commands. For the static PA enable case, this should trigger the requisite
            //off command to disable the PA.
            rfsgHandle.Triggers.ScriptTriggers[0].SendSoftwareEdgeTrigger();

            int sleepTime_ms  = 20;
            int maxIterations = (int)Math.Ceiling((double)timeOut_ms / sleepTime_ms);
            RfsgGenerationStatus genStatus = rfsgHandle.CheckGenerationStatus();

            //Poll the generation status until it is complete or the timeout period is reached
            if (genStatus == RfsgGenerationStatus.InProgress)
            {
                for (int i = 0; i < maxIterations; i++)
                {
                    genStatus = rfsgHandle.CheckGenerationStatus();
                    if (genStatus == RfsgGenerationStatus.Complete)
                    {
                        break;
                    }
                    else
                    {
                        Thread.Sleep(sleepTime_ms);
                    }
                }

                //This will only be true if we time out
                if (genStatus == RfsgGenerationStatus.InProgress)
                {
                    //If we timeed out then we need to call an explicit abort
                    rfsgHandle.Abort();
                    throw new System.ComponentModel.WarningException("Generation did not complete in the specified timeout period, so post-script actions did not complete." +
                                                                     " If using bursted generation, you may need to manually disable the PA control line." +
                                                                     " Increase the timeout period or ensure that scripTrigger0 is properly configured to stop generation");
                }
            }
        }
Example #13
0
        /// <summary>Downloads a previously loaded waveform to the instrument and sets associated properties.</summary>
        /// <param name="rfsgHandle">The open RFSG session to configure.</param>
        /// <param name="waveform">The waveform data and associated properties to download to the instrument. Use <see cref="LoadWaveformFromTDMS(string, string)"/> to load a waveform from a TDMS file.</param>
        public static void DownloadWaveform(NIRfsg rfsgHandle, Waveform waveform)
        {
            IntPtr rfsgPtr = rfsgHandle.GetInstrumentHandle().DangerousGetHandle();

            rfsgHandle.Abort();

            try
            {
                rfsgHandle.Arb.ClearWaveform(waveform.Name); //Clear existing waveform to avoid erros
            }
            catch (Exception ex)
            {
                if (ex is Ivi.Driver.OutOfRangeException || ex is Ivi.Driver.IviCDriverException)
                {
                }                                                                                     //Intentionally ignore this exception; clearing the waveform failed because it doesn't exist
                else
                {
                    throw;
                }
            }

            rfsgHandle.RF.PowerLevelType = RfsgRFPowerLevelType.PeakPower; // set power level to peak before writing so RFSG doesn't scale waveform
            rfsgHandle.Arb.WriteWaveform(waveform.Name, waveform.Data);

            //Store loaded parameters
            NIRfsgPlayback.StoreWaveformSignalBandwidth(rfsgPtr, waveform.Name, waveform.SignalBandwidth_Hz);
            NIRfsgPlayback.StoreWaveformPapr(rfsgPtr, waveform.Name, waveform.PAPR_dB);
            NIRfsgPlayback.StoreWaveformBurstStartLocations(rfsgPtr, waveform.Name, waveform.BurstStartLocations);
            NIRfsgPlayback.StoreWaveformBurstStopLocations(rfsgPtr, waveform.Name, waveform.BurstStopLocations);
            NIRfsgPlayback.StoreWaveformSampleRate(rfsgPtr, waveform.Name, waveform.SampleRate);
            NIRfsgPlayback.StoreWaveformRuntimeScaling(rfsgPtr, waveform.Name, waveform.RuntimeScaling);
            NIRfsgPlayback.StoreWaveformSize(rfsgPtr, waveform.Name, waveform.Data.SampleCount);

            //Manually configure additional settings
            NIRfsgPlayback.StoreWaveformLOOffsetMode(rfsgPtr, waveform.Name, NIRfsgPlaybackLOOffsetMode.Auto);
            NIRfsgPlayback.StoreWaveformRFBlankingEnabled(rfsgPtr, waveform.Name, false);
        }
Example #14
0
 /// <summary>Aborts generation, disables the output, and closes the instrument session.</summary>
 /// <param name="rfsgHandle">The open RFSG session to close.</param>
 public static void CloseInstrument(NIRfsg rfsgHandle)
 {
     rfsgHandle.Abort();
     rfsgHandle.RF.OutputEnabled = false;
     rfsgHandle.Close();
 }
 public void Disconnect()
 {
     _rfsgSession.Abort();
 }