Merge pull request #15 in S3/s3-simulator from S3-19-time-arithmetic-implement to develop

Squashed commit of the following:

commit 1162a5c942c7c2a366883a3b4f5f47feface9344
Author: Peter D. Barnes, Jr <barnes26@llnl.gov>
Date:   Wed Mar 18 16:44:50 2020 -0700

    core: assert Time > 0 in operator< (Time, EventId) refinement

commit 83161ebb6f56fd467498528a5b54f2d6ef1bceba
Author: Peter D. Barnes, Jr <barnes26@llnl.gov>
Date:   Wed Mar 18 15:59:38 2020 -0700

    core: check-style nstime.h

commit d8a0c906997bd7608e19dfd93484477c9b121a67
Author: Peter D. Barnes, Jr <barnes26@llnl.gov>
Date:   Wed Mar 18 15:56:34 2020 -0700

    core: assert Time > 0 in operator< (Time, EventId)

commit 466e66031b6f26e7aaede00be7d8c692382f2b04
Author: Peter D. Barnes, Jr <barnes26@llnl.gov>
Date:   Wed Mar 18 14:41:02 2020 -0700

    core: check-style

commit 5fd40536a23ef683d9eb673a45b492efbe175750
Author: Peter D. Barnes, Jr <barnes26@llnl.gov>
Date:   Wed Mar 18 14:21:33 2020 -0700

    core: operator<(Time, EventId), and doxy
This commit is contained in:
Jordan Dorham
2020-08-20 21:06:20 +00:00
committed by Peter Barnes
parent 81b740721f
commit 0704928170
5 changed files with 15 additions and 15 deletions

View File

@@ -51,7 +51,7 @@ static void DataConfirm (McpsDataConfirmParams params)
static void StateChangeNotification (std::string context, Time now, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
{
NS_LOG_UNCOND (context << " state change at " << now.GetSeconds ()
NS_LOG_UNCOND (context << " state change at " << now.As (Time::S)
<< " from " << LrWpanHelper::LrWpanPhyEnumerationPrinter (oldState)
<< " to " << LrWpanHelper::LrWpanPhyEnumerationPrinter (newState));
}
@@ -91,8 +91,8 @@ int main (int argc, char *argv[])
}
else
{
Ptr<LrWpanMac> mac0 = dev0->GetMac();
Ptr<LrWpanMac> mac1 = dev1->GetMac();
Ptr<LrWpanMac> mac0 = dev0->GetMac ();
Ptr<LrWpanMac> mac1 = dev1->GetMac ();
mac0->SetExtendedAddress (Mac64Address ("00:00:00:00:00:00:00:01"));
mac1->SetExtendedAddress (Mac64Address ("00:00:00:00:00:00:00:02"));
}

View File

@@ -47,7 +47,7 @@ AsciiLrWpanMacTransmitSinkWithContext (
std::string context,
Ptr<const Packet> p)
{
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
*stream->GetStream () << "t " << Simulator::Now ().As (Time::S) << " " << context << " " << *p << std::endl;
}
/**
@@ -60,7 +60,7 @@ AsciiLrWpanMacTransmitSinkWithoutContext (
Ptr<OutputStreamWrapper> stream,
Ptr<const Packet> p)
{
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
*stream->GetStream () << "t " << Simulator::Now ().As (Time::S) << " " << *p << std::endl;
}
LrWpanHelper::LrWpanHelper (void)

View File

@@ -345,6 +345,7 @@ LrWpanCsmaCa::RandomBackoffDelay ()
{
m_canProceedEvent = Simulator::Schedule (randomBackoff, &LrWpanCsmaCa::CanProceed, this);
}
}
}

View File

@@ -122,7 +122,7 @@ LrWpanPhy::GetTypeId (void)
LrWpanPhy::LrWpanPhy (void)
: m_edRequest (),
m_setTRXState ()
m_setTRXState ()
{
m_trxState = IEEE_802_15_4_PHY_TRX_OFF;
m_trxStatePending = IEEE_802_15_4_PHY_IDLE;
@@ -330,7 +330,7 @@ LrWpanPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumRxParams)
// Add any incoming packet to the current interference before checking the
// SINR.
NS_LOG_DEBUG (this << " receiving packet with power: " << 10 * log10(LrWpanSpectrumValueHelper::TotalAvgPower (lrWpanRxParams->psd, m_phyPIBAttributes.phyCurrentChannel)) + 30 << "dBm");
NS_LOG_DEBUG (this << " receiving packet with power: " << 10 * log10 (LrWpanSpectrumValueHelper::TotalAvgPower (lrWpanRxParams->psd, m_phyPIBAttributes.phyCurrentChannel)) + 30 << "dBm");
m_signal->AddSignal (lrWpanRxParams->psd);
Ptr<SpectrumValue> interferenceAndNoise = m_signal->GetSignalPsd ();
*interferenceAndNoise -= *lrWpanRxParams->psd;
@@ -465,7 +465,7 @@ LrWpanPhy::EndRx (Ptr<SpectrumSignalParameters> par)
if (params == 0)
{
NS_LOG_LOGIC ("Node: " << m_device->GetAddress() << " Removing interferent: " << *(par->psd));
NS_LOG_LOGIC ("Node: " << m_device->GetAddress () << " Removing interferent: " << *(par->psd));
return;
}

View File

@@ -49,7 +49,6 @@ public:
LrWpanCcaTestCase ();
private:
/**
* \brief Function called when PlmeCcaConfirm is hit.
* \param testcase The TestCase.
@@ -109,7 +108,7 @@ LrWpanCcaTestCase::LrWpanCcaTestCase ()
void
LrWpanCcaTestCase::PlmeCcaConfirm (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDevice> device, LrWpanPhyEnumeration status)
{
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PlmeCcaConfirm: " << LrWpanHelper::LrWpanPhyEnumerationPrinter (status) << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PlmeCcaConfirm: " << LrWpanHelper::LrWpanPhyEnumerationPrinter (status) << std::endl;
testcase->m_status = status;
}
@@ -119,7 +118,7 @@ LrWpanCcaTestCase::PhyTxBegin (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDevice>
{
std::ostringstream os;
packet->Print (os);
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PhyTxBegin: " << os.str () << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PhyTxBegin: " << os.str () << std::endl;
}
void
@@ -127,7 +126,7 @@ LrWpanCcaTestCase::PhyTxEnd (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDevice> d
{
std::ostringstream os;
packet->Print (os);
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PhyTxEnd: " << os.str () << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PhyTxEnd: " << os.str () << std::endl;
}
void
@@ -135,7 +134,7 @@ LrWpanCcaTestCase::PhyRxBegin (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDevice>
{
std::ostringstream os;
packet->Print (os);
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PhyRxBegin: " << os.str () << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PhyRxBegin: " << os.str () << std::endl;
}
void
@@ -143,7 +142,7 @@ LrWpanCcaTestCase::PhyRxEnd (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDevice> d
{
std::ostringstream os;
packet->Print (os);
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PhyRxEnd (" << sinr << "): " << os.str () << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PhyRxEnd (" << sinr << "): " << os.str () << std::endl;
// The first packet was received. Now start a CCA, to try to detect the second packet which is still being transmitted.
device->GetPhy ()->PlmeCcaRequest ();
@@ -153,7 +152,7 @@ void LrWpanCcaTestCase::PhyRxDrop (LrWpanCcaTestCase *testcase, Ptr<LrWpanNetDev
{
std::ostringstream os;
packet->Print (os);
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().GetSeconds () << "] " << device->GetMac ()->GetShortAddress () << " PhyRxDrop: " << os.str () << std::endl;
std::cout << std::setiosflags (std::ios::fixed) << std::setprecision (9) << "[" << Simulator::Now ().As (Time::S) << "] " << device->GetMac ()->GetShortAddress () << " PhyRxDrop: " << os.str () << std::endl;
}
void