/// <summary>
        /// This example illustrates how to use the RFmxWLAN APIs to configure the analyzer to perform an OFDMModAcc measurement.
        /// You can use the Generator Basic example to generate the WLAN signal before running this example.
        /// </summary>
        static void Main(string[] args)
        {
            Console.WriteLine("\n----------------------- WLAN Analyzer Example -----------------------\n");
            double centerFrequency = 3.5e9; //Hz
            string resourceName    = "5840";
            string signalString    = "Signal0";
            string resultString    = "Result0";

            SA.RFmxInstr.InstrumentConfiguration saInstrConfig;
            SA.CommonConfiguration              saCommonConfig;
            SA.AutoLevelConfiguration           saAutolevelConfig;
            SA.RFmxWLAN.StandardConfiguration   wlanStandardConfig;
            SA.RFmxWLAN.OFDMModAccConfiguration modaccConfig;
            SA.RFmxWLAN.OFDMModAccResults       modAccResults = new OFDMModAccResults();

            //Analyzer Configuration
            Console.WriteLine("Configure...\n");
            saInstrConfig  = SA.RFmxInstr.InstrumentConfiguration.GetDefault();
            saCommonConfig = saCommonConfig = SA.CommonConfiguration.GetDefault();
            saCommonConfig.ExternalAttenuation_dB = 0;
            saCommonConfig.CenterFrequency_Hz     = centerFrequency;
            saCommonConfig.ReferenceLevel_dBm     = 0.0;
            saAutolevelConfig         = SA.AutoLevelConfiguration.GetDefault();
            saAutolevelConfig.Enabled = true;
            saAutolevelConfig.MeasurementInterval_s = 10e-3;
            wlanStandardConfig = SA.RFmxWLAN.StandardConfiguration.GetDefault();
            wlanStandardConfig.ChannelBandwidth_Hz = 80.0e6;
            wlanStandardConfig.Standard            = RFmxWlanMXStandard.Standard802_11ax;
            modaccConfig = SA.RFmxWLAN.OFDMModAccConfiguration.GetDefault();

            #region Configure Analyzer
            RFmxInstrMX instr = new RFmxInstrMX(resourceName, "");
            SA.RFmxInstr.ConfigureInstrument(instr, saInstrConfig);
            RFmxWlanMX wlan = instr.GetWlanSignalConfiguration(signalString);
            SA.RFmxWLAN.ConfigureCommon(wlan, saCommonConfig);
            SA.RFmxWLAN.ConfigureStandard(wlan, wlanStandardConfig);
            #endregion

            #region Measure
            Console.WriteLine("Measure...\n");
            ConfigureOFDMModAcc(wlan, modaccConfig);
            RFmxWlanMXMeasurementTypes[] lteMeasurements = new RFmxWlanMXMeasurementTypes[1] {
                RFmxWlanMXMeasurementTypes.OfdmModAcc
            };
            SA.RFmxWLAN.SelectAndInitiateMeasurements(wlan, lteMeasurements, saAutolevelConfig, false, "", resultString);
            modAccResults = FetchOFDMModAcc(wlan, RFmxWlanMX.BuildResultString(resultString));
            //print Results
            Console.WriteLine("\n---------------------- ModAcc Results ---------------------\n");
            Console.WriteLine("Composite RMS EVM (dB): {0:N}", modAccResults.CompositeRMSEVMMean_dB);
            #endregion
            wlan.Dispose();
            instr.Close();
            Console.WriteLine("Please press any key to close the application.\n");
            Console.ReadKey();
        }
        /// <summary>Performs actions to initiate acquisition and measurement.<para></para> Enables the specified measurement(s) before optionally
        /// automatically adjusting the reference level before beginning measurements. Finally, initiates the acquisition and measurement(s).</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
        /// <param name="measurements">Specifies one or more previously configured measurements to enable for this acquisition.</param>
        /// <param name="autoLevelConfig">Specifies the configuration for the optional AutoLevel process which will automatically set the analyzer's reference level.</param>
        /// <param name="enableTraces">(Optional) Specifies whether traces should be enabled for the measurement(s). 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>
        /// <param name="resultName">(Optional) Specifies the name to be associated with measurement results. Provide a unique name, such as "r1" to enable
        /// fetching of multiple measurement results and traces. See the RFmx help for more documentation of this parameter.</param>
        public static void SelectAndInitiateMeasurements(RFmxWlanMX wlanSignal, RFmxWlanMXMeasurementTypes[] measurements, AutoLevelConfiguration autoLevelConfig = default,
                                                         bool enableTraces = false, string selectorString = "", string resultName = "")
        {
            // Aggregate the selected measurements into a single value
            // OR of 0 and x equals x
            RFmxWlanMXMeasurementTypes selectedMeasurements = 0;

            foreach (RFmxWlanMXMeasurementTypes measurement in measurements)
            {
                selectedMeasurements |= measurement;
            }
            wlanSignal.SelectMeasurements(selectorString, selectedMeasurements, enableTraces);

            if (autoLevelConfig.Enabled)
            {
                wlanSignal.AutoLevel(selectorString, autoLevelConfig.MeasurementInterval_s);
            }

            // Initiate acquisition and measurement for the selected measurements
            wlanSignal.Initiate(selectorString, resultName);
        }
        public void Run()
        {
            #region Create Sessions
            NIRfsg       nIRfsg = new NIRfsg(resourceName, false, false);
            RFmxInstrMX  instr  = new RFmxInstrMX(resourceName, "");
            RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan);
            RFmxWlanMX   wlan   = instr.GetWlanSignalConfiguration(signalStringWlan);
            #endregion

            #region Configure Generation
            ConfigureInstrument(nIRfsg, sgInstrConfig);
            Waveform waveform = LoadWaveformFromTDMS(filePath);
            DownloadWaveform(nIRfsg, waveform);
            ConfigureBurstedGeneration(nIRfsg, waveform, paEnableTiming, paenConfig, out double period, out _);

            nIRfsg.Initiate();
            #endregion

            #region Configure Analyzer
            saAutolevelConfig.MeasurementInterval_s = period;
            SA.RFmxInstr.ConfigureInstrument(instr, saInstrConfig);

            SA.RFmxSpecAn.ConfigureCommon(specAn, saCommonConfig);

            ampmConfigurationSpecAn.ReferenceWaveform        = waveform;
            ampmConfigurationSpecAn.DutAverageInputPower_dBm = sgInstrConfig.DutAverageInputPower_dBm;
            SA.RFmxSpecAn.ConfigureAmpm(specAn, ampmConfigurationSpecAn);

            SA.RFmxWLAN.ConfigureCommon(wlan, saCommonConfig);
            SA.RFmxWLAN.ConfigureStandard(wlan, wlanStandardConfig);

            SA.RFmxWLAN.ConfigureOFDMModAcc(wlan, modAccConfig);
            SA.RFmxWLAN.ConfigureSEM(wlan, semConfig);
            #endregion

            #region Measure SpecAn
            RFmxSpecAnMXMeasurementTypes[] specanMeasurements = new RFmxSpecAnMXMeasurementTypes[1] {
                RFmxSpecAnMXMeasurementTypes.Ampm
            };
            SA.RFmxSpecAn.SelectAndInitiateMeasurements(specAn, specanMeasurements, saAutolevelConfig, waveform.SignalBandwidth_Hz, false, "", resultStringSpecan);
            ampmResultsSpecAn = SA.RFmxSpecAn.FetchAmpm(specAn, RFmxSpecAnMX.BuildResultString(resultStringSpecan));
            PrintAMPMResults();
            #endregion

            #region WLAN measure and results
            RFmxWlanMXMeasurementTypes[] wlanMeasurements = new RFmxWlanMXMeasurementTypes[1] {
                RFmxWlanMXMeasurementTypes.OfdmModAcc
            };
            SA.RFmxWLAN.SelectAndInitiateMeasurements(wlan, wlanMeasurements, saAutolevelConfig, false, "", resultStringWlan);
            modAccResults = SA.RFmxWLAN.FetchOFDMModAcc(wlan, RFmxWlanMX.BuildResultString(resultStringWlan));
            PrintModAccResults();

            wlanMeasurements[0] = RFmxWlanMXMeasurementTypes.Sem;
            SA.RFmxWLAN.SelectAndInitiateMeasurements(wlan, wlanMeasurements, saAutolevelConfig, false, "", resultStringWlan);
            semResults = SA.RFmxWLAN.FetchSEM(wlan, RFmxWlanMX.BuildResultString(resultStringWlan));
            PrintSemResults();
            #endregion

            AbortGeneration(nIRfsg);
            CloseInstrument(nIRfsg);
            wlan.Dispose();
            wlan = null;
            instr.Close();
            instr = null;
        }
Exemplo n.º 4
0
        public void Run()
        {
            #region Create Sessions
            NIRfsg       nIRfsg = new NIRfsg(resourceName, false, false);
            RFmxInstrMX  instr  = new RFmxInstrMX(resourceName, "");
            RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan);
            RFmxWlanMX   wlan   = instr.GetWlanSignalConfiguration(signalStringWlan);
            #endregion

            #region Configure Generation
            ConfigureInstrument(nIRfsg, sgInstrConfig);
            Waveform waveform = LoadWaveformFromTDMS(filePath);

            // Apply CRF to the waveform if it is enabled
            waveform = Methods.RFmxDPD.ConfigurePreDpdCrestFactorReduction(specAn, waveform, preDpdCrestFactorReductionConfig);

            DownloadWaveform(nIRfsg, waveform);
            ConfigureContinuousGeneration(nIRfsg, waveform);

            var waveformLength_s = waveform.Data.SampleCount / waveform.SampleRate;

            nIRfsg.Initiate();
            #endregion

            #region configure Analyzer
            saAutolevelConfig.MeasurementInterval_s = waveform.BurstLength_s;

            SA.RFmxInstr.ConfigureInstrument(instr, saInstrConfig);
            SA.RFmxSpecAn.ConfigureCommon(specAn, saCommonConfig);
            SA.RFmxWLAN.ConfigureCommon(wlan, saCommonConfig);
            #endregion

            #region Configure SpecAn
            ampmConfigurationSpecAn.ReferenceWaveform        = waveform;
            ampmConfigurationSpecAn.DutAverageInputPower_dBm = sgInstrConfig.DutAverageInputPower_dBm;
            SA.RFmxSpecAn.ConfigureAmpm(specAn, ampmConfigurationSpecAn);
            #endregion

            #region Configure WLAN Measurement
            SA.RFmxWLAN.ConfigureStandard(wlan, wlanStandardConfig);
            SA.RFmxWLAN.ConfigureOFDMModAcc(wlan, modAccConfig);
            SA.RFmxWLAN.ConfigureSEM(wlan, semConfig);
            #endregion

            #region Configure and Measure DPD
            if (EnableDpd)
            {
                Methods.RFmxDPD.ConfigureCommon(specAn, commonConfigurationDpd, waveform);
                Methods.RFmxDPD.ConfigureMemoryPolynomial(specAn, memoryPolynomialConfiguration);
                Methods.RFmxDPD.ConfigureApplyDpdCrestFactorReduction(specAn, applyDpdCrestFactorReductionConfig);

                Console.WriteLine("\n------------------------ Perform DPD ----------------------\n");

                specAn.SelectMeasurements("", RFmxSpecAnMXMeasurementTypes.Dpd, true);
                Methods.RFmxDPD.PerformMemoryPolynomial(specAn, nIRfsg, memoryPolynomialConfiguration, waveform);
                Console.WriteLine("\n------------------------ DPD done --------------------------\n");
            }
            #endregion

            #region Measure SpecAn
            RFmxSpecAnMXMeasurementTypes[] specanMeasurements = new RFmxSpecAnMXMeasurementTypes[1] {
                RFmxSpecAnMXMeasurementTypes.Ampm
            };
            SA.RFmxSpecAn.SelectAndInitiateMeasurements(specAn, specanMeasurements, saAutolevelConfig, waveform.SignalBandwidth_Hz, false, "", resultStringSpecan);
            ampmResultsSpecAn = SA.RFmxSpecAn.FetchAmpm(specAn, RFmxSpecAnMX.BuildResultString(resultStringSpecan));
            PrintAMPMResults();
            #endregion

            #region measure and results
            RFmxWlanMXMeasurementTypes[] wlanMeasurements = new RFmxWlanMXMeasurementTypes[1] {
                RFmxWlanMXMeasurementTypes.OfdmModAcc
            };
            SA.RFmxWLAN.SelectAndInitiateMeasurements(wlan, wlanMeasurements, saAutolevelConfig, false, "", resultStringWlan);
            modAccResults = SA.RFmxWLAN.FetchOFDMModAcc(wlan, RFmxWlanMX.BuildResultString(resultStringWlan));
            PrintModAccResults();

            wlanMeasurements[0] = RFmxWlanMXMeasurementTypes.Sem;
            SA.RFmxWLAN.SelectAndInitiateMeasurements(wlan, wlanMeasurements, saAutolevelConfig, false, "", resultStringWlan);
            semResults = SA.RFmxWLAN.FetchSEM(wlan, RFmxWlanMX.BuildResultString(resultStringWlan));
            PrintSemResults();
            #endregion

            AbortGeneration(nIRfsg);
            CloseInstrument(nIRfsg);
            wlan.Dispose();
            wlan = null;
            instr.Close();
            instr = null;
        }