private void ConfigureSA() { transceiver.RfsaHandle.Configuration.Vertical.ReferenceLevel = saReferenceLevel; double maxBandwidth = bandwidths.Max(); transceiver.RfsaHandle.Configuration.IQ.IQRate = 1.25 * maxBandwidth; double actualIqRate = transceiver.RfsaHandle.Configuration.IQ.IQRate; // need to pull the actual iq rate from the driver for accurate calculation transceiver.RfsaHandle.Configuration.IQ.NumberOfSamples = (long)Math.Ceiling(actualIqRate * dwellTime); transceiver.RfsaHandle.Configuration.IQ.NumberOfRecords = rxFrequencyRamp.Length * numberOfRuns; { // automatically offset the LO outside of the band // the DownconverterCenterFrequency property will remain constant for each step in the configuration list if (txStartFrequency > rxStopFrequency) { transceiver.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = rxStartFrequency - maxBandwidth; // inject to the left if the rx band is below the tx band } else if (rxStartFrequency > txStopFrequency) { transceiver.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = rxStopFrequency + maxBandwidth; // inject to the right 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 (upperMargin < lowerMargin) { transceiver.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = rxStopFrequency + upperMargin + maxBandwidth; } else // prefer low side injection if the upper and lower margins are equal { transceiver.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = rxStartFrequency - lowerMargin - 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.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = (rxStartFrequency + rxStopFrequency) / 2; } #endif { // set configuration list to loop through the carrier frequencies RfsaConfigurationListProperties[] configurationListProperties = new RfsaConfigurationListProperties[] { RfsaConfigurationListProperties.IQCarrierFrequency }; transceiver.RfsaHandle.Configuration.BasicConfigurationList.CreateConfigurationList(band, configurationListProperties, true); foreach (double frequency in rxFrequencyRamp) { // a configuration list executes in the order in which it is configured transceiver.RfsaHandle.Configuration.BasicConfigurationList.CreateStep(true); transceiver.RfsaHandle.Configuration.IQ.CarrierFrequency = frequency; } } transceiver.RfsaHandle.Configuration.Triggers.ReferenceTrigger.DigitalEdge.Configure(referenceTriggerLine, RfsaTriggerEdge.Rising, 0); transceiver.RfsaHandle.Utility.Commit(); }
private void ConfigureSA() { transceiver.RfsaHandle.Configuration.Vertical.ReferenceLevel = saReferenceLevel; transceiver.RfsaHandle.Configuration.IQ.IQRate = 1.25 * bandwidth; transceiver.RfsaHandle.Configuration.IQ.NumberOfRecords = frequencyRamp.Length; transceiver.RfsaHandle.Configuration.IQ.NumberOfSamples = (int)Math.Round(dwellTime * transceiver.RfsaHandle.Configuration.IQ.IQRate); transceiver.RfsaHandle.Configuration.Events.EndOfRecordEvent.OutputTerminal = triggerLine; transceiver.RfsaHandle.Configuration.Triggers.ReferenceTrigger.Advanced.TriggerDelay = deskew; // reference trigger delay works even if reference trigger is not configured transceiver.RfsaHandle.Acquisition.Advanced.DownconverterCenterFrequency = startFrequency - bandwidth; // inject to the left of the sweep band RfsaConfigurationListProperties[] configurationListProperties = new RfsaConfigurationListProperties[] { RfsaConfigurationListProperties.IQCarrierFrequency }; transceiver.RfsaHandle.Configuration.BasicConfigurationList.CreateConfigurationList("AnalyzerSweep", configurationListProperties, true); for (int i = 0; i < frequencyRamp.Length; i++) { transceiver.RfsaHandle.Configuration.BasicConfigurationList.CreateStep(true); transceiver.RfsaHandle.Configuration.IQ.CarrierFrequency = frequencyRamp[i]; } transceiver.RfsaHandle.Utility.Commit(); }