fixed spectrum code for python bindings as per Gustavo's suggestion

This commit is contained in:
Nicola Baldo
2010-06-14 17:13:43 +02:00
parent 2503d95453
commit f53d27ed76
10 changed files with 38 additions and 11 deletions

View File

@@ -29,6 +29,9 @@ NS_LOG_COMPONENT_DEFINE ("SpectrumConverter");
namespace ns3 {
SpectrumConverter::SpectrumConverter ()
{
}
SpectrumConverter::SpectrumConverter (Ptr<const SpectrumModel> fromSpectrumModel, Ptr<const SpectrumModel> toSpectrumModel)
{

View File

@@ -50,6 +50,8 @@ public:
*/
SpectrumConverter (Ptr<const SpectrumModel> fromSpectrumModel, Ptr<const SpectrumModel> toSpectrumModel);
SpectrumConverter ();
/**

View File

@@ -31,6 +31,9 @@ NS_LOG_COMPONENT_DEFINE ("SpectrumValue");
namespace ns3 {
SpectrumValue::SpectrumValue ()
{
}
SpectrumValue::SpectrumValue (Ptr<const SpectrumModel> sof)
: m_spectrumModel (sof),

View File

@@ -74,6 +74,10 @@ public:
*/
SpectrumValue (Ptr<const SpectrumModel> sm);
SpectrumValue ();
/**
* Access value at given frequency index
*
@@ -517,6 +521,14 @@ private:
std::ostream& operator << (std::ostream& os, const SpectrumValue& pvf);
double Norm (const SpectrumValue& x);
double Sum (const SpectrumValue& x);
double Prod (const SpectrumValue& x);
SpectrumValue Pow (const SpectrumValue& base, double exp);
SpectrumValue Pow (double base, const SpectrumValue& exp);
SpectrumValue Log10 (const SpectrumValue& arg);
SpectrumValue Log2 (const SpectrumValue& arg);
SpectrumValue Log (const SpectrumValue& arg);
} // namespace ns3

View File

@@ -263,6 +263,13 @@ AlohaNoackNetDevice::GetPhy () const
}
void
AlohaNoackNetDevice::SetChannel (Ptr<Channel> c)
{
NS_LOG_FUNCTION (this << c);
m_channel = c;
}
Ptr<Channel>
AlohaNoackNetDevice::GetChannel (void) const

View File

@@ -196,6 +196,12 @@ NonCommunicatingNetDevice::GetPhy () const
}
void
NonCommunicatingNetDevice::SetChannel (Ptr<Channel> c)
{
NS_LOG_FUNCTION (this << c);
m_channel = c;
}
Ptr<Channel>
NonCommunicatingNetDevice::GetChannel (void) const

View File

@@ -111,16 +111,6 @@ public:
/**
* Set the time resolution of the generated waveforms.
*
* @param resolution time resolution of the generated
* waveforms. This determines both the duration of waveforms, and
* the time between subsequent waveforms (i.e., they are generated
* back to back during the active portion of the generator cycle).
*/
void SetResolution (Time resolution);
/**
* Start the waveform generator
*

View File

@@ -126,6 +126,7 @@ AdhocAlohaNoackIdealPhyHelper::Install (NodeContainer c) const
NS_ASSERT_MSG (m_channel, "you forgot to call AdhocAlohaNoackIdealPhyHelper::SetChannel ()");
phy->SetChannel (m_channel);
dev->SetChannel (m_channel);
m_channel->AddRx (phy);
phy->SetPhyMacTxEndCallback (MakeCallback (&AlohaNoackNetDevice::NotifyTransmissionEnd, dev));

View File

@@ -153,6 +153,8 @@ SpectrumAnalyzerHelper::Install (NodeContainer c) const
NS_ASSERT_MSG (m_channel, "you forgot to call SpectrumAnalyzerHelper::SetChannel ()");
m_channel->AddRx (phy);
dev->SetChannel (m_channel);
uint32_t devId = node->AddDevice (dev);
devices.Add (dev);

View File

@@ -108,7 +108,8 @@ WaveformGeneratorHelper::Install (NodeContainer c) const
NS_ASSERT_MSG (m_channel, "you forgot to call WaveformGeneratorHelper::SetChannel ()");
phy->SetChannel (m_channel);
//m_channel->AddRx (phy);
dev->SetChannel (m_channel);
node->AddDevice (dev);
devices.Add (dev);