spectrum API change
This commit is contained in:
@@ -80,6 +80,9 @@ instead of CXXDEFINES
|
|||||||
|
|
||||||
<h2>Changes to existing API:</h2>
|
<h2>Changes to existing API:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> In the spectrum module, the parameters to SpectrumChannel::StartTx () and SpectrumPhy::StartRx () methods are now passed using the new struct SpectrumSignalParameters. This new struct supports inheritance, hence it allows technology-specific PHY implementations to provide technology-specific parameters in SpectrumChannel::StartTx() and SpectrumPhy::StartRx(), while at the same time keeping a set of technology-independent parameters common across all spectrum-enabled PHY implementations (i.e., the duration and the power spectral density which are needed for interference calculation). Additionally, the SpectrumType class has been removed, since now the type of a spectrum signal can be inferred by doing a dynamic cast on SpectrumSignalParameters. See the <A href="http://mailman.isi.edu/pipermail/ns-developers/2011-October/009495.html" >Spectrum API change discussion on ns-developers</A> for the motivation behind this API change.
|
||||||
|
</li>
|
||||||
|
|
||||||
<li> The WifiPhyStandard enumerators for specifying half- and quarter-channel
|
<li> The WifiPhyStandard enumerators for specifying half- and quarter-channel
|
||||||
width standards has had a change in capitalization:
|
width standards has had a change in capitalization:
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -28,10 +28,10 @@
|
|||||||
#include <ns3/nstime.h>
|
#include <ns3/nstime.h>
|
||||||
#include <ns3/spectrum-phy.h>
|
#include <ns3/spectrum-phy.h>
|
||||||
#include <ns3/spectrum-channel.h>
|
#include <ns3/spectrum-channel.h>
|
||||||
#include <ns3/spectrum-type.h>
|
#include <ns3/spectrum-signal-parameters.h>
|
||||||
#include <ns3/spectrum-interference.h>
|
#include <ns3/spectrum-interference.h>
|
||||||
#include <ns3/generic-phy.h>
|
#include <ns3/generic-phy.h>
|
||||||
#include "lte-spectrum-phy.h"
|
#include <ns3/lte-spectrum-phy.h>
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <ns3/trace-source-accessor.h>
|
#include <ns3/trace-source-accessor.h>
|
||||||
#include "ns3/spectrum-error-model.h"
|
#include "ns3/spectrum-error-model.h"
|
||||||
#include "lte-spectrum-phy.h"
|
#include "lte-spectrum-phy.h"
|
||||||
|
#include "lte-spectrum-signal-parameters.h"
|
||||||
#include "lte-net-device.h"
|
#include "lte-net-device.h"
|
||||||
|
|
||||||
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
|
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
|
||||||
@@ -165,15 +166,6 @@ LteSpectrumPhy::GetRxSpectrumModel () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SpectrumType
|
|
||||||
LteSpectrumPhy::GetSpectrumType ()
|
|
||||||
{
|
|
||||||
NS_LOG_FUNCTION (this);
|
|
||||||
static SpectrumType st = SpectrumTypeFactory::Create ("IdealOfdm");
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LteSpectrumPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
|
LteSpectrumPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
|
||||||
{
|
{
|
||||||
@@ -286,7 +278,12 @@ LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
|
|||||||
ChangeState (TX);
|
ChangeState (TX);
|
||||||
NS_ASSERT (m_channel);
|
NS_ASSERT (m_channel);
|
||||||
double tti = 0.001;
|
double tti = 0.001;
|
||||||
m_channel->StartTx (pb, m_txPsd, GetSpectrumType (), Seconds (tti), GetObject<SpectrumPhy> ());
|
Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
|
||||||
|
txParams->duration = Seconds (tti);
|
||||||
|
txParams->txPhy = GetObject<SpectrumPhy> ();
|
||||||
|
txParams->psd = m_txPsd;
|
||||||
|
txParams->packetBurst = pb;
|
||||||
|
m_channel->StartTx (txParams);
|
||||||
Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this);
|
Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -329,18 +326,19 @@ LteSpectrumPhy::EndTx ()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LteSpectrumPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration)
|
LteSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumRxParams)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << pb << rxPsd << st << duration);
|
NS_LOG_FUNCTION (this << spectrumRxParams);
|
||||||
NS_LOG_LOGIC (this << "state: " << m_state);
|
NS_LOG_LOGIC (this << "state: " << m_state);
|
||||||
|
|
||||||
|
|
||||||
// interference will happen regardless of the state of the receiver
|
// interference will happen regardless of the state of the receiver
|
||||||
// m_interference->AddSignal (rxPsd, duration);
|
// m_interference->AddSignal (rxPsd, duration);
|
||||||
|
|
||||||
|
Ptr<LteSpectrumSignalParameters> lteRxParams = DynamicCast<LteSpectrumSignalParameters> (spectrumRxParams);
|
||||||
// the device might start RX only if the signal is of a type understood by this device
|
// the device might start RX only if the signal is of a type understood by this device
|
||||||
// this corresponds in real device to preamble detection
|
// this corresponds in real device to preamble detection
|
||||||
if (st == GetSpectrumType ())
|
if (lteRxParams != 0)
|
||||||
{
|
{
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
@@ -360,16 +358,17 @@ LteSpectrumPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, S
|
|||||||
// preamble detection and synchronization is supposed to be always successful.
|
// preamble detection and synchronization is supposed to be always successful.
|
||||||
NS_LOG_LOGIC (this << " receiving new packet");
|
NS_LOG_LOGIC (this << " receiving new packet");
|
||||||
|
|
||||||
for (std::list<Ptr<Packet> >::const_iterator iter = pb->Begin (); iter
|
for (std::list<Ptr<Packet> >::const_iterator iter = lteRxParams->packetBurst->Begin (); iter
|
||||||
!= pb->End (); ++iter)
|
!= lteRxParams->packetBurst->End (); ++iter)
|
||||||
{
|
{
|
||||||
Ptr<Packet> packet = (*iter)->Copy ();
|
Ptr<Packet> packet = (*iter)->Copy ();
|
||||||
m_phyRxStartTrace (packet);
|
m_phyRxStartTrace (packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_rxPacket = pb;
|
m_rxPacket = lteRxParams->packetBurst;
|
||||||
m_rxPsd = rxPsd;
|
m_rxPsd = lteRxParams->psd;
|
||||||
|
Time duration = lteRxParams->duration;
|
||||||
|
|
||||||
ChangeState (RX);
|
ChangeState (RX);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include <ns3/net-device.h>
|
#include <ns3/net-device.h>
|
||||||
#include <ns3/spectrum-phy.h>
|
#include <ns3/spectrum-phy.h>
|
||||||
#include <ns3/spectrum-channel.h>
|
#include <ns3/spectrum-channel.h>
|
||||||
#include <ns3/spectrum-type.h>
|
|
||||||
#include <ns3/spectrum-interference.h>
|
#include <ns3/spectrum-interference.h>
|
||||||
#include <ns3/data-rate.h>
|
#include <ns3/data-rate.h>
|
||||||
#include <ns3/generic-phy.h>
|
#include <ns3/generic-phy.h>
|
||||||
@@ -70,6 +69,7 @@ public:
|
|||||||
Ptr<MobilityModel> GetMobility ();
|
Ptr<MobilityModel> GetMobility ();
|
||||||
Ptr<NetDevice> GetDevice ();
|
Ptr<NetDevice> GetDevice ();
|
||||||
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
||||||
|
void StartRx (Ptr<SpectrumSignalParameters> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the channel where the physical layer is attached
|
* \brief Get the channel where the physical layer is attached
|
||||||
@@ -77,15 +77,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Ptr<SpectrumChannel> GetChannel (void);
|
Ptr<SpectrumChannel> GetChannel (void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SpectrumType used by this PHY
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
SpectrumType GetSpectrumType ();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the Power Spectral Density of outgoing signals in W/Hz.
|
* set the Power Spectral Density of outgoing signals in W/Hz.
|
||||||
*
|
*
|
||||||
@@ -117,15 +108,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool StartTx (Ptr<PacketBurst> pb);
|
bool StartTx (Ptr<PacketBurst> pb);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Notify the SpectrumPhy instance of an incoming waveform
|
|
||||||
* \param pb the burst of packet associated with the incoming waveform
|
|
||||||
* \param rxPsd the Power Spectral Density of the incoming waveform.
|
|
||||||
* The units of the SPD are the same specified for SpectrumChannel::StartTx().
|
|
||||||
* \param st the spectrum type
|
|
||||||
* \param duration the duration of the incoming waveform
|
|
||||||
*/
|
|
||||||
void StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the callback for the end of a TX, as part of the
|
* set the callback for the end of a TX, as part of the
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ def build(bld):
|
|||||||
module = bld.create_ns3_module('lte', ['internet', 'spectrum', 'wimax'])
|
module = bld.create_ns3_module('lte', ['internet', 'spectrum', 'wimax'])
|
||||||
module.source = [
|
module.source = [
|
||||||
'model/lte-spectrum-phy.cc',
|
'model/lte-spectrum-phy.cc',
|
||||||
|
'model/lte-spectrum-signal-parameters.cc',
|
||||||
'model/enb-lte-spectrum-phy.cc',
|
'model/enb-lte-spectrum-phy.cc',
|
||||||
'model/ue-lte-spectrum-phy.cc',
|
'model/ue-lte-spectrum-phy.cc',
|
||||||
'model/lte-phy.cc',
|
'model/lte-phy.cc',
|
||||||
@@ -51,6 +52,7 @@ def build(bld):
|
|||||||
headers.module = 'lte'
|
headers.module = 'lte'
|
||||||
headers.source = [
|
headers.source = [
|
||||||
'model/lte-spectrum-phy.h',
|
'model/lte-spectrum-phy.h',
|
||||||
|
'model/lte-spectrum-signal-parameters.h',
|
||||||
'model/enb-lte-spectrum-phy.h',
|
'model/enb-lte-spectrum-phy.h',
|
||||||
'model/ue-lte-spectrum-phy.h',
|
'model/ue-lte-spectrum-phy.h',
|
||||||
'model/lte-phy.h',
|
'model/lte-phy.h',
|
||||||
|
|||||||
@@ -27,13 +27,14 @@
|
|||||||
#include <ns3/packet-burst.h>
|
#include <ns3/packet-burst.h>
|
||||||
#include <ns3/callback.h>
|
#include <ns3/callback.h>
|
||||||
#include "half-duplex-ideal-phy.h"
|
#include "half-duplex-ideal-phy.h"
|
||||||
|
#include "half-duplex-ideal-phy-signal-parameters.h"
|
||||||
#include "spectrum-error-model.h"
|
#include "spectrum-error-model.h"
|
||||||
|
|
||||||
|
|
||||||
NS_LOG_COMPONENT_DEFINE ("HalfDuplexIdealPhy");
|
NS_LOG_COMPONENT_DEFINE ("HalfDuplexIdealPhy");
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
|
|
||||||
NS_OBJECT_ENSURE_REGISTERED (HalfDuplexIdealPhy);
|
NS_OBJECT_ENSURE_REGISTERED (HalfDuplexIdealPhy);
|
||||||
|
|
||||||
HalfDuplexIdealPhy::HalfDuplexIdealPhy ()
|
HalfDuplexIdealPhy::HalfDuplexIdealPhy ()
|
||||||
@@ -178,15 +179,6 @@ HalfDuplexIdealPhy::GetRxSpectrumModel () const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SpectrumType
|
|
||||||
HalfDuplexIdealPhy::GetSpectrumType ()
|
|
||||||
{
|
|
||||||
NS_LOG_FUNCTION (this);
|
|
||||||
static SpectrumType st = SpectrumTypeFactory::Create ("IdealOfdm");
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HalfDuplexIdealPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
|
HalfDuplexIdealPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
|
||||||
{
|
{
|
||||||
@@ -274,10 +266,15 @@ HalfDuplexIdealPhy::StartTx (Ptr<Packet> p)
|
|||||||
{
|
{
|
||||||
m_txPacket = p;
|
m_txPacket = p;
|
||||||
ChangeState (TX);
|
ChangeState (TX);
|
||||||
|
Ptr<HalfDuplexIdealPhySignalParameters> txParams = Create<HalfDuplexIdealPhySignalParameters> ();
|
||||||
double txTimeSeconds = m_rate.CalculateTxTime (p->GetSize ());
|
double txTimeSeconds = m_rate.CalculateTxTime (p->GetSize ());
|
||||||
Ptr<PacketBurst> pb = Create<PacketBurst> ();
|
txParams->duration = Seconds (txTimeSeconds);
|
||||||
pb->AddPacket (p);
|
txParams->txPhy = GetObject<SpectrumPhy> ();
|
||||||
m_channel->StartTx (pb, m_txPsd, GetSpectrumType (), Seconds (txTimeSeconds), GetObject<SpectrumPhy> ());
|
txParams->psd = m_txPsd;
|
||||||
|
txParams->data = m_txPacket;
|
||||||
|
|
||||||
|
NS_LOG_LOGIC (this << " tx power: " << 10 * log10 (Integral (*(txParams->psd))) + 30 << " dBm");
|
||||||
|
m_channel->StartTx (txParams);
|
||||||
Simulator::Schedule (Seconds (txTimeSeconds), &HalfDuplexIdealPhy::EndTx, this);
|
Simulator::Schedule (Seconds (txTimeSeconds), &HalfDuplexIdealPhy::EndTx, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -295,7 +292,7 @@ void
|
|||||||
HalfDuplexIdealPhy::EndTx ()
|
HalfDuplexIdealPhy::EndTx ()
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this);
|
NS_LOG_FUNCTION (this);
|
||||||
NS_LOG_LOGIC (this << "state: " << m_state);
|
NS_LOG_LOGIC (this << " state: " << m_state);
|
||||||
|
|
||||||
NS_ASSERT (m_state == TX);
|
NS_ASSERT (m_state == TX);
|
||||||
|
|
||||||
@@ -312,18 +309,21 @@ HalfDuplexIdealPhy::EndTx ()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HalfDuplexIdealPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration)
|
HalfDuplexIdealPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumParams)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << pb << rxPsd << st << duration);
|
NS_LOG_FUNCTION (this << spectrumParams);
|
||||||
NS_LOG_LOGIC (this << "state: " << m_state);
|
NS_LOG_LOGIC (this << " state: " << m_state);
|
||||||
|
NS_LOG_LOGIC (this << " rx power: " << 10 * log10 (Integral (*(spectrumParams->psd))) + 30 << " dBm");
|
||||||
|
|
||||||
// interference will happen regardless of the state of the receiver
|
// interference will happen regardless of the state of the receiver
|
||||||
m_interference.AddSignal (rxPsd, duration);
|
m_interference.AddSignal (spectrumParams->psd, spectrumParams->duration);
|
||||||
|
|
||||||
// the device might start RX only if the signal is of a type understood by this device
|
// the device might start RX only if the signal is of a type understood by this device
|
||||||
// this corresponds in real device to preamble detection
|
// this corresponds in real devices to preamble detection
|
||||||
if (st == GetSpectrumType ())
|
Ptr<HalfDuplexIdealPhySignalParameters> rxParams = DynamicCast<HalfDuplexIdealPhySignalParameters> (spectrumParams);
|
||||||
|
if (rxParams != 0)
|
||||||
{
|
{
|
||||||
|
// signal is of known type
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
case TX:
|
case TX:
|
||||||
@@ -341,12 +341,11 @@ HalfDuplexIdealPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPs
|
|||||||
|
|
||||||
case IDLE:
|
case IDLE:
|
||||||
// preamble detection and synchronization is supposed to be always successful.
|
// preamble detection and synchronization is supposed to be always successful.
|
||||||
NS_LOG_LOGIC (this << " receiving " << pb->GetNPackets () << " packet(s)" );
|
|
||||||
NS_ASSERT (pb->GetNPackets () == 1); // this PHY only supports a single packet per waveform
|
Ptr<Packet> p = rxParams->data;
|
||||||
Ptr<Packet> p = pb->GetPackets ().front ();
|
|
||||||
m_phyRxStartTrace (p);
|
m_phyRxStartTrace (p);
|
||||||
m_rxPacket = p;
|
m_rxPacket = p;
|
||||||
m_rxPsd = rxPsd;
|
m_rxPsd = rxParams->psd;
|
||||||
ChangeState (RX);
|
ChangeState (RX);
|
||||||
if (!m_phyMacRxStartCallback.IsNull ())
|
if (!m_phyMacRxStartCallback.IsNull ())
|
||||||
{
|
{
|
||||||
@@ -357,16 +356,20 @@ HalfDuplexIdealPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPs
|
|||||||
{
|
{
|
||||||
NS_LOG_LOGIC (this << " m_phyMacRxStartCallback is NULL");
|
NS_LOG_LOGIC (this << " m_phyMacRxStartCallback is NULL");
|
||||||
}
|
}
|
||||||
m_interference.StartRx (p, rxPsd);
|
m_interference.StartRx (p, rxParams->psd);
|
||||||
NS_LOG_LOGIC (this << " scheduling EndRx with delay " << duration);
|
NS_LOG_LOGIC (this << " scheduling EndRx with delay " << rxParams->duration);
|
||||||
m_endRxEventId = Simulator::Schedule (duration, &HalfDuplexIdealPhy::EndRx, this);
|
m_endRxEventId = Simulator::Schedule (rxParams->duration, &HalfDuplexIdealPhy::EndRx, this);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // rxParams == 0
|
||||||
|
{
|
||||||
|
NS_LOG_LOGIC (this << " signal of unknown type");
|
||||||
|
}
|
||||||
|
|
||||||
NS_LOG_LOGIC (this << "state: " << m_state);
|
NS_LOG_LOGIC (this << " state: " << m_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -388,7 +391,7 @@ void
|
|||||||
HalfDuplexIdealPhy::EndRx ()
|
HalfDuplexIdealPhy::EndRx ()
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this);
|
NS_LOG_FUNCTION (this);
|
||||||
NS_LOG_LOGIC (this << "state: " << m_state);
|
NS_LOG_LOGIC (this << " state: " << m_state);
|
||||||
|
|
||||||
NS_ASSERT (m_state == RX);
|
NS_ASSERT (m_state == RX);
|
||||||
|
|
||||||
|
|||||||
@@ -29,16 +29,14 @@
|
|||||||
#include <ns3/net-device.h>
|
#include <ns3/net-device.h>
|
||||||
#include <ns3/spectrum-phy.h>
|
#include <ns3/spectrum-phy.h>
|
||||||
#include <ns3/spectrum-channel.h>
|
#include <ns3/spectrum-channel.h>
|
||||||
#include <ns3/spectrum-type.h>
|
|
||||||
#include <ns3/spectrum-interference.h>
|
#include <ns3/spectrum-interference.h>
|
||||||
#include <ns3/data-rate.h>
|
#include <ns3/data-rate.h>
|
||||||
#include <ns3/generic-phy.h>
|
#include <ns3/generic-phy.h>
|
||||||
#include <ns3/event-id.h>
|
#include <ns3/event-id.h>
|
||||||
|
#include <ns3/spectrum-signal-parameters.h>
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup spectrum
|
* \ingroup spectrum
|
||||||
*
|
*
|
||||||
@@ -99,16 +97,7 @@ public:
|
|||||||
Ptr<MobilityModel> GetMobility ();
|
Ptr<MobilityModel> GetMobility ();
|
||||||
Ptr<NetDevice> GetDevice ();
|
Ptr<NetDevice> GetDevice ();
|
||||||
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
||||||
void StartRx (Ptr<PacketBurst> p, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
|
void StartRx (Ptr<SpectrumSignalParameters> params);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SpectrumType used by this PHY
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
SpectrumType GetSpectrumType ();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -223,20 +223,20 @@ MultiModelSpectrumChannel::FindAndEventuallyAddTxSpectrumModel (Ptr<const Spectr
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> originalTxPowerSpectrum, SpectrumType st, Time duration, Ptr<SpectrumPhy> txPhy)
|
MultiModelSpectrumChannel::StartTx (Ptr<SpectrumSignalParameters> txParams)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << p << *originalTxPowerSpectrum << duration << txPhy);
|
NS_LOG_FUNCTION (this << txParams);
|
||||||
|
|
||||||
NS_ASSERT (txPhy);
|
NS_ASSERT (txParams->txPhy);
|
||||||
NS_ASSERT (originalTxPowerSpectrum);
|
NS_ASSERT (txParams->psd);
|
||||||
|
|
||||||
|
|
||||||
Ptr<MobilityModel> txMobility = txPhy->GetMobility ();
|
Ptr<MobilityModel> txMobility = txParams->txPhy->GetMobility ();
|
||||||
SpectrumModelUid_t txSpectrumModelUid = originalTxPowerSpectrum->GetSpectrumModelUid ();
|
SpectrumModelUid_t txSpectrumModelUid = txParams->psd->GetSpectrumModelUid ();
|
||||||
NS_LOG_LOGIC (" txSpectrumModelUid " << txSpectrumModelUid);
|
NS_LOG_LOGIC (" txSpectrumModelUid " << txSpectrumModelUid);
|
||||||
|
|
||||||
//
|
//
|
||||||
TxSpectrumModelInfoMap_t::const_iterator txInfoIteratorerator = FindAndEventuallyAddTxSpectrumModel (originalTxPowerSpectrum->GetSpectrumModel ());
|
TxSpectrumModelInfoMap_t::const_iterator txInfoIteratorerator = FindAndEventuallyAddTxSpectrumModel (txParams->psd->GetSpectrumModel ());
|
||||||
NS_ASSERT (txInfoIteratorerator != m_txSpectrumModelInfoMap.end ());
|
NS_ASSERT (txInfoIteratorerator != m_txSpectrumModelInfoMap.end ());
|
||||||
|
|
||||||
NS_LOG_LOGIC ("converter map for TX SpectrumModel with Uid " << txInfoIteratorerator->first);
|
NS_LOG_LOGIC ("converter map for TX SpectrumModel with Uid " << txInfoIteratorerator->first);
|
||||||
@@ -251,20 +251,20 @@ MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> orig
|
|||||||
NS_LOG_LOGIC (" rxSpectrumModelUids " << rxSpectrumModelUid);
|
NS_LOG_LOGIC (" rxSpectrumModelUids " << rxSpectrumModelUid);
|
||||||
|
|
||||||
Ptr <SpectrumValue> convertedTxPowerSpectrum;
|
Ptr <SpectrumValue> convertedTxPowerSpectrum;
|
||||||
|
|
||||||
if (txSpectrumModelUid == rxSpectrumModelUid)
|
if (txSpectrumModelUid == rxSpectrumModelUid)
|
||||||
{
|
{
|
||||||
NS_LOG_LOGIC ("no conversion needed");
|
NS_LOG_LOGIC ("no spectrum conversion needed");
|
||||||
convertedTxPowerSpectrum = originalTxPowerSpectrum;
|
convertedTxPowerSpectrum = txParams->psd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NS_LOG_LOGIC (" converting txPowerSpectrum SpectrumModelUids" << txSpectrumModelUid << " --> " << rxSpectrumModelUid);
|
NS_LOG_LOGIC (" converting txPowerSpectrum SpectrumModelUids" << txSpectrumModelUid << " --> " << rxSpectrumModelUid);
|
||||||
SpectrumConverterMap_t::const_iterator rxConverterIterator = txInfoIteratorerator->second.m_spectrumConverterMap.find (rxSpectrumModelUid);
|
SpectrumConverterMap_t::const_iterator rxConverterIterator = txInfoIteratorerator->second.m_spectrumConverterMap.find (rxSpectrumModelUid);
|
||||||
NS_ASSERT (rxConverterIterator != txInfoIteratorerator->second.m_spectrumConverterMap.end ());
|
NS_ASSERT (rxConverterIterator != txInfoIteratorerator->second.m_spectrumConverterMap.end ());
|
||||||
convertedTxPowerSpectrum = rxConverterIterator->second.Convert (originalTxPowerSpectrum);
|
convertedTxPowerSpectrum = rxConverterIterator->second.Convert (txParams->psd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (std::list<Ptr<SpectrumPhy> >::const_iterator rxPhyIterator = rxInfoIterator->second.m_rxPhyList.begin ();
|
for (std::list<Ptr<SpectrumPhy> >::const_iterator rxPhyIterator = rxInfoIterator->second.m_rxPhyList.begin ();
|
||||||
rxPhyIterator != rxInfoIterator->second.m_rxPhyList.end ();
|
rxPhyIterator != rxInfoIterator->second.m_rxPhyList.end ();
|
||||||
++rxPhyIterator)
|
++rxPhyIterator)
|
||||||
@@ -272,9 +272,13 @@ MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> orig
|
|||||||
NS_ASSERT_MSG ((*rxPhyIterator)->GetRxSpectrumModel ()->GetUid () == rxSpectrumModelUid,
|
NS_ASSERT_MSG ((*rxPhyIterator)->GetRxSpectrumModel ()->GetUid () == rxSpectrumModelUid,
|
||||||
"MultiModelSpectrumChannel only supports devices that use a single RxSpectrumModel that does not change for the whole simulation");
|
"MultiModelSpectrumChannel only supports devices that use a single RxSpectrumModel that does not change for the whole simulation");
|
||||||
|
|
||||||
if ((*rxPhyIterator) != txPhy)
|
|
||||||
|
|
||||||
|
if ((*rxPhyIterator) != txParams->txPhy)
|
||||||
{
|
{
|
||||||
Ptr <SpectrumValue> rxPowerSpectrum = convertedTxPowerSpectrum->Copy ();
|
NS_LOG_LOGIC (" copying signal parameters " << txParams);
|
||||||
|
Ptr<SpectrumSignalParameters> rxParams = txParams->Copy ();
|
||||||
|
rxParams->psd = Copy<SpectrumValue> (convertedTxPowerSpectrum);
|
||||||
Time delay = MicroSeconds (0);
|
Time delay = MicroSeconds (0);
|
||||||
|
|
||||||
Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
|
Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
|
||||||
@@ -284,19 +288,19 @@ MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> orig
|
|||||||
if (m_propagationLoss)
|
if (m_propagationLoss)
|
||||||
{
|
{
|
||||||
double gainDb = m_propagationLoss->CalcRxPower (0, txMobility, receiverMobility);
|
double gainDb = m_propagationLoss->CalcRxPower (0, txMobility, receiverMobility);
|
||||||
m_propagationLossTrace (txPhy, *rxPhyIterator, -gainDb);
|
m_propagationLossTrace (txParams->txPhy, *rxPhyIterator, -gainDb);
|
||||||
if ( (-gainDb) > m_maxLossDb)
|
if ( (-gainDb) > m_maxLossDb)
|
||||||
{
|
{
|
||||||
// beyond range
|
// beyond range
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double gainLinear = pow (10.0, gainDb/10.0);
|
double gainLinear = pow (10.0, gainDb / 10.0);
|
||||||
*rxPowerSpectrum = (*rxPowerSpectrum) * gainLinear;
|
*(rxParams->psd) *= gainLinear;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_spectrumPropagationLoss)
|
if (m_spectrumPropagationLoss)
|
||||||
{
|
{
|
||||||
rxPowerSpectrum = m_spectrumPropagationLoss->CalcRxPowerSpectralDensity (rxPowerSpectrum, txMobility, receiverMobility);
|
rxParams->psd = m_spectrumPropagationLoss->CalcRxPowerSpectralDensity (rxParams->psd, txMobility, receiverMobility);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_propagationDelay)
|
if (m_propagationDelay)
|
||||||
@@ -305,20 +309,19 @@ MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> orig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<PacketBurst> pktBurstCopy = p->Copy ();
|
|
||||||
Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
|
Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
|
||||||
if (netDev)
|
if (netDev)
|
||||||
{
|
{
|
||||||
// the receiver has a NetDevice, so we expect that it is attached to a Node
|
// the receiver has a NetDevice, so we expect that it is attached to a Node
|
||||||
uint32_t dstNode = netDev->GetNode ()->GetId ();
|
uint32_t dstNode = netDev->GetNode ()->GetId ();
|
||||||
Simulator::ScheduleWithContext (dstNode, delay, &MultiModelSpectrumChannel::StartRx, this,
|
Simulator::ScheduleWithContext (dstNode, delay, &MultiModelSpectrumChannel::StartRx, this,
|
||||||
pktBurstCopy, rxPowerSpectrum, st, duration, *rxPhyIterator);
|
rxParams, *rxPhyIterator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// the receiver is not attached to a NetDevice, so we cannot assume that it is attached to a node
|
// the receiver is not attached to a NetDevice, so we cannot assume that it is attached to a node
|
||||||
Simulator::Schedule (delay, &MultiModelSpectrumChannel::StartRx, this,
|
Simulator::Schedule (delay, &MultiModelSpectrumChannel::StartRx, this,
|
||||||
pktBurstCopy, rxPowerSpectrum, st, duration, *rxPhyIterator);
|
rxParams, *rxPhyIterator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,10 +331,10 @@ MultiModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> orig
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MultiModelSpectrumChannel::StartRx (Ptr<PacketBurst> pb, Ptr <SpectrumValue> rxPsd, SpectrumType st, Time duration, Ptr<SpectrumPhy> receiver)
|
MultiModelSpectrumChannel::StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this);
|
NS_LOG_FUNCTION (this);
|
||||||
receiver->StartRx (pb, rxPsd, st, duration);
|
receiver->StartRx (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
|
virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
|
||||||
virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay);
|
virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay);
|
||||||
virtual void AddRx (Ptr<SpectrumPhy> phy);
|
virtual void AddRx (Ptr<SpectrumPhy> phy);
|
||||||
virtual void StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> txPsd, SpectrumType st, Time duration, Ptr<SpectrumPhy> sender);
|
virtual void StartTx (Ptr<SpectrumSignalParameters> params);
|
||||||
|
|
||||||
|
|
||||||
// inherited from Channel
|
// inherited from Channel
|
||||||
@@ -135,12 +135,10 @@ private:
|
|||||||
/**
|
/**
|
||||||
* used internally to reschedule transmission after the propagation delay
|
* used internally to reschedule transmission after the propagation delay
|
||||||
*
|
*
|
||||||
* @param p
|
* @param params
|
||||||
* @param rxPowerSpectrum
|
|
||||||
* @param duration
|
|
||||||
* @param receiver
|
* @param receiver
|
||||||
*/
|
*/
|
||||||
virtual void StartRx (Ptr<PacketBurst> p, Ptr <SpectrumValue> rxPowerSpectrum, SpectrumType st, Time duration, Ptr<SpectrumPhy> receiver);
|
virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,59 +103,59 @@ SingleModelSpectrumChannel::AddRx (Ptr<SpectrumPhy> phy)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SingleModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> txPsd, SpectrumType st, Time duration, Ptr<SpectrumPhy> txPhy)
|
SingleModelSpectrumChannel::StartTx (Ptr<SpectrumSignalParameters> txParams)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << p << *txPsd << st << duration << txPhy);
|
NS_LOG_FUNCTION (this << txParams->psd << txParams->duration << txParams->txPhy);
|
||||||
NS_ASSERT_MSG (p, "NULL PacketBurst");
|
NS_ASSERT_MSG (txParams->psd, "NULL txPsd");
|
||||||
NS_ASSERT_MSG (txPsd, "NULL txPsd");
|
NS_ASSERT_MSG (txParams->txPhy, "NULL txPhy");
|
||||||
NS_ASSERT_MSG (txPhy, "NULL txPhy");
|
|
||||||
|
|
||||||
// just a sanity check routine. We might want to remove it to save some computational load -- one "if" statement ;-)
|
// just a sanity check routine. We might want to remove it to save some computational load -- one "if" statement ;-)
|
||||||
if (m_spectrumModel == 0)
|
if (m_spectrumModel == 0)
|
||||||
{
|
{
|
||||||
// first pak, record SpectrumModel
|
// first pak, record SpectrumModel
|
||||||
m_spectrumModel = txPsd->GetSpectrumModel ();
|
m_spectrumModel = txParams->psd->GetSpectrumModel ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// all attached SpectrumPhy instances must use the same SpectrumModel
|
// all attached SpectrumPhy instances must use the same SpectrumModel
|
||||||
NS_ASSERT (*(txPsd->GetSpectrumModel ()) == *m_spectrumModel);
|
NS_ASSERT (*(txParams->psd->GetSpectrumModel ()) == *m_spectrumModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ptr<MobilityModel> senderMobility = txPhy->GetMobility ();
|
Ptr<MobilityModel> senderMobility = txParams->txPhy->GetMobility ();
|
||||||
|
|
||||||
for (PhyList::const_iterator rxPhyIterator = m_phyList.begin ();
|
for (PhyList::const_iterator rxPhyIterator = m_phyList.begin ();
|
||||||
rxPhyIterator != m_phyList.end ();
|
rxPhyIterator != m_phyList.end ();
|
||||||
++rxPhyIterator)
|
++rxPhyIterator)
|
||||||
{
|
{
|
||||||
if ((*rxPhyIterator) != txPhy)
|
if ((*rxPhyIterator) != txParams->txPhy)
|
||||||
{
|
{
|
||||||
Ptr <SpectrumValue> rxPsd = Copy<SpectrumValue> (txPsd);
|
|
||||||
Time delay = MicroSeconds (0);
|
Time delay = MicroSeconds (0);
|
||||||
|
|
||||||
Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
|
Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility ();
|
||||||
|
NS_LOG_LOGIC ("copying signal parameters " << txParams);
|
||||||
|
Ptr<SpectrumSignalParameters> rxParams = txParams->Copy ();
|
||||||
|
|
||||||
if (senderMobility && receiverMobility)
|
if (senderMobility && receiverMobility)
|
||||||
{
|
{
|
||||||
if (m_propagationLoss)
|
if (m_propagationLoss)
|
||||||
{
|
{
|
||||||
double gainDb = m_propagationLoss->CalcRxPower (0, senderMobility, receiverMobility);
|
double gainDb = m_propagationLoss->CalcRxPower (0, senderMobility, receiverMobility);
|
||||||
m_propagationLossTrace (txPhy, *rxPhyIterator, -gainDb);
|
m_propagationLossTrace (txParams->txPhy, *rxPhyIterator, -gainDb);
|
||||||
if ( (-gainDb) > m_maxLossDb)
|
if ( (-gainDb) > m_maxLossDb)
|
||||||
{
|
{
|
||||||
// beyond range
|
// beyond range
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double gainLinear = pow (10.0, gainDb/10.0);
|
double gainLinear = pow (10.0, gainDb / 10.0);
|
||||||
*rxPsd = (*rxPsd) * gainLinear;
|
*(rxParams->psd) *= gainLinear;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_spectrumPropagationLoss)
|
if (m_spectrumPropagationLoss)
|
||||||
{
|
{
|
||||||
rxPsd = m_spectrumPropagationLoss->CalcRxPowerSpectralDensity (rxPsd, senderMobility, receiverMobility);
|
rxParams->psd = m_spectrumPropagationLoss->CalcRxPowerSpectralDensity (rxParams->psd, senderMobility, receiverMobility);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_propagationDelay)
|
if (m_propagationDelay)
|
||||||
@@ -164,20 +164,19 @@ SingleModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> txP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<PacketBurst> pktBurstCopy = p->Copy ();
|
|
||||||
Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
|
Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice ();
|
||||||
if (netDev)
|
if (netDev)
|
||||||
{
|
{
|
||||||
// the receiver has a NetDevice, so we expect that it is attached to a Node
|
// the receiver has a NetDevice, so we expect that it is attached to a Node
|
||||||
uint32_t dstNode = netDev->GetNode ()->GetId ();
|
uint32_t dstNode = netDev->GetNode ()->GetId ();
|
||||||
Simulator::ScheduleWithContext (dstNode, delay, &SingleModelSpectrumChannel::StartRx, this,
|
Simulator::ScheduleWithContext (dstNode, delay, &SingleModelSpectrumChannel::StartRx, this, rxParams, *rxPhyIterator);
|
||||||
pktBurstCopy, rxPsd, st, duration, *rxPhyIterator);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// the receiver is not attached to a NetDevice, so we cannot assume that it is attached to a node
|
// the receiver is not attached to a NetDevice, so we cannot assume that it is attached to a node
|
||||||
Simulator::Schedule (delay, &SingleModelSpectrumChannel::StartRx, this,
|
Simulator::Schedule (delay, &SingleModelSpectrumChannel::StartRx, this,
|
||||||
pktBurstCopy, rxPsd, st, duration, *rxPhyIterator);
|
rxParams, *rxPhyIterator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,10 +184,10 @@ SingleModelSpectrumChannel::StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> txP
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SingleModelSpectrumChannel::StartRx (Ptr<PacketBurst> p, Ptr <SpectrumValue> rxPsd, SpectrumType st, Time duration, Ptr<SpectrumPhy> receiver)
|
SingleModelSpectrumChannel::StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << p << *rxPsd << st << duration << receiver);
|
NS_LOG_FUNCTION (this << params);
|
||||||
receiver->StartRx (p, rxPsd, st, duration);
|
receiver->StartRx (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,11 +51,7 @@ public:
|
|||||||
virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
|
virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
|
||||||
virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay);
|
virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay);
|
||||||
virtual void AddRx (Ptr<SpectrumPhy> phy);
|
virtual void AddRx (Ptr<SpectrumPhy> phy);
|
||||||
virtual void StartTx (Ptr<PacketBurst> p,
|
virtual void StartTx (Ptr<SpectrumSignalParameters> params);
|
||||||
Ptr <SpectrumValue> txPsd,
|
|
||||||
SpectrumType st,
|
|
||||||
Time duration,
|
|
||||||
Ptr<SpectrumPhy> sender);
|
|
||||||
|
|
||||||
|
|
||||||
// inherited from Channel
|
// inherited from Channel
|
||||||
@@ -73,13 +69,10 @@ private:
|
|||||||
/**
|
/**
|
||||||
* used internally to reschedule transmission after the propagation delay
|
* used internally to reschedule transmission after the propagation delay
|
||||||
*
|
*
|
||||||
* @param p
|
* @param params
|
||||||
* @param rxPowerSpectrum
|
|
||||||
* @param st
|
|
||||||
* @param duration
|
|
||||||
* @param receiver
|
* @param receiver
|
||||||
*/
|
*/
|
||||||
virtual void StartRx (Ptr<PacketBurst> p, Ptr <SpectrumValue> rxPowerSpectrum, SpectrumType st, Time duration, Ptr<SpectrumPhy> receiver);
|
void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list of SpectrumPhy instances attached to
|
* list of SpectrumPhy instances attached to
|
||||||
|
|||||||
@@ -136,14 +136,11 @@ SpectrumAnalyzer::SetChannel (Ptr<SpectrumChannel> c)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpectrumAnalyzer::StartRx (Ptr<PacketBurst> pb,
|
SpectrumAnalyzer::StartRx (Ptr<SpectrumSignalParameters> params)
|
||||||
Ptr <const SpectrumValue> rxPowerSpectralDensity,
|
|
||||||
SpectrumType st,
|
|
||||||
Time duration)
|
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION ( this << st << duration << *rxPowerSpectralDensity);
|
NS_LOG_FUNCTION ( this << params);
|
||||||
AddSignal (rxPowerSpectralDensity);
|
AddSignal (params->psd);
|
||||||
Simulator::Schedule (duration, &SpectrumAnalyzer::SubtractSignal, this, rxPowerSpectralDensity);
|
Simulator::Schedule (params->duration, &SpectrumAnalyzer::SubtractSignal, this, params->psd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
Ptr<MobilityModel> GetMobility ();
|
Ptr<MobilityModel> GetMobility ();
|
||||||
Ptr<NetDevice> GetDevice ();
|
Ptr<NetDevice> GetDevice ();
|
||||||
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
||||||
void StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPowerSpectralDensity, SpectrumType st, Time duration);
|
void StartRx (Ptr<SpectrumSignalParameters> params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <ns3/object.h>
|
#include <ns3/object.h>
|
||||||
#include <ns3/nstime.h>
|
#include <ns3/nstime.h>
|
||||||
#include <ns3/channel.h>
|
#include <ns3/channel.h>
|
||||||
#include <ns3/spectrum-type.h>
|
#include <ns3/spectrum-signal-parameters.h>
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
@@ -72,21 +72,11 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by attached PHY instances to transmit waveforms on the channel
|
* Used by attached PHY instances to transmit signals on the channel
|
||||||
*
|
*
|
||||||
* @param p the PacketBurst associated with the waveform being transmitted
|
* @param params the parameters of the signals being transmitted
|
||||||
* @param txPsd the Power Spectral Density of the
|
|
||||||
* waveform, in linear units. The exact unit will depend on the
|
|
||||||
* type of transmission medium involved: W for radio communications, Pa for
|
|
||||||
* underwater acoustic communications. Other transmission media to be defined.
|
|
||||||
* @param st spectrum type
|
|
||||||
* @param duration duration of the packet transmission. It is
|
|
||||||
* assumed that the Power Spectral Density remains constant for the
|
|
||||||
* whole duration of the transmission. In other words, all waveform
|
|
||||||
* have a rect shape with respect to time.
|
|
||||||
* @param sender the SpectrumPhy instance making this function call
|
|
||||||
*/
|
*/
|
||||||
virtual void StartTx (Ptr<PacketBurst> p, Ptr <SpectrumValue> txPsd, SpectrumType st, Time duration, Ptr<SpectrumPhy> sender) = 0;
|
virtual void StartTx (Ptr<SpectrumSignalParameters> params) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief add a SpectrumPhy to a channel, so it can receive packets
|
* @brief add a SpectrumPhy to a channel, so it can receive packets
|
||||||
|
|||||||
@@ -110,10 +110,15 @@ void
|
|||||||
SpectrumInterference::ConditionallyEvaluateChunk ()
|
SpectrumInterference::ConditionallyEvaluateChunk ()
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this);
|
NS_LOG_FUNCTION (this);
|
||||||
if (m_receiving && (Now () > m_lastChangeTime))
|
NS_LOG_LOGIC ("m_receiving: " << m_receiving );
|
||||||
|
NS_LOG_LOGIC ("m_lastChangeTime: " << m_lastChangeTime << " Now: " << Now ());
|
||||||
|
bool condition = m_receiving && (Now () > m_lastChangeTime);
|
||||||
|
NS_LOG_LOGIC ("if condition: " << condition);
|
||||||
|
if (condition)
|
||||||
{
|
{
|
||||||
SpectrumValue sinr = (*m_rxSignal) / ((*m_allSignals) - (*m_rxSignal) + (*m_noise));
|
SpectrumValue sinr = (*m_rxSignal) / ((*m_allSignals) - (*m_rxSignal) + (*m_noise));
|
||||||
Time duration = Now () - m_lastChangeTime;
|
Time duration = Now () - m_lastChangeTime;
|
||||||
|
NS_LOG_LOGIC ("calling m_errorModel->EvaluateChunk (sinr, duration)");
|
||||||
m_errorModel->EvaluateChunk (sinr, duration);
|
m_errorModel->EvaluateChunk (sinr, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include <ns3/object.h>
|
#include <ns3/object.h>
|
||||||
#include <ns3/nstime.h>
|
#include <ns3/nstime.h>
|
||||||
#include <ns3/spectrum-type.h>
|
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
@@ -34,6 +33,7 @@ class MobilityModel;
|
|||||||
class SpectrumValue;
|
class SpectrumValue;
|
||||||
class SpectrumModel;
|
class SpectrumModel;
|
||||||
class NetDevice;
|
class NetDevice;
|
||||||
|
struct SpectrumSignalParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup spectrum
|
* \ingroup spectrum
|
||||||
@@ -94,15 +94,11 @@ public:
|
|||||||
virtual Ptr<const SpectrumModel> GetRxSpectrumModel () const = 0;
|
virtual Ptr<const SpectrumModel> GetRxSpectrumModel () const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the SpectrumPhy instance of an incoming waveform
|
* Notify the SpectrumPhy instance of an incoming signal
|
||||||
*
|
*
|
||||||
* @param p the PacketBurst associated with the incoming waveform
|
* @param params the parameters of the signals being received
|
||||||
* @param rxPsd the Power Spectral Density of the incoming
|
|
||||||
* waveform. The units of the PSD are the same specified for SpectrumChannel::StartTx().
|
|
||||||
* @param st spectrum type
|
|
||||||
* @param duration the duration of the incoming waveform
|
|
||||||
*/
|
*/
|
||||||
virtual void StartRx (Ptr<PacketBurst> p, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration) = 0;
|
virtual void StartRx (Ptr<SpectrumSignalParameters> params) = 0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <ns3/log.h>
|
#include <ns3/log.h>
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#define log2(x) (log(x)/M_LN2)
|
#define log2(x) (log (x) / M_LN2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -387,6 +387,24 @@ Prod (const SpectrumValue& x)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
Integral (const SpectrumValue& x)
|
||||||
|
{
|
||||||
|
double i = 0;
|
||||||
|
Values::const_iterator vit = x.ConstValuesBegin ();
|
||||||
|
Bands::const_iterator bit = x.ConstBandsBegin ();
|
||||||
|
while (vit != x.ConstValuesEnd ())
|
||||||
|
{
|
||||||
|
NS_ASSERT (bit != x.ConstBandsEnd ());
|
||||||
|
i += (*vit) * (bit->fh - bit->fl);
|
||||||
|
++vit;
|
||||||
|
++bit;
|
||||||
|
}
|
||||||
|
NS_ASSERT (bit == x.ConstBandsEnd ());
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ptr<SpectrumValue>
|
Ptr<SpectrumValue>
|
||||||
SpectrumValue::Copy () const
|
SpectrumValue::Copy () const
|
||||||
|
|||||||
@@ -480,6 +480,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
friend SpectrumValue Log (const SpectrumValue& arg);
|
friend SpectrumValue Log (const SpectrumValue& arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param arg the argument
|
||||||
|
*
|
||||||
|
* @return the value of the integral \f$\int_F g(f) df \f$
|
||||||
|
*/
|
||||||
|
friend double Integral (const SpectrumValue& arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return a Ptr to a copy of this instance
|
* @return a Ptr to a copy of this instance
|
||||||
|
|||||||
@@ -134,17 +134,9 @@ WaveformGenerator::SetChannel (Ptr<SpectrumChannel> c)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveformGenerator::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPowerSpectrum, SpectrumType st, Time duration)
|
WaveformGenerator::StartRx (Ptr<SpectrumSignalParameters> params)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (pb << rxPowerSpectrum << duration);
|
NS_LOG_FUNCTION (this << params);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SpectrumType
|
|
||||||
WaveformGenerator::GetSpectrumType ()
|
|
||||||
{
|
|
||||||
static SpectrumType st = SpectrumTypeFactory::Create ("GenericWaveform");
|
|
||||||
return st;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -188,12 +180,14 @@ WaveformGenerator::GenerateWaveform ()
|
|||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this);
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
Ptr<PacketBurst> pb = Create<PacketBurst> ();
|
Ptr<SpectrumSignalParameters> txParams = Create<SpectrumSignalParameters> ();
|
||||||
Time duration = Time (m_period * m_dutyCycle);
|
txParams->duration = Time (m_period * m_dutyCycle);
|
||||||
|
txParams->psd = m_txPowerSpectralDensity;
|
||||||
|
txParams->txPhy = GetObject<SpectrumPhy> ();
|
||||||
|
|
||||||
NS_LOG_LOGIC ("generating waveform : " << *m_txPowerSpectralDensity);
|
NS_LOG_LOGIC ("generating waveform : " << *m_txPowerSpectralDensity);
|
||||||
m_phyTxStartTrace (0);
|
m_phyTxStartTrace (0);
|
||||||
m_channel->StartTx (pb, m_txPowerSpectralDensity, GetSpectrumType (), duration, GetObject<SpectrumPhy> ());
|
m_channel->StartTx (txParams);
|
||||||
|
|
||||||
if (m_active)
|
if (m_active)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include <ns3/net-device.h>
|
#include <ns3/net-device.h>
|
||||||
#include <ns3/spectrum-phy.h>
|
#include <ns3/spectrum-phy.h>
|
||||||
#include <ns3/spectrum-channel.h>
|
#include <ns3/spectrum-channel.h>
|
||||||
#include <ns3/spectrum-type.h>
|
|
||||||
#include <ns3/trace-source-accessor.h>
|
#include <ns3/trace-source-accessor.h>
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
@@ -61,7 +60,7 @@ public:
|
|||||||
Ptr<MobilityModel> GetMobility ();
|
Ptr<MobilityModel> GetMobility ();
|
||||||
Ptr<NetDevice> GetDevice ();
|
Ptr<NetDevice> GetDevice ();
|
||||||
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
|
||||||
void StartRx (Ptr<PacketBurst> p, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
|
void StartRx (Ptr<SpectrumSignalParameters> params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,16 +70,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetTxPowerSpectralDensity (Ptr<SpectrumValue> txs);
|
void SetTxPowerSpectralDensity (Ptr<SpectrumValue> txs);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SpectrumType used by this PHY
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
SpectrumType GetSpectrumType ();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the period according to which the WaveformGenerator switches
|
* Set the period according to which the WaveformGenerator switches
|
||||||
* on and off
|
* on and off
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ def build(bld):
|
|||||||
'model/spectrum-model.cc',
|
'model/spectrum-model.cc',
|
||||||
'model/spectrum-value.cc',
|
'model/spectrum-value.cc',
|
||||||
'model/spectrum-converter.cc',
|
'model/spectrum-converter.cc',
|
||||||
'model/spectrum-type.cc',
|
'model/spectrum-signal-parameters.cc',
|
||||||
'model/spectrum-propagation-loss-model.cc',
|
'model/spectrum-propagation-loss-model.cc',
|
||||||
'model/friis-spectrum-propagation-loss.cc',
|
'model/friis-spectrum-propagation-loss.cc',
|
||||||
'model/spectrum-phy.cc',
|
'model/spectrum-phy.cc',
|
||||||
@@ -24,6 +24,7 @@ def build(bld):
|
|||||||
'model/aloha-noack-mac-header.cc',
|
'model/aloha-noack-mac-header.cc',
|
||||||
'model/aloha-noack-net-device.cc',
|
'model/aloha-noack-net-device.cc',
|
||||||
'model/half-duplex-ideal-phy.cc',
|
'model/half-duplex-ideal-phy.cc',
|
||||||
|
'model/half-duplex-ideal-phy-signal-parameters.cc',
|
||||||
'model/non-communicating-net-device.cc',
|
'model/non-communicating-net-device.cc',
|
||||||
'model/microwave-oven-spectrum-value-helper.cc',
|
'model/microwave-oven-spectrum-value-helper.cc',
|
||||||
'helper/spectrum-helper.cc',
|
'helper/spectrum-helper.cc',
|
||||||
@@ -45,7 +46,7 @@ def build(bld):
|
|||||||
'model/spectrum-model.h',
|
'model/spectrum-model.h',
|
||||||
'model/spectrum-value.h',
|
'model/spectrum-value.h',
|
||||||
'model/spectrum-converter.h',
|
'model/spectrum-converter.h',
|
||||||
'model/spectrum-type.h',
|
'model/spectrum-signal-parameters.h',
|
||||||
'model/spectrum-propagation-loss-model.h',
|
'model/spectrum-propagation-loss-model.h',
|
||||||
'model/friis-spectrum-propagation-loss.h',
|
'model/friis-spectrum-propagation-loss.h',
|
||||||
'model/spectrum-phy.h',
|
'model/spectrum-phy.h',
|
||||||
@@ -62,6 +63,7 @@ def build(bld):
|
|||||||
'model/aloha-noack-mac-header.h',
|
'model/aloha-noack-mac-header.h',
|
||||||
'model/aloha-noack-net-device.h',
|
'model/aloha-noack-net-device.h',
|
||||||
'model/half-duplex-ideal-phy.h',
|
'model/half-duplex-ideal-phy.h',
|
||||||
|
'model/half-duplex-ideal-phy-signal-parameters.h',
|
||||||
'model/non-communicating-net-device.h',
|
'model/non-communicating-net-device.h',
|
||||||
'model/microwave-oven-spectrum-value-helper.h',
|
'model/microwave-oven-spectrum-value-helper.h',
|
||||||
'helper/spectrum-helper.h',
|
'helper/spectrum-helper.h',
|
||||||
|
|||||||
Reference in New Issue
Block a user