Skip to content

Commit

Permalink
Added support for latest GEBCO 2D and Bellhop latest syntax. Updated …
Browse files Browse the repository at this point in the history
…example with latest changes (#17)

* added support for GEBCO 2D format. Updated example with latest 2D format and Bellhop syntax

* fixed example

* fixed helper syntax

* added support for GEBCO 2D 15 seconds

* waf syntax changed

* fixed-example

* fixed readme
  • Loading branch information
MetalKnight authored Dec 31, 2019
1 parent 58f5401 commit 3adfe20
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 56 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ WOSS can be integrated in any network simulator or simulation tool that supports

'woss-ns3' relies on the following libraries:
- WOSS
- NetCDF
- Acoustic Toolbox
- NetCDF 4 with HDF5 or NetCDF legacy (optional)

Latest WOSS source code, installation instructions and related libraries can be found at http://telecom.dei.unipd.it/ns/woss/

'woss-ns3' module will be automatically installed by the ns3 app installer, but this feature is not yet complete.

It can also be manually installed by:
- downloading and installing the latest Acoustic Toolbox library
- downloading and installing the recommended NetCDF library
- downloading and installing the latest WOSS library
- cloning this repository in the '<ns3-dir>/src' path and then running ./waf configure
--with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path> --with-netcdf-lib=<netcdf_installed_lib_path> --with-netcdf-include=<netcdf_installed_include_path>
- for info on how to install all the required libraries with the suggested paths, please check http://telecom.dei.unipd.it/ns/woss/doxygen/installation.html

For any info and question please use the NS3 users mailing list.

Any issue should be reported via github Issue tracker.
It can also be manually installed:
- by downloading and installing the recommended Acoustic Toolbox library
- with optional NetCDF support, by downloading and installing the recommended HDF5, NetCDF libraries, with NetCDF4 format support
- by downloading and installing the latest WOSS library
- by cloning this repository in the `<ns3-dir>/src` path and then running one of the following:
- NetCDF4 and HDF5 support `./waf configure
--with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path> --with-netcdf4-install=<netcdf4_and_hdf5_installed_path>`
- with no NetCDF support `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path>`
- for info on how to install all the required libraries with the suggested paths, please check http://telecom.dei.unipd.it/ns/woss/doxygen/installation.html

*Any issue should be reported via github Issue tracker*.
19 changes: 14 additions & 5 deletions examples/woss-aloha-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Experiment::Experiment ()
m_bytesTotal (0),
m_dataMode ()
{
//m_databasePath = "/home/fedwar/ns/ocean_database/dbs";
}

void
Expand All @@ -77,15 +78,23 @@ Experiment::InitWossHelper (Ptr<WossHelper> wossHelper, Ptr<WossPropModel> wossP
wossHelper->SetAttribute ("ResDbFileName", StringValue ("woss-aloha-example-results.dat"));
if (m_databasePath != "")
{
wossHelper->SetAttribute ("SedimDbCoordFilePath", StringValue (m_databasePath + "/sea_floor/DECK41_coordinates.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenFilePath", StringValue (m_databasePath + "/sea_floor/DECK41_mardsen_square.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenOneFilePath", StringValue (m_databasePath + "/sea_floor/DECK41_mardsen_one_degree.nc"));
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/standard_depth/2WOA2009_SSP_April.nc"));
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2014_1D.nc"));
wossHelper->SetAttribute ("SedimDbCoordFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_coordinates.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_square.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenOneFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_one_degree.nc"));
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/2WOA2009_SSP_April.nc"));
wossHelper->SetAttribute ("BathyDbDebug", BooleanValue (false));
#if defined (WOSS_NETCDF4_SUPPORT)
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (4)); // 15 seconds, 2D netcdf format
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2019.nc"));
#else
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (3)); // 30 seconds, 2D netcdf format
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2014_2D.nc"));
#endif // defined (WOSS_NETCDF4_SUPPORT)
}
wossHelper->SetAttribute ("WossCleanWorkDir", BooleanValue (false));
wossHelper->SetAttribute ("WossWorkDirPath", StringValue ("./woss-aloha-example-output/work-dir/"));
wossHelper->SetAttribute ("WossSimTime", StringValue ("1|10|2012|0|1|1|1|10|2012|0|1|1"));
wossHelper->SetAttribute ("WossBellhopArrSyntax", IntegerValue (2)); // Check woss::BellhopArrSyntax; 2 means bellhop output syntax >= march 2019
wossHelper->SetAttribute ("WossManagerTimeEvoActive", BooleanValue (m_useTimeEvolution));
wossHelper->SetAttribute ("WossManagerTotalThreads", IntegerValue (4));
wossHelper->SetAttribute ("WossManagerUseMultithread", BooleanValue (m_useMultithread));
Expand Down
16 changes: 9 additions & 7 deletions helper/woss-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
#define WH_ALTIMETRY_TYPE_DEFAULT "L"
#define WH_SIMULATION_TIMES_DEFAULT ()
#define WH_CONCURRENT_THREADS_DEFAULT (0.0)
#define WH_BELLHOP_ARR_SYNTAX_DEFAULT (1)
#define WH_BELLHOP_ARR_SYNTAX_DEFAULT (2)
#define WH_BOX_DEPTH (-3000.0)
#define WH_BOX_RANGE (-3000.0)
#define WH_GEBCO_FORMAT_DEFAULT (3)

namespace ns3 {

Expand Down Expand Up @@ -187,7 +188,7 @@ WossHelper::WossHelper ()
m_sspDbCreator (NULL),
m_bathyDbCreatorDebug (WH_DEBUG_DEFAULT),
m_bathyDbDebug (WH_DEBUG_DEFAULT),
m_bathyDbUseThirtySecsPrec (true),
m_bathyDbGebcoFormat(WH_GEBCO_FORMAT_DEFAULT),
m_bathyDbFilePath (WH_STRING_DEFAULT),
m_bathyDbCreator (NULL),
m_wossDbManagerDebug (WH_DEBUG_DEFAULT),
Expand Down Expand Up @@ -370,6 +371,7 @@ WossHelper::Initialize (Ptr<WossPropModel> wossPropModel)
m_bathyDbCreator->setDbPathName (m_bathyDbFilePath);
m_bathyDbCreator->setDebug (m_bathyDbCreatorDebug);
m_bathyDbCreator->setWossDebug (m_bathyDbDebug);
m_bathyDbCreator->setGebcoBathyType ((woss::GEBCO_BATHY_TYPE)m_bathyDbGebcoFormat);

m_wossController->setBathymetryDbCreator (m_bathyDbCreator);
}
Expand Down Expand Up @@ -1349,11 +1351,11 @@ WossHelper::GetTypeId ()
BooleanValue (WH_DEBUG_DEFAULT),
MakeBooleanAccessor (&WossHelper::m_bathyDbDebug),
MakeBooleanChecker () )
.AddAttribute ("BathyDbUseThirtySecsPrecision",
"If true the Bathymetry Db will try to load the 30 seconds db version, the one minute one otherwise",
BooleanValue (true),
MakeBooleanAccessor (&WossHelper::m_bathyDbUseThirtySecsPrec),
MakeBooleanChecker () )
.AddAttribute ("BathyDbGebcoFormat",
"Sets up the the GEBCO database format: 0 = 1D one minute, 1 = 1D 30 seconds, 2 = 2D one minute, 3 = 2D 30 seconds, 4 = 2D 15 seconds",
IntegerValue (WH_GEBCO_FORMAT_DEFAULT),
MakeIntegerAccessor (&WossHelper::m_bathyDbGebcoFormat),
MakeIntegerChecker<int> () )
.AddAttribute ("BathyDbCoordFilePath",
"Bathymetry Db will read the GEBCO database from this file (full path required)",
StringValue (WH_STRING_DEFAULT),
Expand Down
2 changes: 1 addition & 1 deletion helper/woss-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class WossHelper : public Object

bool m_bathyDbCreatorDebug; //!< enable/disable the debug prints of the woss Bathymetry database creator.
bool m_bathyDbDebug; //!< enable/disable the debug prints of the woss Bathymetry database (GEBCO).
bool m_bathyDbUseThirtySecsPrec; //!< setup the the GEBCO database format resolution: thirty second of arc, or one minute of arc (see GEBCO formats).
int m_bathyDbGebcoFormat; //!< setup the the GEBCO database format: 0=1D one minute, 1=1D 30 seconds, 2=2D one minute, 3=2D 30 seconds, 4=2D 15 seconds
::std::string m_bathyDbFilePath; //!< setup the path of the woss GEBCO database
woss::BathyGebcoDbCreator *m_bathyDbCreator; //!< the helper will automatically allocate the woss GEBCO bathymetry db creator

Expand Down
80 changes: 49 additions & 31 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def options(opt):
opt.add_option('--with-woss-library',
help=('Path to WOSS library, for NS-3 WOSS Integration Framework support'),
dest='with_woss_lib', default=None)
opt.add_option('--with-netcdf-include',
help=('Path to NetCDF library include code, for WOSS Integration Framework support'),
dest='with_netcdf_src', default=None)
opt.add_option('--with-netcdf-library',
help=('Path to NetCDF library, for WOSS Integration Framework support'),
dest='with_netcdf_lib', default=None)
opt.add_option('--with-netcdf-install',
help=('Path to NetCDF legacy library install, for WOSS Integration Framework support'),
dest='with_netcdf_install', default=None)
opt.add_option('--with-netcdf4-install',
help=('Path to NetCDF4 and HDF5 library install, for WOSS Integration Framework support'),
dest='with_netcdf4_install', default=None)

def configure(conf):

Expand Down Expand Up @@ -48,24 +48,28 @@ def configure(conf):
conf.msg("Checking for WOSS library location", ("%s (guessed)" % '/usr/lib'))
conf.env['WITH_WOSS_LIB'] = os.path.abspath('/usr/lib')

if Options.options.with_netcdf_src:
conf.msg("Checking the given NetCDF source code path", ("%s (given)" % Options.options.with_netcdf_src))
if os.path.isdir(Options.options.with_netcdf_src):
conf.env['WITH_NETCDF_SRC'] = os.path.abspath(Options.options.with_netcdf_src)
if Options.options.with_netcdf4_install:
conf.msg("Checking the given NetCDF4 and HDF5 install path", ("%s (given)" % Options.options.with_netcdf4_install))
if (os.path.isdir(Options.options.with_netcdf4_install) and
os.path.isdir(Options.options.with_netcdf4_install + '/include') and
os.path.isdir(Options.options.with_netcdf4_install + '/lib')):
conf.env['WITH_NETCDF4_SRC'] = os.path.abspath(Options.options.with_netcdf4_install + '/include')
conf.env['WITH_NETCDF4_LIB'] = os.path.abspath(Options.options.with_netcdf4_install + '/lib')
else:
conf.msg("NetCDF source code path", False)
conf.msg("NetCDF4 and HDF5 install path", False)
config_error = "true"

if Options.options.with_netcdf_lib:
conf.msg("Checking the given NetCDF library path", ("%s (given)" % Options.options.with_netcdf_lib))
if os.path.isdir(Options.options.with_netcdf_lib):
conf.env['WITH_NETCDF_LIB'] = os.path.abspath(Options.options.with_netcdf_lib)
elif Options.options.with_netcdf_install:
conf.msg("Checking the given NetCDF legacy install path", ("%s (given)" % Options.options.with_netcdf_install))
if (os.path.isdir(Options.options.with_netcdf_install) and
os.path.isdir(Options.options.with_netcdf_install + '/include') and
os.path.isdir(Options.options.with_netcdf_install + '/lib')):
conf.env['WITH_NETCDF_SRC'] = os.path.abspath(Options.options.with_netcdf_install + '/include')
conf.env['WITH_NETCDF_LIB'] = os.path.abspath(Options.options.with_netcdf_install + '/lib')
else:
conf.msg("NetCDF library path", False)
conf.msg("NetCDF legacy install path", False)
config_error = "true"
else:
conf.msg("Checking the NetCDF library path", ("%s (guessed)" % '/usr/lib'))
conf.env['WITH_NETCDF_LIB'] = os.path.abspath('/usr/lib')
conf.msg("NetCDF support", False)

if config_error == "true":
conf.report_optional_feature("WOSS", "WOSS Integration Framework", False,
Expand Down Expand Up @@ -102,21 +106,35 @@ def configure(conf):
conf.env['WOSS'] = conf.check(mandatory=True, lib='WOSS', define_name='WOSS', libpath=conf.env['WITH_WOSS_LIB'] , uselib_store='WOSS',
msg="Checking the given WOSS library")

if conf.env['WITH_NETCDF_SRC']:
conf.msg("NetCDF source code path", ("%s " % conf.env['WITH_NETCDF_SRC']))

conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT']
conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF_SRC']
conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF'])
conf.env['LIB_NETCDF'] = ['netcdf_c++', 'netcdf']
if conf.env['WITH_NETCDF_SRC'] or conf.env['WITH_NETCDF4_SRC']:
if conf.env['WITH_NETCDF_SRC']:
conf.msg("NetCDF source code path", ("%s " % conf.env['WITH_NETCDF_SRC']))

conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT']
conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF_SRC']
conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF'])
conf.env['LIB_NETCDF'] = ['netcdf_c++', 'netcdf']

conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++ netcdf', libpath=conf.env['WITH_NETCDF_LIB'], define_name='NETCDF_CPP', uselib_store='NETCDF_CPP', msg="Checking the given NETCDF library")
conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++ netcdf', libpath=conf.env['WITH_NETCDF_LIB'], define_name='NETCDF_CPP', uselib_store='NETCDF_CPP', msg="Checking the given NETCDF library")

conf.report_optional_feature("WOSS", "WOSS Integration Framework", True,
"WOSS correctly configured")
conf.report_optional_feature("WOSS", "WOSS Integration Framework", True,
"WOSS correctly configured")
else:
conf.msg("NetCDF4 and HDF5 source code path", ("%s " % conf.env['WITH_NETCDF4_SRC']))

conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT', 'WOSS_NETCDF4_SUPPORT']
conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF4_SRC']
conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF4_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF'])
conf.env['LIB_NETCDF'] = ['netcdf_c++4', 'netcdf', 'hdf5']

conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++4 netcdf hdf5', libpath=conf.env['WITH_NETCDF4_LIB'], define_name='NETCDF_CPP', uselib_store='NETCDF_CPP', msg="Checking the given NETCDF4 and HDF5 libraries")

conf.report_optional_feature("WOSS", "WOSS Integration Framework", True,
"WOSS correctly configured")
else:
conf.msg("Checking for NetCDF source location", False)
conf.msg("Checking for NetCDF/NetCDF4 source location", False)


def build(bld):
Expand Down

0 comments on commit 3adfe20

Please sign in to comment.