A Discrete-Event Network Simulator
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
15using namespace ns3;
16
17NS_LOG_COMPONENT_DEFINE("WraparoundModel");
19
22{
23 static TypeId tid = TypeId("ns3::WraparoundModel")
25 .SetGroupName("Spectrum")
26 .AddConstructor<WraparoundModel>();
27 return tid;
28}
29
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
61{
62 return tx; // Placeholder, you are supposed to implement whatever wraparound model you want
63}
mobility buildings information (to be used by mobility models)
A network Node.
Definition node.h:46
Object()
Constructor.
Definition object.cc:96
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
a 3d vector
Definition vector.h:35
Introspection did not find any typical Config paths No Attributes are defined for this type No Tr...
WraparoundModel()=default
Default constructor.
static TypeId GetTypeId()
Register this type with the TypeId system.
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.
virtual Vector3D GetVirtualPosition(const Vector3D tx, const Vector3D rx) const
Get virtual position of txPos with respect to rxPos.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.