Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e6cffd5
Push before changes. At this point, this does not work. DO NOT MERGE …
Jul 8, 2020
f20e5cc
Wireless capabalities changed to Wifi from LR-WPAN
Jul 8, 2020
1f0fcdb
Wi-Fi seems to be working. Some issues need to be solved.
Jul 16, 2020
debc4d8
TCP applications ported over.
Jul 16, 2020
b211f4b
Both TCP and UDP applications ready to go.
Jul 16, 2020
10f789d
Merge pull request #8 from sustainable-computing/apps-change-listen-o…
Jul 16, 2020
e7bb257
Starting commit
Jul 29, 2020
d3f86cc
New network file added.
Jul 29, 2020
dff82ee
Updated config file to include secondary network
Jul 29, 2020
84c8d24
Creating of Config Reader and Node class with Tests
Jul 31, 2020
5106ea3
Node and NodeTests updated to reflect immutable nature of Node and ni…
Jul 31, 2020
65b84d0
Node Updated
Jul 31, 2020
4f83690
Network Connection Done and validation code moved
Jul 31, 2020
9961990
Author information added to files.
Jul 31, 2020
56de50e
NIC classes and tests created. Node updated
Aug 5, 2020
1329d2c
App Connections and Tests finished
Aug 6, 2020
5add661
Config reader started, nodes read and verified
Aug 6, 2020
87eb6ec
Network Connections finished.
Aug 12, 2020
cddeb77
App Connections Finished
Aug 12, 2020
2642bda
Config Validation for wifi nodes distance and tests finished.
Aug 13, 2020
5bc9d9d
Folder re-org and Consisntent date format
Aug 17, 2020
6cd8ebc
Files moved. Config now returns nodes, network connections and app co…
Aug 28, 2020
1f885fe
Changes to the network spec file.
Sep 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ NS3Mosaik/NS3MosaikSim
# Ignore files generated by python
*.pyc
# Ignore files generated by macOS
.DS_Store
.DS_Store
*.pcap
TapControl/monitor_udp.png
TapControl/monitor_tcp.png
TapControl/Monitor.png
TapControl/Monitor.png
NS3Mosaik/NS3MosaikSim
NS3Mosaik/NS3MosaikSim
NS3Mosaik/NS3MosaikSim
16 changes: 16 additions & 0 deletions IEEE13Node_BusXY.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SourceBus, 200, 400
650, 200, 350
RG60, 200, 300
646, 0, 250
645, 100, 250
632, 200, 250
633, 350, 250
634, 400, 250
670, 200, 200
611, 0, 100
684, 100, 100
671, 200, 100
692, 250, 100
675, 400, 100
652, 100, 0
680, 200, 0
8 changes: 7 additions & 1 deletion NS3Mosaik/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ LXFLAGS = -ljsoncpp\
${NS3_LIB}/libns3.30.1-traffic-control-debug.so\
${NS3_LIB}/libns3.30.1-stats-debug.so\
${NS3_LIB}/libns3.30.1-mpi-debug.so\

${NS3_LIB}/libns3.30.1-sixlowpan-debug.so\
${NS3_LIB}/libns3.30.1-lr-wpan-debug.so\
${NS3_LIB}/libns3.30.1-propagation-debug.so\
${NS3_LIB}/libns3.30.1-spectrum-debug.so\
${NS3_LIB}/libns3.30.1-antenna-debug.so\
${NS3_LIB}/libns3.30.1-wifi-debug.so\
${NS3_LIB}/libns3.30.1-energy-debug.so\

#------------------------#
#--- Print Debug Info ---#
Expand Down
Binary file modified NS3Mosaik/NS3MosaikSim
Binary file not shown.
20 changes: 7 additions & 13 deletions NS3Mosaik/mosaik_api/include/NS3Netsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct DataXCHG {
static vector<DataXCHG> dataXchgInput; ///< Input data exchange vector
static vector<DataXCHG> dataXchgOutput; ///< Output data exchange vector
static map<Ipv4Address, uint32_t> mapIpv4NodeId; ///< Map from client Ipv4 to Node Id

static map<string, set<string>> wifiNetworks; ///< Map for the end-node in the primary network and the secondary network nodes

class NS3Netsim {
public:
Expand Down Expand Up @@ -201,11 +201,11 @@ class NS3Netsim {
/**
* Set up a tcp or udp server depending on what has been passed in.
*
* \param address The address that will be used to assigned addresses to both the server
* \param addressPrimary The address that will be used to assign addresses to both type of servers for the primary network
* \param tcpOrUdp a string that is either set to tcp or udp, indicating which kind of server will be created
* \param server holds the server id
*/
void setUpServer(InetSocketAddress address, string protocol, string server);
void setUpServer(InetSocketAddress addressPrimary, string protocol, string server);

/**
* Sets up a tcp or udp client depending on what has been passed in
Expand All @@ -215,7 +215,7 @@ class NS3Netsim {
* \param server holds the server id
* \param client holds the client id
*/
void setUpClient(InetSocketAddress address, string protocol, string server, string client);
void setUpClient(AddressValue addressValue, string protocol, string server, string client);

vector< vector<bool>> nodeAdjMatrix; ///< Node adjacency matrix
string nodeAdjMatrixFilename; ///< Node adjacency matrix filename
Expand All @@ -225,17 +225,12 @@ class NS3Netsim {
vector<vector<double>> arrayNodeCoords; ///< Array of doubles with node coordinates
NodeContainer nodes; ///< NS3 container with simulation nodes

PointToPointHelper pointToPoint; ///< Pointer to pointTopoint helper class
string LinkRate; ///< Uniform link data rate
string LinkDelay; ///< Uniform link delay
string LinkErrorRate; ///< Uniform Link error rate
uint32_t linkCount; ///< Network link count
vector<NetDeviceContainer> p2pDevices; ///< Vector with all link devices

InternetStackHelper internet; ///< Pointer to Internet helper class
Ipv4AddressHelper ipv4Address; ///< Pointer to Ipv4 Internet helper class

MobilityHelper mobility; ///< Pointer to mobility (position) helper class
Ptr<ListPositionAllocator> nodePositionAlloc; ///< Pointer to node position allocation

string appConnectionsFilename; ///< Application client-server connections filename
Expand All @@ -245,10 +240,10 @@ class NS3Netsim {
vector<string>::iterator iList; ///< Application servers vector iterator
uint16_t sinkPort; ///< Application port for all server nodes

MultiClientTcpServerHelper multiClientTcpServerHelper = MultiClientTcpServerHelper(Address()); ///< Application TCP server helper
MultiClientTcpServerHelper multiClientTcpServerHelper; ///< Application TCP server helper
TcpClientHelper tcpClientHelper = TcpClientHelper(Address()); ///< Application TCP client helper
CustomUdpClientHelper customUdpClientHelper = CustomUdpClientHelper(Address()); ///< Application UDP server helper
CustomUdpServerHelper customUdpServerHelper = CustomUdpServerHelper(Address()); ///< Application UDP client helper
CustomUdpClientHelper customUdpClientHelper = CustomUdpClientHelper(Address()); ///< Application UDP client helper
CustomUdpServerHelper customUdpServerHelper; ///< Application UDP server helper

double startTime; ///< Simulation start time
int verbose; ///< Verbose level
Expand All @@ -258,7 +253,6 @@ class NS3Netsim {
Ptr<SmartgridDefaultSimulatorImpl> sim; ///< Pointer to the smartgrid simulator implementation

ApplicationContainer allApplications;
NodeContainer allNodes;

string tcpOrUdp; ///< Which network protocol should be used
};
Expand Down
57 changes: 57 additions & 0 deletions NS3Mosaik/mosaik_api/include/ns3-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,61 @@ void PrintIpAddresses(NodeContainer nodes);
*/
map<Ipv4Address, uint32_t> CreateMapIpv4NodeId(NodeContainer nodes);

/**
* Checks the number of nodes. If the number does not match the number passed in, throws an error
* \param nodes, the node container which should be checked
* \param numberToCheck, the size nodes should equal this number
*/
void checkNumberOfNodesInContainer(NodeContainer nodes, int numberToCheck);

/**
* Gets the address that starts with the string passed in.
* \param node, contains the node for which all the ipv4 addresses will be fetched
* \param starting, the string with which the address starts
* \return return the ipv4 address that starts with the starting string
*/
Ipv4Address getAddressForNodeStartingWith(NodeContainer node, std::string starting);

/**
* Get a net-device of the type passed in
* \param node, the node which will be searched.
*/
template <typename T>
Ptr<T> GetNetDeviceOfType(NodeContainer node) {
checkNumberOfNodesInContainer(node, 1);
// Now iterate through the net devices
for (int i = 0; i < node.Get(0)->GetNDevices(); i++) {
// Try a dynamic cast
Ptr<T> netDevice = DynamicCast<T> (node.Get(0)->GetDevice(i));
// If T is not null, successful, return the device
if (netDevice != 0) {
return netDevice;
}
}

// If you've gotten to this point there is no net device of this type, throw an error
NS_FATAL_ERROR("NetDevice of correct type not found.");
}

/**
* Get a application of the type passed in
* \param node, the node which will be searched
*/
template <typename T>
Ptr<T> GetApplicationOfType(NodeContainer node) {
checkNumberOfNodesInContainer(node, 1);
// Now iterate through the net devices
for (int i = 0; i < node.Get(0)->GetNApplications(); i++) {
// Try a dynamic cast
Ptr<T> application = DynamicCast<T> (node.Get(0)->GetApplication(i));
// If T is not null, successful, return the device
if (application != 0) {
return application;
}
}

// If you've gotten to this point there is no application of this type, throw an error
NS_FATAL_ERROR("Application of correct type not found.");
}

#endif /* SMARTGRID_NS3_HELPER_H_ */
3 changes: 3 additions & 0 deletions NS3Mosaik/mosaik_api/src/MosaikSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,14 @@ MosaikSim::create(Json::Value args, Json::Value kwargs)
std::string result;
std::string entity;

std::cout << "CREATING" << std::endl;
mosaikNum = args[0].asInt();
mosaikSimModel = args[1].asString();

if (verbose > 1)
std::cout << "MosaikSim::create mosaikNum: " << mosaikNum << " - mosaikSimModel: " << mosaikSimModel << std::endl;

std::cout << kwargs << std::endl;
//--- Store simulator parameters
for (auto const& key : kwargs.getMemberNames()) {
netsimParams[key] = (kwargs[key]).asString();
Expand Down Expand Up @@ -601,6 +603,7 @@ MosaikSim::create(Json::Value args, Json::Value kwargs)
}

return result;
exit(0);
}


Expand Down
Loading