public override FrequencyBand[] GetBands(SamplesResolution resolution) { var diapasons = new FrequencyBand[_milestones.Length + 1]; var coefficient = (float)resolution / MaximalFrequency; Debug.Log("Band shrink coefficient: " + coefficient); var min = Mathf.FloorToInt(MinimalFrequency * coefficient); var max = Mathf.FloorToInt(MaximalFrequency * coefficient); _milestones = Sort(_milestones); var previousMilestone = min; for (var i = 0; i <= _milestones.Length; i++) { if (i == _milestones.Length) { diapasons[i] = new FrequencyBand(previousMilestone, max); Debug.Log("Created diapason: #" + i + ": " + diapasons[i].Min + " - " + diapasons[i].Max); } else { var shrankValue = _milestones[i].GetShrankValue(coefficient); diapasons[i] = new FrequencyBand(previousMilestone, shrankValue); previousMilestone = shrankValue; Debug.Log("Created diapason #" + i + ": " + diapasons[i].Min + " - " + diapasons[i].Max); } } return(diapasons); }
public void CustomAverages(FrequencyBand[] customFrequencyBands) { this.whichAverage = WhichAverage.custom; this.customFrequencyBands = customFrequencyBands; averages = new float[customFrequencyBands.Length]; }
private void SmoothenFrequencyBands() { for (int i = 0; i < _frequencyBands.Length; ++i) { FrequencyBand band = _frequencyBands[i]; if (band.frequency > band.smoothedFrequency) { band.smoothedFrequency = band.frequency; band.smoothing = frequencySmoothing; } if (band.frequency < band.smoothedFrequency) { band.smoothedFrequency -= band.smoothing; band.smoothing *= frequencySmoothingMultiplier; if (band.smoothing < 0) { band.smoothing = 0; } } if (band.frequency > band.maxFrequency) { band.maxFrequency = band.frequency; } band.mappedFrequency = band.frequency / band.maxFrequency; band.smoothedMappedFrequency = band.smoothedFrequency / band.maxFrequency; _frequencyBands[i] = band; } }
private void scanMarkersMenu_Click(object sender, EventArgs e) { if (!ScanFrequenciesEnabled) { ScanStartFreq = 0; ScanEndFreq = 0; ScanFrequencies.Clear(); foreach (FrequencyMarker marker in MarkerList.Markers) { ScanFrequencies.AddLast(marker); } CurrentScanFreq = ScanFrequencies.First; ChannelBandDetails = new FrequencyBand(); ScanStrongestFrequency = true; ScanFrequenciesEnabled = true; if (!FitSpectrum) { fitSpectrumMenu_Click(null, null); } } else { ScanFrequenciesEnabled = false; } scanBandMenu.Checked = false; scanBandMenu.Enabled = !ScanFrequenciesEnabled; scanChannelsMenu.Checked = false; scanChannelsMenu.Enabled = !ScanFrequenciesEnabled; scanMarkersMenu.Checked = ScanFrequenciesEnabled; scanMarkersMenu.Enabled = true; }
private void CreateLevelObjects(GameObject levelObjectPrefab, FrequencyBand band, ref LevelFeature feature) { int iterationsSinceLast = 0; feature.AdjustForJumpDistance(physicsModel.jumpDistance); feature.CalculateSpaceIndexes(spacingBetweenSamples); for (int i = 0; i < band.spectralFluxSamples.Count; i++) { SpectralFluxData sample = band.spectralFluxSamples[i]; if (sample.isOnset && (iterationsSinceLast >= feature.preSpaceIndex || feature.placeAdjacent)) { LevelObject levelObject = LevelObjectAtPosition(i); if (levelObject == null) { levelObject = new LevelObject(); levelObject.gameObject = Instantiate(levelObjectPrefab, new Vector2(i * spacingBetweenSamples + feature.offset, levelTransform.position.y), Quaternion.identity, levelTransform); levelObject.feature = feature; levelObject.songPositionIndex = i; levelObjects.Add(levelObject); } iterationsSinceLast = 0; } else { iterationsSinceLast++; } } }
public void UpdateAll() { tuning = tuningSlider.value; band = bands[bandIndex]; frequencyRangeIndicator.text = bandNames[bandIndex]; //TODO: update shit in space. }
/// <summary> /// 获取频段所属国家 /// </summary> /// <param name="MaxFre">表示最小频率的一个字节</param> /// <param name="MinFre">表示最大频率的一个字节</param> /// <returns></returns> public static string GetBandCountry(byte MinFre, byte MaxFre) { byte bandByte = (byte)((MaxFre & 0xC0) >> 4 | MinFre >> 6); FrequencyBand country = (FrequencyBand)bandByte; return(CodeInterpret.BandCountrySet[country]); }
/// <summary> ///获取每个发射机的频段信息 /// </summary> public static List <FrequencyBand> GetTxFrequenceBand(string txpath, string setuppath, int txindex) { List <FrequencyBand> TxFrequenceBand = new List <FrequencyBand>(); List <TxObject> txs = TxReader(txpath); SetupObject setupfile = SetupFileProceed.GetSetupFile.GetSetup(setuppath); WaveformStp txwaveform = GetTxWaveForm(txs[txindex], setupfile); if (txwaveform.type == null) { throw new Exception("波形信息错误"); } if (txwaveform.type == "Sinusoid") { if (txwaveform.bandwidth < 2) { FrequencyBand temp = new FrequencyBand((int)(txwaveform.CarrierFrequency - 1), (int)(txwaveform.CarrierFrequency + 1), (txs[txindex].at.power)); TxFrequenceBand.Add(temp); } else { FrequencyBand temp = new FrequencyBand((int)(txwaveform.CarrierFrequency - txwaveform.bandwidth / 2), (int)(txwaveform.CarrierFrequency + txwaveform.bandwidth / 2), (txs[txindex].at.power)); TxFrequenceBand.Add(temp); } } else { psd TxDivFrequence = new psd(txwaveform.type, txwaveform.PulseWidth, (long)txwaveform.CarrierFrequency, txwaveform.Rolloff, txwaveform.FrequencyVariation, txwaveform.StartFrequency, txwaveform.StopFrequency); DivFrequency Frequencyinfo = TxDivFrequence.GetFandPSD(); TxFrequenceBand = GetBandInformation((txs[txindex].at.power), Frequencyinfo); } return(TxFrequenceBand); }
public override FrequencyBand[] GetBands(SamplesResolution resolution) { var coefficient = (float)resolution / MaximalFrequency; Debug.Log("Band shrink coefficient: " + coefficient); var min = Mathf.FloorToInt(MinimalFrequency * coefficient); var max = Mathf.FloorToInt(MaximalFrequency * coefficient); var diapasons = RangeFrequency(min, max); Debug.Log("Diapasons: " + diapasons.Length); var previousMilestone = min; for (var i = 0; i <= _milestones.Count; i++) { if (i == _milestones.Count) { // Creating last diapason diapasons[i] = new FrequencyBand(previousMilestone, max); Debug.Log("Created diapason: #" + i + ": " + diapasons[i].Min + " - " + diapasons[i].Max); } else { var shrankValue = _milestones[i].FrequencyValue; diapasons[i] = new FrequencyBand(previousMilestone, shrankValue); previousMilestone = shrankValue; Debug.Log("Created diapason #" + i + ": " + diapasons[i].Min + " - " + diapasons[i].Max); } } return(diapasons); }
void Start() { band = FrequencyBand.VISIBLE; bandIndex = 2; tuning = 0.5f; tuningSlider = GameObject.Find("ConsoleSlider").GetComponent <Slider>(); frequencyRangeIndicator = GameObject.Find("FBandIndicatorText").GetComponent <Text>(); }
public List <FlightSoundCircles> CalculateFlightSound( FlightSoundCalculationInputData id, List <double> SoundLevels, RadiusInterval RadiusInterval, FrequencyBand FrequencyBand) { return(flightNoiseModel.Calculate(id, SoundLevels, RadiusInterval, FrequencyBand)); }
/// <summary> /// 返回指定国家频段的最大值 /// </summary> /// <param name="country">国家</param> /// <returns></returns> public static double GetMaxFrequency(FrequencyBand country) { BandParameter para = band.Where(c => c.Country == country).First(); double minFre = para.MinFrequency; double intervalCount = para.IntervalCount; double interval = para.Interval; return(minFre + intervalCount * interval); }
public void OpenFlightNoiseInputData( string FileName, out FlightSoundCalculationInputData id, out Dictionary <double, Color> SoundLevels, out RadiusInterval RadiusInterval, out FrequencyBand FrequencyBand) { flightNoiseModel.Open(FileName, out id, out SoundLevels, out RadiusInterval, out FrequencyBand); }
public void SaveFlightNoiseInputData( string FileName, FlightSoundCalculationInputData id, Dictionary <double, Color> SoundLevels, RadiusInterval RadiusInterval, FrequencyBand FrequencyBand) { flightNoiseModel.Save(FileName, id, SoundLevels, RadiusInterval, FrequencyBand); }
private void CreateOnsetIndicators(FrequencyBand band) { for (int i = 0; i < band.spectralFluxSamples.Count; i++) { if (band.spectralFluxSamples[i].isOnset) { Instantiate(onsetMarkerPrefab, new Vector2(i * spacingBetweenSamples, levelTransform.position.y), Quaternion.identity, onsetHolder); } } }
void DrawFrequencyBands() { DrawHeader("Beat Frequency Bands"); int indexToDelete = -1; for (int i = 0; i < detector.subBands.Count; i++) { FrequencyBand band = detector.subBands[i]; EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString()); float frequency; EditorGUI.BeginChangeCheck(); frequency = EditorGUILayout.FloatField(band.lowerFrequency); EndChangeCheck(() => { band.lowerFrequency = frequency; }); EditorGUI.BeginChangeCheck(); frequency = EditorGUILayout.FloatField(band.higherFrequency); EndChangeCheck(() => { band.higherFrequency = frequency; }); if (GUILayout.Button("X", EditorStyles.miniButton)) { indexToDelete = i; } EditorGUILayout.EndHorizontal(); } if (indexToDelete >= 0) { Undo.RecordObject(detector, "Deleted a band in the beat dector"); detector.subBands.RemoveAt(indexToDelete); } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add BeatBand")) { detector.subBands.Add(new FrequencyBand()); } if (GUILayout.Button("Beat Band Editor")) { SpectogramWindow.OpenWindow(detector); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); }
private void scanChannelsMenu_Click(object sender, EventArgs e) { if (!DeviceOpened) { return; } if (!ScanFrequenciesEnabled) { FrequencyBand band = new FrequencyBand(); band.BaseFrequency = 935014000; band.ChannelStart = 2; band.ChannelEnd = 124; band.ChannelDistance = 200000; FrequencyBandDetailsDialog dlg = new FrequencyBandDetailsDialog(band); if (dlg.ShowDialog() == DialogResult.OK) { ScanStartFreq = 0; ScanEndFreq = 0; ScanFrequencies.Clear(); for (long channel = band.ChannelStart; channel <= band.ChannelEnd; channel++) { ScanFrequencies.AddLast(new FrequencyMarker("Ch. " + channel, "", band.BaseFrequency + (channel - band.ChannelStart) * band.ChannelDistance)); } CurrentScanFreq = ScanFrequencies.First; ChannelBandDetails = band; ScanStrongestFrequency = false; ScanFrequenciesEnabled = true; if (!FitSpectrum) { fitSpectrumMenu_Click(null, null); } } else { ScanFrequenciesEnabled = false; } } else { ScanFrequenciesEnabled = false; } scanBandMenu.Checked = false; scanBandMenu.Enabled = !ScanFrequenciesEnabled; scanChannelsMenu.Checked = ScanFrequenciesEnabled; scanChannelsMenu.Enabled = true; scanMarkersMenu.Checked = false; scanMarkersMenu.Enabled = !ScanFrequenciesEnabled; }
void DrawSidebar() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Visualise Bands"); visualiseBands = EditorGUILayout.Toggle(visualiseBands); GUILayout.EndHorizontal(); GUILayout.Label("Beat Bands"); int indexToDelete = -1; Color standardColor = GUI.color; for (int i = 0; i < detector.subBands.Count; i++) { FrequencyBand band = detector.subBands[i]; int colorIndex = i % settings.bandColors.Length; GUI.color = settings.bandColors[colorIndex]; GUILayout.BeginHorizontal(); GUILayout.Label(i.ToString()); float frequency; EditorGUI.BeginChangeCheck(); frequency = EditorGUILayout.FloatField(band.lowerFrequency); EndChangeCheck(() => { band.lowerFrequency = frequency; }); EditorGUI.BeginChangeCheck(); frequency = EditorGUILayout.FloatField(band.higherFrequency); EndChangeCheck(() => { band.higherFrequency = frequency; }); if (GUILayout.Button("X", EditorStyles.miniButton)) { indexToDelete = i; } GUILayout.EndHorizontal(); } if (indexToDelete >= 0) { Undo.RecordObject(detector, "Deleted a band in the beat dector"); detector.subBands.RemoveAt(indexToDelete); } GUI.color = standardColor; GUILayout.EndVertical(); }
public void GenerateVisualiserFromSamples(FrequencyBand[] frequencyBands, float _songTime) { for (int i = 0; i < 4; i++) { FrequencyBandVisualisers[i].seperator.gameObject.SetActive(i < frequencyBands.Length); } for (int b = 0; b < frequencyBands.Length; b++) { FrequencyBand band = frequencyBands[b]; FrequencyBandVisualisers[b].parent.position = new Vector3(0f, 0f, 0f); previousPlotTransform = null; foreach (Transform child in FrequencyBandVisualisers[b].parent) { GameObject.Destroy(child.gameObject); } for (int i = 0; i < band.spectralFluxSamples.Count; i++) { SpectralFluxData sample = band.spectralFluxSamples[i]; PlotPoint spectralPoint = Instantiate(plotPoint, new Vector2(i * spacingBetweenSamples, sample.spectralFlux * FrequencyBandVisualisers[b].heightMultiplier), Quaternion.identity, FrequencyBandVisualisers[b].parent); spectralPoint.spriteRenderer.color = sample.isOnset ? peakColor : plotColor; if (previousPlotTransform != null) { spectralPoint.connectingPlotTransform = previousPlotTransform; } previousPlotTransform = spectralPoint.transform; } float screenHeight = 12.6f; float distanceBetweenBands = screenHeight / frequencyBands.Length; float offsetSpace = distanceBetweenBands * bandOffsetMultiplier; float initialOffset = (screenHeight / 2) - distanceBetweenBands + offsetSpace; FrequencyBandVisualisers[b].parent.position = new Vector3(0f, initialOffset - (distanceBetweenBands * b), 0f); Vector2 anchorMin = FrequencyBandVisualisers[b].seperator.anchorMin; Vector2 anchorMax = FrequencyBandVisualisers[b].seperator.anchorMax; anchorMin.Set(anchorMin.x, (b) * (1f / frequencyBands.Length)); anchorMax.Set(anchorMax.x, (b + 1f) * (1f / frequencyBands.Length)); FrequencyBandVisualisers[b].seperator.anchorMin = anchorMin; FrequencyBandVisualisers[b].seperator.anchorMax = anchorMax; } levelLength = (frequencyBands[0].spectralFluxSamples.Count * spacingBetweenSamples); songTime = _songTime; }
public void OpenFlightNoiseInputData // Метод, пределяющий исходные данные для расчёта уровня шума в полёте из файла ( XmlDocument xmlDoc, // Файл .xml и исходными данными out FlightSoundCalculationInputData id, // Переменная, в которую записываются основные исходные данные out Dictionary <double, Color> SoundLevels, // Переменная, в которую записывается словарь, ключи которого -- уровни шума в слышимом диапазоне, значения -- цвет отображения геометрического места точек out RadiusInterval RadiusInterval, // Область расчёта геометрическое место точек, в которых уровни шума в слышиомом диапазоне равны ключам словаря SoundLevels out FrequencyBand FrequencyBand // Спектр частот ) { flightNoiseModel.Open(xmlDoc, out id, out SoundLevels, out RadiusInterval, out FrequencyBand); }
public static int BandIndex(FrequencyBand band) { for (int i = 0; i < bands.Length; i++) { if (band == bands[i]) { return(i); } } return(-1); }
public ScanBandDialog(FrequencyBand band) { InitializeComponent(); AcceptButton = btnOk; Band = band; StartFrequency = band.BaseFrequency; EndFrequency = band.BaseFrequency; UpdateDetails(); }
/// <summary> ///从setup中获取发射机波形信息 /// </summary> private static List <FrequencyBand> GetBandInformation(double power, DivFrequency Frequencyinfo) { List <FrequencyBand> TxFrequencyBand = new List <FrequencyBand>(); for (int i = 0; i < 7; i++) { double divPower = (power * Frequencyinfo.proportion[i]); FrequencyBand param = new FrequencyBand((int)(Frequencyinfo.startFre[i] / 1000000), (int)(Frequencyinfo.endFre[i] / 1000000), divPower); TxFrequencyBand.Add(param); } return(TxFrequencyBand); }
protected override FrequencyBand GetDefauleFrequencyBandObj() { FrequencyBand band = new FrequencyBand(); band.Name = string.Empty; band.BandWidth = 0.2f; band.StartChIndex = 1; band.EndChIndex = 0x7c; band.DLFrequency = 935f; band.ULFrequency = 935f; band.BandNumber = base.GetDefaultFreqBandNumber(); return band; }
/// <summary> /// 获取频率范围,用于设置读写器工作频率,必须两个参数同时使用才能知晓是哪个频段 /// </summary> /// <param name="MaxFre">表示最小频率的一个字节</param> /// <param name="MinFre">表示最大频率的一个字节</param> /// <returns></returns> public static Tuple <double, double> GetFrequencyRange(byte MinFre, byte MaxFre) { byte bandByte = (byte)((MaxFre & 0xC0) >> 4 | MinFre >> 6); FrequencyBand country = (FrequencyBand)bandByte; int max = MaxFre & 0x3F; int min = MinFre & 0x3F; BandParameter para = band.Where(c => c.Country == country).First(); double maxF = para.MinFrequency + max * para.Interval; double minF = para.MinFrequency + min * para.Interval; return(Tuple.Create(minF, maxF)); }
protected override FrequencyBand GetDefauleFrequencyBandObj() { FrequencyBand band = new FrequencyBand(); band.Name = string.Empty; band.BandWidth = 5f; band.StartChIndex = 0; band.EndChIndex = 1; band.DLFrequency = 1900f; band.ULFrequency = 1900f; band.DuplexingMethod = FrequencyBand.eDupMethod.FDD; band.BandNumber = base.GetDefaultFreqBandNumber(); return band; }
public FrequencyBandDetailsDialog(string title, FrequencyBand band) { this.Text = title; this.band = band; InitializeComponent(); txtBaseFreq.Frequency = band.BaseFrequency; txtLabel.Text = band.Label; txtChannelDist.Frequency = band.ChannelDistance; txtChannelWidth.Frequency = band.ChannelWidth; txtChannelStart.Value = band.ChannelStart; txtChannelEnd.Value = band.ChannelEnd; }
} // Спектр частот public FireTestNoiseCalculationInputData( double Thrust, FlowParameters FlowParameters, List <WeatherParameters> WeatherParameters, RadiusInterval RadiusInterval, FrequencyBand FrequencyBand) : this() { this.Thrust = Thrust; this.FlowParameters = FlowParameters; this.WeatherParameters = WeatherParameters; this.RadiusInterval = RadiusInterval; this.FrequencyBand = FrequencyBand; }
public void Init() { IProject project = new MockProject(); ProjectSingleton.CurrentProject = project; IGeoProvider Geo = new MockGeoProvider(); ProjectSingleton.CurrentProject.AppContext.RegisterService(Geo); m_Target = new CalcCellToCellLinkLoss(ProjectSingleton.CurrentProject.AppContext); m_CellFrom = new MockIACell(); m_CellTo = new MockIACell(); FrequencyBand fromBand = new FrequencyBand(); fromBand.DLFrequency = 900; m_CellFrom.FreqBand = fromBand; Transceiver fromParent = new Transceiver(); IASite fromSite = new Site(); fromSite.X = 0; fromSite.Y = 0; fromParent.setParent(fromSite); //List<AntConfig> fromConfigs = new List<AntConfig>(); AntConfig fromConfig1 = new AntConfig(); fromConfig1.OutdoorAntenna = new AntennaEntity(); fromConfig1.AntType = 1; fromConfig1.Height = 30; fromConfig1.SectorID = 0; //fromConfigs.Add(fromConfig1); fromParent.addAntConfig(fromConfig1); m_CellFrom.setParent(fromParent, m_CellFrom); FrequencyBand toBand = new FrequencyBand(); toBand.DLFrequency = 905; m_CellTo.FreqBand = toBand; Transceiver toParent = new Transceiver(); IASite toSite = new Site(); toSite.X = 4; toSite.Y = 3; toParent.setParent(toSite); AntConfig toConfig = new AntConfig(); toConfig.OutdoorAntenna = new AntennaEntity(); toConfig.AntType = 1; toConfig.Height = 25; toConfig.SectorID = 0; toParent.addAntConfig(toConfig); m_CellTo.setParent(toParent, m_CellTo); }
private void CreateLightingEvents(FrequencyBand band) { lightingEvents = new List <LightingEventData>(); for (int i = 0; i < band.spectralFluxSamples.Count; i++) { SpectralFluxData sample = band.spectralFluxSamples[i]; if (sample.isOnset) { lightingEvents.Add(new LightingEventData(i)); } } }
private void FindFrequencyBands() { //int fff = 0; float hzPerBin = (SampleRate / 2f) / sampleCount; //Debug.Log($"Hz per Bin: {hzPerBin}"); for (int i = 0; i < _frequencyBands.Length; i++) { /* * int start = (int)Mathf.Pow(2, i) - 1; //-1 because 2^0 == 1 so Index 0 is not captured * int end = (start + 1) + start; * float average = 0f; * for (int k = start; k < end; k++) * average += spectrum[k] * (k + 1); * average /= start + 1; * * /* * float avg = 0f; * int c = (int)Mathf.Pow(2, i) * 2; * if (i == _frequencyBands.Length - 1) * c += 2; * for (int k = 0; k < c; k++) * { * avg += spectrum[fff] * (fff + 1); * fff++; * } * * avg /= fff; */ int s = (int)Mathf.Pow(2, i) - 1; int e = s + s + 1; float avg = 0f; for (int k = s; k < e; k++) { avg += FFTSpectrumDataChannel0[s] * (k + 1); } avg /= s + 1; FrequencyBand band = _frequencyBands[i]; band.frequencyRange = new Range(s * hzPerBin, e * hzPerBin); band.frequency = avg * sampleScalar; //band.smoothedFrequency = Mathf.MoveTowards(band.smoothedFrequency, band.frequency, frequencySmoothing * Time.deltaTime); _frequencyBands[i] = band; } }
private bool CheckMappingDataValid(FrequencyBand freqBand, ref string info) { for (int i = 0; i < (this.channelDgv.RowCount - 1); i++) { if (!this.ValidateRowByRowIndex(i, ref info)) { return false; } if (!freqBand.AvailableChIndexList.Contains(this.ParseStringToInt(this.channelDgv.Rows[i].Cells["channelIndex"].Value))) { info = NEResource.NE_INVALID_FIELD + NEResource.NE_CHANNEL_INDEX; return false; } } return true; }
public SaveFireTestNoiseInputDataEventArgs( string FileName, double Thrust, FlowParameters FlowParameters, List <WeatherParameters> WeatherParameters, Dictionary <double, Color> SoundLevels, RadiusInterval RadiusInterval, FrequencyBand FrequencyBand) { this.FileName = FileName; this.Thrust = Thrust; this.FlowParameters = FlowParameters; this.WeatherParameters = WeatherParameters; this.SoundLevels = SoundLevels; this.RadiusInterval = RadiusInterval; this.FrequencyBand = FrequencyBand; }
private void SetCarriers(List<LTECell> sCarrier, List<LTECell> nCarrier, int chnIndex, FrequencyBand frqBand) { foreach (LTECell cell in this.m_CarrierList) { bool flag = (frqBand == cell.FreqBand) && (chnIndex == cell.ChannelIndex); bool flag2 = (frqBand == cell.FreqBand) && ((chnIndex == (cell.ChannelIndex - 1)) || (chnIndex == (cell.ChannelIndex + 1))); if (flag) { this.m_sfcellidlist.Add(cell.getParent().ID); sCarrier.Add(cell); } else if (flag2) { this.m_nfcellidlist.Add(cell.getParent().ID); nCarrier.Add(cell); } } }
//Calculate total positive changes in a freqeuncy band in the spectrum data float CalculateRectifiedSpectralFlux(FrequencyBand band) { float sum = 0f; for (int i = 0; i < numberOfSamples; i++) { //Seperate the spectral flux into frequency band //Current frequency of index < percentage of the max frequency provided by the FFT float indexFrequency = i * frequencyPerIndex; if (band.lowerBoundary < indexFrequency && indexFrequency < band.upperBoundary) { sum += Mathf.Max(0f, currentSpectrum[i] - previousSpectrum[i]); } } return(sum); }
private static void InitCell(out IACell cell1, out IACell cell2) { cell1 = new MockACell(); cell1.ID = 1; FrequencyBand Fre1 = new FrequencyBand(); Fre1.DLFrequency = 900; cell1.FreqBand = Fre1; Transceiver Trans1 = new Transceiver(); IASite Site1 = new Site(); Site1.X = 0; Site1.Y = 0; ((Site)Site1).Equipment = new BtsEquipment(); Trans1.setParent(Site1); AntConfig Ant1 = new AntConfig(); Ant1.OutdoorAntenna = new AntennaEntity(); Ant1.AntType = 1; Ant1.Height = 25; Ant1.SectorID = 0; Ant1.IsMainAnt = true; Trans1.addAntConfig(Ant1); cell1.setParent(Trans1, cell1); cell2 = new MockACell(); cell2.ID = 2; FrequencyBand Fre2 = new FrequencyBand(); Fre2.DLFrequency = 925; cell2.FreqBand = Fre2; Transceiver Trans2 = new Transceiver(); IASite Site2 = new Site(); Site2.X = 10; Site2.Y = 10; ((Site)Site2).Equipment = new BtsEquipment(); Trans2.setParent(Site2); AntConfig Ant2 = new AntConfig(); Ant2.OutdoorAntenna = new AntennaEntity(); Ant2.AntType = 1; Ant2.Height = 25; Ant2.SectorID = 0; Ant2.IsMainAnt = true; Trans2.addAntConfig(Ant2); cell2.setParent(Trans2, cell2); }
private void DecodeSatelliteInformation(byte[] section, int endOfSection, ref int pointer) { if (pointer + 4 > endOfSection) { throw new Exception(string.Format("NIT: corruption detected at satellite information, pointer = {0}, end of section = {1}", pointer, endOfSection)); } byte satelliteId = section[pointer++]; bool youAreHere = ((section[pointer] & 0x80) != 0); FrequencyBand frequencyBand = (FrequencyBand)((section[pointer] >> 5) & 0x03); bool outOfService = ((section[pointer] & 0x10) != 0); bool isEasternHemisphere = ((section[pointer] & 0x08) != 0); int orbitalPosition = ((section[pointer] & 0x03) << 8) + section[pointer + 1]; pointer += 2; bool isCircularPolarisation = ((section[pointer] & 0x80) != 0); int numberOfTransponders = (section[pointer++] & 0x3f) + 1; Log.Log.Debug("NIT: satellite information, satellite ID = {0}, you are here = {1}, frequency band = {2}, out of service = {3}, is Eastern hemisphere = {4}, orbital position = {5}, is circular polarisation = {6}, number of transponders = {7}", satelliteId, youAreHere, frequencyBand, outOfService, isEasternHemisphere, orbitalPosition, isCircularPolarisation, numberOfTransponders); }
private void GetPrachSinr( int index) { if (m_bestServer is LteCellEx) { LteCellEx lteCellEx = (LteCellEx)m_bestServer; m_frenquentBand = lteCellEx.LteCell.FreqBand; m_FrequencyBandEx = lteCellEx.LteFreqBandEx; m_ulActualIoT = lteCellEx.LteCell.UlActualIoT; } else { if (m_bestServer is RelayCellEx) { RelayCellEx relayCellEx = (RelayCellEx)m_bestServer; m_frenquentBand = relayCellEx.RelayCell.FreqBand; m_FrequencyBandEx = relayCellEx.RelayFreqBandEx; m_ulActualIoT = relayCellEx.RelayCell.UlActualIoT; } } int rbNum = 6; double sinr = double.MinValue; double ulLinkLoss = 0.0; ulLinkLoss = ((float)this.m_ULBestServerLinkLoss[index]) * LteConst.TIMES_TO_FLOAT; double powerOfPrach = (this.m_PrachPower - ulLinkLoss) + this.m_OneBinValueTemp.m_ModelShadowMargin; double ulNoisePower = this.CalculateUlNoisePower(rbNum); if (m_isFDD) { sinr = powerOfPrach - ((ulNoisePower + this.m_ulActualIoT) + this.m_OneBinValueTemp.m_C_i_nShadowMargin); } else { //double dlInterf = (double)this.m_DLInterfMatrix[index]; double dlInterf = 0; sinr = powerOfPrach - dlInterf - ((ulNoisePower + this.m_ulActualIoT) + this.m_OneBinValueTemp.m_C_i_nShadowMargin); } this.m_OneBinValueTemp.PRACH_SINR = UnitTrans.DoubleToShort(sinr); }
public void IsSameFreqencyBandTest_False() { GSMSimTRX trx = GSMMock.MockGsmSimTrx(); FrequencyBand freb = new FrequencyBand(); freb.Name = "GSM 900"; trx.NeTRX.FreqBand = freb; GSMSimUser user = GSMMock.MockGsmSimUser(); GSMTerminal terminal = user.TrafficUser.Terminal.GetNetWorkTerminal(NetWorkType.GSM) as GSMTerminal; terminal.PrimaryBand = "GSM 1800"; terminal.SecondaryBand = "GSM 450"; Assert.IsFalse(CalculationCommon.IsSameFreqencyBand(trx, user)); }
public void MyTestInitialize() { m_NgbCarrierList = new List<ISimulationCarrier>(); m_AdCarrier1 = new SimulationCarrier(); m_AdCarrier2 = new SimulationCarrier(); m_AdCarrier1.AdmissionCarrierTag = new AdmissionCellTag(); m_AdCarrier2.AdmissionCarrierTag = new AdmissionCellTag(); m_LbThresHoldParam = new LBThresholdParam(); m_SUser1 = new SimulationUser(); m_SUser2 = new SimulationUser(); m_SUser1.AdmissionUserTag = new SimulationUser(); m_SUser2.AdmissionUserTag = new SimulationUser(); m_AdmissionCarrier = new SimulationCarrier(); LTECell ltecarrier = new LTECell(); m_AdmissionCarrier.Carrier = ltecarrier; m_AdCarrier1.Carrier = ltecarrier; m_AdCarrier2.Carrier = ltecarrier; FrequencyBand freband = new FrequencyBand(); freband.BandWidth = 100; ltecarrier.FreqBand = freband; m_AdmissionCarrier.AdmissionCarrierTag = new AdmissionCellTag(); m_Lbth = new LBThresholdParam(); m_DLLB = new DlLoadBalancingService(m_CurrentTTI, m_Lbth); m_LbUserList = new List<ISimulationUser>(); m_User1 = new SimulationUser(); m_User2 = new SimulationUser(); m_LbUserList.Add(m_User1); m_LbUserList.Add(m_User2); m_DlDataWaitUserList = new List<ISimulationUser>(); m_DlDataWaitUserList.Add(m_SUser1); m_DlDataWaitUserList.Add(m_SUser2); m_AdmissionCarrier.DlDataWaitUserList = m_DlDataWaitUserList; m_DlVoiceWaitUserList = new List<ISimulationUser>(); m_DlVoiceWaitUserList.Add(m_SUser1); m_DlVoiceWaitUserList.Add(m_SUser2); m_AdmissionCarrier.DlVoiceWaitUserList = m_DlVoiceWaitUserList; m_NgbList = new List<ISimulationCarrier>(); RelayCell relaycarrier = new RelayCell(); LteAlgParam ltealgparam = new LteAlgParam(); m_AdmissionCarrier.Carrier = relaycarrier; m_AdCarrier1.Carrier = relaycarrier; m_AdCarrier2.Carrier = relaycarrier; m_DlUserList = new List<ISimulationUser>(); m_DlUserList.Add(m_SUser1); m_DlUserList.Add(m_SUser2); m_AdmissionCarrier.DlUserList = m_DlUserList; m_CarrierListInComputerArea = new CarrierTotalLoss(); List<CarrierTotalLoss> listcarrier1 = new List<CarrierTotalLoss>(); CarrierTotalLoss a = new CarrierTotalLoss(); CarrierTotalLoss b = new CarrierTotalLoss(); listcarrier1.Add(a); listcarrier1.Add(b); SimulationCarrier carrier = new SimulationCarrier(); ((SimulationUser)m_SUser1).CarrierListInComputeArea = listcarrier1.ToArray(); ((SimulationUser)m_SUser2).CarrierListInComputeArea = listcarrier1.ToArray(); ((SimulationUser)m_SUser1).CarrierListInComputeArea[0].Carrier = carrier; ((SimulationUser)m_SUser2).CarrierListInComputeArea[0].Carrier = carrier; ((SimulationUser)m_SUser1).CarrierListInComputeArea[1].Carrier = carrier; ((SimulationUser)m_SUser2).CarrierListInComputeArea[1].Carrier = carrier; ((SimulationUser)m_SUser1).CarrierListInComputeArea[0].Carrier.Carrier = relaycarrier; ((SimulationUser)m_SUser2).CarrierListInComputeArea[0].Carrier.Carrier = relaycarrier; ((SimulationUser)m_SUser1).CarrierListInComputeArea[1].Carrier.Carrier = relaycarrier; ((SimulationUser)m_SUser2).CarrierListInComputeArea[1].Carrier.Carrier = relaycarrier; m_User1.CarrierListInComputeArea = listcarrier1.ToArray(); m_User2.CarrierListInComputeArea = listcarrier1.ToArray(); m_User1.CarrierListInComputeArea[0].Carrier = carrier; m_User2.CarrierListInComputeArea[0].Carrier = carrier; m_User1.CarrierListInComputeArea[1].Carrier = carrier; m_User2.CarrierListInComputeArea[1].Carrier = carrier; m_User1.CarrierListInComputeArea[0].Carrier.Carrier = relaycarrier; m_User2.CarrierListInComputeArea[0].Carrier.Carrier = relaycarrier; m_User1.CarrierListInComputeArea[1].Carrier.Carrier = relaycarrier; m_User2.CarrierListInComputeArea[1].Carrier.Carrier = relaycarrier; m_User1.BestServiceCellBeforeHandOver = a; m_User1.StroNbrBeforeHandOver = b; m_User2.BestServiceCellBeforeHandOver = a; m_User2.StroNbrBeforeHandOver = b; m_CarrierListInComputerArea.Carrier = carrier; relaycarrier.RSPower = 100; }
public FreBandObjExtractor(FrequencyBand frequencyBand) { this.m_FrequncyBand = frequencyBand; }
public void InitData(FrequencyBand frequencyBand) { this.m_FreBand = frequencyBand; int num = 0; foreach (KeyValuePair<int, Earfcn> pair in this.m_FreBand.ChannelIndexEarfcn) { this.channelDgv.Rows.Add(); this.channelDgv.Rows[num].Cells["channelIndex"].Value = pair.Key; this.channelDgv.Rows[num].Cells["ulEarfcn"].Value = pair.Value.UlEarfcn; this.channelDgv.Rows[num].Cells["dlEarfcn"].Value = pair.Value.DlEarfcn; num++; } }
private void CalcReceivePower(int index, LTECellCalcInfo cellInfo, double DLLinkLoss, double tempReceivePower, double receivePower) { if ((receivePower > tempReceivePower) && (receivePower > this.m_RsRxSensitivity)) { this.m_BestServerRSRP[index] = UnitTrans.DoubleToShort(receivePower); if (this.m_NeedCalSymbolRSRP) { this.m_RsMaxCarrierFrequecyBand = cellInfo.RSMaxCarrier.FreqBand; //TODO:: //this.m_SymbolRSRP[index] = UnitTrans.DoubleToShort(receivePower + this.m_RsMaxCarrierFrequecyBand.get_RSNumOfBandWidth()); } this.m_BestServerCarrierID[index] = this.m_DataManager.GetCarrierID(cellInfo.RSMaxCarrier); this.m_BestServerCellID[index] = cellInfo.Tanceiver.ID; if (this.m_NeedCalActualRxIntf || this.m_NeedCalMaxRxIntf) { this.m_DlBestServerLinkLoss[index] = Convert.ToInt32((double) (DLLinkLoss * PredictionConst.TIMES_TO_BIG_INT)); } } }
private double GetDataReRsReOffSet(LTECell carrier, FrequencyBand freqBand) { double rsPowerOfFreband = 0.0; double averagePower = 0.0; rsPowerOfFreband = UnitTrans.dBto((double)carrier.RSPower) * (freqBand.RBNum * 2); averagePower = UnitTrans.dBto((double)carrier.MaxPower) - rsPowerOfFreband; return UnitTrans.todB((double)(averagePower / (rsPowerOfFreband * 5.0))); }
public static int GetRbNumber(FrequencyBand band) { return GetRbNumber(band.BandWidth); }
/// <summary> /// 主程序 /// </summary> /// <param name="index"></param> /// <returns></returns> public bool IsBuildOneBinOk(int index) { this.m_BestCarrierID = this.m_BestServerCarrierID[index]; if ((this.m_BestCarrierID != this.m_InvalidateValue) && (this.m_OneBinValueTemp.UL_RSRP != this.m_InvalidateValue)) { if (!ValiteTeminal()) { return true; } m_bestServer = m_DataManager.GetCellExByID(m_BestCarrierID); //RelayNode relayNode = this.m_DataManager.Group.TrafficTerminal.NetTerminalList[0] as RelayNode; LTETerminal terminal = this.m_DataManager.Group.TrafficTerminal.NetTerminalList[0] as LTETerminal; int rbNum = 0; double gain = 0.0; //if (m_bestServer is LteCellEx) //{ LteCellEx lteCellEx = (LteCellEx)m_bestServer; if (lteCellEx.ULMIMO == null) { return true; } LTECell lteCell = lteCellEx.LteCell; this.m_ulActualIoT = lteCell.UlActualIoT; this.m_FreqBand = lteCell.FreqBand; this.m_RSPower = lteCell.RSPower; this.m_ActualUlLoad = lteCell.ActualUlLoad; this.m_LteAlgParam = lteCell.LteAlgParameter; this.m_NoisePowerOfBandWidth = lteCellEx.LteFreqBandEx.NoisePowerOfBandWidth; //} //else //{ // if (m_bestServer is RelayCellEx) // { // RelayCellEx relayCellEx = (RelayCellEx)m_bestServer; // RelayCell relayCell = relayCellEx.RelayCell; // this.m_ulActualIoT = relayCell.UlActualIoT; // this.m_FreqBand = relayCell.FreqBand; // this.m_RSPower = relayCell.RSPower; // this.m_ActualUlLoad = relayCell.ActualUlLoad; // this.m_LteAlgParam = relayCell.RelayAlgParameter; // this.m_NoisePowerOfBandWidth = relayCellEx.RelayFreqBandEx.NoisePowerOfBandWidth; // } //} if ((this.m_IRCSwitch && (this.m_ulActualIoT >= 3.0)) && (this.m_ulActualIoT <= 15.0)) { gain = Huawei.UNet.Application.Common.IRC.IRC.CalculateIRCGain(m_bestServer.IRCFigure, this.m_ulActualIoT); } this.GetHighSinrGate(m_bestServer.ULDemodulationTable, this.m_HighMCS, out this.m_AcutalHighMcsIndex, out this.m_AcutalHighSinrGate); this.m_HighMCSSinr = Convert.ToInt16((double)(this.m_AcutalHighSinrGate * 100.0)); if (terminal.CanUseRBNum) { rbNum = terminal.RBNum; this.GetPushSinrByFixedRB(index, terminal, rbNum, gain); } else { /*lteCell.FreqBand.RBNum 为100,lteCell.FreqBand.RBNum 为16*/ rbNum = Convert.ToInt32((float)(m_FreqBand.RBNum * m_ActualUlLoad)) - m_LteAlgParam.UlPucchRbs; this.GetPuschSinr(index, terminal, rbNum, m_ActualUlLoad, gain); } } return true; }
private double GetDataReRsReOffSet(LTECell carrier, FrequencyBand freqBand) { double num = 0.0; double num2 = 0.0; num = UnitTrans.dBto((double)carrier.RSPower) * (freqBand.RBNum * 2); num2 = UnitTrans.dBto((double)carrier.MaxPower) - num; return UnitTrans.todB((double)(num2 / (num * 5.0))); }
private void ConvertXLSToFrequencyEquipment(SubsystemDataImple systemDateImple, XlsTable xlsNetWorkTable) { List<FrequencyBand> list = new List<FrequencyBand>(); for (int i = 0; i < xlsNetWorkTable.Data.Rows.Count; i++) { DataRow row = xlsNetWorkTable.Data.Rows[i]; try { FrequencyBand item = new FrequencyBand(); item.Name = row["Name"].ToString(); if (string.IsNullOrEmpty(item.Name)) { this.m_Model.EventVierService.WriteLog("Frequency Bands Table's " + (i + 1) + "row import error", Huawei.UNet.Frame.Interface.LogLevel.Warning); } else { item.ACIR = float.Parse(row["ACIR"].ToString()); item.BandWidth = float.Parse(row["BandWidth (MHz)"].ToString()); item.DLFrequency = float.Parse(row["Downlink Frequency (MHz)"].ToString()); item.EndChIndex = int.Parse(row["End Channel"].ToString()); item.ExcludedChannels = row["Excluded Channels"].ToString(); item.StartChIndex = int.Parse(row["Start Channel"].ToString()); item.ULFrequency = float.Parse(row["Uplink Frequency (MHz)"].ToString()); item.DuplexingMethod = (FrequencyBand.eDupMethod) Enum.Parse(typeof(FrequencyBand.eDupMethod), row["Duplexing"].ToString()); list.Add(item); } } catch (Exception exception) { this.m_Model.EventVierService.WriteLog("Frequency Bands Table's " + (i + 1) + "row import error", Huawei.UNet.Frame.Interface.LogLevel.Warning); WriteLog.Logger.Error(exception.StackTrace); } } systemDateImple.FrequencyBand = list; }
public bool IsMappingDataValidate(FrequencyBand freqBand, ref string info) { if (!this.CheckMappingDataValid(freqBand, ref info)) { return false; } if (!this.CheckChannelIndexIsExisted(ref info)) { return false; } return true; }
public FranqBandExtrator(FrequencyBand lteFreqBand) { this.m_lteFreqBand = lteFreqBand; }
private double GetNoisePower(FrequencyBand freqBand) { double linearValue = freqBand.RBNum * 0x2bf20; return (-174.0 + UnitTrans.todB(linearValue)); }