/// <summary>Configures common measurement settings for the personality.</summary> /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param> /// <param name="commonConfig">Specifies the common settings to apply.</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> public static void ConfigureCommon(RFmxWlanMX wlanSignal, CommonConfiguration commonConfig, string selectorString = "") { wlanSignal.SetSelectedPorts(selectorString, commonConfig.SelectedPorts); wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz); wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm); wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB); wlanSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalTriggerSource, RFmxWlanMXDigitalEdgeTriggerEdge.Rising, commonConfig.TriggerDelay_s, commonConfig.TriggerEnabled); }
public static TxPServoResults TxPServoPower(RFmxWlanMX wlanSignal, NIRfsg rfsgSession, TxPServoConfiguration servoConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "") { //Duplicate the existing configuration so that we can select only TxP for the power servo to save time, //but not disrupt all of the other user enabled measurements. wlanSignal.CloneSignalConfiguration("servo_txp", out RFmxWlanMX servoTxpSession); servoTxpSession.SelectMeasurements(selectorString, RFmxWlanMXMeasurementTypes.Txp, false); double[] servoTrace = new double[servoConfig.MaxNumberOfIterations]; double powerLevel = 0, outputPower = 0, margin = 0; bool servoSucess = false; for (int i = 0; i < servoConfig.MaxNumberOfIterations; i++) { if (autoLevelConfig.Enabled) { servoTxpSession.AutoLevel(selectorString, autoLevelConfig.MeasurementInterval_s); } servoTxpSession.Initiate(selectorString, ""); powerLevel = rfsgSession.RF.PowerLevel; servoTxpSession.Txp.Results.FetchMeasurement(selectorString, 10, out outputPower, out _); margin = servoConfig.TargetTxPPower_dBm - outputPower; servoTrace[i] = outputPower; if (Math.Abs(margin) <= servoConfig.Tolerance_dBm) //Servo complete; exit the loop { servoSucess = true; break; } else //Still more room to go { rfsgSession.RF.PowerLevel = powerLevel + margin; rfsgSession.Utility.WaitUntilSettled(1000); } } //If we auto-leveled we need to set the original configuration to the newly calculated ref level servoTxpSession.GetReferenceLevel(selectorString, out double newRefLevel); wlanSignal.ConfigureReferenceLevel(selectorString, newRefLevel); servoTxpSession.Dispose(); TxPServoResults servoResults = new TxPServoResults(); servoResults.FinalInputPower_dBm = powerLevel; servoResults.FinalOutputPower_dBm = outputPower; servoResults.ServoTrace = servoTrace; if (!servoSucess) { throw new System.TimeoutException("WLAN TxP Power Servo exceeded max iterations without success."); } return(servoResults); }
public static void ConfigureRF(ref RFmxWlanMX wlanSignal, CommonConfiguration commonConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "") { wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz); wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB); //Make sure all other parameters are configured before calling autolevel if (autoLevelConfig.AutoLevelReferenceLevel) { wlanSignal.AutoLevel(selectorString, autoLevelConfig.AutoLevelMeasureTime_s); } else { wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm); } }
public static void ConfigureCommon(RFmxInstrMX sessionHandle, RFmxWlanMX wlanSignal, CommonConfiguration commonConfig, AutoLevelConfiguration autoLevelConfig, string selectorString = "") { string instrModel; sessionHandle.ConfigureFrequencyReference("", commonConfig.FrequencyReferenceSource, 10e6); sessionHandle.GetInstrumentModel("", out instrModel); sessionHandle.SetLOSource("", commonConfig.LOSource); sessionHandle.SetDownconverterFrequencyOffset("", commonConfig.LOOffset); wlanSignal.ConfigureDigitalEdgeTrigger(selectorString, commonConfig.DigitalEdgeSource, commonConfig.DigitalEdgeType, commonConfig.TriggerDelay_s, commonConfig.EnableTrigger); wlanSignal.ConfigureFrequency(selectorString, commonConfig.CenterFrequency_Hz); wlanSignal.ConfigureExternalAttenuation(selectorString, commonConfig.ExternalAttenuation_dB); if (autoLevelConfig.AutoLevelReferenceLevel) { wlanSignal.AutoLevel(selectorString, autoLevelConfig.AutoLevelMeasureTime_s); } else { wlanSignal.ConfigureReferenceLevel(selectorString, commonConfig.ReferenceLevel_dBm); } }