private EmiAzimuthData GetEmiAzimuthData(EMIFileData emiData, double azimuth) { EmiAzimuthData emiAzimuthData = new EmiAzimuthData(); emiAzimuthData.Azimuth = azimuth; emiAzimuthData.StartFreq = double.MaxValue; emiAzimuthData.EndFreq = double.MinValue; emiAzimuthData.HorizontalSamples = new List<WatsEmiSample>(); emiAzimuthData.VerticalSamples = new List<WatsEmiSample>(); emiAzimuthData.ChannelDatas = new Dictionary<ChannelSetting, WatsEmiData>(); ChannelSetting curChannelSetting; WatsEmiData curData; foreach (DG_Type dataGroup in emiData.DataGroups) { if (dataGroup.DG_FB_Angle != azimuth) continue; if (dataGroup.DG_FB_Start < emiAzimuthData.StartFreq) emiAzimuthData.StartFreq = dataGroup.DG_FB_Start; if (dataGroup.DG_FB_End > emiAzimuthData.EndFreq) emiAzimuthData.EndFreq = dataGroup.DG_FB_End; foreach (DG_Data_Type data in dataGroup.DGDatas) { if (dataGroup.DB_FB_AntennaPolarization == 0) emiAzimuthData.VerticalSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else //if (dataGroup.DB_FB_AntennaPolarization == 1) emiAzimuthData.HorizontalSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); curChannelSetting = null; foreach (ChannelSetting channelSetting in mChannelSettings) { if (data.DG_DI_Freq >= channelSetting.StartFreq && data.DG_DI_Freq <= channelSetting.EndFreq || data.DG_DI_Freq >= channelSetting.Pair.StartFreq && data.DG_DI_Freq <= channelSetting.Pair.EndFreq) { curChannelSetting = channelSetting; break; } } if (curChannelSetting == null) continue; if (!emiAzimuthData.ChannelDatas.TryGetValue(curChannelSetting, out curData)) { curData = new WatsEmiData(); emiAzimuthData.ChannelDatas.Add(curChannelSetting, curData); } if (dataGroup.DB_FB_AntennaPolarization == 0) { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mVSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mVPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } else { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mHSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mHPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } } } return emiAzimuthData; }
public void Init() { mEmiAzimuthDataA = GetEmiAzimuthData(mEmiA, mAzimuthA); mEmiAzimuthDataB = GetEmiAzimuthData(mEmiB, mAzimuthB); mAvailableChannels = GetAvailableChannels(); }