diff --git a/Makefile b/Makefile
index 1202a771b5a722ac733113d66b6c13b9d65f5d33..71f121d9f95fe9f876a38a22869d4555c157d203 100755
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ GZIP = gzip -9 -f
 DEBUG  = -g
 CLASSPATH = -classpath
 CLASSPATH = -sourcepath
-PACKAGE = avatartranslator avatartranslator/directsimulation avatartranslator/tocppsim avatartranslator/touppaal avatartranslator/toturtle avatartranslator/toproverif automata compiler/tmlparser vcd nc ddtranslator launcher myutil tpndescription sddescription sdtranslator tepe translator tmltranslator tmltranslator/toautomata tmltranslator/tosystemc  tmltranslator/tomappingsystemc tmltranslator/tomappingsystemc2 tmltranslator/touppaal tmltranslator/toturtle translator/tojava translator/tosimujava translator/totpn translator/touppaal  ui ui/avatarbd ui/avatarsmd ui/avatarrd ui/ad ui/cd ui/oscd ui/osad ui/dd ui/ebrdd ui/file ui/graph ui/iod ui/ncdd ui/procsd ui/prosmdui/prosmd/util ui/tmlad ui/tmlcd ui/tmldd ui/tmlcomp ui/req ui/sd ui/tree ui/ucd ui/window tmltranslator tmltranslator/toturtle req/ebrdd tmltranslator/tosystemc tmatrix proverifspec uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
+PACKAGE = avatartranslator avatartranslator/toexecutable avatartranslator/directsimulation avatartranslator/tocppsim avatartranslator/touppaal avatartranslator/toturtle avatartranslator/toproverif automata compiler/tmlparser vcd nc ddtranslator launcher myutil tpndescription sddescription sdtranslator tepe translator tmltranslator tmltranslator/toautomata tmltranslator/tosystemc  tmltranslator/tomappingsystemc tmltranslator/tomappingsystemc2 tmltranslator/touppaal tmltranslator/toturtle translator/tojava translator/tosimujava translator/totpn translator/touppaal  ui ui/avatarbd ui/avatarsmd ui/avatarrd ui/ad ui/cd ui/oscd ui/osad ui/dd ui/ebrdd ui/file ui/graph ui/iod ui/ncdd ui/procsd ui/prosmdui/prosmd/util ui/tmlad ui/tmlcd ui/tmldd ui/tmlcomp ui/req ui/sd ui/tree ui/ucd ui/window tmltranslator tmltranslator/toturtle req/ebrdd tmltranslator/tosystemc tmatrix proverifspec uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
 BUILDER = builder.jar
 BUILD_INFO = build.txt
 BUILD_TO_MODIFY = src/ui/DefaultText.java
@@ -86,7 +86,7 @@ basic:
 ttooljar_std:
 	rm -f $(TTOOL_BIN)/$(TTOOL_BINARY)
 	cp $(TTOOL_SRC)/ui/images/$(STD_LOGO) $(TTOOL_SRC)/ui/images/$(LOGO) 
-	cd $(TTOOL_SRC);  $(JAR) cmf $(TTOOL_JAR_TXT) $(TTOOL_BIN)/$(TTOOL_BINARY) Main.class vcd/*.class avatartranslator/*.class avatartranslator/directsimulation/*.class avatartranslator/touppaal/*.class avatartranslator/toproverif/*.class avatartranslator/*.class avatartranslator/toturtle/*.java automata/*.class compiler/tmlparser/*.class nc/*.class  tepe/*.class tmltranslator/*.class tmltranslator/toautomata/*.class tmatrix/*.class tmltranslator/toturtle/*.class tmltranslator/touppaal/*.class tmltranslator/tosystemc/*.class tmltranslator/tomappingsystemc/*.class tmltranslator/tomappingsystemc2/*.class  tpndescription/*.class ddtranslator/*.class launcher/*.class myutil/*.class sddescription/*.class sdtranslator/*.class translator/*.class translator/tojava/*.class  translator/tosimujava/*.class translator/touppaal/*.class translator/totpn/*.class req/ebrdd/*.java ui/*.class ui/*/*.class ui/*/*/*.class proverifspec/*.class uppaaldesc/*.class ui/images/*.* ui/images/toolbarButtonGraphics/general/*.gif ui/images/toolbarButtonGraphics/media/*.gif $(TTOOL_BIN)/$(LAUNCHER_BINARY) RTLLauncher.class launcher/*.class fr/inria/oasis/vercors/cttool/model/*.class remotesimulation/*.class
+	cd $(TTOOL_SRC);  $(JAR) cmf $(TTOOL_JAR_TXT) $(TTOOL_BIN)/$(TTOOL_BINARY) Main.class vcd/*.class avatartranslator/*.class avatartranslator/toexecutable/*.class avatartranslator/directsimulation/*.class avatartranslator/touppaal/*.class avatartranslator/toproverif/*.class avatartranslator/*.class avatartranslator/toturtle/*.java automata/*.class compiler/tmlparser/*.class nc/*.class  tepe/*.class tmltranslator/*.class tmltranslator/toautomata/*.class tmatrix/*.class tmltranslator/toturtle/*.class tmltranslator/touppaal/*.class tmltranslator/tosystemc/*.class tmltranslator/tomappingsystemc/*.class tmltranslator/tomappingsystemc2/*.class  tpndescription/*.class ddtranslator/*.class launcher/*.class myutil/*.class sddescription/*.class sdtranslator/*.class translator/*.class translator/tojava/*.class  translator/tosimujava/*.class translator/touppaal/*.class translator/totpn/*.class req/ebrdd/*.java ui/*.class ui/*/*.class ui/*/*/*.class proverifspec/*.class uppaaldesc/*.class ui/images/*.* ui/images/toolbarButtonGraphics/general/*.gif ui/images/toolbarButtonGraphics/media/*.gif $(TTOOL_BIN)/$(LAUNCHER_BINARY) RTLLauncher.class launcher/*.class fr/inria/oasis/vercors/cttool/model/*.class remotesimulation/*.class
 
 
 launcher:
diff --git a/executablecode/Makefile b/executablecode/Makefile
index d4637a02ffacd9dc73fab26325ec6c1b46100ccd..dda10ddd96435fa587bf0ee8817081a9d667bc79 100755
--- a/executablecode/Makefile
+++ b/executablecode/Makefile
@@ -20,7 +20,7 @@ OBJDIR = lib
 MODULE = run
 SRCS_generated_DIR = generated_src/
 include Makefile.src
-SRCS_base = src/request.c src/message.c src/myerrors.c src/debug.c src/syncchannel.c src/asyncchannel.c src/request_manager.c
+SRCS_base = src/request.c src/message.c src/myerrors.c src/debug.c src/syncchannel.c src/asyncchannel.c src/request_manager.c src/random.c
 SRCS_base_DIR = .
 SRCS_base_DIRSRC = src/ 
 OBJS_executor = $(SRCS_base:%.c=lib/%.o)
diff --git a/executablecode/doc/mainPrinciples.tex b/executablecode/doc/mainPrinciples.tex
index 37d5d187907e852cb2d681285d5606eeaadff34a..a93eddcdc3643cc1edb26fb885d5454abe7c4163 100644
--- a/executablecode/doc/mainPrinciples.tex
+++ b/executablecode/doc/mainPrinciples.tex
@@ -13,7 +13,7 @@ Requests of the same task are linked together
 * When no request can be performed, the task terminates
 
 * When a request is added:
-The system sees whether that request can be performed immedialty -> if so, request are performed, and related tasks unblocked
+The system sees whether that request can be performed immediatly -> if so, request are performed, and related tasks unblocked
 Otherwise, each request is put int its wait queue
 
 
diff --git a/executablecode/generated_src/main.c b/executablecode/generated_src/main.c
index bd8cfe73058a4f3d949c0e9dc757a8f1e7dca45f..349fe13fa693f05a2aea4a23f13cb0090e81b01f 100644
--- a/executablecode/generated_src/main.c
+++ b/executablecode/generated_src/main.c
@@ -5,99 +5,10 @@
 
 #include "request.h"
 #include "syncchannel.h"
+#include "request_manager.h"
 #include "debug.h"
 
+int main(int argc, char *argv[]) {
 
-syncchannel * syncchannels[1];
-pthread_mutex_t syncmutex[1];
-pthread_cond_t sendConditions[1];
-pthread_cond_t receiveConditions[1];
 
-
-void *send(void *arg) {
-  int myid = (int)arg;
-
-  int x = 2;
-  int y = 3;
-  
-  int index;
-
-  int *p[2];
-
-  request* req;
-
-  p[0] = &x;
-  p[1] = &y;
-  req = makeNewSendSync(0, 0, 2, p);
-
-  return NULL;
-}
-
-void *receive(void *arg) {
-  int myid = (int)arg;
-  int x;
-  int y;
-  int *p[2];
-  int sleepTime;
-
-  debugInt("Setting timer ", 13 + myid);
-  //setTimerMs(myid, 13+myid, 1000);
-  debugInt("Setting timer done", 13 + myid);
-
-  debugInt("Trying to receive id", myid);
-  p[0] = &x;
-  p[1] = &y;
-  //receiveSyncParams(myid, 1, p ,2);
-  //debugThreeInts("Receive OK", x, y, myid);
-  
-  //resetTimer(myid, 13+myid);
-  // random wait between 5 and 15 seconds
-  // Trying to receive
-
-  //sleepTime = 5 + (rand() % 10);
-  //debugTwoInts("---------- Waiting for seconds:", sleepTime, myid);
-  //setTimerMs(myid, 13+myid, sleepTime * 1000);
-
-  //debugInt("-------------- Waiting for timerExpiration", myid);
-  //waitForTimerExpiration(myid, 13+myid);
-  debugInt("-------------- Timer has expired", myid);
-  
-  
-  //receiveSyncParams(myid, 1, p ,2);
-  debugThreeInts("--------------- Second receive OK", x, y, myid);
-  
-
-
-  return NULL;
-}
-
-
-int main(int argc, char * argv[]) {
-
-  syncchannels[0] = getNewSyncchannel("outch", "inch", &(syncmutex[0]), &(sendConditions[0]), &(receiveConditions[0]));
-
-  pthread_t sender;
-  pthread_t receiver0, receiver1;
-
-  activeDebug();
-  //initStoreEvents();
-
-  debugMsg("Timer management initialization ...");
-  //initTimerManagement();
-  debugMsg("Timer management initialization done");
-  
-  debugMsg("Creating threads");
-  pthread_create(&sender, NULL, send, (void *)1);
-  pthread_create(&receiver0, NULL, receive, (void *)3);
-  //pthread_create(&receiver1, NULL, receive, (void *)2);
-  //pthread_create(&sender, NULL, send, NULL);
-
-  debugMsg("Starting threads");
-  pthread_join(sender, NULL);
-  pthread_join(receiver0, NULL);
-  //pthread_join(receiver1, NULL);
-  
-  debugMsg("All done");
-
-  return 0;
-}
+}
\ No newline at end of file
diff --git a/executablecode/src/random.c b/executablecode/src/random.c
new file mode 100644
index 0000000000000000000000000000000000000000..c217131a57893a7ff16357f16b756ff78792a472
--- /dev/null
+++ b/executablecode/src/random.c
@@ -0,0 +1,9 @@
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "random.h"
+
+int computeRandom(int min, int max) {
+  return (rand() % (max - min)) + min;
+}
diff --git a/executablecode/src/random.h b/executablecode/src/random.h
new file mode 100644
index 0000000000000000000000000000000000000000..dcc5b07e4618dd2105cf767933352997bbaee55a
--- /dev/null
+++ b/executablecode/src/random.h
@@ -0,0 +1,6 @@
+#ifndef RANDOM_H
+#define RANDOM_H
+
+extern int computeRandom(int min, int max);
+
+#endif
diff --git a/executablecode/src/request.c b/executablecode/src/request.c
index 30b59206cd357e2ba6793306f654712816453db1..c4a7714e01ebbbb5bf820e5248f37f5ab13d473a 100644
--- a/executablecode/src/request.c
+++ b/executablecode/src/request.c
@@ -6,7 +6,7 @@
 #include "myerrors.h"
 
 
-request *getNewRequest(int type, int hasDelay, long delay, int nbOfParams, int *params[]) {
+request *getNewRequest(int type, int hasDelay, long minDelay, long maxDelay, int nbOfParams, int *params[]) {
   int i;
   request *req = (request *)(malloc(sizeof(struct request)+nbOfParams*sizeof(int)));
   
@@ -17,7 +17,8 @@ request *getNewRequest(int type, int hasDelay, long delay, int nbOfParams, int *
   req->listOfRequests = NULL;
   req->type = type;
   req->hasDelay = hasDelay;
-  req->delay = delay;
+  req->minDelay = minDelay;
+  req->maxDelay = maxDelay;
   req->selected = 0;
   req->nbOfParams = nbOfParams;
 
diff --git a/executablecode/src/request.h b/executablecode/src/request.h
index f96b97483761a044ff50c75fc583522b9e1b3664..2d17a63a827739a7b2b4862156b898883516a82c 100644
--- a/executablecode/src/request.h
+++ b/executablecode/src/request.h
@@ -1,6 +1,8 @@
 #ifndef REQUEST_H
 #define REQUEST_H
 
+#include <pthread.h>
+
 #define SEND_SYNC_REQUEST 0
 #define RECEIVE_SYNC_REQUEST 2
 #define SEND_ASYNC_REQUEST 4
@@ -11,6 +13,10 @@ struct request;
 
 struct setOfRequests {
   struct request *head;
+  long timeWhenStarted;
+  long timeWhenSelected;
+  pthread_cond_t *wakeupCondition;
+  pthread_mutex_t *mutex;
 };
 
 typedef struct setOfRequests setOfRequests;
@@ -18,10 +24,11 @@ typedef struct setOfRequests setOfRequests;
 struct request {
   struct request *next;
   struct setOfRequests* listOfRequests;
+  struct request* nextRequestInList;
   int type;
   int hasDelay;
-  long delay;
-  int delayElapsed;
+  long minDelay;
+  long maxDelay;
   int selected;
   int nbOfParams;
   int *params[];
@@ -29,7 +36,7 @@ struct request {
 
 typedef struct request request;
 
-request *getNewRequest(int type, int hasDelay, long delay, int nbOfParams, int *params[]);
+request *getNewRequest(int type, int hasDelay, long minDelay, long maxDelay, int nbOfParams, int *params[]);
 void destroyRequest(request *req);
 extern int isRequestSelected(request *req);
 
diff --git a/executablecode/src/request_manager.c b/executablecode/src/request_manager.c
index 643c2165f94e73847820d467563d1cd8bcb1309a..5fa9398ab0722cd6b18af9bfcaa3e9421f0e3238 100644
--- a/executablecode/src/request_manager.c
+++ b/executablecode/src/request_manager.c
@@ -4,25 +4,216 @@
 #include "request_manager.h"
 #include "request.h"
 #include "myerrors.h"
+#include "debug.h"
 
 
+request * addToRequestQueue(request *list, request *requestToAdd) {
+  request *origin = list;
+
+  if (list == NULL) {
+    return requestToAdd;
+  }
+
+  while(list->next != NULL) {
+    list = list->next;
+  }
+  
+  list->next = requestToAdd;
+
+  return origin;
+}
+
+request * removeRequestFromList(request *list, request *requestToRemove) {
+  request *origin = list;
+
+  if (list == requestToRemove) {
+    return list->next;
+  }
+
+
+
+  while(list->next != requestToRemove) {
+    list = list->next;
+  }
+
+  list->next = requestToRemove->next;
+
+  return origin;
+} 
+
 void executeSendSyncTransaction(request *req, syncchannel *channel) {
+  /*int cpt;
+  request *selectedReq;
+
   // Search for an available transaction
-  // If not return
-  //Otherwise, select the transactions, and broadcast the new condition!
+  request* currentReq = channel->inWaitQueue;
+
+  debugMsg("Execute send sync tr");
+  
+  if (currentReq == NULL) {
+    // No transaction available
+    channel->outWaitQueue = addToRequestQueue(channel->outWaitQueue, req);
+    return;
+  }
+  
+  // At least one transaction available -> must select one randomly
+  // First: count how many of them are available
+  // Then, select one
+  // Broadcast the new condition!
+
+  cpt = 0;
+  while(currentReq != NULL) {
+    cpt ++;
+    currentReq = currentReq->next;
+  }
+
+  cpt = random() % cpt;
+
+  // Head of the list?
+  selectedReq = channel->inWaitQueue;
+  while (cpt > 0) {
+    selectedReq = selectedReq->next;
+    cpt --;
+  } 
+
+  channel->inWaitQueue = removeRequestFromList(channel->inWaitQueue, selectedReq);
+
+  // Select the two requests, and broadcast the information in the channel
+  
+  selectedReq->selected = 1;
+  req->selected = 1;
+
+  pthread_cond_broadcast(selectedReq->listOfRequests->wakeupCondition);*/
+}
+
+void executeReceiveSyncTransaction(request *req, syncchannel *channel) {
+  /*int cpt;
+  request *selectedReq;
+
+  // Search for an available transaction
+  request* currentReq = channel->outWaitQueue;
+
+  debugMsg("Execute receive sync tr");
+  
+  if (currentReq == NULL) {
+    // No transaction available
+    channel->inWaitQueue = addToRequestQueue(channel->inWaitQueue, req);
+    return;
+  }
+  
+  // At least one transaction available -> must select one randomly
+  // First: count how many of them are available
+  // Then, select one
+  // Broadcast the new condition!
+
+  cpt = 0;
+  while(currentReq != NULL) {
+    cpt ++;
+    currentReq = currentReq->next;
+  }
+  cpt = random() % cpt;
+  selectedReq = channel->outWaitQueue;
+  while (cpt > 0) {
+    selectedReq = selectedReq->next;
+    cpt --;
+  } 
+
+  channel->outWaitQueue = removeRequestFromList(channel->outWaitQueue, selectedReq);
+
+  // Select the two requests, and broadcast the information in the channel
+  selectedReq->selected = 1;
+  req->selected = 1;
+
+  pthread_cond_broadcast(selectedReq->listOfRequests->wakeupCondition);*/
 }
 
 
 void executeSendSyncRequest(request *req, syncchannel *channel) {
+  /*debugMsg("Locking mutex");
+
+  if(channel == NULL) {
+    debugMsg("NULL channel");
+    exit(-1);
+  }
+
+  if(channel->mutex == NULL) {
+    debugMsg("NULL mutex");
+    exit(-1);
+  }
+
   pthread_mutex_lock(channel->mutex);
 
+  debugMsg("Execute");
   executeSendSyncTransaction(req, channel);
 
   while (isRequestSelected(req) == 0) {
+    debugMsg("Stuck waiting for a receive request");
     pthread_cond_wait(channel->sendCondition, channel->mutex);
+    debugMsg("Woke up from waiting for a receive request");
+  }
+
+  pthread_mutex_unlock(channel->mutex);
+  debugMsg("Mutex unlocked");*/
+
+}
+
+void executeReceiveSyncRequest(request *req, syncchannel *channel) {
+  /*debugMsg("Locking mutex");
+
+  pthread_mutex_lock(channel->mutex);
+
+  debugMsg("Execute");
+  executeReceiveSyncTransaction(req, channel);
+
+  while (isRequestSelected(req) == 0) {
+    debugMsg("Stuck waiting for a send request");
+    pthread_cond_wait(req->listOfRequests->wakeupCondition, channel->mutex);
+    debugMsg("Woke up from waiting for a send request");
   }
 
   pthread_mutex_unlock(channel->mutex);
+  debugMsg("Mutex unlocked");*/
+}
+
+
+void executeListOfRequests(setOfRequests *list) {
+
+
 
 }
 
+setOfRequests *newListOfRequests(pthread_cond_t *wakeupCondition, pthread_mutex_t *mutex) {
+  setOfRequests *list = (setOfRequests *)(malloc(sizeof(setOfRequests)));
+  list->head = NULL;
+  list->wakeupCondition = wakeupCondition;
+  list->mutex = mutex;
+
+  return list;
+}
+
+
+void addRequestToList(setOfRequests *list, request* req) {
+  request *tmpreq;
+
+  if (list == NULL) {
+    criticalError("NULL List in addRequestToList");
+  }
+
+  if (req == NULL) {
+    criticalError("NULL req in addRequestToList");
+  }
+
+  req->listOfRequests = list;
+
+  if (list->head == NULL) {
+    list->head = req;
+    return;
+  }
+
+  tmpreq = list->head;
+  while(tmpreq->nextRequestInList != NULL) {
+    tmpreq = tmpreq->nextRequestInList;
+  }
+
+  tmpreq->nextRequestInList = req;
+}
diff --git a/executablecode/src/request_manager.h b/executablecode/src/request_manager.h
index d410c5afcaf5f7e8685035db5244ffbea664169d..a140764da28c25a31ca24cf5ca38071582919877 100644
--- a/executablecode/src/request_manager.h
+++ b/executablecode/src/request_manager.h
@@ -7,5 +7,10 @@
 
 
 void executeSendSyncRequest(request *req, syncchannel *channel);
+void executeReceiveSyncRequest(request *req, syncchannel *channel);
+
+void executeListOfRequests(setOfRequests *list);
+setOfRequests *newListOfRequests(pthread_cond_t *wakeupCondition, pthread_mutex_t *mutex);
+void addRequestToList(setOfRequests *list, request* req);
 
 #endif
diff --git a/executablecode/src/syncchannel.c b/executablecode/src/syncchannel.c
index 8f2aa04ed6da229e00ee54f0d1e39c06b7a3995a..452b22a16322cf0f7579779b6ac2a248a6cd5754 100644
--- a/executablecode/src/syncchannel.c
+++ b/executablecode/src/syncchannel.c
@@ -4,9 +4,10 @@
 #include "syncchannel.h"
 #include "request.h"
 #include "myerrors.h"
+#include "debug.h"
 
 
-syncchannel *getNewSyncchannel(char *outname, char *inname, pthread_mutex_t *mutex, pthread_cond_t *condSend,  pthread_cond_t *condReceive) {
+syncchannel *getNewSyncchannel(char *outname, char *inname) {
   syncchannel * syncch = (syncchannel *)(malloc(sizeof(struct syncchannel)));
   if (syncch == NULL) {
     criticalError("Allocation of request failed");
@@ -15,14 +16,12 @@ syncchannel *getNewSyncchannel(char *outname, char *inname, pthread_mutex_t *mut
   syncch->outname = outname;
   syncch->inWaitQueue = NULL;
   syncch->outWaitQueue = NULL;
-  syncch->mutex = mutex;
-  syncch->sendCondition = condSend;
-  syncch->receiveCondition = condReceive;
+
   return syncch;
 }
 
 
-request *makeNewSendSync(int hasDelay, long delay, int nbOfParams, int *params[]) {
+/*request *makeNewSendSync(int hasDelay, long delay, int nbOfParams, int *params[]) {
   request *req = getNewRequest(SEND_SYNC_REQUEST, hasDelay, delay, nbOfParams, params);
   return req;
 }
@@ -30,7 +29,7 @@ request *makeNewSendSync(int hasDelay, long delay, int nbOfParams, int *params[]
 request *makeNewReceiveSync(int hasDelay, long delay, int nbOfParams, int *params[]) {
   request *req = getNewRequest(RECEIVE_SYNC_REQUEST, hasDelay, delay, nbOfParams, params);
   return req;
-}
+  }*/
 
 void destroySyncchannel(syncchannel *syncch) {
   free(syncch);
diff --git a/executablecode/src/syncchannel.h b/executablecode/src/syncchannel.h
index fc2a3cf90b9d0581da5ee56742f09b07cbcc97ea..7a4cc1ac6a44d862adf81db1ebf3e942cdcd9500 100644
--- a/executablecode/src/syncchannel.h
+++ b/executablecode/src/syncchannel.h
@@ -1,8 +1,6 @@
 #ifndef SYNCCHANNEL_H
 #define SYNCCHANNEL_H
 
-#include <pthread.h>
-
 #include "request.h"
 
 struct syncchannel {
@@ -10,18 +8,16 @@ struct syncchannel {
   char *inname;
   request* inWaitQueue;
   request* outWaitQueue; 
-  pthread_mutex_t *mutex;
-  pthread_cond_t *sendCondition;
-  pthread_cond_t *receiveCondition;
 };
 
 typedef struct syncchannel syncchannel;
 
 
 
-syncchannel *getNewSyncchannel(char *inname, char *outname, pthread_mutex_t *mutex,  pthread_cond_t *condSend,  pthread_cond_t *condReceive);
-request *makeNewSendSync(int hasDelay, long delay, int nbOfParams, int *params[]);
-request *makeNewReceiveSync(int hasDelay, long delay, int nbOfParams, int *params[]);
+syncchannel *getNewSyncchannel(char *inname, char *outname);
+//request *makeNewSendSync(int hasDelay, long delay, int nbOfParams, int *params[]);
+//request *makeNewReceiveSync(int hasDelay, long delay, int nbOfParams, int *params[]);
 void destroySyncchannel(syncchannel *syncch);
 
+
 #endif
diff --git a/src/avatartranslator/toexecutable/AVATAR2CPOSIX.java b/src/avatartranslator/toexecutable/AVATAR2CPOSIX.java
new file mode 100755
index 0000000000000000000000000000000000000000..d5bb1077c597d7b02682ea51351186df23265af9
--- /dev/null
+++ b/src/avatartranslator/toexecutable/AVATAR2CPOSIX.java
@@ -0,0 +1,102 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+*
+* ludovic.apvrille AT enst.fr
+*
+* This software is a computer program whose purpose is to allow the
+* edition of TURTLE analysis, design and deployment diagrams, to
+* allow the generation of RT-LOTOS or Java code from this diagram,
+* and at last to allow the analysis of formal validation traces
+* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+* from INRIA Rhone-Alpes.
+*
+* This software is governed by the CeCILL  license under French law and
+* abiding by the rules of distribution of free software.  You can  use,
+* modify and/ or redistribute the software under the terms of the CeCILL
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* "http://www.cecill.info".
+*
+* As a counterpart to the access to the source code and  rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty  and the software's author,  the holder of the
+* economic rights,  and the successive licensors  have only  limited
+* liability.
+*
+* In this respect, the user's attention is drawn to the risks associated
+* with loading,  using,  modifying and/or developing or reproducing the
+* software by the user in light of its specific status of free software,
+* that may mean  that it is complicated to manipulate,  and  that  also
+* therefore means  that it is reserved for developers  and  experienced
+* professionals having in-depth computer knowledge. Users are therefore
+* encouraged to load and test the software's suitability as regards their
+* requirements in conditions enabling the security of their systems and/or
+* data to be ensured and,  more generally, to use and operate it in the
+* same conditions as regards security.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL license and that you accept its terms.
+*
+* /**
+* Class AVATAR2CPOSIX
+* Creation: 29/03/2011
+* @version 1.1 29/03/2011
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package avatartranslator.toexecutable;
+
+import java.awt.*;
+import java.util.*;
+
+import myutil.*;
+import avatartranslator.*;
+
+public class AVATAR2CPOSIX {
+
+	private final static String UNKNOWN = "UNKNOWN";
+
+	
+	private final static String BOOLEAN_DATA_HEADER = "(* Boolean return types *)\ndata true/0.\ndata false/0.\n";
+	private final static String FUNC_DATA_HEADER = "(* Functions data *)\ndata " + UNKNOWN + "/0.\n";
+	
+	private final static String PK_HEADER = "(* Public key cryptography *)\nfun pk/1.\nfun encrypt/2.\nreduc decrypt(encrypt(x,pk(y)),y) = x.\n";
+	private final static String SK_HEADER = "(* Symmetric key cryptography *)\nfun sencrypt/2.\nreduc sdecrypt(sencrypt(x,k),k) = x.\n";
+	private final static String MAC_HEADER = "(* MAC *)\nfun MAC/2.\nreduc verifyMAC(m, k, MAC(m, k)) = true.\n";
+	private final static String CONCAT_HEADER = "(* CONCAT *)\nfun concat/5.\nreduc get1(concat(m1, m2, m3, m4, m5))= m1.\nreduc get2(concat(m1, m2, m3, m4, m5))= m2.\nreduc get3(concat(m1, m2, m3, m4, m5))= m3.\nreduc get4(concat(m1, m2, m3, m4, m5))= m4.\nreduc get5(concat(m1, m2, m3, m4, m5))= m5.\n";
+	
+	private final static String MAIN_DEC = "int main(int argc, char *argv[]) {\n";
+	
+	private AvatarSpecification avspec;
+	
+	private Vector warnings;
+	
+	private MainFile mainFile;
+	private Vector<TaskFile> taskFiles;
+	
+
+	public AVATAR2CPOSIX(AvatarSpecification _avspec) {
+		avspec = _avspec;
+	}
+	
+	
+	public void saveInFiles(String path) throws FileException {
+		if (mainFile != null) {
+			FileUtils.saveFile(path + mainFile.getName() + ".h", mainFile.getHeaderCode());
+			FileUtils.saveFile(path + mainFile.getName() + ".c", mainFile.getMainCode());
+		}
+	}
+	
+	
+	public Vector getWarnings() {
+		return warnings;
+	}
+	
+
+	
+	public void generateCPOSIX(boolean _debug) {
+		mainFile = new MainFile("main");
+	
+	
+	}
+	
+}
\ No newline at end of file
diff --git a/src/avatartranslator/toexecutable/MainFile.java b/src/avatartranslator/toexecutable/MainFile.java
new file mode 100755
index 0000000000000000000000000000000000000000..fb05cdc863de4bf5fb43ceb323fea441e3a6e803
--- /dev/null
+++ b/src/avatartranslator/toexecutable/MainFile.java
@@ -0,0 +1,85 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+*
+* ludovic.apvrille AT enst.fr
+*
+* This software is a computer program whose purpose is to allow the
+* edition of TURTLE analysis, design and deployment diagrams, to
+* allow the generation of RT-LOTOS or Java code from this diagram,
+* and at last to allow the analysis of formal validation traces
+* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+* from INRIA Rhone-Alpes.
+*
+* This software is governed by the CeCILL  license under French law and
+* abiding by the rules of distribution of free software.  You can  use,
+* modify and/ or redistribute the software under the terms of the CeCILL
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* "http://www.cecill.info".
+*
+* As a counterpart to the access to the source code and  rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty  and the software's author,  the holder of the
+* economic rights,  and the successive licensors  have only  limited
+* liability.
+*
+* In this respect, the user's attention is drawn to the risks associated
+* with loading,  using,  modifying and/or developing or reproducing the
+* software by the user in light of its specific status of free software,
+* that may mean  that it is complicated to manipulate,  and  that  also
+* therefore means  that it is reserved for developers  and  experienced
+* professionals having in-depth computer knowledge. Users are therefore
+* encouraged to load and test the software's suitability as regards their
+* requirements in conditions enabling the security of their systems and/or
+* data to be ensured and,  more generally, to use and operate it in the
+* same conditions as regards security.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL license and that you accept its terms.
+*
+* /**
+* Class MainFile
+* Creation: 29/03/2011
+* @version 1.1 29/03/2011
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package avatartranslator.toexecutable;
+
+import java.awt.*;
+import java.util.*;
+
+import myutil.*;
+import avatartranslator.*;
+
+public class MainFile {
+
+	private final static String INCLUDE_HEADER = "#include <stdio.h>\n#include <pthread.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
+	private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager.h\"\n#include \"debug.h\""; 
+	
+	private final static String MAIN_DEC = "int main(int argc, char *argv[]) {\n";
+	private final static String CR = "\n";
+	
+	private String name;
+	
+	
+	public MainFile(String _name) {
+		name = _name;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public String getHeaderCode() {
+		return "";
+	}
+	
+	public String getMainCode() {
+		String s = INCLUDE_HEADER + "\n" + LOCAL_INCLUDE_HEADER + CR + CR;
+		s += MAIN_DEC + CR + CR + "}" + CR;
+		
+		return s;
+		
+	}
+	
+}
\ No newline at end of file
diff --git a/src/avatartranslator/toexecutable/TaskFile.java b/src/avatartranslator/toexecutable/TaskFile.java
new file mode 100755
index 0000000000000000000000000000000000000000..e4c284b77d0e7e461921ffc62e822ccfd1cb3b9a
--- /dev/null
+++ b/src/avatartranslator/toexecutable/TaskFile.java
@@ -0,0 +1,78 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+*
+* ludovic.apvrille AT enst.fr
+*
+* This software is a computer program whose purpose is to allow the
+* edition of TURTLE analysis, design and deployment diagrams, to
+* allow the generation of RT-LOTOS or Java code from this diagram,
+* and at last to allow the analysis of formal validation traces
+* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+* from INRIA Rhone-Alpes.
+*
+* This software is governed by the CeCILL  license under French law and
+* abiding by the rules of distribution of free software.  You can  use,
+* modify and/ or redistribute the software under the terms of the CeCILL
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* "http://www.cecill.info".
+*
+* As a counterpart to the access to the source code and  rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty  and the software's author,  the holder of the
+* economic rights,  and the successive licensors  have only  limited
+* liability.
+*
+* In this respect, the user's attention is drawn to the risks associated
+* with loading,  using,  modifying and/or developing or reproducing the
+* software by the user in light of its specific status of free software,
+* that may mean  that it is complicated to manipulate,  and  that  also
+* therefore means  that it is reserved for developers  and  experienced
+* professionals having in-depth computer knowledge. Users are therefore
+* encouraged to load and test the software's suitability as regards their
+* requirements in conditions enabling the security of their systems and/or
+* data to be ensured and,  more generally, to use and operate it in the
+* same conditions as regards security.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL license and that you accept its terms.
+*
+* /**
+* Class TaskFile
+* Creation: 29/03/2011
+* @version 1.1 29/03/2011
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package avatartranslator.toexecutable;
+
+import java.awt.*;
+import java.util.*;
+
+import myutil.*;
+import avatartranslator.*;
+
+public class TaskFile {
+
+	private final static String INCLUDE_HEADER = "#include <stdio.h>\n#include <pthread.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
+	private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager.h\"\n#include \"debug.h\""; 
+	
+	private String name;
+	
+	
+	public TaskFile(String _name) {
+		name = _name;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public String getHeaderCode() {
+		return "";
+	}
+	
+	public String getMainCode() {
+		return INCLUDE_HEADER + "\n" + LOCAL_INCLUDE_HEADER;
+	}
+	
+}
\ No newline at end of file
diff --git a/src/ui/ConfigurationTTool.java b/src/ui/ConfigurationTTool.java
index f3d1c254dbe3fb5f50b55d58b5195e45346c2808..99c96625ebd62a576231a9d5f6b509411fbaae91 100755
--- a/src/ui/ConfigurationTTool.java
+++ b/src/ui/ConfigurationTTool.java
@@ -122,6 +122,11 @@ public class ConfigurationTTool {
 	public static String AVATARCPPSIMCodeExecuteCommand = "";
 	public static String AVATARCPPSIMInteractiveExecuteCommand = "";
 	
+	// AVATAR Code generation
+	public static String AVATARExecutableCodeDirectory = "";
+	public static String AVATARExecutableCodeHost = "";
+	public static String AVATARExecutableCodeCompileCommand = "";
+	public static String AVATARExecutableCodeExecuteCommand = "";
     
     public static String LastOpenFile = "";
     public static boolean LastOpenFileDefined = false;
@@ -296,6 +301,13 @@ public class ConfigurationTTool {
 		sb.append("AVATARCPPSIMCodeDirectory: " + AVATARCPPSIMCodeDirectory + "\n");
 		sb.append("UPPAALVerifierHOST: " + UPPAALVerifierHost + "\n");
 		
+		// AVATAR: executable code
+		sb.append("\nAVATAR (executable code):\n");
+        sb.append("AVATARExecutableCodeDirectory: " + AVATARExecutableCodeDirectory + "\n");
+		sb.append("AVATARExecutableCodeHost: " + AVATARExecutableCodeHost + "\n");
+		sb.append("AVATARExecutableCodeCompileCommand: " + AVATARExecutableCodeCompileCommand + "\n");
+		sb.append("AVATARExecutableCodeExecuteCommand: " + AVATARExecutableCodeExecuteCommand + "\n");
+		
 		sb.append("\nProVerif:\n");
         sb.append("ProVerifCodeDirectory: " + ProVerifCodeDirectory + "\n");
 		sb.append("ProVerifVerifierPATH: " + ProVerifVerifierPath + "\n");
@@ -496,6 +508,20 @@ public class ConfigurationTTool {
 			nl = doc.getElementsByTagName("AVATARCPPSIMInteractiveExecuteCommand");
             if (nl.getLength() > 0)
                 AVATARCPPSIMInteractiveExecuteCommand(nl);
+			
+			// AVATAR Executable code
+			nl = doc.getElementsByTagName("AVATARExecutableCodeDirectory");
+            if (nl.getLength() > 0)
+                AVATARExecutableCodeDirectory(nl);
+			nl = doc.getElementsByTagName("AVATARExecutableCodeHost");
+            if (nl.getLength() > 0)
+                AVATARExecutableCodeHost(nl);
+			nl = doc.getElementsByTagName("AVATARExecutableCodeCompileCommand");
+            if (nl.getLength() > 0)
+                AVATARExecutableCodeCompileCommand(nl);
+			nl = doc.getElementsByTagName("AVATARExecutableCodeExecuteCommand");
+            if (nl.getLength() > 0)
+                AVATARExecutableCodeExecuteCommand(nl);
             
 			if (systemcOn) {
 					nl = doc.getElementsByTagName("SystemCHost");
@@ -1033,6 +1059,42 @@ public class ConfigurationTTool {
         }
     }
 	
+	private static void AVATARExecutableCodeDirectory(NodeList nl) throws MalformedConfigurationException {
+        try {
+            Element elt = (Element)(nl.item(0));
+            AVATARExecutableCodeDirectory = elt.getAttribute("data");
+        } catch (Exception e) {
+            throw new MalformedConfigurationException(e.getMessage());
+        }
+    }
+	
+	private static void AVATARExecutableCodeHost(NodeList nl) throws MalformedConfigurationException {
+        try {
+            Element elt = (Element)(nl.item(0));
+            AVATARExecutableCodeHost = elt.getAttribute("data");
+        } catch (Exception e) {
+            throw new MalformedConfigurationException(e.getMessage());
+        }
+    }
+	
+	private static void AVATARExecutableCodeCompileCommand(NodeList nl) throws MalformedConfigurationException {
+        try {
+            Element elt = (Element)(nl.item(0));
+            AVATARExecutableCodeCompileCommand = elt.getAttribute("data");
+        } catch (Exception e) {
+            throw new MalformedConfigurationException(e.getMessage());
+        }
+    }
+	
+	private static void AVATARExecutableCodeExecuteCommand(NodeList nl) throws MalformedConfigurationException {
+        try {
+            Element elt = (Element)(nl.item(0));
+            AVATARExecutableCodeExecuteCommand = elt.getAttribute("data");
+        } catch (Exception e) {
+            throw new MalformedConfigurationException(e.getMessage());
+        }
+    }
+	
 	 private static void ProVerifCodeDirectory(NodeList nl) throws MalformedConfigurationException {
         try {
             Element elt = (Element)(nl.item(0));
diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java
index f2ed7b9e091c17516e2efe8c3f39c6d5d447685a..505d68d01ff8cee18b876972e3f6b7c6803cb373 100755
--- a/src/ui/IconManager.java
+++ b/src/ui/IconManager.java
@@ -75,7 +75,7 @@ public class IconManager {
     public static ImageIcon imgic60, imgic61, imgic62, imgic63, imgic64, imgic65, imgic66;
     public static ImageIcon imgic70, imgic71, imgic72, imgic73, imgic75, imgic76, imgic77;
 	public static ImageIcon imgic80, imgic82, imgic84, imgic86, imgic88;
-	public static ImageIcon imgic90, imgic92;
+	public static ImageIcon imgic90, imgic92, imgic94;
 	
     // Class diagram
     public static ImageIcon imgic100, imgic101, imgic102, imgic104, imgic106, imgic108;
@@ -246,6 +246,7 @@ public class IconManager {
 	private static String icon88 = "images/avatarfvproverif.png";
 	private static String icon90 = "images/genlotos.gif";
 	private static String icon92 = "images/genuppaal.gif";
+	private static String icon94 = "images/avatarcodegeneration.gif";
 	
     private static String icon100 = "images/toolbarButtonGraphics/general/Properties16.gif";
     private static String icon101 = "images/toolbarButtonGraphics/general/Properties24.gif";
@@ -644,6 +645,7 @@ public class IconManager {
 		imgic88 = getIcon(icon88);
 		imgic90 = getIcon(icon90);
 		imgic92 = getIcon(icon92);
+		imgic94 = getIcon(icon94);
         
         imgic100 = getIcon(icon100);
         imgic101 = getIcon(icon101);
diff --git a/src/ui/JToolBarMainTurtle.java b/src/ui/JToolBarMainTurtle.java
index 1c6d226757612e91877d4f6dc19de9ed3a604d8a..3f98ce6a1edf99584e5f3da265d4a9eef342bc06 100755
--- a/src/ui/JToolBarMainTurtle.java
+++ b/src/ui/JToolBarMainTurtle.java
@@ -59,7 +59,7 @@ import myutil.*;
 
 public	class JToolBarMainTurtle extends JToolBar	{
 	// Avatar
-	JButton  avatarSimu, avatarFVUPPAAL, avatarFVProVerif;
+	JButton  avatarSimu, avatarFVUPPAAL, avatarFVProVerif, avatarCodeGeneration;
 	
 	// Other
 	JButton genrtlotos, genlotos, genuppaal, gendesign;
@@ -155,6 +155,11 @@ public	class JToolBarMainTurtle extends JToolBar	{
 		}
 		
         addSeparator();
+		
+		avatarCodeGeneration = add(mgui.actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION]);
+		avatarCodeGeneration.addMouseListener(mgui.mouseHandler);
+		
+		addSeparator();
         
         genrtlotos = add(mgui.actions[TGUIAction.ACT_GEN_RTLOTOS]);
         genrtlotos.addMouseListener(mgui.mouseHandler);
@@ -259,6 +264,7 @@ public	class JToolBarMainTurtle extends JToolBar	{
 		 if (avatarFVProVerif != null) {
 			 avatarFVProVerif.setVisible(b);
 		 }
+		 avatarCodeGeneration.setVisible(b);
 		 
 		 if (genrtlotos != null) {
 			 genrtlotos.setVisible(!b);
@@ -327,6 +333,7 @@ public	class JToolBarMainTurtle extends JToolBar	{
 		 if (avatarFVProVerif != null) {
 			 avatarFVProVerif.setVisible(!b);
 		 }
+		 avatarCodeGeneration.setVisible(!b);
 		 
 		 if (genrtlotos != null) {
 			 genrtlotos.setVisible(!b);
diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java
index 06be4320452d1d70a138919dc32fe3bd2aa9d4d1..e962b49e877a8f26726bd67bfd9abb94214b0580 100755
--- a/src/ui/MainGUI.java
+++ b/src/ui/MainGUI.java
@@ -599,6 +599,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 			actions[TGUIAction.ACT_AVATAR_SIM].setEnabled(true);
 			actions[TGUIAction.ACT_AVATAR_FV_UPPAAL].setEnabled(true); 
 			actions[TGUIAction.ACT_AVATAR_FV_PROVERIF].setEnabled(true);
+			actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION].setEnabled(true);
 			break;
 		case REQ_OK:
 			//actions[TGUIAction.ACT_VIEW_MATRIX].setEnabled(true);
@@ -638,6 +639,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 			actions[TGUIAction.ACT_AVATAR_SIM].setEnabled(false);
 			actions[TGUIAction.ACT_AVATAR_FV_UPPAAL].setEnabled(false);
 			actions[TGUIAction.ACT_AVATAR_FV_PROVERIF].setEnabled(false);
+			actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION].setEnabled(false);
 			break;
 		case METHO_CHANGED:
 			actions[TGUIAction.ACT_GEN_RTLOTOS].setEnabled(false);
@@ -3184,6 +3186,15 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         jgen.setVisible(true);
         dtree.toBeUpdated();
 	}
+	
+	public void avatarExecutableCodeGeneration() {
+		TraceManager.addDev("Avatar code generation");
+		JDialogAvatarExecutableCodeGeneration jgen = new JDialogAvatarExecutableCodeGeneration(frame, this, "Executable Code generation, compilation and execution", ConfigurationTTool.AVATARExecutableCodeHost, ConfigurationTTool.AVATARExecutableCodeDirectory,  ConfigurationTTool.AVATARExecutableCodeCompileCommand, ConfigurationTTool.AVATARExecutableCodeExecuteCommand);
+        jgen.setSize(500, 450);
+        GraphicLib.centerOnParent(jgen);
+        jgen.setVisible(true);
+        dtree.toBeUpdated();
+	}
     
     public void generateUPPAAL() {
 		//TraceManager.addDev("Generate UPPAAL!");
@@ -6307,7 +6318,8 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 			avatarUPPAALVerification();
 		} else if (command.equals(actions[TGUIAction.ACT_AVATAR_FV_PROVERIF].getActionCommand())) {
             avatarProVerifVerification();
-		
+		} else if (command.equals(actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION].getActionCommand())) {
+            avatarExecutableCodeGeneration();
 		
 		// AVATAR BD
 		} else if (command.equals(actions[TGUIAction.ABD_BLOCK].getActionCommand())) {
diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java
index 1765ef5a9e7088b751cbad2b7fda363edfae745d..215b1172a014a3898b9df89f5252c0773e09ce2e 100755
--- a/src/ui/TGUIAction.java
+++ b/src/ui/TGUIAction.java
@@ -455,12 +455,13 @@ public class TGUIAction extends AbstractAction {
 	public static final int ACT_AVATAR_SIM = 339;
 	public static final int ACT_AVATAR_FV_UPPAAL = 337;
 	public static final int ACT_AVATAR_FV_PROVERIF = 338;
+	public static final int ACT_AVATAR_EXECUTABLE_GENERATION = 340;
 
     
     //Action for the help button created by Solange
     public static final int PRUEBA_1 = 205;
 
-    public static final int NB_ACTION = 340;
+    public static final int NB_ACTION = 341;
 
     private  static final TAction [] actions = new TAction[NB_ACTION];
     
@@ -588,6 +589,7 @@ public class TGUIAction extends AbstractAction {
 		actions[ACT_AVATAR_SIM] = new TAction("avatar-simu", "Interactive simulation", IconManager.imgic18, IconManager.imgic18, "Interactive simulation",  "Interactive simulation of the AVATAR design under edition", '0');
         actions[ACT_AVATAR_FV_UPPAAL] = new TAction("avatar-formal-verification-uppaal", "Formal verification with UPPAAL (Safety)", IconManager.imgic86, IconManager.imgic86, "Formal verification with UPPAAL (Safety)",  "Formal verification with UPPAAL (Safety) of the AVATAR design under edition", '0');
         actions[ACT_AVATAR_FV_PROVERIF] = new TAction("avatar-formal-verification-proverif", "Formal verification with ProVerif (Security)", IconManager.imgic88, IconManager.imgic88, "Formal verification with ProVerif (Security)",  "Formal verification with ProVerif (Security) of the AVATAR design under edition", '0');
+        actions[ACT_AVATAR_EXECUTABLE_GENERATION] = new TAction("avatar-executable-generation", "Generation of executable code", IconManager.imgic94, IconManager.imgic94, "Generation of executable code",  "Generation of executable code from AVATAR design under edition", '0');
         
 		
         actions[ACT_VIEW_JAVA] = new TAction("view-java", "Display Java code", IconManager.imgic38, IconManager.imgic39, "Display Java code",  "Display the java code of the pointed component", 0);
diff --git a/src/ui/images/avatarcodegeneration.gif b/src/ui/images/avatarcodegeneration.gif
new file mode 100644
index 0000000000000000000000000000000000000000..4763027b8c4ad889811c9a24584c9d782c08334c
Binary files /dev/null and b/src/ui/images/avatarcodegeneration.gif differ
diff --git a/src/ui/window/JDialogAvatarExecutableCodeGeneration.java b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java
new file mode 100644
index 0000000000000000000000000000000000000000..d138ed45583844261af51b317e6231a7461fdb76
--- /dev/null
+++ b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java
@@ -0,0 +1,559 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+*
+* ludovic.apvrille AT enst.fr
+*
+* This software is a computer program whose purpose is to allow the
+* edition of TURTLE analysis, design and deployment diagrams, to
+* allow the generation of RT-LOTOS or Java code from this diagram,
+* and at last to allow the analysis of formal validation traces
+* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+* from INRIA Rhone-Alpes.
+*
+* This software is governed by the CeCILL  license under French law and
+* abiding by the rules of distribution of free software.  You can  use,
+* modify and/ or redistribute the software under the terms of the CeCILL
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* "http://www.cecill.info".
+*
+* As a counterpart to the access to the source code and  rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty  and the software's author,  the holder of the
+* economic rights,  and the successive licensors  have only  limited
+* liability.
+*
+* In this respect, the user's attention is drawn to the risks associated
+* with loading,  using,  modifying and/or developing or reproducing the
+* software by the user in light of its specific status of free software,
+* that may mean  that it is complicated to manipulate,  and  that  also
+* therefore means  that it is reserved for developers  and  experienced
+* professionals having in-depth computer knowledge. Users are therefore
+* encouraged to load and test the software's suitability as regards their
+* requirements in conditions enabling the security of their systems and/or
+* data to be ensured and,  more generally, to use and operate it in the
+* same conditions as regards security.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL license and that you accept its terms.
+*
+* /**
+* Class JDialogAvatarExecutableCodeGeneration
+* Dialog for managing the generation and compilation of AVATAR executable code
+* Creation: 29/03/2011
+* @version 1.1 29/03/2011
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package ui.window;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.util.*;
+
+import myutil.*;
+import ui.*;
+
+
+import avatartranslator.*;
+import avatartranslator.toexecutable.*;
+import launcher.*;
+
+
+public class JDialogAvatarExecutableCodeGeneration extends javax.swing.JDialog implements ActionListener, Runnable, MasterProcessInterface  {
+    
+    protected MainGUI mgui;
+    
+    private String textSysC1 = "Generate executable code in";
+    private String textSysC2 = "Compile executable code in";
+    //private String textSysC3 = "with";
+    private String textSysC4 = "Run code:";
+    
+    private static String unitCycle = "1";
+	
+	private static String[] codes = {"AVATAR CPOSIX"};
+	private static int selectedItem = 0;
+    
+    protected static String pathCode;
+    protected static String pathCompiler;
+    protected static String pathExecute;
+	
+	
+	protected static boolean optimizeModeSelected = true;
+    
+    protected final static int NOT_STARTED = 1;
+    protected final static int STARTED = 2;
+    protected final static int STOPPED = 3;
+    
+    int mode;
+    
+    //components
+    protected JTextArea jta;
+    protected JButton start;
+    protected JButton stop;
+    protected JButton close;
+    
+	protected JRadioButton exe, exeint;
+	protected ButtonGroup exegroup;
+    protected JLabel gen, comp;
+    protected JTextField code1, code2, compiler1, exe1, exe2, exe3, exe2int;
+    protected JTabbedPane jp1;
+    protected JScrollPane jsp;
+    protected JCheckBox removeCFiles, removeXFiles, debugmode, optimizemode;
+	protected JComboBox versionCodeGenerator;
+	
+    
+    private Thread t;
+    private boolean go = false;
+    private boolean hasError = false;
+	protected boolean startProcess = false;
+
+    
+    private String hostExecute;
+    
+    protected RshClient rshc;
+    
+    
+    /** Creates new form  */
+    public JDialogAvatarExecutableCodeGeneration(Frame f, MainGUI _mgui, String title, String _hostExecute, String _pathCode, String _pathCompiler, String _pathExecute) {
+        super(f, title, true);
+        
+        mgui = _mgui;
+        
+        if (pathCode == null) {
+            pathCode = _pathCode;
+        }
+        
+        if (pathCompiler == null)
+            pathCompiler = _pathCompiler;
+        
+        if (pathExecute == null)
+            pathExecute = _pathExecute;
+        
+        hostExecute = _hostExecute;
+        
+		
+        initComponents();
+        myInitComponents();
+        pack();
+        
+        //getGlassPane().addMouseListener( new MouseAdapter() {});
+        getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+    }
+    
+    
+    protected void myInitComponents() {
+        mode = NOT_STARTED;
+        setButtons();
+    }
+    
+    protected void initComponents() {
+        
+        Container c = getContentPane();
+        setFont(new Font("Helvetica", Font.PLAIN, 14));
+        c.setLayout(new BorderLayout());
+        //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        
+        jp1 = new JTabbedPane();
+        
+        JPanel jp01 = new JPanel();
+        GridBagLayout gridbag01 = new GridBagLayout();
+        GridBagConstraints c01 = new GridBagConstraints();
+        jp01.setLayout(gridbag01);
+        jp01.setBorder(new javax.swing.border.TitledBorder("Code generation"));
+        
+        JPanel jp02 = new JPanel();
+        GridBagLayout gridbag02 = new GridBagLayout();
+        GridBagConstraints c02 = new GridBagConstraints();
+        jp02.setLayout(gridbag02);
+        jp02.setBorder(new javax.swing.border.TitledBorder("Compilation"));
+        
+        JPanel jp03 = new JPanel();
+        GridBagLayout gridbag03 = new GridBagLayout();
+        GridBagConstraints c03 = new GridBagConstraints();
+        jp03.setLayout(gridbag03);
+        jp03.setBorder(new javax.swing.border.TitledBorder("Execution"));
+        
+        
+        c01.gridheight = 1;
+        c01.weighty = 1.0;
+        c01.weightx = 1.0;
+        c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c01.fill = GridBagConstraints.BOTH;
+        c01.gridheight = 1;
+        
+        gen = new JLabel(textSysC1);
+        //genJava.addActionListener(this);
+        jp01.add(gen, c01);
+        
+        code1 = new JTextField(pathCode, 100);
+        jp01.add(code1, c01);
+        
+        jp01.add(new JLabel(" "), c01);
+        c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+        
+        removeCFiles = new JCheckBox("Remove .c / .h files");
+        removeCFiles.setSelected(true);
+        jp01.add(removeCFiles, c01);
+        
+        removeXFiles = new JCheckBox("Remove .x files");
+        removeXFiles.setSelected(true);
+        jp01.add(removeXFiles, c01);
+        
+        debugmode = new JCheckBox("Put debug information in generated code");
+        debugmode.setSelected(false);
+        jp01.add(debugmode, c01);
+		
+		optimizemode = new JCheckBox("Optimize code");
+		optimizemode.setSelected(optimizeModeSelected);
+        jp01.add(optimizemode, c01);
+		
+		jp01.add(new JLabel("Code generator used:"), c01);
+		
+		versionCodeGenerator = new JComboBox(codes);
+		versionCodeGenerator.setSelectedIndex(selectedItem);
+		versionCodeGenerator.addActionListener(this);
+		jp01.add(versionCodeGenerator, c01);
+		//System.out.println("selectedItem=" + selectedItem);
+		
+		//devmode = new JCheckBox("Development version of the simulator");
+        //devmode.setSelected(true);
+        //jp01.add(devmode, c01);
+        
+        jp01.add(new JLabel(" "), c01);
+        jp1.add("Generate code", jp01);
+        
+        // Panel 02
+        c02.gridheight = 1;
+        c02.weighty = 1.0;
+        c02.weightx = 1.0;
+        c02.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c02.fill = GridBagConstraints.BOTH;
+        c02.gridheight = 1;
+        
+        comp = new JLabel(textSysC2);
+        //compJava.addActionListener(this);
+        jp02.add(comp, c02);
+        
+        code2 = new JTextField(pathCode, 100);
+        jp02.add(code2, c02);
+        
+        jp02.add(new JLabel("with"), c02);
+        
+        compiler1 = new JTextField(pathCompiler, 100);
+        jp02.add(compiler1, c02);
+        
+        jp02.add(new JLabel(" "), c02);
+        
+        jp1.add("Compile", jp02);
+        
+        // Panel 03
+        c03.gridheight = 1;
+        c03.weighty = 1.0;
+        c03.weightx = 1.0;
+        c03.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c03.fill = GridBagConstraints.BOTH;
+        c03.gridheight = 1;
+		
+		exegroup = new ButtonGroup();
+        exe = new JRadioButton(textSysC4, false);
+		exe.addActionListener(this);
+		exegroup.add(exe);
+        //exeJava.addActionListener(this);
+        jp03.add(exe, c03);
+        
+        exe2 = new JTextField(pathExecute, 100);
+        jp03.add(exe2, c02);
+		
+		/*exeint = new JRadioButton(textSysC5, true);
+		exeint.addActionListener(this);
+		exegroup.add(exeint);
+        //exeJava.addActionListener(this);
+        jp03.add(exeint, c03);
+        
+        exe2int = new JTextField(pathInteractiveExecute, 100);
+        jp03.add(exe2int, c02);*/
+        
+        jp03.add(new JLabel(" "), c03);
+        
+        jp1.add("Execute", jp03);
+        
+        c.add(jp1, BorderLayout.NORTH);
+        
+        jta = new ScrolledJTextArea();
+        jta.setEditable(false);
+        jta.setMargin(new Insets(10, 10, 10, 10));
+        jta.setTabSize(3);
+        jta.append("Select options and then, click on 'start' to launch code generation / compilation / execution\n");
+        Font f = new Font("Courrier", Font.BOLD, 12);
+        jta.setFont(f);
+        jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+        
+        c.add(jsp, BorderLayout.CENTER);
+        
+        start = new JButton("Start", IconManager.imgic53);
+        stop = new JButton("Stop", IconManager.imgic55);
+        close = new JButton("Close", IconManager.imgic27);
+        
+        start.setPreferredSize(new Dimension(100, 30));
+        stop.setPreferredSize(new Dimension(100, 30));
+        close.setPreferredSize(new Dimension(100, 30));
+        
+        start.addActionListener(this);
+        stop.addActionListener(this);
+        close.addActionListener(this);
+        
+        JPanel jp2 = new JPanel();
+        jp2.add(start);
+        jp2.add(stop);
+        jp2.add(close);
+        
+        c.add(jp2, BorderLayout.SOUTH);
+        
+    }
+    
+    public void	actionPerformed(ActionEvent evt)  {
+        String command = evt.getActionCommand();
+        
+        // Compare the action command to the known actions.
+		if (command.equals("Start"))  {
+            startProcess();
+        } else if (command.equals("Stop")) {
+            stopProcess();
+        } else if (command.equals("Close")) {
+            closeDialog();
+        } else if (evt.getSource() == versionCodeGenerator) {
+			selectedItem = versionCodeGenerator.getSelectedIndex();
+		}
+    }
+    
+    public void closeDialog() {
+        if (mode == STARTED) {
+            stopProcess();
+        }
+		optimizeModeSelected = optimizemode.isSelected();
+        dispose();
+    }
+    
+    public void stopProcess() {
+			try {
+				rshc.stopFillJTA();
+			} catch (LauncherException le) {
+				
+			}
+			rshc = null;
+			mode = 	STOPPED;
+			setButtons();
+			go = false;
+    }
+    
+    public void startProcess() {
+		startProcess = false;
+		t = new Thread(this);
+		mode = STARTED;
+		setButtons();
+		go = true;
+		t.start();
+    }
+    
+    private void testGo() throws InterruptedException {
+        if (go == false) {
+            throw new InterruptedException("Stopped by user");
+        }
+    }
+    
+    public void run() {
+        String cmd;
+        String list, data;
+        int cycle = 0;
+        
+        hasError = false;
+        
+        try {
+            if (versionCodeGenerator.getSelectedIndex() == 0) {
+				// Code generation
+				if (jp1.getSelectedIndex() == 0) {
+					jta.append("Generating executable code (C-POSIX version)\n");
+					
+					if (removeCFiles.isSelected()) {
+						jta.append("Removing all .h files\n");
+						list = FileUtils.deleteFiles(code1.getText(), ".h");
+						if (list.length() == 0) {
+							jta.append("No files were deleted\n");
+						} else {
+							jta.append("Files deleted:\n" + list + "\n");
+						}
+						jta.append("Removing all  .cpp files\n");
+						list = FileUtils.deleteFiles(code1.getText(), ".cpp");
+						if (list.length() == 0) {
+							jta.append("No files were deleted\n");
+						} else {
+							jta.append("Files deleted:\n" + list + "\n");
+						}
+					}
+					
+					if (removeXFiles.isSelected()) {
+						jta.append("Removing all .x files\n");
+						list = FileUtils.deleteFiles(code1.getText(), ".x");
+						if (list.length() == 0) {
+							jta.append("No files were deleted\n");
+						} else {
+							jta.append("Files deleted:\n" + list + "\n");
+						}
+					}
+					
+					testGo();
+					
+					selectedItem = versionCodeGenerator.getSelectedIndex();
+					//System.out.println("Selected item=" + selectedItem);
+					if (selectedItem == 0) {
+						AvatarSpecification avspec = mgui.gtm.getAvatarSpecification();
+						
+						// Generating code
+						if (avspec == null) {
+							jta.append("Error: No AVATAR specification\n");
+						} else {
+							AVATAR2CPOSIX avatartocposix = new AVATAR2CPOSIX(avspec);
+							avatartocposix.generateCPOSIX(debugmode.isSelected());
+							testGo();
+							jta.append("Generation of C-POSIX executable code: done\n");
+							//t2j.printJavaClasses();
+							try {
+								jta.append("Saving code in files\n");
+								pathCode = code1.getText();
+								avatartocposix.saveInFiles(pathCode);
+								//tml2systc.saveFile(pathCode, "appmodel");
+								jta.append("Code saved\n");
+							} catch (Exception e) {
+								jta.append("Could not generate files\n");
+							}
+						}
+					}
+					
+					
+				}
+				
+				testGo();
+				
+				
+				// Compilation
+				if (jp1.getSelectedIndex() == 1) {
+					
+					cmd = compiler1.getText();
+					
+					jta.append("Compiling executable code with command: \n" + cmd + "\n");
+					
+					rshc = new RshClient(hostExecute);
+					// Assuma data are on the remote host
+					// Command
+					try {
+						data = processCmd(cmd);
+						jta.append(data);
+						jta.append("Compilation done\n");
+					} catch (LauncherException le) {
+						jta.append("Error: " + le.getMessage() + "\n");
+						mode = 	STOPPED;
+						setButtons();
+						return;
+					} catch (Exception e) {
+						mode = 	STOPPED;
+						setButtons();
+						return;
+					}
+				}
+				
+				if (jp1.getSelectedIndex() == 2) {
+					try {
+						cmd = exe2.getText();
+						
+						jta.append("Executing code with command: \n" + cmd + "\n");
+						
+						rshc = new RshClient(hostExecute);
+						// Assuma data are on the remote host
+						// Command
+						
+						data = processCmd(cmd);
+						jta.append(data);
+						jta.append("Execution done\n");
+					} catch (LauncherException le) {
+						jta.append("Error: " + le.getMessage() + "\n");
+						mode = 	STOPPED;
+						setButtons();
+						return;
+					} catch (Exception e) {
+						mode = 	STOPPED;
+						setButtons();
+						return;
+					}
+				}
+				
+				if ((hasError == false) && (jp1.getSelectedIndex() < 2)) {
+					jp1.setSelectedIndex(jp1.getSelectedIndex() + 1);
+				}
+			}
+            
+        } catch (InterruptedException ie) {
+            jta.append("Interrupted\n");
+        }
+        
+        jta.append("\n\nReady to process next command\n");
+        
+        checkMode();
+        setButtons();
+		
+		//System.out.println("Selected item=" + selectedItem);
+    }
+    
+    protected String processCmd(String cmd) throws LauncherException {
+        rshc.setCmd(cmd);
+        String s = null;
+        rshc.sendProcessRequest();
+        s = rshc.getDataFromProcess();
+        return s;
+    }
+    
+    protected void checkMode() {
+        mode = NOT_STARTED;
+    }
+    
+    protected void setButtons() {
+        switch(mode) {
+		case NOT_STARTED:
+			start.setEnabled(true);
+			stop.setEnabled(false);
+			close.setEnabled(true);
+			//setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+			getGlassPane().setVisible(false);
+			break;
+		case STARTED:
+			start.setEnabled(false);
+			stop.setEnabled(true);
+			close.setEnabled(false);
+			getGlassPane().setVisible(true);
+			//setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+			break;
+		case STOPPED:
+		default:
+			start.setEnabled(false);
+			stop.setEnabled(false);
+			close.setEnabled(true);
+			getGlassPane().setVisible(false);
+			break;
+        }
+    }
+    
+    public boolean hasToContinue() {
+        return (go == true);
+    }
+    
+    public void appendOut(String s) {
+        jta.append(s);
+    }
+    
+    public void setError() {
+        hasError = true;
+    }
+	
+	
+}