26 #include <ns3/double.h>
28 #include <ns3/simulator.h>
35 NS_LOG_COMPONENT_DEFINE(
"SatResidualInterferenceElimination");
40 NS_OBJECT_ENSURE_REGISTERED(SatResidualInterferenceElimination);
46 TypeId(
"ns3::SatResidualInterferenceElimination")
48 .AddConstructor<SatResidualInterferenceElimination>()
51 "Residual sampling error corresponding to E[g(τ)]/g(0) for the simulation",
54 MakeDoubleChecker<double>());
70 NS_LOG_FUNCTION(
this);
72 NS_FATAL_ERROR(
"SatPhy default constructor is not allowed to use");
76 Ptr<SatWaveformConf> waveformConf)
78 m_waveformConf(waveformConf),
81 NS_LOG_FUNCTION(
this);
86 NS_LOG_FUNCTION(
this);
91 Ptr<SatSignalParameters> packetInterferedWith,
92 Ptr<SatSignalParameters> processedPacket,
96 NS_LOG_FUNCTION(
this);
108 Ptr<SatSignalParameters> packetInterferedWith,
109 Ptr<SatSignalParameters> processedPacket,
115 NS_LOG_FUNCTION(
this);
117 NS_LOG_INFO(
"Removing interference power of packet from Beam[Carrier] "
118 << processedPacket->m_beamId <<
"[" << processedPacket->m_carrierId <<
"] between "
119 << startTime <<
" and " << endTime);
121 double ifPowerToRemove;
125 double normalizedTime = 0.0;
126 std::vector<std::pair<double, double>> ifPowerPerFragment;
130 oldIfPower = packetInterferedWith->GetInterferencePower();
131 ifPowerToRemove = processedPacket->m_rxPower_W;
132 ifPowerPerFragment = packetInterferedWith->GetInterferencePowerPerFragment();
136 oldIfPower = packetInterferedWith->GetInterferencePowerInSatellite();
137 ifPowerToRemove = processedPacket->GetRxPowerInSatellite();
138 ifPowerPerFragment = packetInterferedWith->GetInterferencePowerInSatellitePerFragment();
141 for (std::pair<double, double>& ifPower : ifPowerPerFragment)
143 normalizedTime += ifPower.first;
144 if (startTime >= normalizedTime)
148 else if (endTime < normalizedTime)
153 ifPower.second -= ifPowerToRemove;
154 ifPower.second += residualPower;
155 if (std::abs(ifPower.second) < 1.0e-30)
157 ifPower.second = 0.0;
160 if (ifPower.second < 0)
162 NS_FATAL_ERROR(
"Negative interference");
168 packetInterferedWith->SetInterferencePower(ifPowerPerFragment);
172 packetInterferedWith->SetInterferencePowerInSatellite(ifPowerPerFragment);
175 NS_LOG_INFO(
"Interfered packet ifPower went from "
183 NS_LOG_FUNCTION(
this);
185 NS_LOG_INFO(
"SatResidualInterferenceElimination::GetResidualPower");
187 double ifPowerToRemove = processedPacket->GetRxPowerInSatellite();
189 double sigma_lambda_2 = 1.0 / (8.0 * L * EsNo);
190 double sigma_phy_2 = 1.0 / (2.0 * L * EsNo);
191 return (2.0 + sigma_lambda_2 - (2.0 *
m_samplingError * std::exp(-sigma_phy_2 / 2.0))) *
Abstract class defining interface for interference elimination calculation objects.
~SatResidualInterferenceElimination()
Destructor.
void EliminateInterferences(Ptr< SatSignalParameters > packetInterferedWith, Ptr< SatSignalParameters > processedPacket, double EsNo, bool isRegenerative)
Eliminate the residual power of interference for the given packets.
uint32_t GetBurstLengthInSymbols(uint32_t waveformId) const
SatResidualInterferenceElimination()
Default constructor.
TypeId GetInstanceTypeId(void) const
Derived from Object.
double GetResidualPower(Ptr< SatSignalParameters > processedPacket, double EsNo)
Calculate the residual power of interference for a given packet.
static TypeId GetTypeId(void)
Derived from Object.
static double ScalarProduct(const std::vector< std::pair< double, double >> &vector)
Scalar product.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.