certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi libCERTI/LBTS.hh libCERTI/LBTS.cc RTIA/Ti...


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/LBTS.hh libCERTI/LBTS.cc RTIA/Ti...
Date: Thu, 19 Aug 2010 10:50:22 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/08/19 10:50:22

Modified files:
        libCERTI       : LBTS.hh LBTS.cc 
        RTIA           : TimeManagement.cc TimeManagement.hh 
        RTIG           : Federation.cc 

Log message:
        Update of the NULL PRIME message protocol
        hopefully this last makes this new time advance protocol robust.
        Ready for testing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.hh?cvsroot=certi&r1=3.12&r2=3.13
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.cc?cvsroot=certi&r1=3.19&r2=3.20
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&r1=3.66&r2=3.67
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.hh?cvsroot=certi&r1=3.25&r2=3.26
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.134&r2=3.135

Patches:
Index: libCERTI/LBTS.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.hh,v
retrieving revision 3.12
retrieving revision 3.13
diff -u -b -r3.12 -r3.13
--- libCERTI/LBTS.hh    18 Aug 2010 15:33:18 -0000      3.12
+++ libCERTI/LBTS.hh    19 Aug 2010 10:50:19 -0000      3.13
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: LBTS.hh,v 3.12 2010/08/18 15:33:18 erk Exp $
+// $Id: LBTS.hh,v 3.13 2010/08/19 10:50:19 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef LIBCERTI_LBTS_HH
@@ -63,7 +63,8 @@
     FederationTime getLBTSValue() const {return _LBTS;};
 
     /**
-     * Check if a federate exists
+     * Check if a federate exists.
+     * @return true is the corresponding federate exists.
      */
     bool exists(FederateHandle) const ;
     void get(std::vector<FederateClock> &) const ;
@@ -80,9 +81,22 @@
      */
     void update(FederateHandle federateHandle, FederationTime logicalTime);
 
+    /**
+     * Return true is the last call to update was done with an "anonymous"
+     * federate handle. I.e. was the consequence of the NULL PRIME message
+     * algorithm.
+     */
+    bool hasReceivedAnonymousUpdate() const {return anonymousUpdateReceived;};
+
+    /**
+     * The reception of anonymous update have been taken into account.
+     */
+    void resetAnonymousUpdate() {anonymousUpdateReceived=false;};
+
 protected:
     FederationTime _LBTS ;
     FederateHandle MyFederateNumber ;
+    bool           anonymousUpdateReceived;
 
 private:
     typedef std::map<FederateHandle, FederationTime> ClockSet ;
@@ -94,4 +108,4 @@
 
 #endif // LIBCERTI_LBTS_HH
 
-// $Id: LBTS.hh,v 3.12 2010/08/18 15:33:18 erk Exp $
+// $Id: LBTS.hh,v 3.13 2010/08/19 10:50:19 erk Exp $

Index: libCERTI/LBTS.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.cc,v
retrieving revision 3.19
retrieving revision 3.20
diff -u -b -r3.19 -r3.20
--- libCERTI/LBTS.cc    11 Aug 2010 16:45:14 -0000      3.19
+++ libCERTI/LBTS.cc    19 Aug 2010 10:50:22 -0000      3.20
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: LBTS.cc,v 3.19 2010/08/11 16:45:14 erk Exp $
+// $Id: LBTS.cc,v 3.20 2010/08/19 10:50:22 erk Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -40,6 +40,7 @@
 LBTS::LBTS()
     : MyFederateNumber(0)
 {
+  anonymousUpdateReceived = false;
   _LBTS.setPositiveInfinity();
 }
 
@@ -122,6 +123,7 @@
                itend = it;
        }
     } else {
+       anonymousUpdateReceived = true;
        it = clocks.begin();
     }
 
@@ -133,7 +135,7 @@
        else {
                D.Out(pdDebug, "LBTS.update: federate-%u, time %f --> %f 
(old-->new)",
                                it->first, it->second.getTime(),time.getTime());
-               it->second = time ;
+               it->second = time;
        }
        if (it!=itend) ++it;
     } while (it!=itend);
@@ -157,4 +159,4 @@
 
 } // namespace certi
 
-// $Id: LBTS.cc,v 3.19 2010/08/11 16:45:14 erk Exp $
+// $Id: LBTS.cc,v 3.20 2010/08/19 10:50:22 erk Exp $

Index: RTIA/TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.66
retrieving revision 3.67
diff -u -b -r3.66 -r3.67
--- RTIA/TimeManagement.cc      17 Aug 2010 07:59:11 -0000      3.66
+++ RTIA/TimeManagement.cc      19 Aug 2010 10:50:22 -0000      3.67
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: TimeManagement.cc,v 3.66 2010/08/17 07:59:11 erk Exp $
+// $Id: TimeManagement.cc,v 3.67 2010/08/19 10:50:22 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -515,11 +515,22 @@
             }
         }
         else { // date_min < _LBTS
-
             // Federate can't advance up to expected time but up to LBTS. Other
             // federates are informed and no TSO message are sent.
-            if (_est_regulateur)
+            if (_est_regulateur) {
+               /* The following NULL message is part of the classical CMB NULL 
MESSAGE algorithm */
                 sendNullMessage(_LBTS);
+                /**
+                 * The following NULL PRIME message is part of SN NULL MESSAGE 
PRIME algorithm
+                 * This message is sent because we did receive some anonymous 
NULL message
+                 * in the past and we are still NERing so RTIG may be 
interested (again)
+                 * in our wanted advance time.
+                 */
+                if (hasReceivedAnonymousUpdate()) {
+                       Debug(D,pdDebug) << "TM::nextEventAdvance - (re)sending 
NULL PRIME" << std::endl;
+                       sendNullPrimeMessage(date_avancee);
+                }
+            }
         }
     }
 
@@ -931,9 +942,6 @@
 }
 
 // ----------------------------------------------------------------------------
-/*! Once every messages has been delivered to federate, logical time can be
-  advanced and send a timeAdvanceGrant to federate.
-*/
 void
 TimeManagement::timeAdvanceGrant(FederationTime logical_time,
                                  TypeException &e)
@@ -953,7 +961,9 @@
     comm->requestFederateService(&req);
 
     _heure_courante = logical_time ;
-}
+    /* reset the sending of NULL PRIME message whenever we get TAG */
+    resetAnonymousUpdate();
+} /* timeAdvanceGrant */
 
 // ----------------------------------------------------------------------------
 /*! Either nextEventRequest or timeAdvanceRequest is called by federate to
@@ -1051,4 +1061,4 @@
 
 }} // namespaces
 
-// $Id: TimeManagement.cc,v 3.66 2010/08/17 07:59:11 erk Exp $
+// $Id: TimeManagement.cc,v 3.67 2010/08/19 10:50:22 erk Exp $

Index: RTIA/TimeManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.hh,v
retrieving revision 3.25
retrieving revision 3.26
diff -u -b -r3.25 -r3.26
--- RTIA/TimeManagement.hh      11 Aug 2010 16:45:14 -0000      3.25
+++ RTIA/TimeManagement.hh      19 Aug 2010 10:50:22 -0000      3.26
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: TimeManagement.hh,v 3.25 2010/08/11 16:45:14 erk Exp $
+// $Id: TimeManagement.hh,v 3.26 2010/08/19 10:50:22 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_RTIA_TIME_MANAGEMENT_HH
@@ -123,7 +123,7 @@
     /**
      * Main time advancing method.
      * This method is called by tick().
-     *  Calls are dispatched between timeAdvance and nextEventAdvance
+     * Calls are dispatched between timeAdvance (TAR/TARA) and 
nextEventAdvance (NER/NERA)
      *  depending on current time advancing method.
      */
     void advance(bool &msg_restant, TypeException &e);
@@ -141,8 +141,12 @@
      */
     void nextEventAdvance(bool &msg_restant, TypeException &e);
 
-    void timeAdvanceGrant(FederationTime, TypeException &);
-    void flushQueueRequest(FederationTime, TypeException &);
+    /**
+     * Once every messages has been delivered to federate, logical time can be
+     * advanced and send a timeAdvanceGrant to federate.
+     */
+    void timeAdvanceGrant(FederationTime, TypeException& e);
+    void flushQueueRequest(FederationTime, TypeException& e);
     bool executeFederateService(NetworkMessage &msg);
     /**
      * Send a null message to RTIG containing Logicaal Time + Lookahead.
@@ -185,4 +189,4 @@
 
 #endif // CERTI_RTIA_TIME_MANAGEMENT_HH
 
-// $Id: TimeManagement.hh,v 3.25 2010/08/11 16:45:14 erk Exp $
+// $Id: TimeManagement.hh,v 3.26 2010/08/19 10:50:22 erk Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.134
retrieving revision 3.135
diff -u -b -r3.134 -r3.135
--- RTIG/Federation.cc  18 Aug 2010 15:33:18 -0000      3.134
+++ RTIG/Federation.cc  19 Aug 2010 10:50:22 -0000      3.135
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Federation.cc,v 3.134 2010/08/18 15:33:18 erk Exp $
+// $Id: Federation.cc,v 3.135 2010/08/19 10:50:22 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -757,13 +757,13 @@
                Debug(D,pdDebug) << "New minNERx =" << newMin << std::endl;
                retval = true;
                minNERx = newMin;
-               /* if a new Min is found then we shall reset the NERx status of 
NERing federates
-                * whose lastNERx value is equal to the new Min found.
+               /* if a new Min is found then we shall reset the NERx status of 
ALL NERing federates
                 * Rationale: an Anonymous NULL MESSAGE dated with newMin will 
be sent to them.
+                *            after that a NERing Federate which remains in its 
NERing loop should
+                *            send a new NULL PRIME message.
                 */
                for (HandleFederateMap::iterator i = 
_handleFederateMap.begin(); i != _handleFederateMap.end(); ++i) {
-                       if ((i->second.isUsingNERx()) &&
-                           (i->second.getLastNERxValue()==newMin)) {
+                       if (i->second.isUsingNERx()) {
                                //i->second.setLastNERxValue(FedTime(0.0)); // 
not needed
                                i->second.setIsUsingNERx(false);
                                Debug(D,pdDebug) << "Federate <" << 
i->second.getName() <<"> not NERing anymore." <<  std::endl;
@@ -2689,5 +2689,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.134 2010/08/18 15:33:18 erk Exp $
+// $Id: Federation.cc,v 3.135 2010/08/19 10:50:22 erk Exp $
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]