public PAVTMeasurement(RFmxInstrMX session) { instrSession = session; specAn = instrSession.GetSpecAnSignalConfiguration(); specAn.SelectMeasurements("", RFmxSpecAnMXMeasurementTypes.Pavt, true); specAn.Pavt.Configuration.ConfigureMeasurementLocationType("", RFmxSpecAnMXPavtMeasurementLocationType.Trigger); }
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; }
private void ConfigureSpecAn() { /* Get SpecAn signal */ specAn = instrSession.GetSpecAnSignalConfiguration(); specAn.ConfigureFrequency("", centerFrequency); instrSession.ConfigureFrequencyReference("", frequencySource, frequency); specAn.SetSelectedPorts("", selectedPorts); specAn.ConfigureReferenceLevel("", referenceLevel); specAn.ConfigureExternalAttenuation("", externalAttenuation); instrSession.ConfigureRFAttenuation("", rfAttenuationAuto, rfAttenuation); specAn.SelectMeasurements("", RFmxSpecAnMXMeasurementTypes.IM, enableAllTraces); specAn.IM.Configuration.ConfigureAveraging("", averagingEnabled, averagingCount, averagingType); specAn.IM.Configuration.ConfigureRbwFilter("", rbwAuto, rbw, rbwFilterType); specAn.IM.Configuration.ConfigureSweepTime("", sweepTimeAuto, sweepTimeInterval); specAn.IM.Configuration.ConfigureFft("", fftWindow, fftPadding); specAn.IM.Configuration.ConfigureMeasurementMethod("", measurementMethod); specAn.IM.Configuration.ConfigureFundamentalTones("", lowerToneFrequency, upperToneFrequency); specAn.IM.Configuration.ConfigureAutoIntermodsSetup("", autoIntermodsSetupEnabled, maximumIntermodOrder); specAn.Initiate("", ""); }
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; }
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(); } } }