Loading...
Searching...
No Matches
satellite-traced-interference.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd.
4 * Copyright (c) 2018 CNES
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Sami Rantanen <sami.rantanen@magister.fi>
20 * Author: Mathias Ettinger <mettinger@toulouse.viveris.fr>
21 */
22
24
25#include "ns3/log.h"
26#include "ns3/simulator.h"
27#include "ns3/singleton.h"
28
29#include <limits>
30#include <stdint.h>
31#include <utility>
32#include <vector>
33
34NS_LOG_COMPONENT_DEFINE("SatTracedInterference");
35
36namespace ns3
37{
38
39NS_OBJECT_ENSURE_REGISTERED(SatTracedInterference);
40
41TypeId
43{
44 static TypeId tid = TypeId("ns3::SatTracedInterference")
45 .SetParent<SatInterference>()
46 .AddConstructor<SatTracedInterference>();
47
48 return tid;
49}
50
52 double rxBandwidth)
53 : m_rxing(false),
54 m_power(0),
55 m_channelType(channeltype),
56 m_rxBandwidth_Hz(rxBandwidth)
57{
58 NS_LOG_FUNCTION(this);
59
60 if (m_rxBandwidth_Hz <= std::numeric_limits<double>::epsilon())
61 {
62 NS_FATAL_ERROR("SatTracedInterference::SatTracedInterference - Invalid value");
63 }
64}
65
67 : m_rxing(false),
68 m_power(),
71{
72 NS_LOG_FUNCTION(this);
73
74 NS_FATAL_ERROR("SatTracedInterference::SatTracedInterference - Constructor not in use");
75}
76
78{
79 NS_LOG_FUNCTION(this);
80
81 Reset();
82}
83
84Ptr<SatInterference::InterferenceChangeEvent>
85SatTracedInterference::DoAdd(Time duration, double power, Address rxAddress)
86{
87 NS_LOG_FUNCTION(this << duration.GetSeconds() << power << rxAddress);
88
89 Ptr<SatInterference::InterferenceChangeEvent> event;
90 event = Create<SatInterference::InterferenceChangeEvent>(0, duration, power, rxAddress);
91
92 return event;
93}
94
95std::vector<std::pair<double, double>>
96SatTracedInterference::DoCalculate(Ptr<SatInterference::InterferenceChangeEvent> event)
97{
98 NS_LOG_FUNCTION(this);
99
101 Singleton<SatInterferenceInputTraceContainer>::Get()->GetInterferenceDensity(
102 std::make_pair(event->GetSatEarthStationAddress(), m_channelType));
103
104 std::vector<std::pair<double, double>> powerPerFragment;
105 powerPerFragment.emplace_back(1.0, m_power);
106
107 return powerPerFragment;
108}
109
110void
112{
113 NS_LOG_FUNCTION(this);
114}
115
116void
117SatTracedInterference::DoNotifyRxStart(Ptr<SatInterference::InterferenceChangeEvent> event)
118{
119 NS_LOG_FUNCTION(this);
120
121 m_rxing = true;
122}
123
124void
125SatTracedInterference::DoNotifyRxEnd(Ptr<SatInterference::InterferenceChangeEvent> event)
126{
127 NS_LOG_FUNCTION(this);
128
129 m_rxing = false;
130}
131
132void
134{
135 NS_LOG_FUNCTION(this);
136
137 SatInterference::DoDispose();
138}
139
140void
142{
143 NS_LOG_FUNCTION(this);
144
145 if (rxBandwidth <= std::numeric_limits<double>::epsilon())
146 {
147 NS_FATAL_ERROR("SatTracedInterference::SetRxBandwidth - Invalid value");
148 }
149
150 m_rxBandwidth_Hz = rxBandwidth;
151}
152
153} // namespace ns3
154
155// namespace ns3
ChannelType_t
Types of channel.
void Reset(void)
Resets current interference.
SatInterference()
Constructor for Satellite interference base class.
Satellite traced interference.
static TypeId GetTypeId(void)
Derived from Object.
virtual void DoNotifyRxEnd(Ptr< SatInterference::InterferenceChangeEvent > event)
Notifies that RX is ended by a receiver.
virtual void DoReset(void)
Resets current interference.
void DoDispose()
Dispose of SatTracedInterference.
virtual std::vector< std::pair< double, double > > DoCalculate(Ptr< SatInterference::InterferenceChangeEvent > event)
Calculates interference power for the given reference Sets final power at end time to finalPower.
void SetRxBandwidth(double rxBandwidth)
Set Rx bandwidth.
SatTracedInterference()
Default constructor, not used.
virtual void DoNotifyRxStart(Ptr< SatInterference::InterferenceChangeEvent > event)
Notifies that RX is started by a receiver.
double m_rxBandwidth_Hz
RX Bandwidth in Hz.
virtual Ptr< SatInterference::InterferenceChangeEvent > DoAdd(Time rxDuration, double rxPower, Address rxAddress)
Adds interference power to interference object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.