[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi doc/CERTI-tickHandling.xml RTIA/TimeManag...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi doc/CERTI-tickHandling.xml RTIA/TimeManag... |
Date: |
Sat, 20 Nov 2010 16:39:29 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 10/11/20 16:39:28
Modified files:
doc : CERTI-tickHandling.xml
RTIA : TimeManagement.cc RTIA_federate.cc
Log message:
More documentation on tick internals
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/doc/CERTI-tickHandling.xml?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&r1=3.67&r2=3.68
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.113&r2=3.114
Patches:
Index: doc/CERTI-tickHandling.xml
===================================================================
RCS file: /sources/certi/certi/doc/CERTI-tickHandling.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- doc/CERTI-tickHandling.xml 19 Nov 2010 21:11:42 -0000 1.3
+++ doc/CERTI-tickHandling.xml 20 Nov 2010 16:39:28 -0000 1.4
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE nta PUBLIC '-//Uppaal
Team//DTD Flat System 1.1//EN'
'http://www.it.uu.se/research/group/darts/uppaal/flat-1_1.dtd'><nta><declaration>//
---------------------------------------------
-// Global constant
+// Global constant or types
// ---------------------------------------------
const int nbFederate = 2;
typedef int[1,nbFederate] FederateRange;
+typedef int[0,1] BoolRange;
+typedef int[0,10] MinTimeRange;
+typedef int[0,10] MaxTimeRange;
+
// ---------------------------------------------
// Global communication channels (synchro)
// ---------------------------------------------
@@ -20,7 +24,7 @@
bool multiple[FederateRange] = {false, false};
// Is there more callbacks to handle?
-bool result[FederateRange] = {false, false};
+bool moreMsg[FederateRange] = {false, false};
// Does current tick has minTime
int minTime[FederateRange] = {0,0};
@@ -42,18 +46,15 @@
clock h;
// The number of callback to be processed
-int nbCallbacks=0;</declaration><location id="id0" x="0" y="-480"><name
x="-42" y="-510">TICK_NEXT</name></location><location id="id1" x="-352"
y="-160"><name x="-408" y="-136">TICK_CALLBACK</name></location><location
id="id2" x="-344" y="-480"><name x="-368"
y="-464">TICK_BLOCKING</name></location><location id="id3" x="8" y="-168"><name
x="-30" y="-130">TICK_RETURN</name></location><location id="id4" x="-600"
y="-312"><name x="-632" y="-344">NO_TICK</name></location><init
ref="id4"/><transition><source ref="id1"/><target ref="id0"/><label
kind="assignment" x="-360" y="-344">result[FedRank]=true,
h=0</label></transition><transition><source ref="id2"/><target
ref="id2"/><label kind="guard" x="-424" y="-592">h <=
minTime[FedRank]</label><nail x="-392" y="-544"/><nail x="-336" y="-568"/><nail
x="-288" y="-536"/></transition><transition><source ref="id2"/><target
ref="id0"/><label kind="assignment" x="-192"
y="-504">h=0</label></transition><transition><source ref="id1"/><target
ref="id3"/></transition><transition><source ref="id4"/><target
ref="id1"/><label kind="synchronisation" x="-592"
y="-208">Tick_rq[FedRank]?</label><label kind="assignment" x="-600"
y="-192">result[FedRank]=false</label></transition><transition><source
ref="id4"/><target ref="id2"/><label kind="guard" x="-640"
y="-472">minTime[FedRank] >= 0</label><label kind="synchronisation" x="-632"
y="-448">Tick_rq[FedRank]?</label><label kind="assignment" x="-664"
y="-424">result[FedRank]=false,
h=0</label></transition></template><template><name>libRTI</name><parameter>FederateRange
FedRank</parameter><declaration>// libRTI is the library linked with the
Federate
-typedef int[0,1] BoolRange;
-typedef int[0,10] MinRange;
-typedef int[0,10] MaxRange;
+int nbCallbacks=0;</declaration><location id="id0" x="128" y="-480"><name
x="86" y="-510">TICK_NEXT</name></location><location id="id1" x="-352"
y="-160"><name x="-408" y="-136">TICK_CALLBACK</name></location><location
id="id2" x="-344" y="-480"><name x="-368"
y="-464">TICK_BLOCKING</name></location><location id="id3" x="128"
y="-160"><name x="90" y="-122">TICK_RETURN</name></location><location id="id4"
x="-600" y="-312"><name x="-632" y="-344">NO_TICK</name></location><init
ref="id4"/><transition><source ref="id0"/><target ref="id3"/><label
kind="guard" x="68" y="-350">h >=
maxTime[FedRank]</label></transition><transition><source ref="id0"/><target
ref="id1"/><label kind="guard" x="-416" y="-376">multiple[FedRank] and h <
maxTime[FedRank]</label><nail x="-64" y="-408"/><nail x="-240"
y="-288"/></transition><transition><source ref="id1"/><target ref="id0"/><label
kind="assignment" x="-112" y="-280">moreMsg[FedRank]=true</label><nail x="-176"
y="-248"/><nail x="0" y="-368"/></transition><transition><source
ref="id2"/><target ref="id2"/><label kind="guard" x="-424" y="-592">h <=
minTime[FedRank]</label><nail x="-392" y="-544"/><nail x="-336" y="-568"/><nail
x="-288" y="-536"/></transition><transition><source ref="id2"/><target
ref="id0"/><label kind="select" x="-264" y="-544">timeAdvance : BoolRange,
fedCallback: BoolRange</label><label kind="guard" x="-216" y="-528">timeAdvance
> 0 or fedCallback > 0</label><label kind="assignment" x="-240"
y="-512">nbCallbacks++,
moreMsg[FedRank]=true</label></transition><transition><source
ref="id1"/><target ref="id3"/></transition><transition><source
ref="id4"/><target ref="id1"/><label kind="synchronisation" x="-592"
y="-208">Tick_rq[FedRank]?</label><label kind="assignment" x="-640"
y="-184">moreMsg[FedRank]=false, h=0</label></transition><transition><source
ref="id4"/><target ref="id2"/><label kind="guard" x="-640"
y="-472">minTime[FedRank] >= 0</label><label kind="synchronisation" x="-632"
y="-448">Tick_rq[FedRank]?</label><label kind="assignment" x="-664"
y="-424">moreMsg[FedRank]=false,
h=0</label></transition></template><template><name>libRTI</name><parameter>FederateRange
FedRank</parameter><declaration>// libRTI is the library linked with the
Federate
void
-buildTickMessageContent(BoolRange mult, MinRange min, MaxRange max)
+buildTickMessageContent(BoolRange mult, MinTimeRange min, MaxTimeRange max)
{
multiple[FedRank] = mult ? true : false;
minTime[FedRank] = min;
maxTime[FedRank] = min + max;
-}</declaration><location id="id5" x="248" y="56"><name x="238"
y="26">HANDLE_CALLBACK</name></location><location id="id6" x="88"
y="-192"><name x="40" y="-224">TICKING</name></location><location id="id7"
x="-320" y="48"><name x="-400" y="8">NOT_TICKING</name></location><init
ref="id7"/><transition><source ref="id5"/><target ref="id6"/><label
kind="synchronisation" x="248" y="-168">Tick_rqNext[FedRank]!</label><nail
x="272" y="-88"/><nail x="208" y="-184"/></transition><transition><source
ref="id5"/><target ref="id7"/><label kind="synchronisation" x="-112"
y="64">Tick_rqStop[FedRank]!</label></transition><transition><source
ref="id6"/><target ref="id5"/></transition><transition><source
ref="id6"/><target ref="id7"/><label kind="synchronisation" x="-144"
y="-40">Tick_rq[FedRank]?</label><nail x="-72" y="-64"/><nail x="-176"
y="-32"/></transition><transition><source ref="id7"/><target ref="id6"/><label
kind="select" x="-408" y="-224">selmult : BoolRange, min : MinRange, max :
MaxRange</label><label kind="synchronisation" x="-304"
y="-208">Tick_rq[FedRank]!</label><label kind="assignment" x="-376"
y="-192">buildTickMessageContent(selmult,min,max)</label><nail x="-224"
y="-96"/><nail x="-120" y="-136"/></transition></template><system>// Place
template instantiations here.
+}</declaration><location id="id5" x="248" y="56"><name x="238"
y="26">HANDLE_CALLBACK</name></location><location id="id6" x="88"
y="-192"><name x="40" y="-224">TICKING</name></location><location id="id7"
x="-320" y="48"><name x="-400" y="8">NOT_TICKING</name></location><init
ref="id7"/><transition><source ref="id5"/><target ref="id6"/><label
kind="synchronisation" x="248" y="-168">Tick_rqNext[FedRank]!</label><nail
x="272" y="-88"/><nail x="208" y="-184"/></transition><transition><source
ref="id5"/><target ref="id7"/><label kind="synchronisation" x="-112"
y="64">Tick_rqStop[FedRank]!</label></transition><transition><source
ref="id6"/><target ref="id5"/></transition><transition><source
ref="id6"/><target ref="id7"/><label kind="synchronisation" x="-144"
y="-40">Tick_rq[FedRank]?</label><nail x="-72" y="-64"/><nail x="-176"
y="-32"/></transition><transition><source ref="id7"/><target ref="id6"/><label
kind="select" x="-456" y="-224">selmult : BoolRange, min : MinTimeRange, max :
MaxTimeRange</label><label kind="synchronisation" x="-304"
y="-208">Tick_rq[FedRank]!</label><label kind="assignment" x="-376"
y="-192">buildTickMessageContent(selmult,min,max)</label><nail x="-224"
y="-96"/><nail x="-120" y="-136"/></transition></template><system>// Place
template instantiations here.
// We instantiate 2 federates (libRTIs) with their corresponding RTIAs
libRTI_1 = libRTI(1);
libRTI_2 = libRTI(2);
Index: RTIA/TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.67
retrieving revision 3.68
diff -u -b -r3.67 -r3.68
--- RTIA/TimeManagement.cc 19 Aug 2010 10:50:22 -0000 3.67
+++ RTIA/TimeManagement.cc 20 Nov 2010 16:39:28 -0000 3.68
@@ -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.67 2010/08/19 10:50:22 erk Exp $
+// $Id: TimeManagement.cc,v 3.68 2010/11/20 16:39:28 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -830,32 +830,38 @@
bool
TimeManagement::tick(TypeException &e)
{
- bool msg_donne = false ;
- bool msg_restant = false ;
+ // Becomes true if there is message to give back to the federate
+ bool oneMsgToHandle = false;
+ // When oneMsgToHandle==true, then msg_restant becomes true if there is
more message to handle
+ bool moreMsgToHandle = false;
+
NetworkMessage *msg = NULL ;
G.Out(pdGendoc," enter TimeManagement::tick");
- // Note: While msg_donne = RTI::RTI_FALSE, msg_restant doesn't matter.
+ // Note: While msg_donne = false, msg_restant doesn't matter.
// 1st try, give a command message. (requestPause, etc.)
- msg = queues->giveCommandMessage(msg_donne, msg_restant);
+ msg = queues->giveCommandMessage(oneMsgToHandle, moreMsgToHandle);
// 2nd try, give a FIFO message. (discoverObject, etc.)
- if (!msg_donne){
- if ( _asynchronous_delivery || (_avancee_en_cours != PAS_D_AVANCEE) ||
(! _est_contraint)) {
+ if (!oneMsgToHandle) {
+ if ( _asynchronous_delivery ||
+ (_avancee_en_cours != PAS_D_AVANCEE) ||
+ (! _est_contraint)) {
D.Out(pdDebug,"FIFO message to be delivered async_deliver=%d,
_avancee=%d, constrained=%d",
_asynchronous_delivery,_avancee_en_cours,_est_contraint);
// to exclude the case not asynchronous_delivery and
// not time advancing for a constrained federate
- msg = queues->giveFifoMessage(msg_donne, msg_restant);
- } else {
+ msg = queues->giveFifoMessage(oneMsgToHandle, moreMsgToHandle);
+ }
+ else {
D.Out(pdDebug,"FIFO message skipped async_deliver=%d, _avancee=%d,
constrained=%d",
_asynchronous_delivery,_avancee_en_cours,_est_contraint);
}
}
- // If message exists, send it to federate.
- if (msg_donne) {
+ // If message exists, send it to the federate.
+ if (oneMsgToHandle) {
D.Out(pdDebug, "TickRequest being processed, Message to send.");
try {
executeFederateService(*msg);
@@ -865,13 +871,12 @@
throw e ;
}
}
-
// No message: we try to send TSO messages.
// Messages to be sent depends on asked advance type.
else {
D.Out(pdDebug, "TickRequest being processed, advance called.");
try {
- advance(msg_restant, e);
+ advance(moreMsgToHandle, e);
}
catch (RTIinternalError &e) {
Debug(D,pdError) << "RTIA:RTIinternalError thrown in tick
(Advance)." << std::endl ;
@@ -882,8 +887,8 @@
delete msg ;
G.Out(pdGendoc," exit TimeManagement::tick");
- return msg_restant ;
-}
+ return moreMsgToHandle;
+} /* end of tick */
// ----------------------------------------------------------------------------
void
@@ -1061,4 +1066,4 @@
}} // namespaces
-// $Id: TimeManagement.cc,v 3.67 2010/08/19 10:50:22 erk Exp $
+// $Id: TimeManagement.cc,v 3.68 2010/11/20 16:39:28 erk Exp $
Index: RTIA/RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.113
retrieving revision 3.114
diff -u -b -r3.113 -r3.114
--- RTIA/RTIA_federate.cc 19 Nov 2010 20:32:27 -0000 3.113
+++ RTIA/RTIA_federate.cc 20 Nov 2010 16:39:28 -0000 3.114
@@ -1331,11 +1331,13 @@
/* a callback was evoked decide how to continue */
if (tm->_tick_result &&
tm->_tick_multiple &&
-
1e-9*clock->getDeltaNanoSecond(tm->_tick_clock_start) < tm->_tick_max_tick)
+
1e-9*clock->getDeltaNanoSecond(tm->_tick_clock_start) < tm->_tick_max_tick) {
tm->_tick_state = TimeManagement::TICK_CALLBACK;
- else
+ }
+ else {
tm->_tick_state = TimeManagement::TICK_RETURN;
- /* unconditionnal return */
+ }
+ /* Unconditional return */
return;
case TimeManagement::TICK_CALLBACK:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi doc/CERTI-tickHandling.xml RTIA/TimeManag...,
certi-cvs <=