コード例 #1
0
        private void ConfigureSG()
        {
            transceiver.RfsgHandle.RF.PowerLevel = sgPowerLevel;
            // set IQ rate of the generator
            transceiver.RfsgHandle.Arb.IQRate = 1 / waveform.PrecisionTiming.SampleInterval.TotalSeconds;
            { // automatically offset the LO outside of the band
                // the Upconverter.CenterFrequency property will remain constant for each step in the configuration list
                double maxBandwidth = bandwidths.Max();
                if (txStartFrequency > rxStopFrequency)
                {
                    transceiver.RfsgHandle.RF.Upconverter.CenterFrequency = txStopFrequency + maxBandwidth; // inject to the right if the rx band is below the tx band
                }
                else if (rxStartFrequency > txStopFrequency)
                {
                    transceiver.RfsgHandle.RF.Upconverter.CenterFrequency = txStartFrequency - maxBandwidth; // inject to the left if the rx band is above the tx band
                }
                else // if none of the above then there is some band overlap
                { // find the side that is easier to inject on
                    double upperMargin = Math.Abs(rxStopFrequency - txStopFrequency);
                    double lowerMargin = Math.Abs(rxStartFrequency - txStartFrequency);
                    if (lowerMargin < upperMargin)
                    {
                        transceiver.RfsgHandle.RF.Upconverter.CenterFrequency = txStartFrequency - lowerMargin - maxBandwidth;
                    }
                    else // prefer high side injection if the upper and lower margins are equal
                    {
                        transceiver.RfsgHandle.RF.Upconverter.CenterFrequency = txStopFrequency + upperMargin + maxBandwidth;
                    }
                } // the driver will throw an error if it is unable to satify the calculated downconverter center frequency
            }
#if ni5644R
            { // comment out if using 5646R
                transceiver.RfsgHandle.RF.Upconverter.CenterFrequency = (txStartFrequency + txStopFrequency) / 2;
            }
#endif
            { // set configuration list to loop through the carrier frequencies
                // transceiver.RfsgHandle.BasicConfigurationList.CheckIfConfigurationListExists(Band); // possible speed improvement can be made here.
                RfsgConfigurationListProperties[] configurationListProperties = new RfsgConfigurationListProperties[] { RfsgConfigurationListProperties.Frequency };
                transceiver.RfsgHandle.BasicConfigurationList.CreateConfigurationList(band, configurationListProperties, true);
                if (soakTime > 0)
                {
                    transceiver.RfsgHandle.BasicConfigurationList.CreateStep(true);
                    transceiver.RfsgHandle.RF.Frequency = soakFrequency;
                }
                foreach (double frequency in txFrequencyRamp)
                { // create steps for sweep
                    transceiver.RfsgHandle.BasicConfigurationList.CreateStep(true);
                    transceiver.RfsgHandle.RF.Frequency = frequency;
                }
            }
            transceiver.ConditionalWriteWaveform(waveformName, waveform);
            transceiver.RfsgHandle.Arb.Scripting.WriteScript(BuildScript());
            transceiver.RfsgHandle.Arb.Scripting.SelectedScriptName = band;
            transceiver.RfsgHandle.DeviceEvents.MarkerEvents[1].ExportedOutputTerminal = referenceTriggerLine;
            transceiver.RfsgHandle.Utility.Commit();
        }
コード例 #2
0
        public void ApplyPowerLevel()
        {
            transceiver.RfsgHandle.RF.PowerLevel = powerLevel;

            if (isConfigFirstTime)
            {
                transceiver.ConditionalWriteWaveform(waveformName, waveform);
                transceiver.RfsgHandle.RF.Frequency = centerFrequency;
                transceiver.RfsgHandle.Arb.IQRate   = IqRate;
                transceiver.RfsgHandle.Initiate();

                isConfigFirstTime = false;
            }
        }