public void Run() { #region Create Sessions FocusITunerBroker iTuner = new FocusITunerBroker(); iTuner.Initialize(tunerAddress, false, true); NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); RFmxInstrMX instr = new RFmxInstrMX(resourceName, ""); RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan); #endregion #region Configure Tuner FocusTuner.ConfigureCommon(iTuner, commonConfiguration); #endregion #region Configure Generation ConfigureInstrument(nIRfsg, sgInstrConfig); Waveform waveform = LoadWaveformFromTDMS(filePath); DownloadWaveform(nIRfsg, waveform); ConfigureContinuousGeneration(nIRfsg, waveform); nIRfsg.Initiate(); #endregion #region Configure Analyzer saAutolevelConfig.MeasurementInterval_s = waveform.BurstLength_s; RFmxInstr.ConfigureInstrument(instr, saInstrConfig); RFmxSpecAn.ConfigureCommon(specAn, saCommonConfig); RFmxSpecAn.ConfigureTxp(specAn, txpConfigurationSpecAn); #endregion #region Measure foreach (var gamma in gammaSweep) { Console.WriteLine("\n--------------------- Tuning --------------------\n"); currentGamma = FocusTuner.MoveTunerPerGamma(iTuner, gamma)[0]; PrintTuneResults(); Console.WriteLine("\n--------------------- Results --------------------\n"); RFmxSpecAnMXMeasurementTypes[] specanMeasurements = new RFmxSpecAnMXMeasurementTypes[1] { RFmxSpecAnMXMeasurementTypes.Txp }; RFmxSpecAn.SelectAndInitiateMeasurements(specAn, specanMeasurements, saAutolevelConfig, waveform.SignalBandwidth_Hz, false, "", resultStringSpecan); txpResultsSpecAn = RFmxSpecAn.FetchTxp(specAn, RFmxSpecAnMX.BuildResultString(resultStringSpecan)); PrintTxPResults(); } #endregion AbortGeneration(nIRfsg); CloseInstrument(nIRfsg); FocusTuner.CloseTuner(iTuner); specAn.Dispose(); specAn = null; instr.Close(); instr = null; }
/// <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); }
public void Run() { #region Create Sessions NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); RFmxInstrMX instr = new RFmxInstrMX(resourceName, ""); RFmxSpecAnMX specAn = instr.GetSpecAnSignalConfiguration(signalStringSpecan); #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.RFmxSpecAn.ConfigureTxp(specAn, TxpConfigurationSpecAn); SA.RFmxSpecAn.ConfigureAcp(specAn, AcpConfigurationSpecAn, ""); if (EnableDpd) { Methods.RFmxDPD.ConfigureCommon(specAn, CommonConfigurationDpd, waveform); Methods.RFmxDPD.ConfigureMemoryPolynomial(specAn, MemoryPolynomialConfiguration); Methods.RFmxDPD.ConfigureApplyDpdCrestFactorReduction(specAn, applyDpdCrestFactorReductionConfig); } #endregion #region Measure Console.WriteLine("\n--------------------- Results --------------------\n"); if (EnableDpd) { specAn.SelectMeasurements("", RFmxSpecAnMXMeasurementTypes.Dpd, true); Methods.RFmxDPD.PerformMemoryPolynomial(specAn, nIRfsg, MemoryPolynomialConfiguration, waveform); } 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(); specanMeasurements[0] = RFmxSpecAnMXMeasurementTypes.Txp; SA.RFmxSpecAn.SelectAndInitiateMeasurements(specAn, specanMeasurements, saAutolevelConfig, waveform.SignalBandwidth_Hz, false, "", resultStringSpecan); TxpResultsSpecAn = SA.RFmxSpecAn.FetchTxp(specAn, RFmxSpecAnMX.BuildResultString(resultStringSpecan)); PrintTxPResults(); specanMeasurements[0] = RFmxSpecAnMXMeasurementTypes.Acp; SA.RFmxSpecAn.SelectAndInitiateMeasurements(specAn, specanMeasurements, saAutolevelConfig, waveform.SignalBandwidth_Hz, false, "", resultStringSpecan); AcpResultsSpecAn = SA.RFmxSpecAn.FetchAcp(specAn, RFmxSpecAnMX.BuildResultString(resultStringSpecan)); PrintACPResults(); #endregion AbortGeneration(nIRfsg); CloseInstrument(nIRfsg); specAn.Dispose(); specAn = null; instr.Close(); instr = null; }
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; }
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; }