certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/doc NullMessageProtocol.xml


From: certi-cvs
Subject: [certi-cvs] certi/doc NullMessageProtocol.xml
Date: Sat, 14 Aug 2010 12:59:22 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/08/14 12:59:22

Modified files:
        doc            : NullMessageProtocol.xml 

Log message:
        Modifs de JBC du 13/08/2010

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/doc/NullMessageProtocol.xml?cvsroot=certi&r1=1.1&r2=1.2

Patches:
Index: NullMessageProtocol.xml
===================================================================
RCS file: /sources/certi/certi/doc/NullMessageProtocol.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- NullMessageProtocol.xml     12 Aug 2010 16:25:58 -0000      1.1
+++ NullMessageProtocol.xml     14 Aug 2010 12:59:22 -0000      1.2
@@ -2,7 +2,10 @@
 const int nbFederates    = 3;
 typedef int[0,nbFederates-1] RangeFederateId;
 const int MaxMsgFIFOSize = 5;
-const int MaxSimulationTime = 15;
+const int MaxMsgSendForEachSimStep = 2;
+
+const int MaxSimulationTime = 10;
+typedef int[0,MaxSimulationTime] RangeSimulationTime;
 
 // Synchronization channel used to send/receive messages
 chan msg[nbFederates][nbFederates];
@@ -25,14 +28,20 @@
 int   LBTS=0; 
 
 // number of message in Timestamped FIFO 
-int   nbMsg;
+int   nbMsgIn = 0;
 int   FIFOMsgTimestamp[MaxMsgFIFOSize];
 
+// number of messages sending by the federate on each simulation step
+// int   nbMsgOut = 0;
+
+// Variable for know if all msg with timestamp less than localtime + lookahead 
are cossuming during the simulation process
+int AllMsgConsuming = 0;
+
 void clearFIFO() {
    int i;
-   nbMsg = 0;
+   nbMsgIn = 0;
    for (i=0;i&lt;MaxMsgFIFOSize;++i) {
-       FIFOMsgTimestamp[i] = 0;
+       FIFOMsgTimestamp[i] = 0 ;
    }
 }
 
@@ -45,11 +54,11 @@
 
 void addToFIFO(int ts) {
    int i,j;
-   ++nbMsg;
+   ++nbMsgIn;
    // insert in order
    i = 0;
    while (FIFOMsgTimestamp[i]&gt;ts) ++i;
-   for (j=nbMsg-1;j&gt;i;--j) {
+   for (j=nbMsgIn-1;j&gt;i;--j) {
       FIFOMsgTimestamp[j] = FIFOMsgTimestamp[j-1];
    }
    FIFOMsgTimestamp[i]=ts;
@@ -57,9 +66,18 @@
 
 
 void popFromFIFO() {
-   --nbMsg;
+         FIFOMsgTimestamp[nbMsgIn-1] = 0;
+         nbMsgIn--;
+         if (nbMsgIn == 0) AllMsgConsuming = 1;
 }
 
+void checkFIFO() { 
+         if (FIFOMsgTimestamp[nbMsgIn-1] &lt;= (Clocks[id] + lookahead)) 
AllMsgConsuming = 0;
+         else AllMsgConsuming = 1;
+              
+}
+        
+
 void updateLBTS(int federate, int ts) {
      int i;
      int t;
@@ -67,7 +85,9 @@
      Clocks[federate] = ts;
 
      LBTS = Clocks[0];
-     if (id==0) Clocks[1];
+     if (id==0) LBTS = Clocks[1];
+     if (id==1) LBTS = Clocks[2];
+     // LBTS = 100000 ;
 
      for (i=0;i&lt;nbFederates; ++i) {
         if(i!=id) {
@@ -78,7 +98,11 @@
         }
      }
 }
-</declaration><location id="id0" x="208" y="-48"><name x="240" 
y="-56">Process</name></location><location id="id1" x="-168" y="-56"><name 
x="-144" y="-64">Wait</name></location><location id="id2" x="-608" 
y="-56"><name x="-624" y="-96">Init</name></location><init 
ref="id2"/><transition><source ref="id1"/><target ref="id1"/><label 
kind="select" x="-228" y="-101">senderId: RangeFederateId</label><label 
kind="synchronisation" x="-512" y="-176">nullMsg[senderId]?</label><label 
kind="assignment" x="-648" 
y="-200">updateLBTS(senderId,nullMsgTimestamp[senderId])</label><nail x="-344" 
y="-104"/><nail x="-376" y="-168"/><nail x="-216" 
y="-128"/></transition><transition><source ref="id1"/><target ref="id1"/><label 
kind="select" x="-216" y="152">srcId: RangeFederateId</label><label 
kind="guard" x="-264" y="136">(srcId != id) and (nbMsg &lt; 
MaxMsgFIFOSize)</label><label kind="synchronisation" x="-192" 
y="120">msg[srcId][id]?</label><label kind="assignment" x="-256" 
y="168">addToFIFO(msgTimestamp[srcId][id])</label><nail x="-104" y="56"/><nail 
x="-112" y="120"/><nail x="-176" y="120"/><nail x="-184" 
y="64"/></transition><transition><source ref="id0"/><target ref="id0"/><label 
kind="guard" x="64" y="-208">FIFOMsgTimestamp[nbMsg-1] &lt; 
(Clocks[id]+lookahead)</label><label kind="assignment" x="176" 
y="-232">popFromFIFO()</label><nail x="168" y="-136"/><nail x="200" 
y="-184"/><nail x="256" y="-184"/><nail x="280" 
y="-120"/></transition><transition><source ref="id1"/><target ref="id1"/><label 
kind="select" x="-312" y="-280">destId: RangeFederateId, timestamp: 
int</label><label kind="guard" x="-456" y="-264">destId != id and (timestamp 
&gt; (Clocks[id]+lookahead)) and (timestamp &lt; 
MaxSimulationTime)</label><label kind="synchronisation" x="-208" 
y="-248">msg[id][destId]!</label><label kind="assignment" x="-304" 
y="-296">msgTimestamp[id][destId]=timestamp</label><nail x="-184" 
y="-160"/><nail x="-168" y="-200"/><nail x="-128" y="-200"/><nail x="-112" 
y="-160"/></transition><transition><source ref="id0"/><target ref="id1"/><label 
kind="synchronisation" x="0" y="16">nullMsg[id]!</label><label 
kind="assignment" x="-88" 
y="32">nullMsgTimestamp[id]=Clocks[id]+lookahead</label><nail x="104" 
y="8"/><nail x="-32" y="8"/></transition><transition><source ref="id1"/><target 
ref="id0"/><label kind="guard" x="0" y="-136">nbMsg &gt; 0</label><label 
kind="assignment" x="-24" y="-152">Clocks[id]=LBTS</label><nail x="-48" 
y="-112"/><nail x="72" y="-112"/></transition><transition><source 
ref="id2"/><target ref="id1"/><label kind="assignment" x="-568" 
y="-40">resetClocks(), clearFIFO()</label></transition></template><system>// 
Place template instantiations here.
+</declaration><location id="id0" x="640" y="-48"><name x="608" 
y="-88">Terminate</name></location><location id="id1" x="208" y="-48"><name 
x="136" y="-56">Process</name></location><location id="id2" x="-168" 
y="-56"><name x="-144" y="-64">Wait</name></location><location id="id3" 
x="-608" y="-56"><name x="-624" y="-96">Init</name></location><init 
ref="id3"/><transition><source ref="id1"/><target ref="id1"/><label 
kind="guard" x="544" y="-224">(AllMsgConsuming == 0) and (nbMsgIn != 
0)</label><label kind="assignment" x="580" y="-234">checkFIFO()</label><nail 
x="436" y="-210"/><nail x="540" y="-234"/><nail x="580" y="-210"/><nail x="524" 
y="-178"/></transition><transition><source ref="id1"/><target ref="id1"/><label 
kind="select" x="320" y="64">senderId: RangeFederateId</label><label 
kind="synchronisation" x="352" y="80">nullMsg[senderId]?</label><label 
kind="assignment" x="304" 
y="96">updateLBTS(senderId,nullMsgTimestamp[senderId])</label><nail x="320" 
y="0"/><nail x="400" y="56"/><nail x="320" 
y="80"/></transition><transition><source ref="id1"/><target ref="id0"/><label 
kind="guard" x="328" y="-72">(Clocks[id] &gt;= MaxSimulationTime)  and 
(AllMsgConsuming == 1) and (nbMsgIn ==0)</label><label kind="synchronisation" 
x="364" y="-63">nullMsg[id]!</label><label kind="assignment" x="296" 
y="-40">nullMsgTimestamp[id] = 
MaxSimulationTime</label></transition><transition><source ref="id2"/><target 
ref="id2"/><label kind="select" x="-616" y="-216">senderId: 
RangeFederateId</label><label kind="synchronisation" x="-576" 
y="-184">nullMsg[senderId]?</label><label kind="assignment" x="-712" 
y="-200">updateLBTS(senderId,nullMsgTimestamp[senderId])</label><nail x="-424" 
y="-136"/><nail x="-440" y="-176"/><nail x="-344" 
y="-176"/></transition><transition><source ref="id2"/><target ref="id2"/><label 
kind="select" x="-216" y="152">srcId: RangeFederateId</label><label 
kind="guard" x="-264" y="136">(srcId != id) and (nbMsgIn &lt; 
MaxMsgFIFOSize)</label><label kind="synchronisation" x="-192" 
y="120">msg[srcId][id]?</label><label kind="assignment" x="-256" 
y="168">addToFIFO(msgTimestamp[srcId][id])</label><nail x="-104" y="56"/><nail 
x="-112" y="120"/><nail x="-176" y="120"/><nail x="-184" 
y="64"/></transition><transition><source ref="id1"/><target ref="id1"/><label 
kind="guard" x="80" y="-328">(nbMsgIn !=0)  and (AllMsgConsuming == 
0)</label><label kind="assignment" x="328" y="-344">popFromFIFO()</label><label 
kind="comments">FIFOMsgTimestamp[nbMsgIn-1] &lt;= (Clocks[id]+lookahead)
+
+J'ai enlevé cette partie car cela faisait une erreur lorsque nbMsgIn etait 
egual à 0
+
+Normalement le checkFIFO() resous le probleme</label><nail x="264" 
y="-240"/><nail x="280" y="-280"/><nail x="336" y="-272"/><nail x="320" 
y="-240"/></transition><transition><source ref="id2"/><target ref="id2"/><label 
kind="select" x="-472" y="-360">destId: RangeFederateId, timestamp: 
RangeSimulationTime</label><label kind="guard" x="-592" y="-344">destId != id 
and (timestamp &gt; (Clocks[id]+lookahead)) and (timestamp &lt; 
MaxSimulationTime)</label><label kind="synchronisation" x="-352" 
y="-328">msg[id][destId]!</label><label kind="assignment" x="-456" 
y="-376">msgTimestamp[id][destId]=timestamp</label><nail x="-288" 
y="-232"/><nail x="-272" y="-288"/><nail x="-224" y="-288"/><nail x="-216" 
y="-232"/></transition><transition><source ref="id1"/><target ref="id2"/><label 
kind="guard" x="-24" y="56">AllMsgConsuming == 1</label><label 
kind="synchronisation" x="0" y="24">nullMsg[id]!</label><label 
kind="assignment" x="-112" y="40">nullMsgTimestamp[id]=Clocks[id]+lookahead, 
AllMsgConsuming = 0</label><nail x="104" y="8"/><nail x="-32" 
y="8"/></transition><transition><source ref="id2"/><target ref="id1"/><label 
kind="guard" x="-8" y="-136">nbMsgIn &gt; 0</label><label kind="assignment" 
x="-24" y="-152">Clocks[id]=LBTS</label><nail x="-48" y="-112"/><nail x="72" 
y="-112"/></transition><transition><source ref="id3"/><target ref="id2"/><label 
kind="assignment" x="-568" y="-40">resetClocks(), 
clearFIFO()</label></transition></template><system>// Place template 
instantiations here.
 
 Federate0 = Federate(0,nbFederates,3);
 Federate1 = Federate(1,nbFederates,3);



reply via email to

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