A Discrete-Event Network Simulator
API
matrix-based-channel-model.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 SIGNET Lab, Department of Information Engineering,
4  * University of Padova
5  * Copyright (c) 2020 Institute for the Wireless Internet of Things,
6  * Northeastern University
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation;
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21 
22 #ifndef MATRIX_BASED_CHANNEL_H
23 #define MATRIX_BASED_CHANNEL_H
24 
25 #include <complex.h>
26 #include <ns3/object.h>
27 #include <ns3/nstime.h>
28 #include <ns3/vector.h>
29 #include <ns3/three-gpp-antenna-array-model.h>
30 #include <tuple>
31 
32 namespace ns3 {
33 
34 class MobilityModel;
35 
44 {
45 public:
49  virtual ~MatrixBasedChannelModel ();
50 
51  typedef std::vector<double> DoubleVector;
52  typedef std::vector<DoubleVector> Double2DVector;
53  typedef std::vector<Double2DVector> Double3DVector;
54  typedef std::vector<ThreeGppAntennaArrayModel::ComplexVector> Complex2DVector;
55  typedef std::vector<Complex2DVector> Complex3DVector;
56 
57 
61  struct ChannelMatrix : public SimpleRefCount<ChannelMatrix>
62  {
67  std::pair<uint32_t, uint32_t> m_nodeIds;
68 
72  virtual ~ChannelMatrix () = default;
73 
81  bool IsReverse (const uint32_t aId, const uint32_t bId) const
82  {
83  uint32_t sId, uId;
84  std::tie (sId, uId) = m_nodeIds;
85  NS_ASSERT_MSG ((sId == aId && uId == bId) || (sId == bId && uId == aId),
86  "This matrix represents the channel between " << sId << " and " << uId);
87  return (sId == bId && uId == aId);
88  }
89  };
90 
113 
120  static constexpr uint32_t GetKey (uint32_t x1, uint32_t x2)
121  {
122  return (((x1 + x2) * (x1 + x2 + 1)) / 2) + x2;
123  }
124 
125  static const uint8_t AOA_INDEX = 0;
126  static const uint8_t ZOA_INDEX = 1;
127  static const uint8_t AOD_INDEX = 2;
128  static const uint8_t ZOD_INDEX = 3;
129 
130 };
131 
132 }; // namespace ns3
133 
134 #endif // MATRIX_BASED_CHANNEL_H
This is an interface for a channel model that can be described by a channel matrix, e.g., the 3GPP Spatial Channel Models, which is generally used in combination with antenna arrays.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::vector< Complex2DVector > Complex3DVector
type definition for complex 3D matrices
std::vector< double > DoubleVector
type definition for vectors of doubles
DoubleVector m_delay
cluster delay in nanoseconds.
std::pair< uint32_t, uint32_t > m_nodeIds
the first element is the s-node ID (the transmitter when the channel was generated), the second element is the u-node ID (the receiver when the channel was generated)
static const uint8_t AOD_INDEX
index of the AOD value in the m_angle array
virtual ~MatrixBasedChannelModel()
Destructor for MatrixBasedChannelModel.
static const uint8_t ZOA_INDEX
index of the ZOA value in the m_angle array
Complex3DVector m_channel
channel matrix H[u][s][n].
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< ThreeGppAntennaArrayModel::ComplexVector > Complex2DVector
type definition for complex matrices
static constexpr uint32_t GetKey(uint32_t x1, uint32_t x2)
Calculate the channel key using the Cantor function.
virtual Ptr< const ChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const ThreeGppAntennaArrayModel > aAntenna, Ptr< const ThreeGppAntennaArrayModel > bAntenna)=0
Returns a matrix with a realization of the channel between the nodes with mobility objects passed as ...
std::vector< DoubleVector > Double2DVector
type definition for matrices of doubles
Double2DVector m_angle
cluster angle angle[direction][n], where direction = 0(AOA), 1(ZOA), 2(AOD), 3(ZOD) in degree...
std::vector< Double2DVector > Double3DVector
type definition for 3D matrices of doubles
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
bool IsReverse(const uint32_t aId, const uint32_t bId) const
Returns true if the ChannelMatrix object was generated considering node b as transmitter and node a a...
virtual ~ChannelMatrix()=default
Destructor for ChannelMatrix.
static const uint8_t AOA_INDEX
index of the AOA value in the m_angle array
Data structure that stores a channel realization.
A base class which provides memory management and object aggregation.
Definition: object.h:87
A template-based reference counting class.
static const uint8_t ZOD_INDEX
index of the ZOD value in the m_angle array