From 11867953148158607b984c20bedd37d3b48782b7 Mon Sep 17 00:00:00 2001 From: Federico Guerra Date: Sun, 30 Jul 2023 21:49:09 +0200 Subject: [PATCH] [Add] WOSS Release 1.12.5 --- CHANGELOG | 2 + configure.ac | 2 +- doxy/Mainpage.dox | 5 ++- samples/test_aloha_hamburg_port_bathy.tcl | 3 +- samples/test_aloha_no_dbs.tcl | 15 ++++--- samples/test_aloha_no_dbs_waypoints.tcl | 9 ++-- .../test_aloha_no_dbs_with_time_evolution.tcl | 15 ++++--- samples/test_aloha_with_dbs.tcl | 11 +++-- woss/woss_def/altimetry-definitions.h | 39 ++++++++++++++--- woss_phy/tcl_hooks/woss-manager-simple-tcl.h | 43 ++++++++++++++----- woss_phy/uw-woss-phy-defaults.tcl | 7 ++- woss_phy/uw-woss-waypoint-position.cpp | 13 +++++- woss_phy/uw-woss-waypoint-position.h | 8 ++-- 13 files changed, 120 insertions(+), 52 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 37e4706..363c16a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -149,3 +149,5 @@ v1.12.4 - Added support for GEBCO 2022 - Fixed bug with WossDbManager - Added TCL debug capabilities to Altimetry classes - Refactored usage of streams' precision throughout the whole framework + +v1.12.5 - Minor fixes to ns-Miracle classes diff --git a/configure.ac b/configure.ac index 6d8d15c..93aabfa 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ # whose support is gratefully acknowledged. -AC_INIT([WOSS], [1.12.4], [woss@guerra-tlc.com]) +AC_INIT([WOSS], [1.12.5], [woss@guerra-tlc.com]) AM_INIT_AUTOMAKE([foreign subdir-objects]) AC_MSG_NOTICE([WOSS AC_PACKAGE_VERSION]) diff --git a/doxy/Mainpage.dox b/doxy/Mainpage.dox index 4cbf62e..b2a768f 100644 --- a/doxy/Mainpage.dox +++ b/doxy/Mainpage.dox @@ -3,7 +3,7 @@ * * @author Federico Guerra - federico@guerra-tlc.com * - * @version 1.12.4 + * @version 1.12.5 * * This document provides a short techical description of the World Ocean Simulation System (WOSS) library * and of its integration into Multi InteRfAce Cross Layer Extension (NS-Miracle).

@@ -1307,6 +1307,9 @@ *

  • Added TCL debug capabilities to Altimetry classes *
  • Refactored usage of streams' precision throughout the whole framework * +*
  • v.1.12.5 * **/ diff --git a/samples/test_aloha_hamburg_port_bathy.tcl b/samples/test_aloha_hamburg_port_bathy.tcl index 9e33f2f..be5f565 100644 --- a/samples/test_aloha_hamburg_port_bathy.tcl +++ b/samples/test_aloha_hamburg_port_bathy.tcl @@ -247,10 +247,9 @@ $woss_creator setSimulationTimes 0 0 1 1 2010 0 0 1 2 1 2010 0 0 1 WOSS/Manager/Simple/MultiThread set debug 0 WOSS/Manager/Simple/MultiThread set is_time_evolution_active -1.0 -WOSS/Manager/Simple/MultiThread set concurrent_threads 0 WOSS/Manager/Simple/MultiThread set space_sampling 0.0 set woss_manager [new "WOSS/Manager/Simple/MultiThread"] - +$woss_manager setConcurrentThreads 0 WOSS/Utilities set debug 0 set woss_utilities [new "WOSS/Utilities"] diff --git a/samples/test_aloha_no_dbs.tcl b/samples/test_aloha_no_dbs.tcl index f62d43d..6b0b032 100644 --- a/samples/test_aloha_no_dbs.tcl +++ b/samples/test_aloha_no_dbs.tcl @@ -221,8 +221,8 @@ $woss_creator setSimulationTimes 0 0 1 12 2009 0 0 1 1 12 2009 0 0 1 WOSS/Manager/Simple/MultiThread set debug 0.0 WOSS/Manager/Simple/MultiThread set is_time_evolution_active -1.0 WOSS/Manager/Simple/MultiThread set space_sampling 0.0 -WOSS/Manager/Simple/MultiThread set concurrent_threads 0 set woss_manager [new "WOSS/Manager/Simple/MultiThread"] +$woss_manager setConcurrentThreads 0 #### we create the mandatory woss::TransducerHandler @@ -234,7 +234,7 @@ set transducer_handler [new "WOSS/Definitions/TransducerHandler"] WOSS/Controller set debug 0 set woss_controller [new "WOSS/Controller"] #uncomment if you wish to store results to a db on filesystem -#$woss_controller setTimeArrResultsDbCreator $db_res_arr +$woss_controller setTimeArrResultsDbCreator $db_res_arr $woss_controller setWossDbManager $db_manager $woss_controller setWossManager $woss_manager $woss_controller setWossCreator $woss_creator @@ -509,11 +509,8 @@ for {set id1 0} {$id1 < $opt(nn)} {incr id1} { ############################### proc finish {} { - global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel db_manager propagation - global woss_manager - -# $woss_manager reset - $db_manager closeAllConnections + global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel propagation + global woss_manager db_manager puts "\n" @@ -541,6 +538,10 @@ proc finish {} { $ns flush-trace close $opt(tracefile) + + puts "Delete WOSS objects to force file operations" + delete $woss_manager + delete $db_manager } ################### diff --git a/samples/test_aloha_no_dbs_waypoints.tcl b/samples/test_aloha_no_dbs_waypoints.tcl index 39ec350..006ad29 100644 --- a/samples/test_aloha_no_dbs_waypoints.tcl +++ b/samples/test_aloha_no_dbs_waypoints.tcl @@ -280,8 +280,8 @@ $woss_creator setSimulationTimes 0 0 1 1 2010 0 0 1 2 1 2010 0 0 1 WOSS/Manager/Simple/MultiThread set debug 0 WOSS/Manager/Simple/MultiThread set space_sampling 2.0 -WOSS/Manager/Simple/MultiThread set concurrent_threads 0.0 set woss_manager [new "WOSS/Manager/Simple/MultiThread"] +$woss_manager setConcurrentThreads 0 WOSS/Definitions/TransducerHandler set debug 0 @@ -647,9 +647,7 @@ for {set id1 0} {$id1 < $opt(nn)} {incr id1} { ############################### proc finish {} { - global ns opt cbr mac propagation cbr_auv mac_auv phy_data phy_data_auv channel db_manager - - $db_manager closeAllConnections + global ns opt cbr mac propagation cbr_auv mac_auv phy_data phy_data_auv channel db_manager woss_manager set totenergy 0.0 set total_cbr_tx_pkts 0.0 @@ -696,6 +694,9 @@ proc finish {} { $ns flush-trace close $opt(tracefile) + puts "Delete WOSS objects to force file operations" + delete $woss_manager + delete $db_manager } diff --git a/samples/test_aloha_no_dbs_with_time_evolution.tcl b/samples/test_aloha_no_dbs_with_time_evolution.tcl index ca1a469..f48a0f5 100644 --- a/samples/test_aloha_no_dbs_with_time_evolution.tcl +++ b/samples/test_aloha_no_dbs_with_time_evolution.tcl @@ -239,10 +239,10 @@ $woss_creator setSimulationTimes 0 0 1 1 2011 9 0 1 2 1 2011 1 0 1 #set woss_manager [new "WOSS/Manager/Simple"] WOSS/Manager/Simple/MultiThread set debug 0.0 -WOSS/Manager/Simple/MultiThread set is_time_evolution_active 10.0 +WOSS/Manager/Simple/MultiThread set is_time_evolution_active 1.0 WOSS/Manager/Simple/MultiThread set space_sampling 0.0 -WOSS/Manager/Simple/MultiThread set concurrent_threads 0 set woss_manager [new "WOSS/Manager/Simple/MultiThread"] +$woss_manager setConcurrentThreads 0 #### we create the mandatory woss::TransducerHandler @@ -526,11 +526,8 @@ for {set id1 0} {$id1 < $opt(nn)} {incr id1} { ############################### proc finish {} { - global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel db_manager propagation - global woss_manager - -# $woss_manager reset - $db_manager closeAllConnections + global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel propagation + global db_manager woss_manager puts "\n" @@ -558,6 +555,10 @@ proc finish {} { $ns flush-trace close $opt(tracefile) + + puts "Delete WOSS objects to force file operations" + delete $woss_manager + delete $db_manager } ################### diff --git a/samples/test_aloha_with_dbs.tcl b/samples/test_aloha_with_dbs.tcl index f64a95f..db30e74 100644 --- a/samples/test_aloha_with_dbs.tcl +++ b/samples/test_aloha_with_dbs.tcl @@ -258,9 +258,9 @@ $woss_creator setSimulationTimes 0 0 1 1 2010 0 0 1 2 1 2010 0 0 1 WOSS/Manager/Simple/MultiThread set debug 0 WOSS/Manager/Simple/MultiThread set is_time_evolution_active -1.0 -WOSS/Manager/Simple/MultiThread set concurrent_threads 0 WOSS/Manager/Simple/MultiThread set space_sampling 0.0 set woss_manager [new "WOSS/Manager/Simple/MultiThread"] +$woss_manager setConcurrentThreads 0 WOSS/Utilities set debug 0 @@ -552,9 +552,8 @@ for {set id1 0} {$id1 < $opt(nn)} {incr id1} { ############################### proc finish {} { - global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel db_manager propagation - - $db_manager closeAllConnections + global ns opt cbr mac propagation cbr_sink mac_sink phy_data phy_data_sink channel propagation + global db_manager woss_manager puts "\n" @@ -582,6 +581,10 @@ proc finish {} { $ns flush-trace close $opt(tracefile) + + puts "Delete WOSS objects to force file operations" + delete $woss_manager + delete $db_manager } ################### diff --git a/woss/woss_def/altimetry-definitions.h b/woss/woss_def/altimetry-definitions.h index b79bd9a..64d3b53 100644 --- a/woss/woss_def/altimetry-definitions.h +++ b/woss/woss_def/altimetry-definitions.h @@ -702,15 +702,31 @@ namespace woss { * @return a new Altimetry object **/ virtual AltimBretschneider* randomize( double ratio_incr_value ) const; - - + + /** + * Configures H - the characteristic height of the wave [m] + * @param h characteristic height [m] + * @return AltimBretschneider reference to this + **/ AltimBretschneider& setCharacteristicHeight( double h ) { char_height = h; return *this; } - + + /** + * Configures T - the wave average period [s] + * @param h average period [s] + * @return AltimBretschneider reference to this + **/ AltimBretschneider& setAveragePeriod( double p ) { average_period = p; return *this; } - - + + /** + * Gets H - the characteristic height of the wave [m] + * @return characteristic height [m] + **/ double getCharacteristicHeight() const { return char_height; } - + + /** + * Gets T - the wave average period [s] + * @return h average period [s] + **/ double getAveragePeriod() const { return average_period; } @@ -719,9 +735,18 @@ namespace woss { virtual AltimBretschneider& createWaveSpectrum(); - + /** + * H - Model's characteristic height [m] + * Refer to: + * G. J. Komen et al., Dynamics and modeling of ocean waves. Cambridge University Press, 1994. + */ double char_height; + /** + * T - Model's average wave period [s] + * Refer to: + * G. J. Komen et al., Dynamics and modeling of ocean waves. Cambridge University Press, 1994. + */ double average_period; }; diff --git a/woss_phy/tcl_hooks/woss-manager-simple-tcl.h b/woss_phy/tcl_hooks/woss-manager-simple-tcl.h index d648af6..a2bb6fe 100644 --- a/woss_phy/tcl_hooks/woss-manager-simple-tcl.h +++ b/woss_phy/tcl_hooks/woss-manager-simple-tcl.h @@ -95,25 +95,22 @@ namespace woss { double debug_; - double is_time_evolution_active_; - - + double is_time_evolution_active_; }; - - + template< typename WMResDb > WossManagerSimpleTcl< WMResDb >::WossManagerSimpleTcl() : WossManagerSimple() { TclObject::bind("debug", &this->debug_); - TclObject::bind("is_time_evolution_active", &this->is_time_evolution_active_); + TclObject::bind("is_time_evolution_active", &this->is_time_evolution_active_); TclObject::bind("space_sampling",&this->space_sampling ); - + this->debug = (bool) this->debug_; this->is_time_evolution_active = (bool) this->is_time_evolution_active_; } - template< typename WMResDb > + template< typename WMResDb > int WossManagerSimpleTcl< WMResDb >::command( int argc, const char*const* argv ) { if(argc==2) { if(strcasecmp(argv[1], "reset") == 0) { @@ -126,9 +123,35 @@ namespace woss { } return TclObject::command(argc,argv); } - + +#ifdef WOSS_MULTITHREAD + template<> + int WossManagerSimpleTcl< WossManagerResDbMT >::command( int argc, const char*const* argv ) { + if(argc==2) { + if(strcasecmp(argv[1], "reset") == 0) { + + if (this->debug) ::std::cout << "WossManagerSimpleTcl::command() reset called" << ::std::endl; + + if ( this->reset() ) return TCL_OK; + else return TCL_ERROR; + } + } + else if (argc==3) { + if(strcasecmp(argv[1], "setConcurrentThreads") == 0) { + int threads = atoi(argv[2]); + + if (this->debug) ::std::cout << "WossManagerSimpleTcl::command() setConcurrentThreads " + << threads << " called" << ::std::endl; + + this->setConcurrentThreads(threads); + + return TCL_OK; + } + } + return TclObject::command(argc,argv); + } +#endif // WOSS_MULTITHREAD } - #endif // WOSS_NS_MIRACLE_SUPPORT diff --git a/woss_phy/uw-woss-phy-defaults.tcl b/woss_phy/uw-woss-phy-defaults.tcl index ae1be7e..96970dc 100644 --- a/woss_phy/uw-woss-phy-defaults.tcl +++ b/woss_phy/uw-woss-phy-defaults.tcl @@ -116,10 +116,9 @@ WOSS/Controller set debug 0.0 WOSS/Definitions/RandomGenerator/C set seed_ 1 -# WOSS/Manager/Simple/MultiThread set max_thread_number 9 -# WOSS/Manager/Simple/MultiThread set is_time_evolution_active -1.0 -# WOSS/Manager/Simple/MultiThread set debug 0.0 -# WOSS/Manager/Simple/MultiThread set space_sampling 0.0 +#WOSS/Manager/Simple/MultiThread set is_time_evolution_active -1.0 +#WOSS/Manager/Simple/MultiThread set debug 0.0 +#WOSS/Manager/Simple/MultiThread set space_sampling 0.0 PacketHeaderManager set tab_(PacketHeader/WOSS) 1 diff --git a/woss_phy/uw-woss-waypoint-position.cpp b/woss_phy/uw-woss-waypoint-position.cpp index 39613c0..7fc4b68 100644 --- a/woss_phy/uw-woss-waypoint-position.cpp +++ b/woss_phy/uw-woss-waypoint-position.cpp @@ -107,6 +107,7 @@ static class WossWpPositionClass : public TclClass { WossWpPosition::WossWpPosition() : time_threshold(1e-5), last_time_update(0.0), + current_speed(0.0), waypoint_vect(), timeid_map() { @@ -232,6 +233,7 @@ void WossWpPosition::update( double time ) { setLocation( pos ); updateVerticalOrientation( waypoint_vect[it->second - 1].getDestination(), pos ); updateBearing( waypoint_vect[it->second - 1].getDestination(), pos ); + current_speed = waypoint_vect[it->second -1].getSpeed(); } // ::std::cout << "WossWpPosition::update() update loc " << curr_coordz << ::std::endl; @@ -328,7 +330,7 @@ woss::CoordZ WossWpPosition::getLocation() { double WossWpPosition::getVerticalOrientation() { - double now = Scheduler::instance().clock(); + double now = Scheduler::instance().clock(); if (now>last_time_update+time_threshold) update(now); // ::std::cout << "WossWpPosition::getVerticalOrientation() vertical orientation " << vertical_orientation << ::std::endl; @@ -337,7 +339,7 @@ double WossWpPosition::getVerticalOrientation() { double WossWpPosition::getBearing() { - double now = Scheduler::instance().clock(); + double now = Scheduler::instance().clock(); if (now>last_time_update+time_threshold) update(now); // ::std::cout << "WossWpPosition::getBearing() current bearing " << ( bearing * 180.0 / M_PI ) << ::std::endl; @@ -345,3 +347,10 @@ double WossWpPosition::getBearing() { } +double WossWpPosition::getSpeed() { + double now = Scheduler::instance().clock(); + if (now>last_time_update+time_threshold) update(now); + +// ::std::cout << "WossWpPosition::getSpeed() current speed " << current_speed << ::std::endl; + return current_speed; +} diff --git a/woss_phy/uw-woss-waypoint-position.h b/woss_phy/uw-woss-waypoint-position.h index 236d0ab..1a4960b 100644 --- a/woss_phy/uw-woss-waypoint-position.h +++ b/woss_phy/uw-woss-waypoint-position.h @@ -62,15 +62,16 @@ class WossWpPosition : public WossPosition { virtual bool isEquivalentTo( const woss::CoordZ& coordz ); - - + + virtual woss::CoordZ getLocation(); - virtual double getVerticalOrientation(); virtual double getBearing(); + virtual double getSpeed(); + protected: @@ -154,6 +155,7 @@ class WossWpPosition : public WossPosition { double last_time_update; + double current_speed; WayPointVect waypoint_vect;