Exemplo n.º 1
0
        public override Task <Empty> NRSelectAndInitiateMeasurements(RFmxNRMeasurementConfiguration request, ServerCallContext context)
        {
            var instr = sessionMap[(IntPtr)request.Session.Handle];
            var nr    = GetNRSignalConfiguration(instr, request.SignalName);

            RFmxNRMXMeasurementTypes[] measurements = new RFmxNRMXMeasurementTypes[request.Measurements.Count];
            for (int i = 0; i < request.Measurements.Count; i++)
            {
                measurements[i] = (RFmxNRMXMeasurementTypes)request.Measurements[i];
            }
            AutoLevelConfiguration autoLevelConfig = new AutoLevelConfiguration()
            {
                Enabled = request.AutoLevelConfiguration.Enabled,
                MeasurementInterval_s = request.AutoLevelConfiguration.MeasurementInterval
            };

            RFmxNR.SelectAndInitiateMeasurements(nr, measurements, autoLevelConfig, request.EnableTraces, request.SelectorString, request.ResultName);
            return(Task.FromResult(new Empty()));
        }
        /// <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="nr">Specifies the NR 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).</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(RFmxNRMX nr, RFmxNRMXMeasurementTypes[] 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
            RFmxNRMXMeasurementTypes selectedMeasurements = 0;

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

            if (autoLevelConfig.Enabled)
            {
                nr.AutoLevel(selectorString, autoLevelConfig.MeasurementInterval_s, out double _);
            }

            // Initiate acquisition and measurement for the selected measurements
            nr.Initiate(selectorString, resultName);
        }
Exemplo n.º 3
0
        public void Run()
        {
            #region Create Sessions
            NIRfsg       nIRfsg = new NIRfsg(resourceName, false, false);
            RFmxInstrMX  instr  = new RFmxInstrMX(resourceName, "");
            RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan);
            RFmxNRMX     nr     = instr.GetNRSignalConfiguration(signalStringNr);
            #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);
            nIRfsg.Initiate();
            #endregion

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

            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.RFmxNR.ConfigureCommon(nr, saCommonConfig);
            SA.RFmxNR.ConfigureStandard(nr, StandardConfigNR);
            #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--------------- Measurement Results with DPD --------------\n");
                specAn.SelectMeasurements("", RFmxSpecAnMXMeasurementTypes.Dpd, true);
                Methods.RFmxDPD.PerformMemoryPolynomial(specAn, nIRfsg, MemoryPolynomialConfiguration, waveform);
            }
            else
            {
                Console.WriteLine("\n------------- Measurement Results without DPD -------------\n");
            }
            #endregion

            #region Measure
            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();

            ConfigureAcp(nr, AcpConfigNR);
            RFmxNRMXMeasurementTypes[] nrMeasurements = new RFmxNRMXMeasurementTypes[1] {
                RFmxNRMXMeasurementTypes.Acp
            };
            SA.RFmxNR.SelectAndInitiateMeasurements(nr, nrMeasurements, saAutolevelConfig, false, "", resultStringNr);
            AcpResultsNR = FetchAcp(nr, RFmxNRMX.BuildResultString(resultStringNr));
            PrintACPResults();

            ConfigureModacc(nr, ModaccConfigNR);
            nrMeasurements[0] = RFmxNRMXMeasurementTypes.ModAcc;
            SA.RFmxNR.SelectAndInitiateMeasurements(nr, nrMeasurements, saAutolevelConfig, false, "", resultStringNr);
            ModaccResultsNR = FetchModAcc(nr, RFmxNRMX.BuildResultString(resultStringNr));
            PrintModAccResults();
            #endregion

            specAn.Dispose();
            specAn = null;
            nr.Dispose();
            instr.Close();

            AbortGeneration(nIRfsg);
            CloseInstrument(nIRfsg);
        }
        /// <summary>
        /// This example illustrates how to use the RFmxNR APIs to configure the analyzer to perform a ModAcc measurement.
        /// You can use the Generator Basic example to generate the NR signal before running this example.
        /// </summary>
        static void Main(string[] args)
        {
            Console.WriteLine("\n----------------------- 5GNR 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.RFmxNR.StandardConfiguration StandardConfigNR;
            SA.RFmxNR.ModAccConfiguration   ModaccConfigNR;
            SA.RFmxNR.ModAccResults         ModaccResultsNR = new ModAccResults();

            //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;
            StandardConfigNR          = SA.RFmxNR.StandardConfiguration.GetDefault();
            StandardConfigNR.ComponentCarrierConfigurations[0].PuschModulationType = RFmxNRMXPuschModulationType.Qpsk;
            ModaccConfigNR = SA.RFmxNR.ModAccConfiguration.GetDefault();

            #region Configure Analyzer
            saAutolevelConfig.MeasurementInterval_s = 0.001;
            RFmxInstrMX instr = new RFmxInstrMX(resourceName, "");
            SA.RFmxInstr.ConfigureInstrument(instr, saInstrConfig);
            RFmxNRMX nr = instr.GetNRSignalConfiguration(signalString);
            SA.RFmxNR.ConfigureCommon(nr, saCommonConfig);
            SA.RFmxNR.ConfigureStandard(nr, StandardConfigNR);
            #endregion

            #region Measure
            Console.WriteLine("Measure...\n");
            ConfigureModacc(nr, ModaccConfigNR);
            RFmxNRMXMeasurementTypes[] nrMeasurements = new RFmxNRMXMeasurementTypes[1] {
                RFmxNRMXMeasurementTypes.ModAcc
            };
            SA.RFmxNR.SelectAndInitiateMeasurements(nr, nrMeasurements, saAutolevelConfig, false, "", resultString);
            ModaccResultsNR = FetchModAcc(nr, RFmxNRMX.BuildResultString(resultString));
            //print Results
            for (int i = 0; i < ModaccResultsNR.ComponentCarrierResults.Length; i++)
            {
                Console.WriteLine("----------------------- EVM Results CC {0} -----------------------\n", i);
                Console.WriteLine("Composite RMS EVM Mean (% or dB)               : {0:0.000}", ModaccResultsNR.ComponentCarrierResults[i].MeanRmsCompositeEvm);
                Console.WriteLine("Composite Peak EVM Maximum (% or dB)           : {0:0.000}", ModaccResultsNR.ComponentCarrierResults[i].MaxPeakCompositeEvm);
                Console.WriteLine("Composite Peak EVM Slot Index                  : {0}", ModaccResultsNR.ComponentCarrierResults[i].PeakCompositeEvmSlotIndex);
                Console.WriteLine("Composite Peak EVM Symbol Index                : {0}", ModaccResultsNR.ComponentCarrierResults[i].PeakCompositeEvmSymbolIndex);
                Console.WriteLine("Composite Peak EVM Subcarrier Index            : {0}", ModaccResultsNR.ComponentCarrierResults[i].PeakCompositeEvmSubcarrierIndex);
                Console.WriteLine("Component Carrier Frequency Error Mean (Hz)    : {0:0.000}", ModaccResultsNR.ComponentCarrierResults[i].MeanFrequencyError_Hz);
            }
            #endregion
            nr.Dispose();
            instr.Close();
            Console.WriteLine("Please press any key to close the application.\n");
            Console.ReadKey();
        }