Beispiel #1
0
        void StopGeneration()
        {
            EnableControls(true);
            updateButton.Enabled = false;

            try
            {
                if (_rfsgSession != null)
                {
                    // Disable the output.  This sets the noise floor as low as possible.
                    _rfsgSession.RF.OutputEnabled = false;

                    // Unsubscribe from warning events
                    _rfsgSession.DriverOperation.Warning -= DriverOperation_Warning;

                    // Close the RFSG NIRfsg session
                    _rfsgSession.Close();
                }
                _rfsgSession = null;
            }
            catch (Exception ex)
            {
                errorTextBox.Text = "Error in StopGeneration(): " + ex.Message;
            }
        }
        private void CloseInstruments()
        {
            AbortGeneration();
            rfsg?.Close();

            instr?.Close();
        }
 /// <summary>
 /// Closes both the SA and the SG.
 /// </summary>
 public override void Close()
 {
     RfsaHandle.Close();
     RfsaHandle = null;
     RfsgHandle.Close();
     RfsgHandle = null;
 }
Beispiel #4
0
        public override void Connect()
        {
            if (!Environs.Debug)
            {
                if (_rfsgSession != null)
                {
                    _rfsgSession.Close();
                    _rfsgSession = null;
                }

                // Initialize the NIRfsg session
                _rfsgSession = new NIRfsg(_resourceName, true, false);

                // Subscribe to Rfsg warnings
                _rfsgSession.DriverOperation.Warning += new EventHandler <RfsgWarningEventArgs>(DriverOperation_Warning);
            }
        }
        private void CloseInstruments()
        {
            AbortGeneration();
            sessionsCreated = false;
            _rfsgSession?.Close();

            instr?.Close();
        }
 void StopGeneration()
 {
     try
     {
         if (rfsgSession != null)
         {
             rfsgSession.Abort();
             rfsgSession.RF.OutputEnabled = false;
             rfsgSession.Close();
             rfsgSession = null;
         }
     }
     catch (Exception ohNo)
     {
         ShowError("StopGeneration", ohNo);
     }
     // Stop the status checking timer
     EnableControls(true);
 }
Beispiel #7
0
        public void StopGeneration()
        {
            try
            {
                if (_rfsgSession != null)
                {
                    // Disable the output
                    _rfsgSession.RF.OutputEnabled = false;

                    // Unsubscribe from warning events
                    _rfsgSession.DriverOperation.Warning -= DriverOperation_Warning;

                    // Close the RFSG NIRfsg session
                    _rfsgSession.Close();
                }

                _rfsgSession = null;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in StopGeneration(): " + ex.Message);
            }
        }
 public static void TestFixtureTearDown()
 {
     sim.Close();
 }
Beispiel #9
0
 private void CloseTransceiverSessions(NIRfsg rfsg, RFmxInstrMX instr)
 {
     rfsg?.Close();
     instr?.Close();
 }
Beispiel #10
0
 /// <summary>Aborts generation, disables the output, and closes the instrument session.</summary>
 /// <param name="rfsgHandle">The open RFSG session to close.</param>
 public static void CloseInstrument(NIRfsg rfsgHandle)
 {
     rfsgHandle.Abort();
     rfsgHandle.RF.OutputEnabled = false;
     rfsgHandle.Close();
 }
        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();
        }
        /// <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();
        }