public static void ConfigureCommon(ref RFmxInstrMX sessionHandle, ref RFmxSpecAnMX specAnSignal, CommonConfiguration commonConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "") { sessionHandle.ConfigureFrequencyReference("", commonConfig.FrequencyReferenceSource, 10e6); sessionHandle.SetLOSource("", commonConfig.LOSource); sessionHandle.SetDownconverterFrequencyOffset("", commonConfig.LOOffset); specAnSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalEdgeSource, commonConfig.DigitalEdgeType, commonConfig.TriggerDelay_s, commonConfig.EnableTrigger); specAnSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz); specAnSignal.Spectrum.Configuration.ConfigureSpan(selectorString, commonConfig.Span_Hz); specAnSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB); if (autoLevelConfig.AutoLevelReferenceLevel) { specAnSignal.AutoLevel(selectorString, commonConfig.Span_Hz, autoLevelConfig.AutoLevelMeasureTime_s, out _); } else { specAnSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm); } }
/// <summary>Performs actions to initiate acquisition and measurement.<para></para> Enables the specified measurement(s) before optionally /// automatically adjusting the reference level before beginning measurements. Finally, initiates the acquisition and measurement(s).</summary> /// <param name="specAn">Specifies the SpecAn signal to configure.</param> /// <param name="measurements">Specifies one or more previously configured measurements to enable for this acquisition.</param> /// <param name="autoLevelConfig">Specifies the configuration for the optional AutoLevel process which will automatically set the analyzer's reference level.</param> /// <param name="autoLevelBandwidth_Hz">Specifies the bandwidth, in hertz (Hz), of the signal to be analyzed. See the RFmx help for more documentation of this parameter.</param> /// <param name="enableTraces">(Optional) Specifies whether traces should be enabled for the measurement(s).</param> /// <param name="selectorString">Pass an empty string. The signal name that is passed when creating the signal configuration is used. See the RFmx help for more documention of this parameter.</param> /// <param name="resultName">(Optional) Specifies the name to be associated with measurement results. Provide a unique name, such as "r1" to enable /// fetching of multiple measurement results and traces. See the RFmx help for more documentation of this parameter.</param> public static void SelectAndInitiateMeasurements(RFmxSpecAnMX specAn, RFmxSpecAnMXMeasurementTypes[] measurements, AutoLevelConfiguration autoLevelConfig = default, double autoLevelBandwidth_Hz = 200e3, bool enableTraces = false, string selectorString = "", string resultName = "") { // Aggregate the selected measurements into a single value // OR of 0 and x equals x RFmxSpecAnMXMeasurementTypes selectedMeasurements = 0; foreach (RFmxSpecAnMXMeasurementTypes measurement in measurements) { selectedMeasurements |= measurement; } specAn.SelectMeasurements(selectorString, selectedMeasurements, enableTraces); if (autoLevelConfig.Enabled) { specAn.AutoLevel(selectorString, autoLevelBandwidth_Hz, autoLevelConfig.MeasurementInterval_s, out double _); } // Initiate acquisition and measurement for the selected measurements specAn.Initiate(selectorString, resultName); }