11#ifndef THREE_GPP_CHANNEL_H
12#define THREE_GPP_CHANNEL_H
16#include "ns3/channel-condition-model.h"
18#include <unordered_map>
136 static std::pair<double, double>
WrapAngles(
double azimuthRad,
double inclinationRad);
323 double* endpointDisplacement2D,
324 double* relativeDisplacement2D,
325 Vector* lastPositionFirst,
326 Vector* lastPositionSecond,
327 Vector2D* lastRelativePosition2D)
const;
409 DoubleVector* clusterDelays)
const;
430 DoubleVector* clusterShadowing)
const;
441 DoubleVector* clusterShadowing,
442 const double displacementLength)
const;
456 const DoubleVector& clusterShadowing,
457 DoubleVector* clusterPowers)
const;
471 DoubleVector* clusterDelays,
474 const double kFactor,
475 double* powerMax)
const;
502 const uint8_t reducedClusterNumber,
503 const double kFactor)
const;
531 const double kFactor);
559 const double kFactor);
593 const DoubleVector& clusterPowerForAngles,
597 const LargeScaleParameters& lsps,
601 Double2DVector* clusterAngles)
const;
654 DoubleVector* powerAttenuation,
656 const DoubleVector& clusterAOA,
657 const DoubleVector& clusterZOA,
671 DoubleVector* delayConsistency,
722 Double2DVector* clusterAngles,
723 const DoubleVector& prevClusterDelay)
const;
741 const Double2DVector& prevClusterAngles,
742 Double2DVector* rayAodRadian,
743 Double2DVector* rayAoaRadian,
744 Double2DVector* rayZodRadian,
745 Double2DVector* rayZoaRadian)
const;
804 DoubleVector* clusterPowers,
805 DoubleVector* attenuation_dB,
807 const DoubleVector& clusterAoa,
808 const DoubleVector& clusterZoa,
831 Double2DVector* rayAoaRadian,
832 Double2DVector* rayAodRadian,
833 Double2DVector* rayZoaRadian,
834 Double2DVector* rayZodRadian)
const;
849 Double2DVector* rayAoaRadian,
850 Double2DVector* rayAodRadian,
851 Double2DVector* rayZoaRadian,
852 Double2DVector* rayZodRadian)
const;
869 Double3DVector* clusterPhase,
870 const uint8_t reducedClusterNumber,
895 DoubleVector* clusterDelay,
896 Double2DVector* angles,
899 DoubleVector* clusterPower)
const;
923 Double2DVector* angles,
924 std::vector<std::vector<std::pair<double, double>>>* cachedAngleSincos,
927 DoubleVector* clusterPower)
const;
943 std::vector<std::vector<std::pair<double, double>>>* cachedAngleSinCos)
const;
961 DoubleVector* dopplerTermAlpha,
962 DoubleVector* dopplerTermD)
const;
1029 const Vector& lastPositionFirst,
1030 const Vector& lastPositionSecond)
const;
O2iConditionValue
Possible values for Outdoor to Indoor condition.
LosConditionValue
Possible values for Line-of-Sight condition.
This is an interface for a channel model that can be described by a channel matrix,...
std::vector< double > DoubleVector
Type definition for vectors of doubles.
std::vector< Double2DVector > Double3DVector
Type definition for 3D matrices of doubles.
std::vector< DoubleVector > Double2DVector
Type definition for matrices of doubles.
Keep track of the current position and velocity of an object.
Smart pointer class similar to boost::intrusive_ptr.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void ComputeRayAngles(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ParamsTable > table3gpp, Double2DVector *rayAoaRadian, Double2DVector *rayAodRadian, Double2DVector *rayZoaRadian, Double2DVector *rayZodRadian) const
Compute per-ray angles (no shuffling), centered on cluster means.
double ComputeEndpointDisplacement2d(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, const Vector &lastPositionFirst, const Vector &lastPositionSecond) const
Compute the effective 2D displacement of a link with respect to previously stored endpoint positions.
Vector ApplyVelocityRotation(double alphaRad, double betaRad, double gammaRad, double etaRad, const Vector &speed, const int Xn) const
Rotate a 3D velocity vector by specified angles, around y-axis and z-axis.
bool m_portraitMode
true if portrait mode, false if landscape
static double CalculateCtheta(const ChannelCondition::LosConditionValue losCondition, Ptr< const ParamsTable > table3gpp, const double kFactor)
Calculates the cTheta parameter for zenith angular spread modeling.
Ptr< NormalRandomVariable > m_normalRv
normal random variable
void ApplyAttenuationToClusterPowers(Double2DVector *nonSelfBlocking, DoubleVector *clusterPowers, DoubleVector *attenuation_dB, Ptr< const ThreeGppChannelParams > channelParams, const DoubleVector &clusterAoa, const DoubleVector &clusterZoa, Ptr< const ParamsTable > table3gpp) const
Applies blockage-based attenuation to the cluster powers according to the 3GPP TR 38....
bool ChannelUpdateNeeded(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const
Check if spatial-consistency requires updating channel parameters.
void FindStrongestClusters(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ParamsTable > table3gpp, uint8_t *cluster1st, uint8_t *cluster2nd, DoubleVector *clusterDelay, Double2DVector *angles, DoubleVector *alpha, DoubleVector *dTerm, DoubleVector *clusterPower) const
Identify the two strongest base clusters and append their derived subclusters.
bool m_blockage
enables the blockage model A
void GenerateCrossPolPowerRatiosAndInitialPhases(Double2DVector *crossPolarizationPowerRatios, Double3DVector *clusterPhase, const uint8_t reducedClusterNumber, Ptr< const ParamsTable > table3gpp) const
Generate cross-polarization power ratios and initial per-ray phases.
LargeScaleParameters GenerateLSPs(const ChannelCondition::LosConditionValue losCondition, Ptr< const ParamsTable > table3gpp) const
Generate large-scale parameters (LSPs) for the current channel state.
Ptr< const ChannelParams > GetParams(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const override
Looks for the channel params associated with the aMob and bMob pair in m_channelParamsMap.
~ThreeGppChannelModel() override
Destructor.
void UpdateClusterDelay(DoubleVector *clusterDelay, DoubleVector *delayConsistency, Ptr< const ThreeGppChannelParams > channelParams) const
Updates the cluster delays for the 3GPP channel model based on the channel parameters and consistency...
void PrecomputeAnglesSinCos(Ptr< const ThreeGppChannelParams > channelParams, std::vector< std::vector< std::pair< double, double > > > *cachedAngleSinCos) const
Precomputes the sine and cosine values for angles.
void TrimToBaseClusters(const uint8_t reducedClusterNumber, DoubleVector *delay, Double2DVector *angles, std::vector< std::vector< std::pair< double, double > > > *cachedAngleSincos, DoubleVector *alpha, DoubleVector *dTerm, DoubleVector *clusterPower) const
Trim per-cluster vectors back to the base (reduced) cluster set.
void CalcAttenuationOfBlockage(Double2DVector *nonSelfBlocking, DoubleVector *powerAttenuation, Ptr< const ThreeGppChannelParams > channelParams, const DoubleVector &clusterAOA, const DoubleVector &clusterZOA, Ptr< const ParamsTable > table3gpp) const
Calculates the per-cluster power attenuation (in dB) due to self-blocking and non-self-blocking effec...
std::unordered_map< uint64_t, Ptr< ThreeGppChannelParams > > m_channelParamsMap
map containing the common channel parameters per a pair of nodes, the key of this map is reciprocal a...
static std::pair< double, double > WrapAngles(double azimuthRad, double inclinationRad)
Wrap an (azimuth, inclination) angle pair in a valid range.
DoubleVector RemoveWeakClusters(DoubleVector *clusterPowers, DoubleVector *clusterDelays, const ChannelCondition::LosConditionValue losCondition, Ptr< const ParamsTable > table3gpp, const double kFactor, double *powerMax) const
Remove the clusters with less power.
ThreeGppChannelModel()
Constructor.
double m_blockerSpeed
the blocker speed
Ptr< const ChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna) override
Looks for the channel matrix associated with the aMob and bMob pair in m_channelMatrixMap.
static constexpr uint8_t Y_INDEX
index of the Y value in the m_nonSelfBlocking array
void SetFrequency(double f)
Sets the center frequency of the model.
std::unordered_map< uint64_t, Ptr< ChannelMatrix > > m_channelMatrixMap
map containing the channel realizations per a pair of PhasedAntennaArray instances; the key of this m...
Ptr< UniformRandomVariable > m_uniformRv
uniform random variable
void UpdateLinkGeometry(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, double *distance2D, double *distance3D, double *endpointDisplacement2D, double *relativeDisplacement2D, Vector *lastPositionFirst, Vector *lastPositionSecond, Vector2D *lastRelativePosition2D) const
Update distance- and displacement-related values between two nodes.
void DoDispose() override
Destructor implementation.
void SetScenario(const std::string &scenario)
Sets the propagation scenario.
void GenerateClusterDelays(const double DS, Ptr< const ParamsTable > table3gpp, double *minTau, DoubleVector *clusterDelays) const
Generate the cluster delays.
static constexpr uint8_t X_INDEX
index of the X value in the m_nonSelfBlocking array
bool NewChannelMatrixNeeded(uint64_t channelMatrixKey, Ptr< const ThreeGppChannelParams > channelParams, Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna) const
Check if channel matrix needs update based on parameter changes or the update period expired.
void RandomRaysCoupling(Ptr< const ThreeGppChannelParams > channelParams, Double2DVector *rayAoaRadian, Double2DVector *rayAodRadian, Double2DVector *rayZoaRadian, Double2DVector *rayZodRadian) const
Randomly couples rays within each cluster by shuffling per-ray angles.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model.
Ptr< UniformRandomVariable > m_uniformRvDoppler
Uniform random variable, used to compute the additional Doppler contribution.
static double CalculateCphi(const ChannelCondition::LosConditionValue losCondition, Ptr< const ParamsTable > table3gpp, const double kFactor)
Calculates the cPhi parameter for azimuth angular spread modeling.
uint16_t m_numNonSelfBlocking
number of non-self-blocking regions
std::string GetScenario() const
Returns the propagation scenario.
bool NewChannelParamsNeeded(const uint64_t channelParamsKey, Ptr< const ChannelCondition > condition, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const
Check if the channel params has to be updated.
void ShiftRayAnglesToUpdatedClusterMeans(Ptr< const ParamsTable > table3gpp, Ptr< const ThreeGppChannelParams > channelParams, const Double2DVector &prevClusterAngles, Double2DVector *rayAodRadian, Double2DVector *rayAoaRadian, Double2DVector *rayZodRadian, Double2DVector *rayZoaRadian) const
Shift per-ray angles to follow updated cluster mean angles while preserving intra-cluster offsets and...
void GenerateClusterPowers(const DoubleVector &clusterDelays, const double DS, Ptr< const ParamsTable > table3gpp, const DoubleVector &clusterShadowing, DoubleVector *clusterPowers) const
Generate cluster powers.
void GenerateClusterXnNLos(const uint8_t clusterNumber, std::vector< int > *clusterSign) const
Generate a random sign (+1 or -1) for each cluster for XN for NLOS computation for channel consistenc...
void GenerateClusterAngles(Ptr< const ThreeGppChannelParams > channelParams, const DoubleVector &clusterPowerForAngles, double powerMax, double cPhi, double cTheta, const LargeScaleParameters &lsps, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const ParamsTable > table3gpp, Double2DVector *clusterAngles) const
Generate cluster angles for a 3GPP channel model based on provided parameters.
double m_frequency
the operating frequency
void GenerateClusterShadowingTerm(Ptr< const ParamsTable > table3gpp, DoubleVector *clusterShadowing) const
Generate per-cluster shadowing terms (in dB) as specified by 3GPP TR 38.901.
double m_vScatt
Variable used to compute the additional Doppler contribution for the delayed (reflected) paths,...
void AdjustClusterDelaysForLosCondition(DoubleVector *clusterDelays, const uint8_t reducedClusterNumber, const double kFactor) const
Adjusts cluster delays for LOS channel condition based on the K-factor.
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Get the associated channel condition model.
Ptr< ChannelConditionModel > m_channelConditionModel
the channel condition model
std::string m_scenario
the 3GPP scenario
static TypeId GetTypeId()
Get the type ID.
void UpdateChannelParameters(Ptr< ThreeGppChannelParams > channelParams, Ptr< const ChannelCondition > channelCondition, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const
Update channel parameters for spatial consistency using 3GPP TR 38.901 procedure A.
static constexpr uint8_t R_INDEX
index of the R value in the m_nonSelfBlocking array
virtual Ptr< ChannelMatrix > GetNewChannel(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ParamsTable > table3gpp, Ptr< const MobilityModel > sMob, Ptr< const MobilityModel > uMob, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna) const
Compute the channel matrix between two nodes a and b, and their antenna arrays aAntenna and bAntenna ...
Ptr< ThreeGppChannelParams > GenerateChannelParameters(Ptr< const ChannelCondition > channelCondition, Ptr< const ParamsTable > table3gpp, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const
Prepare 3gpp channel parameters among the nodes a and b.
static constexpr uint8_t PHI_INDEX
index of the PHI value in the m_nonSelfBlocking array
bool AntennaSetupChanged(Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna, Ptr< const ChannelMatrix > channelMatrix) const
Check if the channel matrix has to be updated due to changes in the number of antenna ports.
static constexpr uint8_t THETA_INDEX
index of the THETA value in the m_nonSelfBlocking array
void GenerateDopplerTerms(const uint8_t reducedClusterNumber, DoubleVector *dopplerTermAlpha, DoubleVector *dopplerTermD) const
Generate additional Doppler terms for delayed (reflected) paths.
double GetFrequency() const
Returns the center frequency.
void UpdateClusterAngles(Ptr< const ThreeGppChannelParams > channelParams, Double2DVector *clusterAngles, const DoubleVector &prevClusterDelay) const
Update cluster angles based on node mobility according to 3GPP TR 38.901.
Time m_updatePeriod
the channel update period enables spatial consistency, procedure A
Ptr< UniformRandomVariable > m_uniformRvShuffle
uniform random variable used to shuffle an array in GetNewChannel
virtual Ptr< const ParamsTable > GetThreeGppTable(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const ChannelCondition > channelCondition) const
Get the parameters needed to apply the channel generation procedure.
void UpdateClusterShadowingTerm(Ptr< const ParamsTable > table3gpp, DoubleVector *clusterShadowing, const double displacementLength) const
Update shadowing per cluster by using the normalized auto correlation function R, which is defined as...
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Data structure that stores channel parameters.
Large-scale channel parameters (3GPP TR 38.901).
double DS
Delay spread [s].
double kFactor
Rician K-factor [dB] (used in LOS).
double ASA
Azimuth spread of arrival [deg].
double ZSD
Zenith spread of departure [deg].
double ASD
Azimuth spread of departure [deg].
double ZSA
Zenith spread of arrival [deg].
Data structure that stores the parameters of 3GPP TR 38.901, Table 7.5-6, for a certain scenario.
double m_sqrtC[7][7]
For LOS, LSP is following the order of [SF,K,DS,ASD,ASA,ZSD,ZSA].
double m_sigLgZSD
Standard deviation of 10-base logarithm of zenith angle spread of departure.
double m_cASD
Cluster ASD (Azimuth angle Spread of Departure).
double m_uLgZSD
Mean value of 10-base logarithm of zenith angle spread of departure.
double m_uLgASA
Mean value of 10-base logarithm of azimuth angle spread of arrival.
double m_sigXpr
Standard deviation of Cross-Polarization Ratio.
double m_uK
Mean of K-factor.
double m_uLgASD
Mean value of 10-base logarithm of azimuth angle spread of departure.
double m_cASA
Cluster ASA (Azimuth angle Spread of Arrival).
double m_perClusterRayDcorDistance
Correlation distance for spatial consistency (7.6.3.1-2) in meters.
double m_rTau
Delay scaling parameter.
uint8_t m_raysPerCluster
Number of rays per cluster.
double m_sigK
Standard deviation of K-factor.
double m_perClusterShadowingStd
Per cluster shadowing standard deviation.
double m_sigLgASD
Standard deviation of 10-base logarithm of azimuth angle spread of departure.
double m_offsetZOD
Offset of a zenith angle of departure.
double m_uLgDS
Mean value of 10-base logarithm of delay spread.
double m_sigLgASA
Standard deviation of 10-base logarithm of azimuth angle spread of arrival.
double m_uLgZSA
Mean value of 10-base logarithm of zenith angle spread of arrival.
double m_cZSA
Cluster ZSA (Zenith angle Spread of Arrival).
uint8_t m_numOfCluster
Number of clusters.
double m_blockerDcorDistance
The spatial correlation distance for the random variable determining the centre of the blocker in met...
double m_sigLgZSA
Standard deviation of 10-base logarithm of zenith angle spread of arrival.
double m_uXpr
Mean of Cross-Polarization Ratio.
double m_sigLgDS
Standard deviation value of 10-base logarithm of delay spread.
Extends the struct ChannelParams by including information that is used within the ThreeGppChannelMode...
std::vector< int > m_clusterXnNlosSign
The signs of the XN per cluster -1 or +1, per NLOS used in channel consistency procedure.
ChannelCondition::LosConditionValue m_losCondition
contains the information about the LOS state of the channel
Double2DVector m_rayAoaRadian
the vector containing AOA angles
Double2DVector m_rayZoaRadian
the vector containing ZOA angles
double m_dis3D
3D distance between tx and rx
Vector m_lastPositionSecond
Position of the endpoint with the largest node ID (canonical endpoint ordering) at the time of the la...
double m_relativeDisplacement2D
2D displacement of the canonical relative position vector between the two endpoints since the last ge...
Double2DVector m_rayAodRadian
the vector containing AOD angles
Vector m_txSpeed
TX velocity.
Double2DVector m_norRvAngles
stores the normal variable for random angles angle[cluster][id] generated for equation (7....
ChannelCondition::O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
uint8_t m_reducedClusterNumber
reduced cluster number
Vector2D m_lastRelativePosition2D
Canonical 2D relative position vector (first -> second) stored at the time of the last channel parame...
DoubleVector m_attenuation_dB
vector that stores the attenuation of the blockage
Double2DVector m_rayZodRadian
the vector containing ZOD angles
DoubleVector m_clusterPower
cluster powers
Double2DVector m_crossPolarizationPowerRatios
cross-polarization power ratios
double m_dis2D
2D distance between tx and rx
Double2DVector m_nonSelfBlocking
store the blockages
uint8_t m_cluster1st
index of the first strongest cluster
DoubleVector m_delayConsistency
cluster delay for consistency update
uint8_t m_cluster2nd
index of the second-strongest cluster
Double3DVector m_clusterPhase
the initial random phases
DoubleVector m_clusterShadowing
cluster shadowing
double m_K_factor
K factor.
double m_endpointDisplacement2D
The effective 2D displacement used to determine whether a channel-consistency update can be applied,...
Vector m_lastPositionFirst
Position of the endpoint with the smallest node ID (canonical endpoint ordering) at the time of the l...
Vector m_rxSpeed
RX velocity.