示例#1
0
        private void CommitTestConfiguration(NIRfsg rfsg, RFmxInstrMX instr)
        {
            SG.DownloadWaveform(rfsg, lteTdd10Waveform);
            SG.ConfigureContinuousGeneration(rfsg, lteTdd10Waveform);

            var lteCommonConfig = CommonConfiguration.GetDefault();

            string instrumentModel = rfsg.Identity.InstrumentModel;

            if (Regex.IsMatch(instrumentModel, "NI PXIe-5830"))
            {
                lteCommonConfig.SelectedPorts      = "if1";
                lteCommonConfig.CenterFrequency_Hz = 6.5e9;
            }
            else if (Regex.IsMatch(instrumentModel, "NI PXIe-5831"))
            {
                lteCommonConfig.SelectedPorts      = "rf1/port0";
                lteCommonConfig.CenterFrequency_Hz = 28e9;
            }
            var lte = instr.GetLteSignalConfiguration();

            RFmxLTE.ConfigureCommon(lte, lteCommonConfig);
            RFmxLTE.ConfigureStandard(lte, RFmxLTE.StandardConfiguration.GetDefault());
            RFmxLTE.ConfigureModAcc(lte, RFmxLTE.ModAccConfiguration.GetDefault());

            lte.Commit("");
            rfsg.Utility.Commit();
        }
 public void IdleDurationCalculatedCorrectly()
 {
     LoopFiles((fileName, waveform, filePath, fileConfig) =>
     {
         string idle      = fileConfig["TestData"]["IdleDuration"];
         bool idlePresent = bool.Parse(idle);
         SG.DownloadWaveform(sim, waveform);
         waveform.IdleDurationPresent.Should().Be(idlePresent, $"of knowledge of file \"{fileName}\"");
     });
 }
示例#3
0
        /// <summary>Scales the envelope waveform data based on the settings in <paramref name="trackerConfig"/>, and downloads the waveform to the envelope generator.</summary>
        /// <param name="envVsg">The open RFSG session to configure.</param>
        /// <param name="envelopeWaveform">The envelope waveform created by <see cref="CreateDetroughEnvelopeWaveform(Waveform, DetroughConfiguration)"/> or
        /// <see cref="CreateLookUpTableEnvelopeWaveform(Waveform, LookUpTableConfiguration)"/> that is to be generated.</param>
        /// <param name="trackerConfig">The common settings pertaining to the tracker that is used to modulate the power supply voltage.</param>
        /// <returns>The envelope waveform with data scaled according to the tracker configuration.</returns>
        public static Waveform ScaleAndDownloadEnvelopeWaveform(NIRfsg envVsg, Waveform envelopeWaveform, TrackerConfiguration trackerConfig)
        {
            // grab the raw envelope so we can use linq to get statistics on it
            ComplexSingle.DecomposeArray(envelopeWaveform.Data.GetRawData(), out float[] envelope, out _);

            // scale envelope to adjust for tracker gain and offset
            for (int i = 0; i < envelope.Length; i++)
            {
                envelope[i] = (float)((envelope[i] - trackerConfig.OutputOffset_V) / trackerConfig.Gain_VperV);
            }

            // clone an envelope waveform to return to the user - want unique waveforms per tracker configuration
            Waveform scaledEnvelopeWaveform = envelopeWaveform;

            scaledEnvelopeWaveform.Data = envelopeWaveform.Data.Clone();
            WritableBuffer <ComplexSingle> scaledEnvelopeWaveformBuffer = scaledEnvelopeWaveform.Data.GetWritableBuffer();

            // populate cloned waveform with scaled waveform data
            for (int i = 0; i < envelope.Length; i++)
            {
                scaledEnvelopeWaveformBuffer[i] = ComplexSingle.FromSingle(envelope[i]);
            }

            // get peak of the waveform
            float absolutePeak = envelope.Max(i => Math.Abs(i)); // applies the absolute value function to each element and returns the max

            // scale waveform to peak voltage
            for (int i = 0; i < envelope.Length; i++)
            {
                envelope[i] = envelope[i] / (absolutePeak); // brings waveform down to +/- 1 magnitude
            }
            // set instrument properties
            envVsg.IQOutPort[""].Level  = 2.0 * absolutePeak; // gain is interpreted as peak-to-peak
            envVsg.IQOutPort[""].Offset = 0.0;                // set offset to 0 since this is done in DSP not in HW on the 5820 and only clips the waveform further

            // create another waveform that we can use to download the scaled envelope to the instrument
            Waveform instrEnvelopeWaveform = envelopeWaveform;

            instrEnvelopeWaveform.Data = envelopeWaveform.Data.Clone();
            WritableBuffer <ComplexSingle> instrEnvelopeWaveformBuffer = instrEnvelopeWaveform.Data.GetWritableBuffer();

            // populate cloned waveform with scaled waveform data
            for (int i = 0; i < envelope.Length; i++)
            {
                instrEnvelopeWaveformBuffer[i] = ComplexSingle.FromSingle(envelope[i]);
            }

            SG.DownloadWaveform(envVsg, instrEnvelopeWaveform); // download optimized waveform

            return(scaledEnvelopeWaveform);                     // return the waveform as it will appear coming out of the front end of the envelope generator
        }
        public void DictionaryWaveformMatchesLoaded()
        {
            LoopFiles((fileName, waveform, filePath, fileConfig) =>
            {
                SG.DownloadWaveform(sim, waveform);
                Waveform newWaveform = SG.GetWaveformParametersByName(sim, waveform.Name);

                newWaveform.Should().BeEquivalentTo(waveform, options =>
                {
                    //Actual waveform data is not returned. Hence, exclude it from comparison
                    options.Excluding(w => w.Data);
                    //Ensure each member is compared; otherwise, it will just compare the two structs as whole values
                    options.ComparingByMembers <Waveform>();
                    return(options);
                }, $"of loading file \"{fileName}\"");
            });
        }