/// <summary>Fetches common results from the TxP measurement.</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to fetch results from.</param>
        /// <param name="selectorString">(Optional) Specifies the result name. See the RFmx help for more documentation of this parameter.</param>
        /// <returns>Common TxP measurement results.</returns>
        public static TxPResults FetchTxP(RFmxWlanMX wlanSignal, string selectorString = "")
        {
            TxPResults txpResults = new TxPResults();

            wlanSignal.Txp.Results.FetchMeasurement(selectorString, 10, out txpResults.AveragePowerMean_dBm, out txpResults.PeakPowerMaximum_dBm);

            return(txpResults);
        }
 /// <summary>Configures common measurement settings for the personality.</summary>
 /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
 /// <param name="commonConfig">Specifies the common settings to apply.</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>
 public static void ConfigureCommon(RFmxWlanMX wlanSignal, CommonConfiguration commonConfig, string selectorString = "")
 {
     wlanSignal.SetSelectedPorts(selectorString, commonConfig.SelectedPorts);
     wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz);
     wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm);
     wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB);
     wlanSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalTriggerSource, RFmxWlanMXDigitalEdgeTriggerEdge.Rising, commonConfig.TriggerDelay_s, commonConfig.TriggerEnabled);
 }
        /// <summary>Configures common settings for the TxP measurement and selects the measurement.</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
        /// <param name="txPConfig">Specifies the TxP settings to apply.</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>
        public static void ConfigureTxP(RFmxWlanMX wlanSignal, TxPConfiguration txPConfig, string selectorString = "")
        {
            wlanSignal.SelectMeasurements(selectorString, RFmxWlanMXMeasurementTypes.Txp, false);
            //Disabled because we are triggering by default
            wlanSignal.Txp.Configuration.SetBurstDetectionEnabled(selectorString, RFmxWlanMXTxpBurstDetectionEnabled.False);

            wlanSignal.Txp.Configuration.ConfigureAveraging(selectorString, txPConfig.AveragingEnabled, txPConfig.AveragingCount);
            wlanSignal.Txp.Configuration.ConfigureMaximumMeasurementInterval(selectorString, txPConfig.MaximumMeasurementInterval_s);
        }
        /// <summary>Configures common settings for the SEM measurement and selects the measurement.</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
        /// <param name="semConfig">Specifies the SEM settings to apply.</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>
        public static void ConfigureSEM(RFmxWlanMX wlanSignal, SEMConfiguration semConfig, string selectorString = "")
        {
            wlanSignal.SelectMeasurements(selectorString, RFmxWlanMXMeasurementTypes.Sem, false);
            wlanSignal.Sem.Configuration.ConfigureSweepTime(selectorString, semConfig.SweepTimeAuto, semConfig.SweepTime_s);
            wlanSignal.Sem.Configuration.ConfigureAveraging(selectorString, semConfig.AveragingEnabled, semConfig.AveragingCount, semConfig.AveragingType);
            wlanSignal.Sem.Configuration.ConfigureSpan(selectorString, semConfig.SpanAuto, semConfig.Span_Hz);

            // Support for custom masks has not been implemented in this module
            wlanSignal.Sem.Configuration.ConfigureMaskType(selectorString, RFmxWlanMXSemMaskType.Standard);
        }
        /// <summary>Fetches common results from the OFDM ModAcc measurement.</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to fetch results from.</param>
        /// <param name="selectorString">(Optional) Specifies the result name. See the RFmx help for more documentation of this parameter.</param>
        /// <returns>Common OFDM ModAcc measurement results.</returns>
        public static OFDMModAccResults FetchOFDMModAcc(RFmxWlanMX wlanSignal, string selectorString = "")
        {
            OFDMModAccResults modAccResults = new OFDMModAccResults();

            wlanSignal.OfdmModAcc.Results.FetchCompositeRmsEvm(selectorString, 10, out modAccResults.CompositeRMSEVMMean_dB,
                                                               out modAccResults.CompositeDataRMSEVMMean_dB, out modAccResults.CompositePilotRMSEVMMean_dB);
            wlanSignal.OfdmModAcc.Results.FetchNumberOfSymbolsUsed(selectorString, 10, out modAccResults.NumberOfSymbolsUsed);

            return(modAccResults);
        }
        /// <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();
        }
Пример #7
0
        public WlanSweep(string resourceName)
        {
            rfsgSession = new NIRfsg(resourceName, false, false, "DriverSetup=Bitfile:NI-RFIC.lvbitx");
            rfsgHandle  = rfsgSession.GetInstrumentHandle().DangerousGetHandle();

            instr = new RFmxInstrMX(resourceName, "RFmxSetup=Bitfile:NI-RFIC.lvbitx");
            wlan  = instr.GetWlanSignalConfiguration();

            instr.DangerousGetNIRfsaHandle(out IntPtr rfsaHandle);
            powerServo = new niPowerServo(rfsaHandle, false);
        }
        public static TxPServoResults TxPServoPower(RFmxWlanMX wlanSignal, NIRfsg rfsgSession, TxPServoConfiguration servoConfig,
                                                    AutoLevelConfiguration autoLevelConfig, string selectorString = "")
        {
            //Duplicate the existing configuration so that we can select only TxP for the power servo to save time,
            //but not disrupt all of the other user enabled measurements.
            wlanSignal.CloneSignalConfiguration("servo_txp", out RFmxWlanMX servoTxpSession);
            servoTxpSession.SelectMeasurements(selectorString, RFmxWlanMXMeasurementTypes.Txp, false);
            double[] servoTrace = new double[servoConfig.MaxNumberOfIterations];
            double   powerLevel = 0, outputPower = 0, margin = 0;
            bool     servoSucess = false;

            for (int i = 0; i < servoConfig.MaxNumberOfIterations; i++)
            {
                if (autoLevelConfig.Enabled)
                {
                    servoTxpSession.AutoLevel(selectorString, autoLevelConfig.MeasurementInterval_s);
                }
                servoTxpSession.Initiate(selectorString, "");

                powerLevel = rfsgSession.RF.PowerLevel;
                servoTxpSession.Txp.Results.FetchMeasurement(selectorString, 10, out outputPower, out _);

                margin        = servoConfig.TargetTxPPower_dBm - outputPower;
                servoTrace[i] = outputPower;

                if (Math.Abs(margin) <= servoConfig.Tolerance_dBm) //Servo complete; exit the loop
                {
                    servoSucess = true;
                    break;
                }
                else //Still more room to go
                {
                    rfsgSession.RF.PowerLevel = powerLevel + margin;
                    rfsgSession.Utility.WaitUntilSettled(1000);
                }
            }
            //If we auto-leveled we need to set the original configuration to the newly calculated ref level
            servoTxpSession.GetReferenceLevel(selectorString, out double newRefLevel);
            wlanSignal.ConfigureReferenceLevel(selectorString, newRefLevel);

            servoTxpSession.Dispose();

            TxPServoResults servoResults = new TxPServoResults();

            servoResults.FinalInputPower_dBm  = powerLevel;
            servoResults.FinalOutputPower_dBm = outputPower;
            servoResults.ServoTrace           = servoTrace;

            if (!servoSucess)
            {
                throw new System.TimeoutException("WLAN TxP Power Servo exceeded max iterations without success.");
            }
            return(servoResults);
        }
Пример #9
0
        public static OFDMModAccResults FetchOFDMModAcc(RFmxWlanMX wlanSignal, string selectorString = "")
        {
            OFDMModAccResults modAccResults = new OFDMModAccResults();

            wlanSignal.OfdmModAcc.Results.FetchChainRmsEvmPerSymbolMeanTrace(selectorString, 10, ref modAccResults.EVMperSymbolTrace);
            wlanSignal.OfdmModAcc.Results.FetchDataConstellationTrace(selectorString, 10, ref modAccResults.DataConstellation);
            wlanSignal.OfdmModAcc.Results.FetchCompositeRmsEvm(selectorString, 10, out modAccResults.CompositeRMSEVMMean_dB,
                                                               out modAccResults.CompositeDataRMSEVMMean_dB, out modAccResults.CompositePilotRMSEVMMean_dB);
            wlanSignal.OfdmModAcc.Results.FetchNumberOfSymbolsUsed(selectorString, 10, out modAccResults.NumberOfSymbolsUsed);

            return(modAccResults);
        }
Пример #10
0
 public static void ConfigureSignal(RFmxWlanMX wlanSignal, SignalConfiguration signalConfig, string selectorString = "")
 {
     if (signalConfig.AutoDetectSignal)
     {
         wlanSignal.AutoDetectSignal(selectorString, 10);
     }
     else
     {
         wlanSignal.ConfigureStandard(selectorString, signalConfig.Standard);
         wlanSignal.ConfigureChannelBandwidth(selectorString, signalConfig.ChannelBandwidth_Hz);
     }
 }
Пример #11
0
        public static void ConfigureRF(ref RFmxWlanMX wlanSignal, CommonConfiguration commonConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "")
        {
            wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz);
            wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB);

            //Make sure all other parameters are configured before calling autolevel
            if (autoLevelConfig.AutoLevelReferenceLevel)
            {
                wlanSignal.AutoLevel(selectorString, autoLevelConfig.AutoLevelMeasureTime_s);
            }
            else
            {
                wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm);
            }
        }
        /// <summary>Fetches common results from the SEM measurement.</summary>
        /// <param name="wlanSignal">Specifies the WLAN signal to fetch results from.</param>
        /// <param name="selectorString">(Optional) Specifies the result name. See the RFmx help for more documentation of this parameter.</param>
        /// <returns>Common SEM measurement results.</returns>
        public static SEMResults FetchSEM(RFmxWlanMX wlanSignal, string selectorString = "")
        {
            SEMResults semResults = new SEMResults();

            wlanSignal.Sem.Results.FetchMeasurementStatus(selectorString, 10, out semResults.measurementStatus);
            wlanSignal.Sem.Results.FetchCarrierMeasurement(selectorString, 10, out semResults.AbsolutePower_dBm, out semResults.RelativePower_dB);
            wlanSignal.Sem.Results.FetchLowerOffsetMarginArray(selectorString, 10, ref semResults.lowerOffsetMeasurementStatus,
                                                               ref semResults.LowerOffsetMargin_dB, ref semResults.LowerOffsetMarginFrequency_Hz, ref semResults.LowerOffsetMarginAbsolutePower_dBm,
                                                               ref semResults.LowerOffsetMarginRelativePower_dB);
            wlanSignal.Sem.Results.FetchUpperOffsetMarginArray(selectorString, 10, ref semResults.upperOffsetMeasurementStatus,
                                                               ref semResults.UpperOffsetMargin_dB, ref semResults.UpperOffsetMarginFrequency_Hz, ref semResults.UpperOffsetMarginAbsolutePower_dBm,
                                                               ref semResults.UpperOffsetMarginRelativePower_dB);

            return(semResults);
        }
Пример #13
0
        public static void ConfigureSEM(RFmxWlanMX wlanSignal, SEMConfiguration semConfig, string selectorString = "")
        {
            //Ensure that the measurement and traces are enabled
            wlanSignal.Sem.Configuration.SetMeasurementEnabled(selectorString, true);
            wlanSignal.Sem.Configuration.SetAllTracesEnabled(selectorString, true);

            wlanSignal.Sem.Configuration.ConfigureSweepTime(selectorString, semConfig.SweepTimeAuto, semConfig.SweepTime_s);
            wlanSignal.Sem.Configuration.ConfigureAveraging(selectorString, semConfig.AveragingEnabled, semConfig.AveragingCount, semConfig.AveragingType);
            wlanSignal.Sem.Configuration.ConfigureSpan(selectorString, semConfig.SpanAuto, semConfig.Span_Hz);

            switch (semConfig.MaskType)
            {
            case RFmxWlanMXSemMaskType.Standard:
                wlanSignal.Sem.Configuration.ConfigureMaskType(selectorString, semConfig.MaskType);
                break;

            default:
                throw new System.NotImplementedException("Custom SEM Mask configurations have not been implemented in this Reference Design module.");
            }
        }
        /// <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);
        }
Пример #15
0
        public static void ConfigureOFDMModAcc(RFmxWlanMX wlanSignal, OFDMModAccConfiguration modAccConfig, string selectorString = "")
        {
            RFmxWlanMXOfdmModAccAcquisitionLengthMode acMode;

            if (modAccConfig.AcquisitionLength_s == 0)
            {
                acMode = RFmxWlanMXOfdmModAccAcquisitionLengthMode.Auto;
            }
            else
            {
                acMode = RFmxWlanMXOfdmModAccAcquisitionLengthMode.Manual;
            }

            wlanSignal.OfdmModAcc.Configuration.SetMeasurementEnabled(selectorString, true);
            wlanSignal.OfdmModAcc.Configuration.SetAllTracesEnabled(selectorString, true);

            wlanSignal.OfdmModAcc.Configuration.ConfigureAcquisitionLength(selectorString, acMode, modAccConfig.AcquisitionLength_s);
            wlanSignal.OfdmModAcc.Configuration.ConfigureMeasurementLength(selectorString,
                                                                           modAccConfig.MeasurementOffset_sym, modAccConfig.MaximumMeasurementLength_sym);
            wlanSignal.OfdmModAcc.Configuration.ConfigureOptimizeDynamicRangeForEvm(selectorString, modAccConfig.OptimizeDynamicRangeForEvmEnabled,
                                                                                    modAccConfig.OptimizeDynamicRangeForEVMMargin_dB);
            wlanSignal.OfdmModAcc.Configuration.ConfigureAveraging(selectorString, modAccConfig.AveragingEnabled, modAccConfig.AveragingCount);

            //Disable the following measurements because SG clocks and LOs are being shared; hence, any measured error would be invalid
            wlanSignal.OfdmModAcc.Configuration.SetFrequencyErrorEstimationMethod(selectorString, RFmxWlanMXOfdmModAccFrequencyErrorEstimationMethod.Disabled);
            wlanSignal.OfdmModAcc.Configuration.SetIQGainImbalanceCorrectionEnabled(selectorString, RFmxWlanMXOfdmModAccIQGainImbalanceCorrectionEnabled.False);
            wlanSignal.OfdmModAcc.Configuration.SetIQQuadratureErrorCorrectionEnabled(selectorString, RFmxWlanMXOfdmModAccIQQuadratureErrorCorrectionEnabled.False);
            wlanSignal.OfdmModAcc.Configuration.SetIQTimingSkewCorrectionEnabled(selectorString, RFmxWlanMXOfdmModAccIQTimingSkewCorrectionEnabled.False);


            //The following values are defaults, but called out explicitly for clarity
            wlanSignal.OfdmModAcc.Configuration.SetEvmUnit(selectorString, RFmxWlanMXOfdmModAccEvmUnit.dB);
            wlanSignal.OfdmModAcc.Configuration.ConfigureChannelEstimationType(selectorString, RFmxWlanMXOfdmModAccChannelEstimationType.ChannelEstimationReference);
            wlanSignal.OfdmModAcc.Configuration.SetBurstStartDetectionEnabled(selectorString, RFmxWlanMXOfdmModAccBurstStartDetectionEnabled.False); //Triggering, so no burst detection
            wlanSignal.OfdmModAcc.Configuration.SetAmplitudeTrackingEnabled(selectorString, RFmxWlanMXOfdmModAccAmplitudeTrackingEnabled.False);
            wlanSignal.OfdmModAcc.Configuration.SetPhaseTrackingEnabled(selectorString, RFmxWlanMXOfdmModAccPhaseTrackingEnabled.False);
            wlanSignal.OfdmModAcc.Configuration.SetChannelEstimationSmoothingEnabled(selectorString, RFmxWlanMXOfdmModAccChannelEstimationSmoothingEnabled.False);
            wlanSignal.OfdmModAcc.Configuration.SetCommonClockSourceEnabled(selectorString, RFmxWlanMXOfdmModAccCommonClockSourceEnabled.True);
        }
Пример #16
0
        public static void ConfigureCommon(RFmxInstrMX sessionHandle, RFmxWlanMX wlanSignal, CommonConfiguration commonConfig,
                                           AutoLevelConfiguration autoLevelConfig, string selectorString = "")
        {
            string instrModel;

            sessionHandle.ConfigureFrequencyReference("", commonConfig.FrequencyReferenceSource, 10e6);
            sessionHandle.GetInstrumentModel("", out instrModel);

            sessionHandle.SetLOSource("", commonConfig.LOSource);
            sessionHandle.SetDownconverterFrequencyOffset("", commonConfig.LOOffset);

            wlanSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalEdgeSource, commonConfig.DigitalEdgeType, commonConfig.TriggerDelay_s, commonConfig.EnableTrigger);
            wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz);
            wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB);

            if (autoLevelConfig.AutoLevelReferenceLevel)
            {
                wlanSignal.AutoLevel(selectorString, autoLevelConfig.AutoLevelMeasureTime_s);
            }
            else
            {
                wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm);
            }
        }
        static void LoadAndRunMeasurements(string instrName, string inputPath, string outputPath)
        {
            inputPath = Path.GetFullPath(inputPath);
            RFmxInstrMX instr = null;
            NIRfsa      rfsa  = null;
            IntPtr      rfsaHandle;

            try
            {
                Console.WriteLine($"Initializing RFmx session with instrument \"{instrName}\"...");
                instr = new RFmxInstrMX(instrName, "");

                Console.WriteLine($"Loading configuration from \"{Path.GetFileName(inputPath)}\"...");
                instr.LoadAllConfigurations(inputPath, true);
                instr.DangerousGetNIRfsaHandle(out rfsaHandle);
                rfsa = new NIRfsa(rfsaHandle);

                string[] signalNames = new string[0];
                RFmxInstrMXPersonalities[] personalities = new RFmxInstrMXPersonalities[0];

                Console.WriteLine("Configuration loaded successfully.");

                instr.GetSignalConfigurationNames("", RFmxInstrMXPersonalities.All, ref signalNames, ref personalities);
                for (int i = 0; i < signalNames.Length; i++)
                {
                    Console.WriteLine("");
                    ConsoleKeyInfo info;
                    switch (personalities[i])
                    {
                    case RFmxInstrMXPersonalities.BT:
                        RFmxBTMX bt = instr.GetBTSignalConfiguration(signalNames[i]);
                        Console.WriteLine($"Enter 'y' to initiate acquisition for RFmx Bluetooth with signal \"{signalNames[i]}\"; any other key to skip.");
                        info = Console.ReadKey();
                        Console.WriteLine();
                        if (info.KeyChar == 'y')
                        {
                            bt.Initiate("", "");
                            bt.WaitForMeasurementComplete("", 10);
                            FetchAndLog(rfsa, personalities[i], signalNames[i], outputPath);
                        }
                        bt.Dispose();
                        break;

                    case RFmxInstrMXPersonalities.Wlan:
                        RFmxWlanMX wlan = instr.GetWlanSignalConfiguration(signalNames[i]);
                        Console.WriteLine($"Enter 'y' to initiate acquisition for RFmx WLAN with signal \"{signalNames[i]}\"; any other key to skip.");
                        info = Console.ReadKey();
                        Console.WriteLine();
                        if (info.KeyChar == 'y')
                        {
                            wlan.Initiate("", "");
                            wlan.WaitForMeasurementComplete("", 10);
                            FetchAndLog(rfsa, personalities[i], signalNames[i], outputPath);
                        }
                        wlan.Dispose();
                        break;

                    case RFmxInstrMXPersonalities.SpecAn:
                        RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalNames[i]);
                        Console.WriteLine($"Enter 'y' to initiate acquisition for RFmx SpecAn with signal \"{signalNames[i]}\"; any other key to skip.");
                        info = Console.ReadKey();
                        Console.WriteLine();
                        if (info.KeyChar == 'y')
                        {
                            specAn.Initiate("", "");
                            specAn.WaitForMeasurementComplete("", 10);
                            FetchAndLog(rfsa, personalities[i], signalNames[i], outputPath);
                        }
                        specAn.Dispose();
                        break;

                    case RFmxInstrMXPersonalities.NR:
                        RFmxNRMX nr = instr.GetNRSignalConfiguration(signalNames[i]);
                        Console.WriteLine($"Enter 'y' to initiate acquisition for RFmx NR with signal \"{signalNames[i]}\"; any other key to skip.");
                        info = Console.ReadKey();
                        Console.WriteLine();
                        if (info.KeyChar == 'y')
                        {
                            nr.Initiate("", "");
                            nr.WaitForMeasurementComplete("", 10);
                            FetchAndLog(rfsa, personalities[i], signalNames[i], outputPath);
                        }
                        nr.Dispose();
                        break;

                    case RFmxInstrMXPersonalities.Lte:
                        RFmxLteMX lte = instr.GetLteSignalConfiguration(signalNames[i]);
                        Console.WriteLine($"Enter 'y' to initiate acquisition for RFmx LTE with signal \"{signalNames[i]}\"; any other key to skip.");
                        info = Console.ReadKey();
                        Console.WriteLine();
                        if (info.KeyChar == 'y')
                        {
                            lte.Initiate("", "");
                            lte.WaitForMeasurementComplete("", 10);
                            FetchAndLog(rfsa, personalities[i], signalNames[i], outputPath);
                        }
                        lte.Dispose();
                        break;

                    default:
                        throw new System.NotImplementedException($"The \"{personalities[i].ToString()}\" personality has not been implemented.");
                    }
                }
                Console.WriteLine("All measurements complete.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred: " + ex.Message);
                Console.WriteLine("Location: " + ex.StackTrace);
            }
            finally
            {
                if (instr != null)
                {
                    instr.Dispose();
                }
            }
        }
Пример #18
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;
        }
        static void Main()
        {
            #region Configure Generation
            string resourceName = "VST2";
            string filePath     = Path.GetFullPath(@"Support Files\80211a_20M_48Mbps.tdms");

            NIRfsg nIRfsg = new NIRfsg(resourceName, false, false);
            InstrumentConfiguration instrConfig = InstrumentConfiguration.GetDefault();
            instrConfig.CarrierFrequency_Hz = 2.412e9;

            ConfigureInstrument(nIRfsg, instrConfig);
            Waveform waveform = LoadWaveformFromTDMS(filePath);

            DownloadWaveform(nIRfsg, waveform);

            WaveformTimingConfiguration timing = new WaveformTimingConfiguration
            {
                DutyCycle_Percent       = 60,
                PreBurstTime_s          = 1e-9,
                PostBurstTime_s         = 1e-9,
                BurstStartTriggerExport = "PXI_Trig0"
            };

            PAENConfiguration paenConfig = new PAENConfiguration
            {
                PAEnableMode = PAENMode.Dynamic,
                PAEnableTriggerExportTerminal = "PFI0",
                PAEnableTriggerMode           = RfsgMarkerEventOutputBehaviour.Toggle
            };

            ConfigureBurstedGeneration(nIRfsg, waveform, timing, paenConfig, out double period, out _);
            nIRfsg.Initiate();
            #endregion

            RFmxInstrMX instr = new RFmxInstrMX("VST2", "");
            RFmxWlanMX  wlan  = instr.GetWlanSignalConfiguration();
            instr.GetWlanSignalConfiguration();


            CommonConfiguration commonConfiguration = CommonConfiguration.GetDefault();
            commonConfiguration.CenterFrequency_Hz = 2.412e9;

            AutoLevelConfiguration autoLevel = new AutoLevelConfiguration
            {
                AutoLevelMeasureTime_s  = period,
                AutoLevelReferenceLevel = true
            };

            SA.RFmxWLAN.ConfigureCommon(instr, wlan, commonConfiguration, autoLevel);

            SignalConfiguration signal = SignalConfiguration.GetDefault();
            signal.AutoDetectSignal    = false;
            signal.ChannelBandwidth_Hz = 20e6;
            signal.Standard            = RFmxWlanMXStandard.Standard802_11ag;

            SA.RFmxWLAN.ConfigureSignal(wlan, signal);

            TxPConfiguration txpConfig = new TxPConfiguration
            {
                AveragingCount = 10,
                MaximumMeasurementInterval_s = waveform.BurstLength_s,
                AveragingEnabled             = RFmxWlanMXTxpAveragingEnabled.True
            };

            SA.RFmxWLAN.ConfigureTxP(wlan, txpConfig);

            OFDMModAccConfiguration modAccConfig = OFDMModAccConfiguration.GetDefault();
            modAccConfig.OptimizeDynamicRangeForEvmEnabled = RFmxWlanMXOfdmModAccOptimizeDynamicRangeForEvmEnabled.False;
            modAccConfig.AveragingEnabled = RFmxWlanMXOfdmModAccAveragingEnabled.True;

            SA.RFmxWLAN.ConfigureOFDMModAcc(wlan, modAccConfig);

            TxPServoConfiguration servoConfig = TxPServoConfiguration.GetDefault();
            servoConfig.TargetTxPPower_dBm = 0.5;

            SA.RFmxWLAN.TxPServoPower(wlan, nIRfsg, servoConfig, autoLevel);

            SEMConfiguration semConfig = SEMConfiguration.GetDefault();
            SA.RFmxWLAN.ConfigureSEM(wlan, semConfig);

            wlan.Initiate("", "");

            TxPResults        txpRes        = SA.RFmxWLAN.FetchTxP(wlan);
            OFDMModAccResults modAccResults = SA.RFmxWLAN.FetchOFDMModAcc(wlan);
            SEMResults        semResults    = SA.RFmxWLAN.FetchSEM(wlan);

            Console.WriteLine("TXP Avg Power: {0:N}", txpRes.AveragePowerMean_dBm);
            Console.WriteLine("Composite RMS EVM (dB): {0:N}", modAccResults.CompositeRMSEVMMean_dB);
            Console.WriteLine("\n----------Lower Offset Measurements----------\n");
            for (int i = 0; i < semResults.LowerOffsetMargin_dB.Length; i++)
            {
                Console.WriteLine("Offset {0}", i);
                Console.WriteLine("Measurement Status              :{0}",
                                  semResults.lowerOffsetMeasurementStatus[i]);
                Console.WriteLine("Margin (dB)                     :{0}", semResults.LowerOffsetMargin_dB[i]);
                Console.WriteLine("Margin Frequency (Hz)           :{0}", semResults.LowerOffsetMarginFrequency_Hz[i]);
                Console.WriteLine("Margin Absolute Power (dBm)     :{0}\n", semResults.LowerOffsetMarginAbsolutePower_dBm[i]);
            }

            Console.WriteLine("\n----------Upper Offset Measurements----------\n");
            for (int i = 0; i < semResults.UpperOffsetMargin_dB.Length; i++)
            {
                Console.WriteLine("Offset {0}", i);
                Console.WriteLine("Measurement Status              :{0}", semResults.upperOffsetMeasurementStatus[i]);
                Console.WriteLine("Margin (dB)                     :{0}", semResults.UpperOffsetMargin_dB[i]);
                Console.WriteLine("Margin Frequency (Hz)           :{0}", semResults.UpperOffsetMarginFrequency_Hz[i]);
                Console.WriteLine("Margin Absolute Power (dBm)     :{0}\n", semResults.UpperOffsetMarginAbsolutePower_dBm[i]);
            }

            Console.WriteLine("\n--------------------\n\nPress any key to exit.");
            Console.ReadKey();

            wlan.Dispose();
            instr.Close();

            AbortGeneration(nIRfsg);
            CloseInstrument(nIRfsg);
        }
        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;
        }
 /// <summary>Configures common settings related to the WLAN standard of the measured signal.</summary>
 /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
 /// <param name="standardConfig">Specifies the WLAN standard settings to apply.</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>
 public static void ConfigureStandard(RFmxWlanMX wlanSignal, StandardConfiguration standardConfig, string selectorString = "")
 {
     wlanSignal.ConfigureStandard(selectorString, standardConfig.Standard);
     wlanSignal.ConfigureChannelBandwidth(selectorString, standardConfig.ChannelBandwidth_Hz);
 }