certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] applications/HLA_TestsSuite test_HugeAVPV.cc


From: certi-cvs
Subject: [certi-cvs] applications/HLA_TestsSuite test_HugeAVPV.cc
Date: Mon, 14 Jul 2008 14:12:42 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Christian Stenzel <approx>      08/07/14 14:12:42

Modified files:
        HLA_TestsSuite : test_HugeAVPV.cc 

Log message:
        refinements of test federate test_HugeAVPV

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/test_HugeAVPV.cc?cvsroot=certi&r1=1.3&r2=1.4

Patches:
Index: test_HugeAVPV.cc
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/test_HugeAVPV.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- test_HugeAVPV.cc    30 Jun 2008 13:35:20 -0000      1.3
+++ test_HugeAVPV.cc    14 Jul 2008 14:12:42 -0000      1.4
@@ -22,6 +22,7 @@
 using std::auto_ptr;
 
 #define MAX_FEDERATES 10
+#define LH 5
 
 class HugeAVPVFed : public NullFederateAmbassador {
 
@@ -71,16 +72,24 @@
         this->create_and_join();
         this->getHandles();
         if (creator) {
+            cout << "--------------------------------------------------" << 
endl;
             cout << "Press ENTER to start execution ..." << endl;
             getchar();
 
+            cout << "1) BEGIN Initialization" << endl;
             this->synchronizeFederation("sync1", "test");
-           cout << "Sync (1) done" << endl;
+           cout << "  Sync (1) done" << endl;
 
             this->publishAttributesAndParameters();
             this->registerObjectInst();
 
+            cout << "1) END Initialization" << endl;
+            cout << "--------------------------------------------------" << 
endl;
+
             // not time regulating
+           // all receivers have to get messages wo timestamps
+            cout << "2) BEGIN Updates, Federate State: Nor TR/TC" << endl;
+
             this->synchronizeFederation("sync2", "test");
            cout << "Sync (2) done" << endl;
 
@@ -89,12 +98,24 @@
             this->sendInteractions(false);
             this->updateAttributeVals(true);
             this->sendInteractions(true);
+
            cout << "(1) Done" << endl;
+            this->synchronizeFederation("sync3", "test");
+           cout << "Sync (3) done" << endl;
+
+            cout << "2) END Updates, Federate State: Nor TR/TC" << endl;
+            cout << "--------------------------------------------------" << 
endl;
 
             // time regulating, receivers are not time constrained
+           // all receivers have to get messages wo timestamps
+            cout << "3) BEGIN Updates, Federate State: TR" << endl;
+           cout << "Enabling Time Regulation. Press ENTER ..." << endl;
+            getchar();
             this->enableTimeReg();
-            this->synchronizeFederation("sync3", "test");
-           cout << "Sync (3) done" << endl;
+           cout << "Time Regulation Enabled. Press ENTER ..." << endl;
+            getchar();
+            this->synchronizeFederation("sync4", "test");
+           cout << "Sync (4) done" << endl;
 
            cout << "(2) Send Attributes and Parameters" << endl;
             this->updateAttributeVals(false);
@@ -102,10 +123,14 @@
             this->updateAttributeVals(true);
             this->sendInteractions(true);
            cout << "(2) Done." << endl;
+            cout << "3) END Updates, Federate State: TR" << endl;
+            cout << "--------------------------------------------------" << 
endl;
 
             // time regulating, receivers are time constrained
-            this->synchronizeFederation("sync4", "test");
-           cout << "Sync (4) done" << endl;
+           // all receivers have to get messages w timestamps !
+            cout << "4) BEGIN Updates, Federate State: TR, Receivers TC" << 
endl;
+            this->synchronizeFederation("sync5", "test");
+           cout << "Sync (5) done" << endl;
 
            cout << "(3) Send Attributes and Parameters" << endl;
             this->updateAttributeVals(false);
@@ -114,37 +139,75 @@
             this->sendInteractions(true);
            cout << "(3) Done." << endl;
 
-           this->advanceTime(10.0);
+           cout << "All ts updates done. Press ENTER ..." << endl;
+           getchar();
             
-            // stay active until all federates reach end of execution
             this->synchronizeFederation("sync6", "test");
            cout << "Sync (6) done" << endl;
+
+           cout << "Advancing time. Press ENTER ..." << endl;
+           getchar();
+           this->advanceTime(10.0);
+           cout << "Time advanced. Press ENTER ..." << endl;
+           getchar();
+
+            cout << "4) END Updates, Federate State: TR, Receivers TC" << endl;
+            cout << "--------------------------------------------------" << 
endl;
+            
+            // stay active until all federates reach end of execution
+            this->synchronizeFederation("sync7", "test");
+           cout << "Sync (7) done" << endl;
         } else {
             this->subscribeAttributesAndParameters();
             // initial sync point
             this->waitForSyncPoint();
+           cout << "First sync point reached." << endl;
 
             // second sync point -> afterwards have to get rav and ri wo ts
             this->waitForSyncPoint();
-            while (rav_ri_counter!=10) this->tickRTI();
+           cout << "Second sync point reached." << endl;
+
+            while (rav_ri_counter!=6) this->tickRTI();
             rav_ri_counter = 0;
 
+           // after next sync point sender is time regulating, receivers
+           // are still timeconstrained nor time regulating
+           // => all received messages have no timestamps
+            this->waitForSyncPoint();
+            cout << "Third sync point reached." << endl;
+
             // third sync point -> afterwards have to get rav and ri wo ts
             this->waitForSyncPoint();
-            while (rav_ri_counter!=10) this->tickRTI();
+            cout << "Fourth sync point reached." << endl;
+
+            while (rav_ri_counter!=6) this->tickRTI();
             rav_ri_counter = 0;
 
             // fourth sync point -> afterwards have to get rav and ri wo/w ts
+           cout << "Enabling Time Constrained. Press ENTER ..." << endl;
+            getchar();
             this->enableTimeCon();
+           cout << "Time Constrained Enabled. Press ENTER ..." << endl;
+            getchar();
+
             this->waitForSyncPoint();
+            cout << "Fifth sync point reached." << endl;
 
+            this->waitForSyncPoint();
+            cout << "Sixth sync point reached." << endl;
+
+           cout << "Advancing time. Press ENTER ..." << endl;
+           getchar();
            this->advanceTime(10.0);
+           cout << "Time advanced. Press ENTER ..." << endl;
+           getchar();
 
-            while (rav_ri_counter!=10) this->tickRTI();
+            while (rav_ri_counter!=6) this->tickRTI();
             rav_ri_counter = 0;
 
             // final sync point
             this->waitForSyncPoint();
+            cout << "Final sync point reached." << endl;
         }
         this->resign_and_destroy();
         return 0;
@@ -399,9 +462,6 @@
     waitForSyncPoint(void) {
         while (!ANNOUNCESYNCPOINT) this->tickRTI();
         ANNOUNCESYNCPOINT = false;
-        cout << "Synchronization Point " << SYNCPOINTLABEL <<
-        " reached, press ENTER ..." << endl;
-        getchar();
         this->indicateSynchronization(SYNCPOINTLABEL);
     }
 
@@ -460,12 +520,14 @@
         ahvps->add(myhdls.TestAttribute.a3, payload, payloadSize);
 
         try {
-            if (ts)
+            if (ts) {
                 rtiamb.updateAttributeValues(myhdls.TestAttribute.oh, *ahvps,
-                                             RTIfedTime(0), "a");
-            else
+                                             RTIfedTime(LH), "a");
+            }
+            else {
                 rtiamb.updateAttributeValues(myhdls.TestAttribute.oh,
                                              *ahvps, "a");
+            }
         } catch ( RTI::Exception &e ) {
             cerr << "RTI exception: " << e._name << " ["
             << (e._reason ? e._reason : "undefined") << "]." << endl;
@@ -502,13 +564,13 @@
         try {
             if (ts) {
                 rtiamb.sendInteraction(myhdls.TestParameter0.ich, *phvps0,
-                                       RTIfedTime(0), "p0");
+                                       RTIfedTime(LH), "p0");
                 rtiamb.sendInteraction(myhdls.TestParameter1.ich, *phvps1,
-                                       RTIfedTime(0), "p1");
+                                       RTIfedTime(LH), "p1");
                 rtiamb.sendInteraction(myhdls.TestParameter2.ich, *phvps2,
-                                       RTIfedTime(0), "p2");
+                                       RTIfedTime(LH), "p2");
                 rtiamb.sendInteraction(myhdls.TestParameter3.ich, *phvps3,
-                                       RTIfedTime(0), "p3");
+                                       RTIfedTime(LH), "p3");
             } else {
                 rtiamb.sendInteraction(myhdls.TestParameter0.ich, *phvps0, 
"p");
                 rtiamb.sendInteraction(myhdls.TestParameter1.ich, *phvps1, 
"p");
@@ -533,7 +595,7 @@
     void
     enableTimeReg(void) {
         try {
-            rtiamb.enableTimeRegulation(RTIfedTime(0), RTIfedTime(5));
+            rtiamb.enableTimeRegulation(RTIfedTime(0), RTIfedTime(LH));
         } catch ( RTI::Exception &e ) {
             cerr << "RTI exception: " << e._name << " ["
             << (e._reason ? e._reason : "undefined") << "]." << endl;
@@ -546,7 +608,6 @@
     enableTimeCon(void) {
         try {
             rtiamb.enableTimeConstrained();
-            rtiamb.enableAsynchronousDelivery();
         } catch ( RTI::Exception &e ) {
             cerr << "RTI exception: " << e._name << " ["
             << (e._reason ? e._reason : "undefined") << "]." << endl;
@@ -646,7 +707,7 @@
             RTI::InvalidFederationTime,
             RTI::FederateInternalError) {
         rav_ri_counter += 1;
-        cout << "rav w ts" << endl;
+        cout << "rav w ts " << (static_cast<RTIfedTime>(theTime)).getTime() << 
endl;
     }
 
     void
@@ -673,7 +734,7 @@
             RTI::InvalidFederationTime,
             RTI::FederateInternalError ) {
         rav_ri_counter += 1;
-        cout << "ri w ts" << endl;
+        cout << "ri w ts " << (static_cast<RTIfedTime>(theTime)).getTime() << 
endl;
     }
 
     void
@@ -681,8 +742,7 @@
     throw (RTI::InvalidFederationTime, 
           RTI::EnableTimeRegulationWasNotPending, 
            RTI::FederateInternalError) {
-        cout << "Time Regulation Enabled, press ENTER to continue..." << endl;
-       getchar();
+       cout << "Time Regulation enabled at " << 
(static_cast<RTIfedTime>(theTime)).getTime() << endl;
     }
 
     void
@@ -690,8 +750,7 @@
     throw (RTI::InvalidFederationTime, 
           RTI::EnableTimeConstrainedWasNotPending, 
            RTI::FederateInternalError) {
-        cout << "Time Constrained Enabled, press ENTER to continue..." << endl;
-       getchar();
+       cout << "Time Constrained enabled at " << 
(static_cast<RTIfedTime>(theTime)).getTime() << endl;
     }
 
     void 




reply via email to

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