protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var complexArray = (T[])objectProvider.GetObject(); double t0 = 0.0; double dt = 1.0; var wfm = ComplexWaveform <T> .FromArray1D(complexArray); double[] real = wfm.GetRealDataArray(true); double[] imag = wfm.GetImaginaryDataArray(true); LabVIEWVisualizers.ComplexWaveform(t0, dt, real, imag); }
public ComplexWaveform <ComplexDouble> createWaveform(List <PhaseAmplitudeOffset> offsets) { ComplexWaveform <ComplexDouble> complexWaveform; ComplexDouble[] IQData = new ComplexDouble[offsets.Count]; for (int i = 0; i < offsets.Count; i++) { IQData[i] = ComplexDouble.FromPolar((double)offsets[i].Amplitude, (double)offsets[i].Phase); } complexWaveform = ComplexWaveform <ComplexDouble> .FromArray1D(IQData); return(complexWaveform); }
public void TestConfigureLookUpTable() { LookUpTableConfiguration lutConfig = new LookUpTableConfiguration() { DutAverageInputPower_dBm = 10.0, // results in no scaling of iq data DutInputPower_dBm = new float[] { 1.0f, 3.0f, 2.0f, 4.0f }, SupplyVoltage_V = new float[] { 5.0f, 7.0f, 6.0f, 8.0f } }; Waveform referenceWaveform = new Waveform() { Data = ComplexWaveform <ComplexSingle> .FromArray1D(new ComplexSingle[] { ComplexSingle.FromSingle(0.5f), ComplexSingle.FromSingle(1.5f), ComplexSingle.FromSingle(2.5f), ComplexSingle.FromSingle(3.5f), ComplexSingle.FromSingle(4.5f) }) }; // p = 10log(i^2) + 10 // i = sqrt(10**(p - 10) / 10) var writableBuffer = referenceWaveform.Data.GetWritableBuffer(); for (int i = 0; i < referenceWaveform.Data.SampleCount; i++) { writableBuffer[i] = ComplexSingle.FromSingle((float)Math.Sqrt(Math.Pow(10.0, (writableBuffer[i].Real - 10.0) / 10.0))); } Waveform envelopeWaveform = CreateLookUpTableEnvelopeWaveform(referenceWaveform, lutConfig); ComplexSingle.DecomposeArrayPolar(envelopeWaveform.Data.GetRawData(), out float[] yi, out _); float[] solution = new float[] { 4.5f, 5.5f, 6.5f, 7.5f, 8.5f }; using (new AssertionScope()) { for (int i = 0; i < yi.Length; i++) { yi[i].Should().BeApproximately(solution[i], 0.1f); } } }
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); }