Exemple #1
0
        /// <summary>Synchronizes the RF and envelope signal generators, and initiates generation.</summary>
        /// <param name="rfVsg">The open RFSG session corresponding to the RF signal generator.</param>
        /// <param name="envVsg">The open RFSG session corresponding to the envelope signal generator.</param>
        /// <param name="syncConfig">Specifies common settings used for synchronizing the RF and envelope signal generators.</param>
        public static void InitiateSynchronousGeneration(NIRfsg rfVsg, NIRfsg envVsg, SynchronizationConfiguration syncConfig)
        {
            TClock tclk = new TClock(new ITClockSynchronizableDevice[] { rfVsg, envVsg });

            // The PXIe-5840 can only apply positive delays so we have to establish an inital delay of -RFDelayRange/2 for TCLK to handle negative shifts as well
            tclk.DevicesToSynchronize[0].SampleClockDelay = -syncConfig.RFDelayRange_s / 2.0;
            rfVsg.Arb.RelativeDelay = syncConfig.RFDelayRange_s / 2.0 + syncConfig.RFDelay_s;
            tclk.ConfigureForHomogeneousTriggers();
            tclk.Synchronize();
            tclk.Initiate();
        }
        /// <summary>
        /// This example illustrates how to use RFSG drivers and envelope tracking APIs to configure envelope tracking.
        /// </summary>
        static void Main(string[] args)
        {
            #region Example Settings
            // Select mode for use in the example
            EnvelopeMode mode         = EnvelopeMode.Detrough;
            string       waveformPath = @"C:\Users\Public\Documents\National Instruments\RFIC Test Software\Waveforms\LTE_FDD_DL_1x20MHz_TM11_OS4.tdms";
            #endregion

            #region Configure RF Generator
            // Initialize instrument sessions
            NIRfsg rfVsg = new NIRfsg("5840", true, false);

            // Load up waveform
            Waveform rfWfm = LoadWaveformFromTDMS(waveformPath);

            // Configure RF generator
            InstrumentConfiguration rfInstrConfig = InstrumentConfiguration.GetDefault();
            ConfigureInstrument(rfVsg, rfInstrConfig);
            DownloadWaveform(rfVsg, rfWfm);
            ConfigureContinuousGeneration(rfVsg, rfWfm);
            #endregion

            #region Configure Tracker Generator
            NIRfsg envVsg = new NIRfsg("5820", true, false);

            // Configure envelope generator
            EnvelopeGeneratorConfiguration envInstrConfig = EnvelopeGeneratorConfiguration.GetDefault();
            TrackerConfiguration           trackerConfig  = TrackerConfiguration.GetDefault();
            ConfigureEnvelopeGenerator(envVsg, envInstrConfig, trackerConfig);

            Waveform envWfm = new Waveform();
            switch (mode)
            {
            case EnvelopeMode.Detrough:
                // Create envelope waveform
                DetroughConfiguration detroughConfig = DetroughConfiguration.GetDefault();
                detroughConfig.MinimumVoltage_V = 1.5;
                detroughConfig.MaximumVoltage_V = 3.5;
                detroughConfig.Exponent         = 1.2;
                detroughConfig.Type             = DetroughType.Exponential;
                envWfm = CreateDetroughEnvelopeWaveform(rfWfm, detroughConfig);
                break;

            case EnvelopeMode.LUT:
                LookUpTableConfiguration lutConfig = new LookUpTableConfiguration
                {
                    DutAverageInputPower_dBm = rfInstrConfig.DutAverageInputPower_dBm
                };
                // Todo - initialize lookup table
                envWfm = CreateLookUpTableEnvelopeWaveform(rfWfm, lutConfig);
                break;
            }

            ScaleAndDownloadEnvelopeWaveform(envVsg, envWfm, trackerConfig);
            ConfigureContinuousGeneration(envVsg, envWfm, "PFI0");
            #endregion

            // Start envelope tracking
            SynchronizationConfiguration syncConfig = SynchronizationConfiguration.GetDefault();
            InitiateSynchronousGeneration(rfVsg, envVsg, syncConfig);

            // Wait until user presses a button to stop
            Console.WriteLine("Press any key to abort envelope tracking..");
            Console.ReadKey();

            AbortGeneration(envVsg);
            AbortGeneration(rfVsg);

            // Close instruments
            rfVsg.Close();
            envVsg.Close();
        }