A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
hexagonal-wraparound-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 CTTC
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef HEXAGONAL_WRAPAROUND_H
9#define HEXAGONAL_WRAPAROUND_H
10
11#include "wraparound-model.h"
12
13#include "ns3/vector.h"
14
15#include <map>
16#include <vector>
17
18namespace ns3
19{
20/**
21 * @ingroup propagation
22 * @brief Hexagonal wraparound model wraps nodes around in space based on an
23 * hexagonal deployment. It is used to determine a virtual position after
24 * wraparound and calculate the distance between a point of reference and
25 * the virtual position.
26 *
27 * This model is used for the hexagonal deployments typical of mobile networks.
28 * It supports rings 0 (1 site), 1 (7 sites) and 3 rings (19 sites).
29 * To use it, set the inter-site distance (isd) and the number of sites.
30 * Then, add the position coordinates of the sites.
31 * All space coordinates in this class and its subclasses are understood
32 * to be meters or meters/s. i.e., they are all metric international units.
33 *
34 * When GetRelativeVirtualPosition (absPos1, absPos2) is called,
35 * the relative position of the absPos2 is calculated respective to the
36 * reference coordinate absPos1, applying the wrapping based on the model
37 * described in:
38 *
39 * R. S. Panwar and K. M. Sivalingam, "Implementation of wrap
40 * around mechanism for system level simulation of LTE cellular
41 * networks in NS3," 2017 IEEE 18th International Symposium on
42 * A World of Wireless, Mobile and Multimedia Networks (WoWMoM),
43 * Macau, 2017, pp. 1-9, doi: 10.1109/WoWMoM.2017.7974289.
44 */
46{
47 public:
48 /**
49 * Register this type with the TypeId system.
50 * @return the object TypeId
51 */
52 static TypeId GetTypeId();
53
54 /**
55 * @brief Default constructor
56 */
58
59 /**
60 * @brief Constructor
61 * @param isd inter-site distance
62 * @param numSites number of sites
63 */
64 HexagonalWraparoundModel(double isd, size_t numSites);
65
66 /**
67 * @brief Set site distance
68 * @param isd site distance
69 */
70 void SetSiteDistance(double isd);
71
72 /**
73 * @brief Set number of sites
74 * @param numSites number of sites
75 */
76 void SetNumSites(uint8_t numSites);
77
78 /**
79 * @brief Add a site position
80 * @param pos position of a site
81 */
82 void AddSitePosition(const Vector3D& pos);
83
84 /**
85 * @brief Set site positions
86 * @param positions positions of all sites
87 */
88 void SetSitePositions(const std::vector<Vector3D>& positions);
89
90 /**
91 * @brief Calculate the site position
92 * @param pos original position
93 * @return closest cell center based on wraparound distance
94 */
95 Vector3D GetSitePosition(const Vector3D& pos) const;
96
97 /**
98 * @brief Calculate distance after wraparound between two points
99 * @param a position of point a
100 * @param b position of point b
101 * @return wraparound distance between a and b
102 */
103 double CalculateDistance(const Vector3D& a, const Vector3D& b) const;
104 /**
105 * @brief Get virtual position of txPos with respect to rxPos
106 * @param txPos
107 * @param rxPos
108 * @return virtual position of txPos
109 */
110 Vector3D GetVirtualPosition(const Vector3D txPos, const Vector3D rxPos) const override;
111
112 private:
113 double m_isd; //!< distance between sites
114 double m_radius; //!< site radius
115 uint8_t m_numSites; //!< number of sites
116 std::vector<Vector3D> m_sitePositions; //!< site positions
117};
118} // namespace ns3
119
120#endif /* HEXAGONAL_WRAPAROUND_H */
Vector3D GetSitePosition(const Vector3D &pos) const
Calculate the site position.
void AddSitePosition(const Vector3D &pos)
Add a site position.
static TypeId GetTypeId()
Register this type with the TypeId system.
Vector3D GetVirtualPosition(const Vector3D txPos, const Vector3D rxPos) const override
Get virtual position of txPos with respect to rxPos.
void SetSitePositions(const std::vector< Vector3D > &positions)
Set site positions.
double CalculateDistance(const Vector3D &a, const Vector3D &b) const
Calculate distance after wraparound between two points.
std::vector< Vector3D > m_sitePositions
site positions
void SetSiteDistance(double isd)
Set site distance.
void SetNumSites(uint8_t numSites)
Set number of sites.
a unique identifier for an interface.
Definition type-id.h:49
a 3d vector
Definition vector.h:35
WraparoundModel()=default
Default constructor.
Every class exported by the ns3 library is enclosed in the ns3 namespace.