26 #include <ns3/simulator.h>
34 NS_LOG_COMPONENT_DEFINE(
"SatPerfectInterferenceElimination");
39 NS_OBJECT_ENSURE_REGISTERED(SatPerfectInterferenceElimination);
44 static TypeId tid = TypeId(
"ns3::SatPerfectInterferenceElimination")
46 .AddConstructor<SatPerfectInterferenceElimination>();
59 NS_LOG_FUNCTION(
this);
64 NS_LOG_FUNCTION(
this);
69 Ptr<SatSignalParameters> packetInterferedWith,
70 Ptr<SatSignalParameters> processedPacket,
74 NS_LOG_FUNCTION(
this);
86 Ptr<SatSignalParameters> packetInterferedWith,
87 Ptr<SatSignalParameters> processedPacket,
93 NS_LOG_FUNCTION(
this);
95 NS_LOG_INFO(
"Removing interference power of packet from Beam[Carrier] "
96 << processedPacket->m_beamId <<
"[" << processedPacket->m_carrierId <<
"] between "
97 << startTime <<
" and " << endTime);
100 double normalizedTime = 0.0;
101 std::vector<std::pair<double, double>> ifPowerPerFragment;
104 oldIfPower = packetInterferedWith->GetInterferencePower();
105 ifPowerPerFragment = packetInterferedWith->GetInterferencePowerPerFragment();
109 oldIfPower = packetInterferedWith->GetInterferencePowerInSatellite();
110 ifPowerPerFragment = packetInterferedWith->GetInterferencePowerInSatellitePerFragment();
113 for (std::pair<double, double>& ifPower : ifPowerPerFragment)
115 normalizedTime += ifPower.first;
116 if (startTime >= normalizedTime)
120 else if (endTime < normalizedTime)
125 ifPower.second -= (isRegenerative ? processedPacket->m_rxPower_W
126 : processedPacket->GetRxPowerInSatellite());
127 if (std::abs(ifPower.second) < std::numeric_limits<double>::epsilon())
129 ifPower.second = 0.0;
132 if (ifPower.second < 0)
134 NS_FATAL_ERROR(
"Negative interference " << ifPower.second);
140 packetInterferedWith->SetInterferencePower(ifPowerPerFragment);
144 packetInterferedWith->SetInterferencePowerInSatellite(ifPowerPerFragment);
147 NS_LOG_INFO(
"Interfered packet ifPower went from "
Abstract class defining interface for interference elimination calculation objects.
static TypeId GetTypeId(void)
Derived from Object.
TypeId GetInstanceTypeId(void) const
Derived from Object.
double GetResidualPower(Ptr< SatSignalParameters > processedPacket, double EsNo)
Calculate the residual power of interference for a given packet.
SatPerfectInterferenceElimination()
Default constructor.
void EliminateInterferences(Ptr< SatSignalParameters > packetInterferedWith, Ptr< SatSignalParameters > processedPacket, double EsNo, bool isRegenerative)
Calculate residual power of interference for the given packets.
~SatPerfectInterferenceElimination()
Destructor.
static double ScalarProduct(const std::vector< std::pair< double, double >> &vector)
Scalar product.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.