Skip to content

Commit

Permalink
Update for NS-3.36
Browse files Browse the repository at this point in the history
  • Loading branch information
a-andre committed Jun 1, 2022
1 parent db016f8 commit 2ea5567
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 148 deletions.
62 changes: 62 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
include(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(STATUS "pkgconf not found")
return()
endif()

pkg_check_modules(ZMQ libzmq)
if(NOT ZMQ_FOUND)
message(STATUS "zeromq not found")
return()
endif()

find_package(Protobuf 3.0.0)
if(NOT Protobuf_FOUND)
message(STATUS "protobuf not found")
return()
endif()

set(proto_source_files
model/messages.proto
)

protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${proto_source_files})
file(RELATIVE_PATH PROTO_HDRS_REL ${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_HDRS})

# TODO generate python file and move to the right location

set(source_files
helper/opengym-helper.cc
model/container.cc
model/opengym_env.cc
model/opengym_interface.cc
model/spaces.cc
${PROTO_SRCS}
)

set(header_files
helper/opengym-helper.h
model/container.h
model/opengym_env.h
model/opengym_interface.h
model/spaces.h
${PROTO_HDRS_REL}
)

build_lib(
LIBNAME opengym
SOURCE_FILES ${source_files}
HEADER_FILES ${header_files}
LIBRARIES_TO_LINK
${libcore}
${ZMQ_LIBRARIES}
${Protobuf_LIBRARIES}
TEST_SOURCES
test/opengym-test-suite.cc
)

# add location of generated messages.pb.h to include directories
target_include_directories(
${libopengym-obj}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
2 changes: 1 addition & 1 deletion NS3-VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release ns-3.29
release ns-3.36
65 changes: 65 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
build_lib_example(
NAME interference-pattern
SOURCE_FILES interference-pattern/mygym.cc
interference-pattern/sim.cc
LIBRARIES_TO_LINK
${libcore}
${libinternet}
${libopengym}
${libwifi}
)

build_lib_example(
NAME linear-mesh
SOURCE_FILES linear-mesh/sim.cc
LIBRARIES_TO_LINK
${libapplications}
${libcore}
${libinternet}
${libopengym}
${libwifi}
)

build_lib_example(
NAME linear-mesh-2
SOURCE_FILES linear-mesh-2/sim.cc
linear-mesh-2/mygym.cc
LIBRARIES_TO_LINK
${libapplications}
${libcore}
${libinternet}
${libopengym}
${libwifi}
)

build_lib_example(
NAME opengym
SOURCE_FILES opengym/sim.cc
LIBRARIES_TO_LINK
${libcore}
${libopengym}
)

build_lib_example(
NAME opengym-2
SOURCE_FILES opengym-2/sim.cc
opengym-2/mygym.cc
LIBRARIES_TO_LINK
${libcore}
${libopengym}
)

build_lib_example(
NAME rl-tcp
SOURCE_FILES rl-tcp/sim.cc
rl-tcp/tcp-rl-env.cc
rl-tcp/tcp-rl.cc
LIBRARIES_TO_LINK
${libapplications}
${libcore}
${libflow-monitor}
${libinternet}
${libopengym}
${libpoint-to-point-layout}
${libptp}
)
8 changes: 3 additions & 5 deletions examples/linear-mesh-2/mygym.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ MyGymEnv::GetQueue(Ptr<Node> node)
Ptr<NetDevice> dev = node->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (wifi_mac);
PointerValue ptr;
rmac->GetAttribute ("Txop", ptr);
wifi_mac->GetAttribute ("Txop", ptr);
Ptr<Txop> txop = ptr.Get<Txop> ();
Ptr<WifiMacQueue> queue = txop->GetWifiMacQueue ();
return queue;
Expand Down Expand Up @@ -180,9 +179,8 @@ MyGymEnv::SetCw(Ptr<Node> node, uint32_t cwMinValue, uint32_t cwMaxValue)
Ptr<NetDevice> dev = node->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (wifi_mac);
PointerValue ptr;
rmac->GetAttribute ("Txop", ptr);
wifi_mac->GetAttribute ("Txop", ptr);
Ptr<Txop> txop = ptr.Get<Txop> ();

// if both set to the same value then we have uniform backoff?
Expand Down Expand Up @@ -238,4 +236,4 @@ MyGymEnv::CountRxPkts(Ptr<MyGymEnv> entity, Ptr<Node> node, Ptr<const Packet> pa
}


} // ns3 namespace
} // ns3 namespace
4 changes: 2 additions & 2 deletions examples/linear-mesh-2/sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ main (int argc, char *argv[])

// WiFi device
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211_5MHZ);
wifi.SetStandard (WIFI_STANDARD_80211p);

// Channel
SpectrumWifiPhyHelper spectrumPhy = SpectrumWifiPhyHelper::Default ();
SpectrumWifiPhyHelper spectrumPhy = SpectrumWifiPhyHelper ();
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();

spectrumPhy.SetChannel (spectrumChannel);
Expand Down
10 changes: 4 additions & 6 deletions examples/linear-mesh/sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ Ptr<WifiMacQueue> GetQueue(Ptr<Node> node)
Ptr<NetDevice> dev = node->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (wifi_mac);
PointerValue ptr;
rmac->GetAttribute ("Txop", ptr);
wifi_mac->GetAttribute ("Txop", ptr);
Ptr<Txop> txop = ptr.Get<Txop> ();
Ptr<WifiMacQueue> queue = txop->GetWifiMacQueue ();
return queue;
Expand Down Expand Up @@ -142,9 +141,8 @@ bool SetCw(Ptr<Node> node, uint32_t cwMinValue=0, uint32_t cwMaxValue=0)
Ptr<NetDevice> dev = node->GetDevice (0);
Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (wifi_mac);
PointerValue ptr;
rmac->GetAttribute ("Txop", ptr);
wifi_mac->GetAttribute ("Txop", ptr);
Ptr<Txop> txop = ptr.Get<Txop> ();

// if both set to the same value then we have uniform backoff?
Expand Down Expand Up @@ -253,10 +251,10 @@ main (int argc, char *argv[])

// WiFi device
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211_5MHZ);
wifi.SetStandard (WIFI_STANDARD_80211p);

// Channel
SpectrumWifiPhyHelper spectrumPhy = SpectrumWifiPhyHelper::Default ();
SpectrumWifiPhyHelper spectrumPhy = SpectrumWifiPhyHelper ();
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();

spectrumPhy.SetChannel (spectrumChannel);
Expand Down
27 changes: 0 additions & 27 deletions examples/wscript

This file was deleted.

107 changes: 0 additions & 107 deletions wscript

This file was deleted.

0 comments on commit 2ea5567

Please sign in to comment.