Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(522)

Unified Diff: src/lorawan/examples/time-on-air-test.cc

Issue 331760043: LoRaWAN module review request
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lorawan/examples/simple-lorawan-network-example.cc ('k') | src/lorawan/examples/wscript » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lorawan/examples/time-on-air-test.cc
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/lorawan/examples/time-on-air-test.cc
@@ -0,0 +1,66 @@
+#include "ns3/lora-phy.h"
+#include "ns3/log.h"
+#include "ns3/command-line.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("TimeOnAirTest");
+
+int main (int argc, char *argv[])
+{
+
+ CommandLine cmd;
+ cmd.Parse (argc, argv);
+
+ LogComponentEnable ("TimeOnAirTest", LOG_LEVEL_ALL);
+ LogComponentEnable ("LoraPhy", LOG_LEVEL_ALL);
+
+ Ptr<Packet> packet;
+ Time duration;
+
+ // Available parameters:
+ // PayloadSize, SF, HeaderDisabled, CodingRate, Bandwidth, nPreambleSyms, crcEnabled, lowDROptimization
+
+ // Starting parameters
+ packet = Create<Packet> (10);
+ LoraTxParameters txParams;
+ txParams.sf = 7;
+ txParams.headerDisabled = false;
+ txParams.codingRate = 1;
+ txParams.bandwidthHz = 125000;
+ txParams.nPreamble = 8;
+ txParams.crcEnabled = 1;
+ txParams.lowDataRateOptimizationEnabled = 0;
+
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.041216 << " s");
+
+ txParams.sf = 8;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.072192 << " s");
+
+ txParams.headerDisabled = true;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.072192 << " s");
+
+ txParams.codingRate = 2;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.078336 << " s");
+
+ txParams.nPreamble = 10;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.082432 << " s");
+
+ txParams.lowDataRateOptimizationEnabled = true;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.082432 << " s");
+
+ txParams.sf = 10;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.280576 << " s");
+
+ txParams.bandwidthHz = 250000;
+ duration = LoraPhy::GetOnAirTime (packet, txParams);
+ NS_LOG_DEBUG ("Computed: " << duration.GetSeconds () << " s, expected: " << 0.14028 << " s");
+ return 0;
+}
« no previous file with comments | « src/lorawan/examples/simple-lorawan-network-example.cc ('k') | src/lorawan/examples/wscript » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b