A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
wraparound-model.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2025 CTTC
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
7
*/
8
9
#include "
wraparound-model.h
"
10
11
#include "ns3/log.h"
12
#include "ns3/mobility-building-info.h"
13
#include "ns3/node.h"
14
15
using namespace
ns3
;
16
17
NS_LOG_COMPONENT_DEFINE
(
"WraparoundModel"
);
18
NS_OBJECT_ENSURE_REGISTERED
(
WraparoundModel
);
19
20
TypeId
21
WraparoundModel::GetTypeId
()
22
{
23
static
TypeId
tid =
TypeId
(
"ns3::WraparoundModel"
)
24
.
SetParent
<
Object
>()
25
.SetGroupName(
"Spectrum"
)
26
.AddConstructor<
WraparoundModel
>();
27
return
tid;
28
}
29
30
Ptr<MobilityModel>
31
WraparoundModel::GetVirtualMobilityModel
(
Ptr<const MobilityModel>
tx,
32
Ptr<const MobilityModel>
rx)
const
33
{
34
NS_LOG_DEBUG
(
"Transmitter using virtual mobility model. Real position "
35
<< tx->GetPosition() <<
", receiver position "
<< rx->GetPosition()
36
<<
", wrapped position "
37
<<
GetVirtualPosition
(tx->GetPosition(), rx->GetPosition()) <<
"."
);
38
auto
virtualMm = tx->Copy();
39
// Set the transmitter to its virtual position respective to receiver
40
virtualMm->SetPosition(
GetVirtualPosition
(tx->GetPosition(), rx->GetPosition()));
41
42
// Unidirectionally aggregate NodeId to it, so it can be fetched later by
43
// propagation models
44
auto
node = tx->GetObject<
Node
>();
45
if
(node)
46
{
47
virtualMm->UnidirectionalAggregateObject(node);
48
}
49
50
// Some mobility models access building info related to mobility model
51
auto
mbi = tx->GetObject<
MobilityBuildingInfo
>();
52
if
(mbi)
53
{
54
virtualMm->UnidirectionalAggregateObject(mbi);
55
}
56
return
virtualMm;
57
}
58
59
Vector3D
60
WraparoundModel::GetVirtualPosition
(
const
Vector3D
tx,
const
Vector3D
rx)
const
61
{
62
return
tx;
// Placeholder, you are supposed to implement whatever wraparound model you want
63
}
ns3::MobilityBuildingInfo
mobility buildings information (to be used by mobility models)
Definition
mobility-building-info.h:37
ns3::Node
A network Node.
Definition
node.h:46
ns3::Object::Object
Object()
Constructor.
Definition
object.cc:96
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:67
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
ns3::Vector3D
a 3d vector
Definition
vector.h:35
ns3::WraparoundModel
Introspection did not find any typical Config paths No Attributes are defined for this type No Tr...
Definition
wraparound-model.h:17
ns3::WraparoundModel::WraparoundModel
WraparoundModel()=default
Default constructor.
ns3::WraparoundModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition
wraparound-model.cc:21
ns3::WraparoundModel::GetVirtualMobilityModel
Ptr< MobilityModel > GetVirtualMobilityModel(Ptr< const MobilityModel > tx, Ptr< const MobilityModel > rx) const
Creates a disposable virtual mobility model for tx based on rx distance and a wraparound model.
Definition
wraparound-model.cc:31
ns3::WraparoundModel::GetVirtualPosition
virtual Vector3D GetVirtualPosition(const Vector3D tx, const Vector3D rx) const
Get virtual position of txPos with respect to rxPos.
Definition
wraparound-model.cc:60
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
wraparound-model.h
src
spectrum
model
wraparound-model.cc
Generated on Wed Oct 1 2025 18:22:29 for ns-3 by
1.13.2