Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
asljivo1 committed Jun 18, 2018
2 parents d8f9b26 + 90a4c84 commit e38bcce
Show file tree
Hide file tree
Showing 49 changed files with 4,894 additions and 11 deletions.
3 changes: 3 additions & 0 deletions OptimalRawGroup/RawConfig-rca.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
1
0 1 1 849 1 0 1 1
1 change: 1 addition & 0 deletions OptimalRawGroup/traffic/data-1-1.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 1.0
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,13 @@ Note: Relation between the above 3 parameters and MCS is described in file "MCSt

To configure a single page slice (whole page encoded in a single page slice), it is neccessary to set pageSliceCount to 0 and pageSliceLength to 1.

### Rate control Algorithm (RCA) ###
The 802.11ah nodes can always use the same MCS as specified by "Wi-Fi mode parameters" when "ConstantRateWifiManager" is used. The nodes can also adapt the MCSs dynamically when rata control algorithm is used. Details about Rate control Algorithms can be found on https://www.nsnam.org/docs/models/html/wifi-design.html#rate-control-algorithms.

An example of using MinstrelWifiManager is given in scratch/rca, where one mobile station continuously transmits 64-byte UDP packets to the AP, while moving from -500 m to 500 m relative to the centrally placed AP at the speed of 1 m/s.

`./waf --run "rca --seed=1 --simulationTime=60 --payloadSize=256"`


### Further reading
For more information on the implementation of the IEEE 802.11ah module for ns-3, check our [recent WNS3 paper on ResearchGate](https://www.researchgate.net/publication/324910418_Extension_of_the_IEEE_80211ah_ns-3_Simulation_Module).
97 changes: 97 additions & 0 deletions scratch/rca/Configuration.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include "Configuration.h"

Configuration::Configuration() {

}

Configuration::Configuration(int argc, char *argv[]) {
CommandLine cmd;
/*cmd.AddValue("useIpv6", "Use Ipv6 (true/false)", useV6);
cmd.AddValue("nControlLoops", "Number of control loops. If -1 all the stations will be in the loops if NSta is even", nControlLoops);
cmd.AddValue("CoapPayloadSize", "Size of CoAP payload",coapPayloadSize);
*/
cmd.AddValue("seed", "random seed", seed);
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue("Nsta", "number of total stations", Nsta);
cmd.AddValue("NRawSta", "number of stations supporting RAW. If -1 it will be based on NSta, should be divisible by NGroup", NRawSta);
cmd.AddValue ("payloadSize", "Size of payload to send in bytes", payloadSize);
cmd.AddValue("BeaconInterval", "Beacon interval time in us", BeaconInterval);
cmd.AddValue("DataMode", "Date mode (check MCStoWifiMode for more details) (format: MCSbw_mcs, e.g. MCS1_0 is OfdmRate300KbpsBW1Mhz)", DataMode);
cmd.AddValue("datarate", "data rate in Mbps", datarate);
cmd.AddValue("bandWidth", "bandwidth in MHz", bandWidth);
cmd.AddValue("rho", "maximal distance between AP and stations", rho);
cmd.AddValue ("folder", "folder where result files are placed", folder);
cmd.AddValue ("file", "files containing reslut information", file);
cmd.AddValue ("totaltraffic", "totaltraffic", totaltraffic);
cmd.AddValue ("TrafficPath", "files path of traffic file", TrafficPath);
cmd.AddValue ("S1g1MfieldEnabled", "S1g1MfieldEnabled", S1g1MfieldEnabled);
cmd.AddValue ("RAWConfigFile", "RAW Config file Path", RAWConfigFile);
cmd.AddValue("TrafficType", "Kind of traffic (udp, -udpecho, -tcpecho, tcpipcamera, -tcpfirmware, -tcpsensor, -coap)", trafficType);
cmd.AddValue("NGroup", "number of RAW groups", NGroup);
cmd.AddValue("NRawSlotNum", "number of slots per RAW", NRawSlotNum);
cmd.AddValue("pagePeriod", "Number of Beacon Intervals between DTIM beacons that carry Page Slice element for the associated page", pagePeriod);
cmd.AddValue("pageSliceLength", "Number of blocks in each TIM for the associated page except for the last TIM (1-31)", pageSliceLength);
cmd.AddValue("pageSliceCount", "Number of TIMs in a single page period (0-31; value 0 for whole page to be encoded in a single (only) TIM)", pageSliceCount);
cmd.AddValue("blockOffset", "The 1st page slice starts with the block with blockOffset", blockOffset);
cmd.AddValue("timOffset", "Offset in number of Beacon Intervals from the DTIM that carries the first page slice of the page", timOffset);

/*
cmd.AddValue("SlotFormat", "format of NRawSlotCount, -1 will auto calculate based on raw slot num", SlotFormat);
cmd.AddValue("NRawSlotCount", "RAW slot duration, , -1 will auto calculate based on raw slot num", NRawSlotCount);
cmd.AddValue("NRawSlotNum", "number of slots per RAW", NRawSlotNum);
cmd.AddValue("NGroup", "number of RAW groups", NGroup);
cmd.AddValue("ContentionPerRAWSlot", "Calculate the NSta and NRawSta based on the amount of contention there has to be in a RAW slot. A contention of 0 means stations are uncontended. If -1 then the specified NSta will be used", ContentionPerRAWSlot);
cmd.AddValue("ContentionPerRAWSlotOnlyInFirstGroup", "If true only the first TIM group will contain stations, this is to prevent huge simulation times while every TIM group behaves the same (true/false)", ContentionPerRAWSlotOnlyInFirstGroup);
cmd.AddValue("MaxTimeOfPacketsInQueue", "Max nr of seconds packets can remain in the DCA queue", MaxTimeOfPacketsInQueue);
cmd.AddValue("APAlwaysSchedulesForNextSlot", "AP Always schedules for next slot (true/false)", APAlwaysSchedulesForNextSlot);
cmd.AddValue("APScheduleTransmissionForNextSlotIfLessThan", "AP schedules transmission for next slot if slot time is less than (microseconds)", APScheduleTransmissionForNextSlotIfLessThan);
cmd.AddValue("TrafficInterval", "Traffic interval time in ms", trafficInterval);
cmd.AddValue("TrafficIntervalDeviation", "Traffic interval deviation time in ms, each interval will have a random deviation between - dev/2 and + dev/2", trafficIntervalDeviation);
cmd.AddValue("MinRTO", "Minimum retransmission timeout for TCP sockets in microseconds", MinRTO);
cmd.AddValue("TCPConnectionTimeout", "TCP Connection timeout to use for all Tcp Sockets", TCPConnectionTimeout);
cmd.AddValue("TCPSegmentSize", "TCP Segment size in bytes", TCPSegmentSize);
cmd.AddValue("TCPInitialSlowStartThreshold", "TCP Initial slow start threshold in segments", TCPInitialSlowStartThreshold);
cmd.AddValue("TCPInitialCwnd", "TCP Initial congestion window in segments", TCPInitialCwnd);
cmd.AddValue("IpCameraMotionPercentage", "Probability the ip camera detects motion each second [0-1]", ipcameraMotionPercentage);
cmd.AddValue("IpCameraMotionDuration", "Time in seconds to stream data when motion was detected", ipcameraMotionDuration);
cmd.AddValue("IpCameraDataRate", "Data rate of the captured stream in kbps", ipcameraDataRate);
cmd.AddValue("FirmwareSize", "Size of the firmware that will be sent to clients for update", firmwareSize);
cmd.AddValue("FirmwareBlockSize", "The chunk size of a piece of firmware. The client has to acknowledge each chunk before the next will be sent", firmwareBlockSize);
cmd.AddValue("FirmwareCorruptionProbability", "The probability that a firmware chunk gets corrupted and the client has to ask for it again", firmwareNewUpdateProbability);
cmd.AddValue("FirmwareNewUpdateProbability", "The probability that a newer firmware version is available when the client polls the server (every trafficinterval)", firmwareNewUpdateProbability);
cmd.AddValue("SensorMeasurementSize", "The size of the measurements taken by the sensor", sensorMeasurementSize);
cmd.AddValue("PropagationLossExponent", "exponent gamma of the log propagation model, default values are outdoors", propagationLossExponent);
cmd.AddValue("PropagationLossReferenceLoss", "reference loss of the log propagation model", propagationLossReferenceLoss);
cmd.AddValue("VisualizerIP", "IP or hostname for the visualizer server, leave empty to not send data", visualizerIP);
cmd.AddValue("VisualizerPort", "Port for the visualizer server", visualizerPort);
cmd.AddValue("VisualizerSamplingInterval", "Sampling interval of statistics in seconds", visualizerSamplingInterval);
cmd.AddValue("APPcapFile", "Name of the pcap file to generate at the AP, leave empty to omit generation", APPcapFile);
cmd.AddValue("NSSFile", "Path of the nss file to write. Note: if a visualizer is active it will also save the nss file", NSSFile);
cmd.AddValue("Name", "Name of the simulation", name);
cmd.AddValue("CoolDownPeriod", "Period of no more traffic generation after simulation time (to allow queues to be processed) in seconds", CoolDownPeriod);
*/

cmd.Parse(argc, argv);
}
142 changes: 142 additions & 0 deletions scratch/rca/Configuration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#pragma once

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
#include "ns3/extension-headers.h"
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
#include <fstream>
#include <sys/stat.h>
#include <string>

using namespace ns3;
using namespace std;

struct Configuration {
/*
* New configuration parameters
*
* */
RPSVector rps;
uint32_t nRps; // Ordinal number of current RPS element; RPS Index
uint64_t totalRawSlots = 0; // Total number of RAW slots in all RAW groups in all RPS elements
std::string RawConfigString; // RPS=2;{RAW=2;[0,1,1,204,2,0,1,16][0,1,1,412,1,0,17,32]}{RAW=1;[0,1,1,180,3,0,33,35]}

UintegerValue maxNumberOfPackets = 4294967295u; ///4294967295u //ami
string trafficType = "udp"; // important - udp is considered to be only uplink in NodeStatistics::GetPacketLoss tcpipcamera tcpfirmware

// Page slicing
pageSlice pageS;
TIM tim;

/*pageSliceCount = 0 means:
*
* - if pageSliceLength > 1, 32nd TIM in this DTIM can contain DL information for STAs that do not support
* page slicing and for STAs who's AID is within the 32nd block of this page and do support page slicing
*
* - if pageSliceLength = 1, all STAs for which the AP has DL BU are included in the *only TIM* that is scheduled
* within the DTIM
*
* */

uint32_t pagePeriod=2; // Number of Beacon Intervals between DTIM beacons that carry Page Slice element for the associated page
uint8_t pageIndex = 0;
uint32_t pageSliceLength=6; // Number of blocks in each TIM for the associated page except for the last TIM (1-31) (value 0 is reserved);
uint32_t pageSliceCount=2; // Number of TIMs in a single page period (1-31)
uint8_t blockOffset = 0; // The 1st page slice starts with the block with blockOffset number
uint8_t timOffset = 0; // Offset in number of Beacon Intervals from the DTIM that carries the first page slice of the page
/*
* Common configuration parameters
* */
double simulationTime = 1000; //60
uint32_t seed = 1;
int NRawSta;
uint32_t Nsta;
uint32_t BeaconInterval = 102400;

double datarate = 7.8;
double bandWidth = 4;
string rho="200"; //50

double totaltraffic = 2;

string visualizerIP = "localhost"; // empty string if no visualization TODO
int visualizerPort = 7707;
double visualizerSamplingInterval = 1;

string name = "test"; // empty string if no visualization TODO
string APPcapFile = "appcap"; // empty string if no visualization TODO
string NSSFile = "test.nss";

/*
* Le's config params
* */
uint32_t payloadSize = 64;
string folder="./scratch/";
string file="./scratch/mac-sta.txt";
string TrafficPath="./OptimalRawGroup/traffic/data-1-1.0.txt";
bool S1g1MfieldEnabled=false;
string RAWConfigFile = "./OptimalRawGroup/RawConfig-rca.txt";
string DataMode = "MCS2_0"; //TODO copy this from Dwight, OfdmRate7_8MbpsBW2MHz MCS2
string OutputPath = "./OptimalRawGroup/resultsenergyconsumption/";
/*
* Amina's configuration parameters
* */
bool useV6 = false; //false
uint32_t nControlLoops = 0;// = 100;
uint32_t coapPayloadSize = 0;// = 15;

uint32_t trafficInterval = 1; //ms 55,110,210,310,410,515,615,720,820,950,1024 beacon interval *4
uint32_t trafficIntervalDeviation = 1000; //1000 discuss with Jeroen

int SlotFormat=0; //0;
int NRawSlotCount=0; //162;
uint32_t NRawSlotNum=0;
uint32_t NGroup=0;

/*
* tcpipcamera configuration parameters
* */
double ipcameraMotionPercentage = 1; //0.1
uint16_t ipcameraMotionDuration = 10; //60
uint16_t ipcameraDataRate = 128; //20
uint32_t MinRTO = 81920000; //819200
uint32_t TCPConnectionTimeout = 6000000;
uint32_t TCPSegmentSize = 3216; //536
uint32_t TCPInitialSlowStartThreshold = 0xffff;
uint32_t TCPInitialCwnd = 1;

int ContentionPerRAWSlot=0; //-1
bool ContentionPerRAWSlotOnlyInFirstGroup=false; //false

double propagationLossExponent = 3.67; //3.76
double propagationLossReferenceLoss = 8;

bool APAlwaysSchedulesForNextSlot = false;
uint32_t APScheduleTransmissionForNextSlotIfLessThan = 0;// = 5000;


uint32_t firmwareSize = 0;// = 1024 * 500;
uint16_t firmwareBlockSize = 0;// = 1024;
double firmwareNewUpdateProbability;// = 0.01;
double firmwareCorruptionProbability;// = 0.01;
uint32_t firmwareVersionCheckInterval;// = 1000;

uint16_t sensorMeasurementSize;// = 54; //1024

uint16_t MaxTimeOfPacketsInQueue = 100; //100

uint16_t CoolDownPeriod = 4; //60

Configuration();
Configuration(int argc, char *argv[]);

};
Loading

0 comments on commit e38bcce

Please sign in to comment.