public void StartGeneration() { if (!Environs.Debug) { // Configure the instrument _rfsgSession.RF.Configure(_frequency, _amplitude); // Initiate Generation _rfsgSession.Initiate(); } }
void stimulateDUTwithCW(int numSamples) { // double[] iData, qData; // iData = new double[numSamples]; // qData = new double[numSamples]; // iData = sinePattern(numSamples, 1.0, 0.0, 1.0); // qData = sinePattern(numSamples, 1.0, 0.0, 1.0); //generate a cw to stimulate dut // _rfsgSession.Arb.WriteWaveform("", iData, qData); _rfsgSession.RF.Configure(frequency, power); _rfsgSession.Initiate(); //System.Threading.Thread.Sleep(100); // _rfsgSession.Abort(); }
void UpdateGeneration() { double frequency, power; try { // Stop the status checking timer EnableControls(true); // Read in all the control values frequency = (double)frequencyNumeric.Value; power = (double)powerLevelNumeric.Value; // Abort generation _rfsgSession.Abort(); // Configure the instrument _rfsgSession.RF.Configure(frequency, power); // Initiate Generation _rfsgSession.Initiate(); // Start the status checking timer EnableControls(false); } catch (Exception ex) { ShowError("UpdateGeneration()", ex); } }
void StartGeneration() { string resourceName; double frequency, power; try { // Read in all the control values resourceName = resourceNameComboBox.Text; frequency = (double)frequencyNumeric.Value; power = (double)powerLevelNumeric.Value; errorTextBox.Text = "No error."; Application.DoEvents(); // Initialize the NIRfsg session _rfsgSession = new NIRfsg(resourceName, true, false); // Subscribe to Rfsg warnings _rfsgSession.DriverOperation.Warning += new EventHandler <RfsgWarningEventArgs>(DriverOperation_Warning); // Configure the instrument _rfsgSession.RF.Frequency = frequency; // Initiate Generation _rfsgSession.Initiate(); // Disable all controls EnableControls(false); } catch (Exception ex) { ShowError("StartGeneration()", ex); } }
public static void TogglePFILine(NIRfsg rfsgHandle, RfsgMarkerEventToggleInitialState toggleDirection = RfsgMarkerEventToggleInitialState.DigitalLow) { rfsgHandle.Abort(); //Ensure that the terminal is configured to the proper toggle state rfsgHandle.DeviceEvents.MarkerEvents[1].ExportedOutputTerminal = RfsgMarkerEventExportedOutputTerminal.Pfi0; rfsgHandle.DeviceEvents.MarkerEvents[1].OutputBehaviour = RfsgMarkerEventOutputBehaviour.Toggle; rfsgHandle.DeviceEvents.MarkerEvents[1].ToggleInitialState = toggleDirection; //Create a script that doesn't do anything, but ensures that the requested intitial toggle behavior //is applied to the hardware to toggle the PFI line correctly string cachedScriptName = rfsgHandle.Arb.Scripting.SelectedScriptName; string toggleScript = @"script toggleScript wait 10 end script"; rfsgHandle.Arb.Scripting.WriteScript(toggleScript); rfsgHandle.Arb.Scripting.SelectedScriptName = "ToggleScript"; rfsgHandle.Initiate(); rfsgHandle.Abort(); //Return the active script to the previous rfsgHandle.Arb.Scripting.SelectedScriptName = cachedScriptName; rfsgHandle.Utility.Commit(); }
void StartGeneration() { string rfsgName = resourceNameComboBox.Text; double freq = (double)frequencyNumeric.Value; double power = (double)powerLevelNumeric.Value; try { rfsgSession = new NIRfsg(rfsgName, true, false); rfsgHandle = rfsgSession.GetInstrumentHandle().DangerousGetHandle(); int i = 0; foreach (string tdmsPath in tdmsFilePaths) { NIRfsgPlayback.ReadAndDownloadWaveformFromFile(rfsgHandle, tdmsPath, tdmsWaveformNames[i]); i++; } //Q: Is it acceptable to utilize mostly private class data and keep prototype empty? I suppose if I don't aniticpate any reuse I can leave it empty... string autoScript = ScriptGen(); NIRfsgPlayback.SetScriptToGenerateSingleRfsg(rfsgHandle, autoScript); rfsgSession.RF.Configure(freq, power); rfsgSession.Initiate(); } catch (Exception uhOh) { ShowError("Start Generation", uhOh); } }
static void Main() { string resourceName = "VST2"; string filePath = Path.GetFullPath(@"Support Files\80211a_20M_48Mbps.tdms"); GenerationType genType = GenerationType.Continuous; NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); InstrumentConfiguration instrConfig = InstrumentConfiguration.GetDefault(); instrConfig.CarrierFrequency_Hz = 2e9; ConfigureInstrument(nIRfsg, instrConfig); Waveform waveform = LoadWaveformFromTDMS(filePath); DownloadWaveform(nIRfsg, waveform); switch (genType) { // For continous generation, we can simply call this function to begin the generation case GenerationType.Continuous: ConfigureContinuousGeneration(nIRfsg, waveform); break; // For bursted generation, we need to configure the duty cycle and PA control case GenerationType.Bursted: WaveformTimingConfiguration dynamicConfig = new WaveformTimingConfiguration { DutyCycle_Percent = 20, PreBurstTime_s = 500e-9, PostBurstTime_s = 500e-9, BurstStartTriggerExport = "PXI_Trig0" }; PAENConfiguration paenConfig = new PAENConfiguration { PAEnableMode = PAENMode.Dynamic, PAEnableTriggerExportTerminal = "PFI0", PAEnableTriggerMode = RfsgMarkerEventOutputBehaviour.Toggle, CommandEnableTime_s = 0, CommandDisableTime_s = 0, }; ConfigureBurstedGeneration(nIRfsg, waveform, dynamicConfig, paenConfig, out _, out _); break; } nIRfsg.Initiate(); Console.WriteLine("Generation has now begun. Press any key to abort generation and close the example."); Console.ReadKey(); AbortGeneration(nIRfsg); CloseInstrument(nIRfsg); }
/// <summary>Acquires the incoming signal, trains the DPD model, applies the memory polynomial to the reference waveform, and downloads the predistorted waveform to the generator. /// If generation is in progress when this function is called, generation will resume with the predistorted waveform.</summary> /// <param name="specAn">Specifies the SpecAn signal to configure.</param> /// <param name="rfsgSession">Specifies the open RFSG session to configure.</param> /// <param name="referenceWaveform">Specifies the <see cref="Waveform"/> whose data defines the complex baseband equivalent of the RF signal applied at the input /// port of the device under test when performing the measurement. 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> /// <returns>Common results after the application of memory polynomial based DPD.</returns> public static MemoryPolynomialResults PerformMemoryPolynomial(RFmxSpecAnMX specAn, NIRfsg rfsgSession, MemoryPolynomialConfiguration mpConfig, Waveform referenceWaveform, string selectorString = "") { //Instantiate new waveform with reference waveform properties MemoryPolynomialResults mpResults = new MemoryPolynomialResults() { PredistortedWaveform = referenceWaveform }; mpResults.PredistortedWaveform.Data = referenceWaveform.Data.Clone(); // clone waveform so RFmx can't act on reference waveform mpResults.PredistortedWaveform.UpdateNameAndScript(referenceWaveform.Name + "postMpDpd"); RFmxSpecAnMXDpdApplyDpdIdleDurationPresent idlePresent = referenceWaveform.IdleDurationPresent ? RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.True : RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.False; RfsgGenerationStatus preDpdGenerationStatus = rfsgSession.CheckGenerationStatus(); rfsgSession.Abort(); // abort so we don't mess with the loop logic for (int i = 0; i < mpConfig.NumberOfIterations; i++) { specAn.Dpd.Configuration.ConfigurePreviousDpdPolynomial(selectorString, mpResults.Polynomial); rfsgSession.Initiate(); specAn.Initiate(selectorString, ""); specAn.WaitForMeasurementComplete(selectorString, 10.0); // wait for polynomial coefficients to be calculated //waveform data and PAPR are overwritten in post DPD waveform specAn.Dpd.ApplyDpd.ApplyDigitalPredistortion(selectorString, referenceWaveform.Data, idlePresent, 10.0, ref mpResults.PredistortedWaveform.Data, out mpResults.PowerResults.WaveformTruePapr_dB, out mpResults.PowerResults.WaveformPowerOffset_dB); //Waveform's PAPR is modified to adjust the output power of the waveform on a per waveform basis rather than changing the //user's configured output power on the instrument mpResults.PredistortedWaveform.PAPR_dB = mpResults.PowerResults.WaveformPowerOffset_dB + mpResults.PowerResults.WaveformTruePapr_dB; DownloadWaveform(rfsgSession, mpResults.PredistortedWaveform); // implicit abort ApplyWaveformAttributes(rfsgSession, mpResults.PredistortedWaveform); specAn.Dpd.Results.FetchDpdPolynomial(selectorString, 10.0, ref mpResults.Polynomial); } mpResults.PowerResults.TrainingPower_dBm = rfsgSession.RF.PowerLevel; if (preDpdGenerationStatus == RfsgGenerationStatus.InProgress) { rfsgSession.Initiate(); // restart generation if it was running on function call } return(mpResults); }
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; }
public void InitiateSequence(string sequenceName) { if (waveformNamesLoaded.Contains(sequenceName)) { session.Arb.SelectedWaveform = sequenceName; session.Initiate(); } else { MessageBox.Show("no loaded waveforms found by this name"); } }
/// <summary>Acquires the incoming signal, trains the DPD model, applies the lookup table to the reference waveform, and downloads the predistorted waveform to the generator. /// If generation is in progress when this function is called, generation will resume with the predistorted waveform.</summary> /// <param name="specAn">Specifies the SpecAn signal to configure.</param> /// <param name="rfsgSession">Specifies the open RFSG session to configure.</param> /// <param name="referenceWaveform">Specifies the <see cref="Waveform"/> whose data defines the complex baseband equivalent of the RF signal applied at the input /// port of the device under test when performing the measurement. 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> /// <returns>Common results after the application of lookup table based DPD.</returns> public static LookupTableResults PerformLookupTable(RFmxSpecAnMX specAn, NIRfsg rfsgSession, Waveform referenceWaveform, string selectorString = "") { //Instantiate new waveform with reference waveform properties LookupTableResults lutResults = new LookupTableResults() { PredistortedWaveform = referenceWaveform, }; lutResults.PredistortedWaveform.Data = referenceWaveform.Data.Clone(); // clone waveform so RFmx can't act on reference waveform lutResults.PredistortedWaveform.UpdateNameAndScript(referenceWaveform.Name + "postLutDpd"); RfsgGenerationStatus preDpdGenerationStatus = rfsgSession.CheckGenerationStatus(); if (preDpdGenerationStatus == RfsgGenerationStatus.Complete) { rfsgSession.Initiate(); // initiate if not already generating } specAn.Initiate(selectorString, ""); RFmxSpecAnMXDpdApplyDpdIdleDurationPresent idlePresent = referenceWaveform.IdleDurationPresent ? RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.True : RFmxSpecAnMXDpdApplyDpdIdleDurationPresent.False; specAn.WaitForMeasurementComplete(selectorString, 10.0); // wait for LUT creation to finish //waveform data and PAPR are overwritten in post DPD waveform specAn.Dpd.ApplyDpd.ApplyDigitalPredistortion(selectorString, referenceWaveform.Data, idlePresent, 10.0, ref lutResults.PredistortedWaveform.Data, out lutResults.PowerResults.WaveformTruePapr_dB, out lutResults.PowerResults.WaveformPowerOffset_dB); //Waveform's PAPR is modified to adjust the output power of the waveform on a per waveform basis rather than changing the //user's configured output power on the instrument lutResults.PredistortedWaveform.PAPR_dB = lutResults.PowerResults.WaveformPowerOffset_dB + lutResults.PowerResults.WaveformTruePapr_dB; DownloadWaveform(rfsgSession, lutResults.PredistortedWaveform); // implicit call to rfsg abort ApplyWaveformAttributes(rfsgSession, lutResults.PredistortedWaveform); lutResults.PowerResults.TrainingPower_dBm = rfsgSession.RF.PowerLevel; specAn.Dpd.Results.FetchLookupTable(selectorString, 10.0, ref lutResults.InputPowers_dBm, ref lutResults.ComplexGains_dB); if (preDpdGenerationStatus == RfsgGenerationStatus.InProgress) { rfsgSession.Initiate(); // restart generation if it was running on function call } return(lutResults); }
public void Run() { NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); ConfigureInstrument(nIRfsg, instrConfig); Waveform waveform = LoadWaveformFromTDMS(filePath); DownloadWaveform(nIRfsg, waveform); ConfigureContinuousGeneration(nIRfsg, waveform, "PXI_Trig0"); ni568x sensor = new ni568x(powerMeterResourceName, true, true); PowerMeter.ConfigureCommon(sensor, commonConfiguration); bool measuredPowerInRange; double measuredPower = 0.0; double maximumDutOutputPower = paOutputPower_dBm + designedAccuracy_dB; double minimumDutOutputPower = paOutputPower_dBm - designedAccuracy_dB; Console.WriteLine("\n------------------------Servo Started ---------------------\n"); for (int currentServoStep = 1; currentServoStep <= maximumSteps; currentServoStep++) { nIRfsg.Initiate(); measuredPower = PowerMeter.ReadMeasurement(sensor, 10000) + Coupling_dB; Console.WriteLine("Servo step: {0}", currentServoStep); Console.WriteLine("Measured power (dBm): {0:0.00}", measuredPower); AbortGeneration(nIRfsg); measuredPowerInRange = (measuredPower >= minimumDutOutputPower) && (measuredPower <= maximumDutOutputPower); if (measuredPowerInRange && (currentServoStep >= minimumSteps)) { servoFailed = false; break; } else { instrConfig.DutAverageInputPower_dBm += ((paOutputPower_dBm - measuredPower) * 0.95); ConfigureInstrument(nIRfsg, instrConfig); } } PrintServoResults(measuredPower); CloseInstrument(nIRfsg); sensor.Dispose(); }
/// <summary> /// This example illustrates how to use RFSG drivers to generate a bursted or continuous waveform. /// </summary> static void Main() { string resourceName = "5840"; string filePath = Path.GetFullPath(@"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\NR_FR1_UL_1x100MHz_30kHz-SCS_256QAM_OS4_VST2_1ms.tdms"); //string filePath = Path.GetFullPath(@"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\LTE_FDD_UL_1x20MHz_256QAM_OS4.tdms"); //string filePath = Path.GetFullPath(@"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\80211ax_80M_MCS11.tdms"); GenerationType genType = GenerationType.Continuous; NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); InstrumentConfiguration instrConfig = InstrumentConfiguration.GetDefault(); instrConfig.CarrierFrequency_Hz = 3.5e9; ConfigureInstrument(nIRfsg, instrConfig); Waveform waveform = LoadWaveformFromTDMS(filePath); DownloadWaveform(nIRfsg, waveform); switch (genType) { // For continous generation, we can simply call this function to begin the generation case GenerationType.Continuous: ConfigureContinuousGeneration(nIRfsg, waveform, "PXI_Trig0"); break; // For bursted generation, we need to configure the duty cycle and PA control case GenerationType.Bursted: WaveformTimingConfiguration dynamicConfig = WaveformTimingConfiguration.GetDefault(); PAENConfiguration paenConfig = PAENConfiguration.GetDefault(); ConfigureBurstedGeneration(nIRfsg, waveform, dynamicConfig, paenConfig, out _, out _); break; } nIRfsg.Initiate(); Console.WriteLine("Generation has now begun. Press any key to abort generation and close the example."); Console.ReadKey(); AbortGeneration(nIRfsg); CloseInstrument(nIRfsg); }
static void Main() { string resourceName = "VST2"; string filePath = Path.GetFullPath(@"Support Files\80211a_20M_48Mbps.tdms"); NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); InstrumentConfiguration instrConfig = new InstrumentConfiguration(); instrConfig.SetDefaults(); instrConfig.CarrierFrequency_Hz = 2e9; ConfigureInstrument(ref nIRfsg, instrConfig); Waveform waveform = LoadWaveformFromTDMS(ref nIRfsg, filePath); DownloadWaveform(ref nIRfsg, ref waveform); WaveformTimingConfiguration dynamicConfig = new WaveformTimingConfiguration { DutyCycle_Percent = 20, PreBurstTime_s = 500e-9, PostBurstTime_s = 500e-9, }; PAENConfiguration paenConfig = new PAENConfiguration { PAEnableMode = PAENMode.Dynamic, PAEnableTriggerExportTerminal = "PFI0", PAEnableTriggerMode = RfsgMarkerEventOutputBehaviour.Toggle, CommandEnableTime_s = 0, CommandDisableTime_s = 0, }; ConfigureWaveformTimingAndPAControl(ref nIRfsg, ref waveform, dynamicConfig, paenConfig, out _, out _); nIRfsg.Initiate(); Console.ReadKey(); AbortDynamicGeneration(ref nIRfsg); CloseInstrument(ref 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; }
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(string[] args) { #region Station Configuration string sgName = "VST2"; string digitalName = "PXIe-6570"; DigitalMode desiredMode = DigitalMode.Digital_Enable; //To calculate this delay, use the TDR feature of the Digital Pattern Editor (DPE) //In the DPE, navigate to Instruments » TDR... double PFI0CableDelay_s = 11.4e-9; #endregion #region SG Configuration NIRfsg rfsgSession = new NIRfsg(sgName, false, false); InstrumentConfiguration instrConfig = new InstrumentConfiguration { ReferenceClockSource = RfsgFrequencyReferenceSource.PxiClock, CarrierFrequency_Hz = 2.402e9, DutAverageInputPower_dBm = 0, ShareLOSGToSA = false, }; ConfigureInstrument(rfsgSession, instrConfig); string waveformPath = Path.GetFullPath(@"TDMS Files\11AC_MCS8_40M.tdms"); Waveform wave = LoadWaveformFromTDMS(waveformPath, "wave"); DownloadWaveform(rfsgSession, wave); WaveformTimingConfiguration waveTiming = new WaveformTimingConfiguration { DutyCycle_Percent = 20, PreBurstTime_s = 2000e-9, PostBurstTime_s = 500e-9, BurstStartTriggerExport = "PXI_Trig0" }; PAENConfiguration paenConfig = new PAENConfiguration { PAEnableMode = PAENMode.Dynamic, PAEnableTriggerExportTerminal = "PFI0", PAEnableTriggerMode = RfsgMarkerEventOutputBehaviour.Toggle, }; switch (desiredMode) { case DigitalMode.RFFE_MIPI: //Calculate the command length by multiplying the number of vector cycles (18 for Reg0Write) //by the clock rate (currently 52 MHz) paenConfig.CommandEnableTime_s = 18 * (1 / 52e6); paenConfig.CommandDisableTime_s = 18 * (1 / 52e6); break; case DigitalMode.Digital_Enable: //For the digital enable case, the command time can be considered to be 0 since the digital //line is simply being toggled high/low paenConfig.CommandDisableTime_s = 0; paenConfig.CommandEnableTime_s = 0; break; } //Until NI-DIGITAL 19.0 is released, the triggering mechanism used is to trigger using the PFI line //and detecting the change with a match opcode. There are a total of 830 cycles of the instrument required //before the command is sent from the pattern. Hence, an 830ns delay is added to the command time to account //for this. paenConfig.CommandEnableTime_s += 830e-9; paenConfig.CommandDisableTime_s += 830e-9; ConfigureBurstedGeneration(rfsgSession, wave, waveTiming, paenConfig, out _, out _); #endregion #region NI Digital Config NIDigital digital = new NIDigital(digitalName, false, false); ProjectFiles projectFiles = Digital.Utilities.SearchForProjectFiles(Path.GetFullPath(@"Dynamic Digital Control Project"), true); LoadProjectFiles(digital, projectFiles); ApplyPinTDROffset(digital, "PFI0", PFI0CableDelay_s); //Select the appropriate pattern based on the desired control mechanism switch (desiredMode) { case DigitalMode.Digital_Enable: digital.PatternControl.BurstPattern("", "Dynamic_Digital_Enable", true, false, TimeSpan.FromSeconds(10)); break; case DigitalMode.RFFE_MIPI: digital.PatternControl.BurstPattern("", "Dynamic_RFFE_Control", true, false, TimeSpan.FromSeconds(10)); break; } #endregion rfsgSession.Initiate(); Console.WriteLine("Generation on the signal generator and digital pattern instrument has begun. Press any key to abort generation and exit the program."); Console.ReadKey(); AbortGeneration(rfsgSession); digital.PatternControl.Abort(); DisconnectAndClose(digital); rfsgSession.Close(); }
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; }
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 StartGeneration() { string BotRFPulse = RfChoice[botRfChoice]; string TopRFPulse = RfChoice[topRfChoice]; string script = @"script myScript" + Environment.NewLine + " Repeat forever" + Environment.NewLine + " Generate allZeros" + Environment.NewLine + " Clear scriptTrigger0" + Environment.NewLine + " Wait until scriptTrigger0" + Environment.NewLine + " Clear scriptTrigger1" + Environment.NewLine + " Repeat until scriptTrigger1" + Environment.NewLine + " Generate " + BotRFPulse + Environment.NewLine + " end repeat" + Environment.NewLine + " Clear scriptTrigger1" + Environment.NewLine + " Repeat until scriptTrigger1" + Environment.NewLine + " Generate " + TopRFPulse + Environment.NewLine + " end repeat" + Environment.NewLine + " end repeat" + Environment.NewLine + "end script"; RfsgScriptTriggerType triggerType1; RfsgScriptTriggerType triggerType2; string triggerSource1; string triggerSource2; triggerType1 = RfsgScriptTriggerType.DigitalEdge; triggerType2 = RfsgScriptTriggerType.DigitalEdge; triggerSource1 = RfsgDigitalEdgeScriptTriggerSource.Pfi0; triggerSource2 = RfsgDigitalEdgeScriptTriggerSource.Pfi1; try { Console.WriteLine("Starting generation of pulses.."); // Configure scriptTrigger0 (refer to the script) if (triggerType1 == RfsgScriptTriggerType.DigitalEdge) { _rfsgSession.Triggers.ScriptTriggers[0].DigitalEdge.Configure(triggerSource1, RfsgTriggerEdge.RisingEdge); } else if (triggerType1 == RfsgScriptTriggerType.DigitalLevel) { _rfsgSession.Triggers.ScriptTriggers[0].DigitalLevel.Configure(triggerSource1, RfsgTriggerLevel.ActiveHigh); } else { _rfsgSession.Triggers.ScriptTriggers[0].Disable(); } // Configure scriptTrigger1 (refer to the script) if (triggerType2 == RfsgScriptTriggerType.DigitalEdge) { _rfsgSession.Triggers.ScriptTriggers[1].DigitalEdge.Configure(triggerSource2, RfsgTriggerEdge.RisingEdge); } else if (triggerType2 == RfsgScriptTriggerType.DigitalLevel) { _rfsgSession.Triggers.ScriptTriggers[1].DigitalLevel.Configure(triggerSource2, RfsgTriggerLevel.ActiveHigh); } else { _rfsgSession.Triggers.ScriptTriggers[1].Disable(); } // Write the script _rfsgSession.Arb.Scripting.WriteScript(script); // Initiate Generation _rfsgSession.Initiate(); } catch (Exception ex) { ShowError("StartGeneration()", ex); } }
public void Run() { ConfigureGeneration(); ConfigureMeasurement(); ConfigureServo(); ConfigureSweep(); rfsgSession.Initiate(); // Define sweep Stopwatch watch = new Stopwatch(); watch.Reset(); StreamWriter stream = new StreamWriter(File.Create("data.csv")); stream.WriteLine(string.Join(", ", "Frequency", "Averages", "Symbols")); var sweep = new Sweep(sweepSteps, () => { // get rid of first run jitter wlan.Initiate("", ""); wlan.WaitForMeasurementComplete("", 10.0); wlan.OfdmModAcc.Configuration.GetAveragingCount("", out int numAverages); wlan.OfdmModAcc.Results.GetNumberOfSymbolsUsed("", out int numSymbolsUsed); wlan.OfdmModAcc.Results.GetCompositeRmsEvmMean("", out double evm); wlan.GetCenterFrequency("", out double centFreq); string currentPoints = string.Join(", ", centFreq.ToString(), sweepSteps[1].GetCurrentPoint().ToString(), sweepSteps[2].GetCurrentPoint().ToString()); stream.Write(currentPoints); Console.WriteLine(currentPoints); for (int i = 0; i < repeatabilityCount; i++) { powerServo.Disable(); powerServo.Enable(); watch.Restart(); wlan.Initiate("", ""); powerServo.Start(); powerServo.Wait(ServoTimeout, out ushort servoNumberOfAveragesCaptured, out bool servoDone, out bool servoFailed); // powerServo.GetDigitalGain(out double servoRawDigitalGain, out double servoDigitalGain); // powerServo.GetServoSteps(servoNumberOfAveragesCaptured, servoContinuous, false, 0, out servoMeasurementTimes, out servoMeasurementLevels); wlan.WaitForMeasurementComplete("", 10.0); wlan.OfdmModAcc.Configuration.GetAveragingCount("", out numAverages); wlan.OfdmModAcc.Results.GetCompositeRmsEvmMean("", out evm); wlan.OfdmModAcc.Results.GetNumberOfSymbolsUsed("", out numSymbolsUsed); watch.Stop(); if (numAverages != (int)sweepSteps[1].GetCurrentPoint() || numSymbolsUsed != (int)sweepSteps[2].GetCurrentPoint()) { throw new Exception(); } stream.Write(", " + evm.ToString()); stream.Write(", " + watch.ElapsedMilliseconds.ToString()); }