public ModelAttenuationCharacteristicsViewModel(PropagationModel pModel) { CountAttenuationPerRangeCommand = new CountAttenuationPerRangeCommand(this); Model = pModel; if (pModel is MultiWallPropagationModel) { IsMultiWallModel = true; } else { ObstacleAttenuation = 1; } Place = 1; var node = NodeRepository.Instance.GetAll().FirstOrDefault(); if (node != null) { Frequency = node.Parameters.CentralFrequency / Tools.GetFrequencyMetricsWithValues()["[MHz]"]; } }
/// <summary> /// Fills cells with signal strength using given propagation model. /// </summary> public void FillAreaWithSignalStrength(PropagationModel pPropagationModel, Parameters pParameters, Position pPosition, Guid pNodeGuid) { UpdateEstimationParameters(); EstimateRange(pPropagationModel, pParameters, pPosition, pNodeGuid); CountMaxRange(pPosition); }
private bool GoWest(int pIndex, Position pNodePosition, PropagationModel pPropagationModel, Parameters pParameters, Guid pNodeGuid) { bool signalAboveThreshold = false; var endPoint = pNodePosition.X - pIndex; var position = new Position { X = pNodePosition.X + pIndex, Y = pNodePosition.Y + pIndex }; Debug.WriteLine("Going to SW corner. Starting point [{0}, {1}]", position.X, position.Y); if (position.X > mBlueprint.Columns) position.X = mBlueprint.Columns; if (position.Y > mBlueprint.Rows) return false; while (position.X != endPoint) { Debug.WriteLine("Counting signal strength for cell [{0}, {1}]", position.X, position.Y); var signal = pPropagationModel.CountSignalStrength(pNodePosition, position, pParameters); if (signal > mTreshold) { signalAboveThreshold = true; var cell = mBlueprint[(int)position.X, (int)position.Y]; cell.SetSignalSource(pNodeGuid.ToString(), signal); } position.X--; } return signalAboveThreshold; }
private bool GoEast(int pIndex, Position pNodePosition, PropagationModel pPropagationModel, Parameters pParameters, Guid pNodeGuid) { bool signalAboveThreshold = false; var endPoint = pNodePosition.X + pIndex; var position = new Position {X = pNodePosition.X - pIndex, Y = pNodePosition.Y - pIndex}; Debug.WriteLine("Going to NE corner. Starting point [{0}, {1}]", position.X, position.Y); if (position.X < 0) position.X = 0; if (position.Y < 0) return false; // index outside cell area, dont count anything while (position.X != endPoint) { Debug.WriteLine("Counting signal strength for cell [{0}, {1}]", position.X, position.Y); var signal = pPropagationModel.CountSignalStrength(pNodePosition, position, pParameters); if (signal > mTreshold) { signalAboveThreshold = true; var cell = mBlueprint[(int)position.X, (int)position.Y]; cell.SetSignalSource(pNodeGuid.ToString(), signal); } position.X++; } return signalAboveThreshold; }
private void EstimateRange(PropagationModel pPropagationModel, Parameters pParameters, Position pPosition, Guid pNodeGuid) { // Log.Write(LogLevel.Debug, "Estimating Node signal strength in CellArea."); var IsAboveThreshold = new []{true, true, true, true}; for(int i = 1; IsAboveThreshold.Any(s => s); i++) { IsAboveThreshold[(int)MoveDirection.East] = GoEast(i, pPosition, pPropagationModel, pParameters, pNodeGuid); IsAboveThreshold[(int)MoveDirection.South] = GoSouth(i, pPosition, pPropagationModel, pParameters, pNodeGuid); IsAboveThreshold[(int)MoveDirection.West] = GoWest(i, pPosition, pPropagationModel, pParameters, pNodeGuid); IsAboveThreshold[(int)MoveDirection.North] = GoNorth(i, pPosition, pPropagationModel, pParameters, pNodeGuid); } }