public void InitializeParameters() { //shared Parameters centerFrequency = 3e9; //Hz resourceName = "5840"; filePath = @"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\LTE_FDD_UL_1x20MHz_256QAM_OS4.tdms"; signalStringSpecan = "specanSig0"; resultStringSpecan = "specanResult0"; //Tuner Configration tunerAddress = "10.0.0.1"; commonConfiguration = FocusTuner.CommonConfiguration.GetDefault(); commonConfiguration.CalibrationID = 1; gammaSweep = GetConstantVSWR(2, 20); //Generator Configuiration sgInstrConfig = SG.InstrumentConfiguration.GetDefault(); sgInstrConfig.CarrierFrequency_Hz = centerFrequency; sgInstrConfig.DutAverageInputPower_dBm = -10.0; sgInstrConfig.ExternalAttenuation_dB = 0; //Analyzer Configuration saInstrConfig = RFmxInstr.InstrumentConfiguration.GetDefault(); saCommonConfig = CommonConfiguration.GetDefault(); saCommonConfig.ExternalAttenuation_dB = 0; saCommonConfig.CenterFrequency_Hz = centerFrequency; saCommonConfig.ReferenceLevel_dBm = 0.0; saAutolevelConfig = AutoLevelConfiguration.GetDefault(); saAutolevelConfig.Enabled = true; txpConfigurationSpecAn = RFmxSpecAn.TxpConfiguration.GetDefault(); txpConfigurationSpecAn.RbwFilterType = RFmxSpecAnMXTxpRbwFilterType.None; txpConfigurationSpecAn.RrcAlpha = 0; }
public override Task <RFmxAutoLevelConfiguration> GetDefaultAutoLevelConfiguration(Empty request, ServerCallContext context) { var defaultAutoLevelConfig = AutoLevelConfiguration.GetDefault(); return(Task.FromResult(new RFmxAutoLevelConfiguration() { Enabled = defaultAutoLevelConfig.Enabled, MeasurementInterval = defaultAutoLevelConfig.MeasurementInterval_s })); }
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); }
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())); }
public static void ConfigureCommon(ref RFmxInstrMX sessionHandle, ref RFmxSpecAnMX specAnSignal, CommonConfiguration commonConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "") { sessionHandle.ConfigureFrequencyReference("", commonConfig.FrequencyReferenceSource, 10e6); sessionHandle.SetLOSource("", commonConfig.LOSource); sessionHandle.SetDownconverterFrequencyOffset("", commonConfig.LOOffset); specAnSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalEdgeSource, commonConfig.DigitalEdgeType, commonConfig.TriggerDelay_s, commonConfig.EnableTrigger); specAnSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz); specAnSignal.Spectrum.Configuration.ConfigureSpan(selectorString, commonConfig.Span_Hz); specAnSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB); if (autoLevelConfig.AutoLevelReferenceLevel) { specAnSignal.AutoLevel(selectorString, commonConfig.Span_Hz, autoLevelConfig.AutoLevelMeasureTime_s, out _); } else { specAnSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm); } }
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); } }
/// <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); }
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 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>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="specAn">Specifies the SpecAn 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="autoLevelBandwidth_Hz">Specifies the bandwidth, in hertz (Hz), of the signal to be analyzed. See the RFmx help for more documentation of this parameter.</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(RFmxSpecAnMX specAn, RFmxSpecAnMXMeasurementTypes[] measurements, AutoLevelConfiguration autoLevelConfig = default, double autoLevelBandwidth_Hz = 200e3, bool enableTraces = false, string selectorString = "", string resultName = "") { // Aggregate the selected measurements into a single value // OR of 0 and x equals x RFmxSpecAnMXMeasurementTypes selectedMeasurements = 0; foreach (RFmxSpecAnMXMeasurementTypes measurement in measurements) { selectedMeasurements |= measurement; } specAn.SelectMeasurements(selectorString, selectedMeasurements, enableTraces); if (autoLevelConfig.Enabled) { specAn.AutoLevel(selectorString, autoLevelBandwidth_Hz, autoLevelConfig.MeasurementInterval_s, out double _); } // Initiate acquisition and measurement for the selected measurements specAn.Initiate(selectorString, resultName); }