/// <summary> /// Convert the Pd0 Correlation data type to the RTI Correlation data set. /// </summary> /// <param name="corr">PD0 Correlation.</param> /// <param name="numRepeats">Number of code repeats from the fixed leader.</param> public void DecodePd0Ensemble(Pd0Correlation corr, float numRepeats) { NumElements = corr.NumDepthCells; ElementsMultiplier = corr.NumBeams; if (corr.Correlation != null) { CorrelationData = new float[corr.Correlation.GetLength(0), corr.Correlation.GetLength(1)]; // PD0 is 0.5 dB per count for (int bin = 0; bin < corr.Correlation.GetLength(0); bin++) { for (int beam = 0; beam < corr.Correlation.GetLength(1); beam++) { // Remap only for 4 beam systems int newBeam = 0; if (corr.Correlation.GetLength(1) >= 4) { // PD0 beam order 3,2,0,1 switch (beam) { case 3: newBeam = 0; break; case 2: newBeam = 1; break; case 0: newBeam = 2; break; case 1: newBeam = 3; break; } } else { newBeam = beam; } //CorrelationData[bin, beam] = corr.Correlation[bin, newBeam] / 255.0f; // Check if numRepeats = 0 if (numRepeats == 0) { numRepeats = 1; } // Constant used in WH to normalize the value based off the number of repeats // Then normalize the value to 128 being the max float n = ((numRepeats - 1.0f) / numRepeats); // Check if n = 0 if (n == 0) { n = 1.0f; } CorrelationData[bin, beam] = (corr.Correlation[bin, newBeam] / 128.0f) * n; } } } }
/// <summary> /// Convert the Pd0 Correlation data type to the RTI Correlation data set. /// </summary> /// <param name="corr">PD0 Correlation.</param> /// <param name="numRepeats">Number of code repeats from the fixed leader.</param> public void DecodePd0Ensemble(Pd0Correlation corr, float numRepeats) { if (corr.Correlation != null) { CorrelationData = new float[corr.Correlation.GetLength(0), corr.Correlation.GetLength(1)]; // PD0 is 0.5 dB per count for (int bin = 0; bin < corr.Correlation.GetLength(0); bin++) { for (int beam = 0; beam < corr.Correlation.GetLength(1); beam++) { // PD0 beam order 3,2,0,1 int newBeam = 0; switch (beam) { case 3: newBeam = 0; break; case 2: newBeam = 1; break; case 0: newBeam = 2; break; case 1: newBeam = 3; break; } //CorrelationData[bin, beam] = corr.Correlation[bin, newBeam] / 255.0f; // Check if numRepeats = 0 if (numRepeats == 0) { numRepeats = 1; } // Constant used in WH to normalize the value based off the number of repeats // Then normalize the value to 128 being the max float n = ((numRepeats - 1.0f) / numRepeats); // Check if n = 0 if (n == 0) { n = 1.0f; } CorrelationData[bin, beam] = (corr.Correlation[bin, newBeam] / 128.0f) * n ; } } } }