public ComplexWaveform <ComplexSingle> ConvertComplexSingleToNiComplexWaveformFormat(ComplexSingle[] data, double sRate) { double absoluteInitialX = 0; // -0.000005; double IQmag = 0, IQmax = 0; double[] arrMag = new double[data.Length]; ComplexWaveform <ComplexSingle> target = new ComplexWaveform <ComplexSingle>(data.Length); var targetBuffer = target.GetWritableBuffer(); for (int i = 0; i < data.Length; i++) { targetBuffer[i] = new ComplexSingle(data[i].Real, data[i].Imaginary); IQmag = Math.Sqrt(Math.Pow(data[i].Real, 2) + Math.Pow(data[i].Imaginary, 2)); arrMag[i] = IQmag; if (IQmag > 1.0) { //Console.WriteLine("IQmag = " + IQmag.ToString() + "\nArrayElement = " + i.ToString()); if (IQmag > IQmax) { IQmax = IQmag; } } } target.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval( new PrecisionTimeSpan(1.0 / sRate), new PrecisionTimeSpan(absoluteInitialX)); Console.WriteLine("IQmax = " + IQmax.ToString()); return(target); }
public void writeWaveform(ComplexWaveform <ComplexDouble> IQdata) //input is complex waveform that was created using createWaveform(offsets); { //rest of code to write offsets ComplexWaveform <ComplexDouble> NewIQData = new ComplexWaveform <ComplexDouble>(numSamples); //List<PhaseAmplitudeOffset> offsetList = new List<PhaseAmplitudeOffset>(); PrecisionTimeSpan dt = PrecisionTimeSpan.FromSeconds(1 / actualIQRate); IQdata.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval(dt); _rfsgSession.Arb.WriteWaveform("", IQdata); _rfsgSession.Initiate(); //ComplexWaveform<ComplexDouble> IQdata }
public void TestOfflineAnalysisSingleCarrierTdd() { RFmxInstrMX instr = new RFmxInstrMX("", "AnalysisOnly=1"); RFmxLteMX lte = instr.GetLteSignalConfiguration(); ConfigureCommon(lte, CommonConfiguration.GetDefault()); StandardConfiguration signalConfig = StandardConfiguration.GetDefault(); signalConfig.DuplexScheme = RFmxLteMXDuplexScheme.Tdd; ConfigureStandard(lte, signalConfig); ModAccConfiguration modAccConfig = ModAccConfiguration.GetDefault(); modAccConfig.MeasurementOffset = 4; ConfigureModAcc(lte, modAccConfig); lte.Commit(""); instr.GetRecommendedIQPreTriggerTime("", out double pretriggerTime); PrecisionTimeSpan timeOffset = new PrecisionTimeSpan(-pretriggerTime); Waveform wfm = LoadWaveformFromTDMS(@"Support Files\LTE_TDD_2.0.tdms"); Buffer <ComplexSingle> readBuffer = wfm.Data.GetBuffer(true); WritableBuffer <ComplexSingle> writeBuffer = wfm.Data.GetWritableBuffer(); int sampleOffset = (int)Math.Round(pretriggerTime * wfm.SampleRate); for (int i = 0; i < readBuffer.Size; i++) { writeBuffer[i] = readBuffer[(i - sampleOffset + readBuffer.Size) % readBuffer.Size]; } wfm.Data.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval( wfm.Data.PrecisionTiming.SampleInterval, timeOffset); lte.AnalyzeIQ("", "", wfm.Data, true, out _); ModAccResults modAccResults = FetchModAcc(lte); instr.Close(); Assert.IsTrue(modAccResults.ComponentCarrierResults[0].MeanRmsCompositeEvm < 0.001); }
public PowerServoTest[] BuildPwrServoTest(string strWaveform, string strWaveformName, S_NoiseConfig[] noiseConfig) { var pwrServoSite = new PowerServoTest[testSite]; for (int i = 0; i < testSite; i++) { #region Load waveform (CW or from file) ComplexDouble[] iqDataArr; s_SignalType value = new s_SignalType(); Get_s_SignalType(strWaveform, strWaveformName, out value); if (value.signalMode == "CW") { iqDataCW_Array(out iqDataArr); } else { iqData_Array(value.SG_IPath, value.SG_QPath, out iqDataArr); } var iqWaveform = ComplexWaveform <ComplexDouble> .FromArray1D(iqDataArr); iqWaveform.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval(new PrecisionTimeSpan(1 / value.SG_IQRate)); #endregion //pass configuration to Contact global config pwrServoSite[i] = new PowerServoTest( VST[i], waveformName: strWaveformName, waveform: iqWaveform, centerFrequency: noiseConfig[i].TXFrequencyStart, powerLevel: noiseConfig[i].SGPowerLevel ); } return(pwrServoSite); }
public NoiseFloorTest[] BuildNFTest(string strWaveform, string strWaveformName, S_NoiseConfig[] noiseConfig) { var nfSite = new NoiseFloorTest[testSite]; for (int i = 0; i < testSite; i++) { #region decode and re-arrange multiple bandwidth (Ascending) int multiRBW_cnt = 0; int bw_cnt = 0; double[] multiRBW_Hz = new double[noiseConfig[i].Bandwidths.Length]; Array.Sort(noiseConfig[i].Bandwidths); foreach (double key in noiseConfig[i].Bandwidths) { multiRBW_Hz[bw_cnt] = Convert.ToDouble(key); bw_cnt++; } multiRBW_cnt = multiRBW_Hz.Length; noiseConfig[i].Rbw = multiRBW_Hz[multiRBW_cnt - 1]; //the largest RBW is the last in array #endregion #region Load waveform (CW or from file) ComplexDouble[] iqDataArr; s_SignalType value = new s_SignalType(); Get_s_SignalType(strWaveform, strWaveformName, out value); if (value.signalMode == "CW") { iqDataCW_Array(out iqDataArr); } else { iqData_Array(value.SG_IPath, value.SG_QPath, out iqDataArr); } var iqWaveform = ComplexWaveform <ComplexDouble> .FromArray1D(iqDataArr); iqWaveform.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval(new PrecisionTimeSpan(1 / value.SG_IQRate)); #endregion //pass configuration to Contact global config nfSite[i] = new NoiseFloorTest( VST[i], waveformName: strWaveformName, waveform: iqWaveform, numberOfRuns: noiseConfig[i].NumberOfRuns, band: noiseConfig[i].Band, dwellTime: noiseConfig[i].DwellTime, soakTime: noiseConfig[i].SoakTime, soakFrequency: noiseConfig[i].TXFrequencyStart, preSoakSweep: noiseConfig[i].preSoakSweep, txStartFrequency: noiseConfig[i].TXFrequencyStart, txStopFrequency: noiseConfig[i].TXFrequencyStop, frequencyStep: noiseConfig[i].TXFrequencyStep, rxStartFrequency: noiseConfig[i].RXFrequencyStart, rxStopFrequency: noiseConfig[i].RXFrequencyStop, saReferenceLevel: noiseConfig[i].SAReferenceLevel, sgPowerLevel: noiseConfig[i].SGPowerLevel, vbw: noiseConfig[i].Vbw ); nfSite[i].bandwidths = multiRBW_Hz; } return(nfSite); }