diff --git a/simulators/c++2/Makefile b/simulators/c++2/Makefile
index b58fedb5dff9012a3c771fc279c303913ed335ff..fc7167d878fda000afa7572dd0f95efe87c82019 100755
--- a/simulators/c++2/Makefile
+++ b/simulators/c++2/Makefile
@@ -10,16 +10,17 @@ OPT    = -O1 -pthread
 LOPT   = -O1 -pthread -ldl
 
 DEBUG  = -g
+PROFILE = -pg
 OTHER  = -Wall
 TRY    = -Wno-deprecated
-#CFLAGS = $(OPT) $(OTHER) $(TRY)
-LFLAGS = $(LOPT) $(OTHER) $(TRY)
-CFLAGS = $(DEBUG) $(OTHER)
+#make  = $(OPT) $(OTHER) $(TRY)
+LFLAGS = $(LOPT) $(OTHER) $(TRY) $(PROFILE)
+CFLAGS = $(PROFILE) $(OTHER)
 OBJDIR = lib
 
 MODULE = run
 include Makefile.src
-SRCS_base = app/TMLTask.cpp app/TMLCommand.cpp TMLTransaction.cpp app/TMLChannel.cpp arch/SingleCoreCPU.cpp app/TMLWriteCommand.cpp app/TMLWriteMultCommand.cpp app/TMLStateChannel.cpp app/TMLbrbwChannel.cpp app/TMLnbrnbwChannel.cpp app/TMLbrnbwChannel.cpp app/TMLReadCommand.cpp app/TMLExeciCommand.cpp app/TMLExeciRangeCommand.cpp app/TMLActionCommand.cpp app/TMLChoiceCommand.cpp app/TMLRandomChoiceCommand.cpp app/TMLWaitCommand.cpp app/TMLSendCommand.cpp app/TMLSelectCommand.cpp app/TMLRequestCommand.cpp app/TMLNotifiedCommand.cpp app/TMLRandomCommand.cpp app/TMLStopCommand.cpp arch/Bus.cpp definitions.cpp arch/Bridge.cpp arch/Memory.cpp Comment.cpp sim/Server.cpp sim/ServerLocal.cpp sim/Simulator.cpp sim/SimComponents.cpp sim/ServerIF.cpp evt/ListenersSimCmd.cpp arch/PrioScheduler.cpp arch/RRScheduler.cpp arch/WorkloadSource.cpp TEPE/AliasConstraint.cpp TEPE/EqConstraint.cpp TEPE/FSMConstraint.cpp TEPE/PropertyConstraint.cpp TEPE/PropertyStateConstraint.cpp TEPE/PropLabConstraint.cpp TEPE/PropRelConstraint.cpp TEPE/SignalConstraint.cpp TEPE/ThreeSigConstraint.cpp TEPE/TimeMMConstraint.cpp TEPE/TimeTConstraint.cpp TEPE/TwoSigConstraint.cpp
+SRCS_base = app/TMLTask.cpp app/TMLCommand.cpp TMLTransaction.cpp app/TMLChannel.cpp arch/SingleCoreCPU.cpp app/TMLWriteCommand.cpp app/TMLWriteMultCommand.cpp app/TMLStateChannel.cpp app/TMLbrbwChannel.cpp app/TMLnbrnbwChannel.cpp app/TMLbrnbwChannel.cpp app/TMLReadCommand.cpp app/TMLExeciCommand.cpp app/TMLExeciRangeCommand.cpp app/TMLActionCommand.cpp app/TMLChoiceCommand.cpp app/TMLRandomChoiceCommand.cpp app/TMLWaitCommand.cpp app/TMLSendCommand.cpp app/TMLSelectCommand.cpp app/TMLRequestCommand.cpp app/TMLNotifiedCommand.cpp app/TMLRandomCommand.cpp app/TMLStopCommand.cpp arch/Bus.cpp definitions.cpp arch/Bridge.cpp arch/Memory.cpp Comment.cpp sim/Server.cpp sim/ServerLocal.cpp sim/Simulator.cpp sim/SimComponents.cpp sim/ServerIF.cpp evt/ListenersSimCmd.cpp arch/PrioScheduler.cpp arch/RRScheduler.cpp arch/RRPrioScheduler.cpp arch/WorkloadSource.cpp TEPE/AliasConstraint.cpp TEPE/EqConstraint.cpp TEPE/FSMConstraint.cpp TEPE/PropertyConstraint.cpp TEPE/PropertyStateConstraint.cpp TEPE/PropLabConstraint.cpp TEPE/PropRelConstraint.cpp TEPE/SignalConstraint.cpp TEPE/ThreeSigConstraint.cpp TEPE/TimeMMConstraint.cpp TEPE/TimeTConstraint.cpp TEPE/TwoSigConstraint.cpp
 
 SRCS_base_DIR = src_simulator
 SRCS_generated = .
diff --git a/simulators/c++2/src_simulator/HashAlgo.h b/simulators/c++2/src_simulator/HashAlgo.h
index 0773adf65d44865b65f915b95d7aefbd168361ee..886c4c9ee6975b76b9326842e4e9be4e5e2ff22e 100644
--- a/simulators/c++2/src_simulator/HashAlgo.h
+++ b/simulators/c++2/src_simulator/HashAlgo.h
@@ -88,12 +88,18 @@ Ludovic Apvrille, Renaud Pacalet
 class HashAlgo{
 public:	
 	
-	HashAlgo(){
+	HashAlgo()/*: _bufferSize(0), _buffer(0), _bufferPos(0)*/{
 		init(0,0);
 	}
 	
-	HashAlgo(HashValueType iInitVal, HashValueType iLength){
+	HashAlgo(HashValueType iInitVal, HashValueType iLength /*, iBufferSize=0*/)/*: _bufferSize(iBufferSize), _buffer(0), _bufferPos(0)*/{
 		init(iInitVal, iLength);
+		//if (_bufferSize!=0) _buffer = new HashValueType[_bufferSize];
+		//memset(_buffer, 0, _bufferSize*sizeof(HashValueType));
+	}
+	
+	~HashAlgo(){
+		//if (_bufferSize!=0) delete [] _buffer;
 	}
 	
 	void init(HashValueType iInitVal, HashValueType iLength){
@@ -143,5 +149,8 @@ public:
 	mutable HashValueType _result;
 	char _state;
 	mutable bool _finalized;
+	//unsigned int _bufferSize;
+	//HashValueType * _buffer;
+	//unsigned int _bufferPos;
 };
 #endif
diff --git a/simulators/c++2/src_simulator/TMLTransaction.cpp b/simulators/c++2/src_simulator/TMLTransaction.cpp
index 437c2d816394d6e4f3755c3397396cbac1e07ad0..0e248132cf1038f95f996d05f9de9c43c51b9b4e 100755
--- a/simulators/c++2/src_simulator/TMLTransaction.cpp
+++ b/simulators/c++2/src_simulator/TMLTransaction.cpp
@@ -45,11 +45,19 @@ Ludovic Apvrille, Renaud Pacalet
 
 MemPool<TMLTransaction> TMLTransaction::memPool(BLOCK_SIZE_TRANS);
 
+
+TMLTransaction::TMLTransaction():_runnableTime(0), _startTime(0), _length(0), _virtualLength(0), _command(0),
+#ifdef PENALTIES_ENABLED
+ _idlePenalty(0), _taskSwitchingPenalty(0), //, _branchingPenalty(0),
+#endif
+_channel(0),_stateID(0) {
+}
+
 TMLTransaction::TMLTransaction(TMLCommand* iCommand, TMLLength iVirtualLength, TMLTime iRunnableTime, TMLChannel* iChannel):_runnableTime(iRunnableTime), _startTime(0), _length(0), _virtualLength(iVirtualLength), _command(iCommand),
 #ifdef PENALTIES_ENABLED
- _idlePenalty(0), _taskSwitchingPenalty(0), _branchingPenalty(0),
+ _idlePenalty(0), _taskSwitchingPenalty(0), //, _branchingPenalty(0),
 #endif
- /*_terminated(false),*/ _channel(iChannel),_stateID(0) {
+_channel(iChannel),_stateID(0) {
 	//if (_virtualLength!=0) std::cout << "Trans runnable: " << toString() << "\n";
 }
 
@@ -59,14 +67,11 @@ TMLTime TMLTransaction::getRunnableTime() const{
 
 void TMLTransaction::setRunnableTime(TMLTime iRunnableTime){
 	_runnableTime = max(_runnableTime,iRunnableTime);
-	//if (_runnableTimeSet){
-	//	std::cout << "ERROR: runnable time set twice\n";
-	//}else{
-		//_runnableTimeSet=true;
-//#ifdef REGISTER_TRANS_AT_CPU 
-//	_command->getTask()->getCPU()->registerTransaction(this,0);
-//#endif
-	//}
+	/*if (_runnableTimeSet){
+		std::cout << "ERROR: runnable time set twice\n";
+	}else{
+		_runnableTimeSet=true;
+	}*/
 }
 
 TMLTime TMLTransaction::getStartTime() const{
@@ -75,7 +80,8 @@ TMLTime TMLTransaction::getStartTime() const{
 
 TMLTime TMLTransaction::getStartTimeOperation() const{
 #ifdef PENALTIES_ENABLED
-	return _startTime + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	//return _startTime + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	return _startTime + _idlePenalty + _taskSwitchingPenalty;
 #else
 	return _startTime;
 #endif
@@ -95,7 +101,8 @@ void TMLTransaction::setLength(TMLTime iLength){
 
 TMLTime TMLTransaction::getOverallLength() const{
 #ifdef PENALTIES_ENABLED
-	return _length + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	//return _length + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	return _length + _idlePenalty + _taskSwitchingPenalty;
 #else
 	return _length;
 #endif
@@ -103,7 +110,8 @@ TMLTime TMLTransaction::getOverallLength() const{
 
 TMLTime TMLTransaction::getPenalties() const{
 #ifdef PENALTIES_ENABLED
-	return _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	//return _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	return _idlePenalty + _taskSwitchingPenalty;
 #else
 	return 0;
 #endif
@@ -124,11 +132,11 @@ TMLCommand* TMLTransaction::getCommand() const{
 
 TMLTime TMLTransaction::getEndTime() const{
 #ifdef PENALTIES_ENABLED
-	return _startTime  + _length + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	//return _startTime  + _length + _idlePenalty + _taskSwitchingPenalty + _branchingPenalty;
+	return _startTime  + _length + _idlePenalty + _taskSwitchingPenalty;
 #else
 	return _startTime  + _length;
 #endif
-	//return _startTime  + _length;
 }
 
 TMLTime TMLTransaction::getIdlePenalty() const{
@@ -159,27 +167,18 @@ void TMLTransaction::setTaskSwitchingPenalty(TMLTime iTaskSwitchingPenalty){
 #endif	
 }
 
-TMLTime TMLTransaction::getBranchingPenalty() const{
+/*TMLTime TMLTransaction::getBranchingPenalty() const{
 #ifdef PENALTIES_ENABLED
 	return _branchingPenalty;
 #else
 	return 0;
 #endif
-}
+}*/
 
-void TMLTransaction::setBranchingPenalty(TMLTime iBranchingPenalty){
+/*void TMLTransaction::setBranchingPenalty(TMLTime iBranchingPenalty){
 #ifdef PENALTIES_ENABLED
 	_branchingPenalty=iBranchingPenalty;
 #endif
-}
-
-/*bool TMLTransaction::getTerminatedFlag() const{
-	return _terminated;
-}
-
-void TMLTransaction::setTerminatedFlag(){
-	_terminated=true;
-	//std::cout << "TERMINATED FLAG SET!!!!!!!!!!!!!!!!!!!!!  " << this << std::endl;
 }*/
 
 std::string TMLTransaction::toString() const{
diff --git a/simulators/c++2/src_simulator/TMLTransaction.h b/simulators/c++2/src_simulator/TMLTransaction.h
index b5fe7f46a25193e47d590a4c52070b1b98ed25bd..f94e911c8f6ce455a14b9aea32117d014624aa94 100644
--- a/simulators/c++2/src_simulator/TMLTransaction.h
+++ b/simulators/c++2/src_simulator/TMLTransaction.h
@@ -57,6 +57,8 @@ public:
 	\param iChannel Channel on which data was conveyed
     	*/
 	TMLTransaction(TMLCommand* iCommand, TMLLength iVirtualLength, TMLTime iRunnableTime, TMLChannel* iChannel=0);
+	///Constructor
+	TMLTransaction();
 	///Returns the time when the transaction became runnable
 	/**
       	\return Runnable time
@@ -142,20 +144,16 @@ public:
       	\param iTaskSwitchingPenalty Task switching penalty
     	*/	
 	void setTaskSwitchingPenalty(TMLTime iTaskSwitchingPenalty);
-	///Returns the branching panalty of the transaction
-	/**
-      	\return Branching penalty
-    	*/	
-	TMLTime getBranchingPenalty() const;
-	///Sets the branching panalty of the transaction
-	/**
-      	\param iBranchingPenalty Branching penalty
-    	*/
-	void setBranchingPenalty(TMLTime iBranchingPenalty);
-	/////Returns the terminated flag of the transaction
-	//bool getTerminatedFlag() const;
-	/////Sets the terminated flag of the transaction to true
-	//void setTerminatedFlag();
+	/////Returns the branching panalty of the transaction
+	////**
+      	//\return Branching penalty
+    	//*/	
+	//TMLTime getBranchingPenalty() const;
+	////Sets the branching panalty of the transaction
+	////**
+      	////\param iBranchingPenalty Branching penalty
+    	//*/
+	//void setBranchingPenalty(TMLTime iBranchingPenalty);
 	///Returns a string representation of the transaction
 	/**
 	\return Detailed string representation
@@ -200,8 +198,8 @@ protected:
 	TMLTime _idlePenalty;
 	///Task switching penalty
 	TMLTime _taskSwitchingPenalty;
-	///Branching penalty
-	TMLTime _branchingPenalty;
+	/////Branching penalty
+	//TMLTime _branchingPenalty;
 #endif
 	///Channel on which data was conveyed
 	TMLChannel* _channel;
diff --git a/simulators/c++2/src_simulator/app/Parameter.h b/simulators/c++2/src_simulator/app/Parameter.h
index adb444a3ed5f9413cf3e46a1a5a86e1d95e0c714..fc914dfb342c1a59219deee149f473e849b35737 100644
--- a/simulators/c++2/src_simulator/app/Parameter.h
+++ b/simulators/c++2/src_simulator/app/Parameter.h
@@ -72,46 +72,48 @@ public:
 	}
 	
 	SizedParameter(const T& ip1 ...){
-#if size>0
-		T arg=ip1;
-		va_list args; // argument list
-		va_start(args, ip1); // initialize args
-		for (unsigned int i=0;i<size;i++){
-			_p[i]=arg;
-			arg=va_arg(args, T);
+//#if size>0
+		if (size!=0){
+			T arg=ip1;
+			va_list args; // argument list
+			va_start(args, ip1); // initialize args
+			for (unsigned int i=0;i<size;i++){
+				_p[i]=arg;
+				arg=va_arg(args, T);
+			}
 		}
-#endif
+//#endif
 	}
 			
 	SizedParameter(std::istream& s){
-#if size>0
+//#if size>0
 		for (unsigned int i=0;i<size;i++){
 			READ_STREAM(s, _p[i]);
 		}
 #ifdef DEBUG_SERIALIZE
 		print();
 #endif
-#endif
+//#endif
 	}
 
 		
 	virtual ~SizedParameter(){
 	}
 		
-		///Print function for testing purposes
+	///Print function for testing purposes
 	void print() const{
 		std::cerr << "print " << size << " elements in mempool " << &memPool << " :\n";
-#if size>0
+//#if size>0	
 		for (unsigned int i=0;i<size;i++){
-			std::cerr << " p[" << (i+1) << "]:" << _p[i];
+				std::cerr << " p[" << (i+1) << "]:" << _p[i];
 		}
-#endif
+//#endif
 		std::cerr << std::endl;
 		std::cerr << "end print:\n";
 	}
 		
 	std::ostream& writeObject(std::ostream& s){
-#if size>0
+//#if size>0
 		//std::cout << "writeObject:\n";
 		for (unsigned int i=0;i<size;i++){
 			WRITE_STREAM(s, _p[i]);
@@ -119,7 +121,7 @@ public:
 #ifdef DEBUG_SERIALIZE
 		print();
 #endif
-#endif
+//#endif
 		//std::cout << "end writeObject:\n";
 		return s;
 	}
@@ -131,11 +133,11 @@ public:
 	void streamStateXML(std::ostream& s) const{
 		//std::cout << "streamStateXML:\n";
 		s << TAG_PARAMo;
-#if size>0
+//#if size>0
 		for (unsigned int i=0;i<size;i++){
 			s << TAG_Pxo << i << ">" << _p[i] << TAG_Pxc << i << ">";
 		}
-#endif
+//#endif
 		s << TAG_PARAMc;
 		//std::cout << "end streamStateXML:\n";
 	}
@@ -152,16 +154,18 @@ public:
 
 	void getP(void* op1 ...) const {
 		//std::cout << "getP:\n";
-#if size>0
-		T* arg= (T*) op1;
-		va_list args; // argument list
-		va_start(args, op1); // initialize args
-		for (unsigned int i=0;i<size;i++){
-			//std::cerr << "set Param " << i << "\n";
-			*arg=_p[i];
-			arg=va_arg(args, T*);
+		if(size!=0){
+//#if size>0
+			T* arg= (T*) op1;
+			va_list args; // argument list
+			va_start(args, op1); // initialize args
+			for (unsigned int i=0;i<size;i++){
+				//std::cerr << "set Param " << i << "\n";
+				*arg=_p[i];
+				arg=va_arg(args, T*);
+			}
 		}
-#endif
+//#endif
 		//std::cout << "end getP:\n";
 	}
 		
@@ -170,15 +174,15 @@ public:
 	//}
 		
 	void getStateHash(HashAlgo* iHash) const{
-#if size>0
-			//std::cout << "add param vals:\n";
-			for (unsigned int i=0;i<size;i++){
-				iHash->addValue((HashValueType)_p[i]);
-				//std::cout << _p[i] << ", ";
-			}
-			//std::cout << "\nend add param vals:\n";
-#endif
+//#if size>0
+		//std::cout << "add param vals:\n";
+		for (unsigned int i=0;i<size;i++){
+			iHash->addValue((HashValueType)_p[i]);
+			//std::cout << _p[i] << ", ";
 		}
+			//std::cout << "\nend add param vals:\n";
+//#endif
+	}
 		
 	static void * operator new(size_t iSize){
 			return memPool.pmalloc(iSize);
@@ -189,17 +193,17 @@ public:
 	}
 		
 	void readFromStream(std::istream &is){
-#if size>0
+//#if size>0
 		for (unsigned int i=0;i<size;i++){
 			is >> _p[i];
 		}
-#endif
+//#endif
 	}
 	protected:
 		static MemPool<SizedParameter<T,size> > memPool;
-#if size>0
-		T _p[size];
-#endif
+//#if size>0
+		T _p[(size==0)?1:size];
+//#endif
 		
 };
 
diff --git a/simulators/c++2/src_simulator/app/TMLCommand.cpp b/simulators/c++2/src_simulator/app/TMLCommand.cpp
index 9081bb0fae0e0c79ce82a99bf151e3be8cbe86fd..82933f058e9753454bb15f78e0c6600652ce2666 100755
--- a/simulators/c++2/src_simulator/app/TMLCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLCommand.cpp
@@ -60,17 +60,14 @@ TMLCommand::TMLCommand(ID iID, TMLTask* iTask, TMLLength iLength, unsigned int i
 		_instanceList.push_back(this);
 		_task->addCommand(iID, this);
 	}
-	//if (_liveVarList!=0) _hash = new HashAlgo(static_cast<HashValueType>(this), 70);
 }
 
 TMLCommand::~TMLCommand(){
-	if (_currTransaction!=0) delete _currTransaction;
+	//if (_currTransaction!=0) delete _currTransaction;  NEW
 	//if (_currTransaction!=0) std::cout << "transaction not yet deleted: " << getCommandStr() << std::endl;
 	if (_nextCommand!=0) delete[] _nextCommand;
-	//if (_param!=0) delete _param;
 	_instanceList.remove(this);
 	removeBreakpoint();
-	//if (_liveVarList!=0) delete _hash;
 }
 
 TMLCommand* TMLCommand::prepare(bool iInit){
@@ -257,14 +254,13 @@ std::istream& TMLCommand::readObject(std::istream& s){
 
 void TMLCommand::reset(){
 	_progress=0;
-	if (_currTransaction!=0) delete _currTransaction;
+	//if (_currTransaction!=0) delete _currTransaction; NEW
 	_currTransaction=0;
 	_commandStartTime=-1;
 	//_execTimes=0;
 	_stateHashes.clear();
 }
 
-//void TMLCommand::registerGlobalListener(CommandListener* iListener){
 void TMLCommand::registerGlobalListener(GeneralListener* iListener){
 	std::cout << "Global cmd listener created \n";
 	for(std::list<TMLCommand*>::iterator i=_instanceList.begin(); i != _instanceList.end(); ++i){
@@ -273,7 +269,6 @@ void TMLCommand::registerGlobalListener(GeneralListener* iListener){
 }
 
 template<typename T>
-//void TMLCommand::registerGlobalListenerForType(CommandListener* iListener, TMLTask* aTask){
 void TMLCommand::registerGlobalListenerForType(GeneralListener* iListener, TMLTask* aTask){
 	//std::cout << "Global cmd listener created \n";
 	for(std::list<TMLCommand*>::iterator i=_instanceList.begin(); i != _instanceList.end(); ++i){
@@ -281,7 +276,6 @@ void TMLCommand::registerGlobalListenerForType(GeneralListener* iListener, TMLTa
 	}
 }
 
-//void TMLCommand::removeGlobalListener(CommandListener* iListener){
 void TMLCommand::removeGlobalListener(GeneralListener* iListener){
 	for(std::list<TMLCommand*>::iterator i=_instanceList.begin(); i != _instanceList.end(); ++i){
 		(*i)->removeListener(iListener);
@@ -333,12 +327,6 @@ unsigned int TMLCommand::getType(){
 	return _type;
 }
 
-/*template void TMLCommand::registerGlobalListenerForType<IndeterminismSource>(CommandListener* iListener, TMLTask* aTask);
-template void TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(CommandListener* iListener, TMLTask* aTask);
-template void TMLCommand::registerGlobalListenerForType<TMLActionCommand>(CommandListener* iListener, TMLTask* aTask);
-template void TMLCommand::registerGlobalListenerForType<TMLNotifiedCommand>(CommandListener* iListener, TMLTask* aTask);
-template void TMLCommand::registerGlobalListenerForType<TMLWaitCommand>(CommandListener* iListener, TMLTask* aTask);*/
-
 template void TMLCommand::registerGlobalListenerForType<IndeterminismSource>(GeneralListener* iListener, TMLTask* aTask);
 template void TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(GeneralListener* iListener, TMLTask* aTask);
 template void TMLCommand::registerGlobalListenerForType<TMLActionCommand>(GeneralListener* iListener, TMLTask* aTask);
diff --git a/simulators/c++2/src_simulator/app/TMLCommand.h b/simulators/c++2/src_simulator/app/TMLCommand.h
index 6a0f141bbfbb78bca7d417fb3e6c2e55d2c1d910..90747ef8bcb0d9283d96de8a840e4f1a871061d0 100755
--- a/simulators/c++2/src_simulator/app/TMLCommand.h
+++ b/simulators/c++2/src_simulator/app/TMLCommand.h
@@ -45,11 +45,10 @@ Ludovic Apvrille, Renaud Pacalet
 #include <Serializable.h>
 #include <ListenerSubject.h>
 #include <GeneralListener.h>
+#include <TMLTransaction.h>
 
-class TMLTransaction;
 class TMLTask;
 class TMLChannel;
-//class CommandListener;
 class Comment;
 class SimComponents;
 class HashAlgo;
@@ -236,7 +235,6 @@ protected:
 	///Number of successors of this command
 	unsigned int _nbOfNextCmds;
 	///Breakpoint
-	//CommandListener* _breakpoint;
 	GeneralListener* _breakpoint;
 	///Is true until the first transaction of a task is executed
 	bool _justStarted;
@@ -265,6 +263,8 @@ protected:
 	bool _checkpoint;
 	///Number of executions of the command
 	unsigned int _execTimes;
+	///Buffer for transaction to be proposed to kernel
+	TMLTransaction transBuffer;
 	/////Hash Algorithm object
 	//HashAlgo* _hash;
 };
diff --git a/simulators/c++2/src_simulator/app/TMLEventBChannel.h b/simulators/c++2/src_simulator/app/TMLEventBChannel.h
index 21acfacb124b956ce0fb4a1c23e29e857c133774..26bf9397bc7c8d98b7aa92542d36dec7a2f4f517 100644
--- a/simulators/c++2/src_simulator/app/TMLEventBChannel.h
+++ b/simulators/c++2/src_simulator/app/TMLEventBChannel.h
@@ -89,16 +89,16 @@ public:
 
 	void write(TMLTransaction* iTrans){
 		this->_content++;
-	#if paramNo>0
-		//if (paramNo!=0){
+	//#if paramNo>0
+		if (paramNo!=0){
 			//this->_paramQueue.push_back(_tmpParam);
 			//std::cerr << "write!\n";
 			this->_paramQueue.push_back(iTrans->getCommand()->setParams(0));
 	#ifdef STATE_HASH_ENABLED
 			_tmpParam->getStateHash(&_stateHash);  //new in if
 	#endif
-		//}
-	#endif
+		}
+	//#endif
 		if (this->_readTrans!=0 && this->_readTrans->getVirtualLength()==0){
 			this->_readTrans->setRunnableTime(iTrans->getEndTime());
 			this->_readTrans->setChannel(this);
@@ -119,16 +119,16 @@ public:
 			if (this->_content==0 && _sourceIsFile) readNextEvents();
 			//std::cout << "read next" << std::endl;
 			//if (this->_readTrans->getCommand()->getParamFuncPointer()!=0) (this->_readTask->*(this->_readTrans->getCommand()->getParamFuncPointer()))(this->_paramQueue.front()); //NEW
-	#if paramNo>0
-			//if (paramNo!=0){
-				//std::cerr << "read! ...";
+	//#if paramNo>0
+			if (paramNo!=0){
+				//std::cout << "read! ...";
 				//this->_paramQueue.front()->print();
 				//std::cerr << "\n";
 				this->_readTrans->getCommand()->setParams(this->_paramQueue.front());
 				delete dynamic_cast<SizedParameter<T,paramNo>*>(this->_paramQueue.front());
 				this->_paramQueue.pop_front();  //NEW
-			//}
-	#endif
+			}
+	//#endif
 	#ifdef STATE_HASH_ENABLED
 			//_stateHash-=this->_paramQueue.front().getStateHash();
 			//this->_paramQueue.front().removeStateHash(&_stateHash);
diff --git a/simulators/c++2/src_simulator/app/TMLEventFBChannel.h b/simulators/c++2/src_simulator/app/TMLEventFBChannel.h
index 0cf521b97ce2387f8cf975b15d03add10f5b05bb..27b63b311e2cd004c7377a4ceb43e41c579329af 100644
--- a/simulators/c++2/src_simulator/app/TMLEventFBChannel.h
+++ b/simulators/c++2/src_simulator/app/TMLEventFBChannel.h
@@ -66,10 +66,10 @@ public:
 
 	void testWrite(TMLTransaction* iTrans){
 		this->_writeTrans=iTrans;
-	#if paramNo>0
+	//#if paramNo>0
 		//if (paramNo!=0) this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
-		this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
-	#endif
+		if (paramNo!=0) this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
+	//#endif
 		this->_writeTrans->setVirtualLength((_length-this->_content>0)?WAIT_SEND_VLEN:0);
 		this->_overflow = (this->_content==_length);
 	}
@@ -83,14 +83,14 @@ public:
 
 	void write(TMLTransaction* iTrans){
 		this->_content++;
-	#if paramNo>0
-		//if (paramNo!=0){
+	//#if paramNo>0
+		if (paramNo!=0){
 			this->_paramQueue.push_back(this->_tmpParam);   //NEW
 	#ifdef STATE_HASH_ENABLED
 			this->_tmpParam->getStateHash(&_stateHash);   //NEW in if
 	#endif
-		//}
-	#endif
+		}
+	//#endif
 		if (this->_readTrans!=0 && this->_readTrans->getVirtualLength()==0){
 			//std::cout << "FB: Wake up trans in channel: " << this->_name << "\n";
 			this->_readTrans->setRunnableTime(iTrans->getEndTime());
@@ -110,13 +110,13 @@ public:
 		}else{
 			this->_content--;
 			//if (this->_readTrans->getCommand()->getParamFuncPointer()!=0) (this->_readTask->*(this->_readTrans->getCommand()->getParamFuncPointer()))(this->_paramQueue.front()); //NEW
-	#if paramNo>0
-			//if (paramNo!=0){
+	//#if paramNo>0
+			if (paramNo!=0){
 				this->_readTrans->getCommand()->setParams(this->_paramQueue.front());
 				delete dynamic_cast<SizedParameter<T,paramNo>*>(this->_paramQueue.front());
 				this->_paramQueue.pop_front();  //NEW
-			//}
-	#endif
+			}
+	//#endif
 	#ifdef STATE_HASH_ENABLED
 			//_stateHash-=this->_paramQueue.front().getStateHash();
 			//this->_paramQueue.front().removeStateHash(&_stateHash);
diff --git a/simulators/c++2/src_simulator/app/TMLEventFChannel.h b/simulators/c++2/src_simulator/app/TMLEventFChannel.h
index c2605ec088027a9f21a5eea77a01badcf95458cb..af418f0ed4572dd1850ec6830c7df75a9c36d575 100644
--- a/simulators/c++2/src_simulator/app/TMLEventFChannel.h
+++ b/simulators/c++2/src_simulator/app/TMLEventFChannel.h
@@ -67,9 +67,9 @@ public:
 	void testWrite(TMLTransaction* iTrans){
 		this->_writeTrans=iTrans;
 		//if (paramNo!=0) this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
-#if paramNo>0
-		this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
-#endif
+//#if paramNo>0
+		if (paramNo!=0) this->_tmpParam = iTrans->getCommand()->setParams(0);  //NEW in if
+//#endif
 		this->_writeTrans->setVirtualLength(WAIT_SEND_VLEN);
 		this->_overflow = (this->_content==_length);
 	}
@@ -84,14 +84,14 @@ public:
 	void write(TMLTransaction* iTrans){
 		if (this->_content<_length){
 			this->_content++;
-	#if paramNo>0
-			//if (paramNo!=0){
+	//#if paramNo>0
+			if (paramNo!=0){
 				this->_paramQueue.push_back(this->_tmpParam);   //NEW
 	#ifdef STATE_HASH_ENABLED
 				this->_tmpParam->getStateHash(&_stateHash);	//new in if
 	#endif
-			//}
-	#endif
+			}
+	//#endif
 			if (this->_readTrans!=0 && this->_readTrans->getVirtualLength()==0){
 				this->_readTrans->setRunnableTime(iTrans->getEndTime());
 				this->_readTrans->setChannel(this);
@@ -111,13 +111,13 @@ public:
 		}else{
 			this->_content--;
 			//if (this->_readTrans->getCommand()->getParamFuncPointer()!=0) (this->_readTask->*(this->_readTrans->getCommand()->getParamFuncPointer()))(this->_paramQueue.front()); //NEW
-	#if paramNo>0
-			//if (paramNo!=0){
+	//#if paramNo>0
+			if (paramNo!=0){
 				this->_readTrans->getCommand()->setParams(this->_paramQueue.front());
 				delete dynamic_cast<SizedParameter<T,paramNo>*>(this->_paramQueue.front());
 				this->_paramQueue.pop_front();  //NEW
-			//}
-	#endif
+			}
+	//#endif
 	#ifdef STATE_HASH_ENABLED
 			//_stateHash-=this->_paramQueue.front().getStateHash();
 			//this->_paramQueue.front().removeStateHash(&_stateHash);
diff --git a/simulators/c++2/src_simulator/app/TMLEventSizedChannel.h b/simulators/c++2/src_simulator/app/TMLEventSizedChannel.h
index a9f73af392ded6840b48cbfae9f73bc2a5ad3cfd..73ce8657eed87c5ae53dfb127c4eb6e56c649f98 100644
--- a/simulators/c++2/src_simulator/app/TMLEventSizedChannel.h
+++ b/simulators/c++2/src_simulator/app/TMLEventSizedChannel.h
@@ -76,14 +76,15 @@ public:
 	virtual std::ostream& writeObject(std::ostream& s){
 		//std::cout << "write size of channel " << _name << " :" << _content << std::endl;
 		TMLStateChannel::writeObject(s);
-#if paramNo>0
-		ParamQueue::iterator i;
-		//if (paramNo!=0){
+//#if paramNo>0
+		
+		if (paramNo!=0){
+			ParamQueue::iterator i;
 			for(i=_paramQueue.begin(); i != _paramQueue.end(); ++i){
 				(*i)->writeObject(s);
 			}
-		//}
-#endif
+		}
+//#endif
 		//for_each( _paramQueue.begin(), _paramQueue.end(), std::bind2nd(std::bind1st(std::mem_fun(&(Parameter<ParamType>::writeObject)),s),(unsigned int)_writeTask));
 		return s;
 	}
@@ -93,17 +94,17 @@ public:
 		TMLStateChannel::readObject(s);
 		//std::cout << "Read Object TMLEventChannel " << _name << std::endl;
 		//_paramQueue.clear();
-#if paramNo>0
+//#if paramNo>0
 		TMLLength aParamNo;
-		ParamQueue::iterator i;
-		//if (paramNo!=0){
+		if (paramNo!=0){
+			ParamQueue::iterator i;
 			for(aParamNo=0; aParamNo < _content; aParamNo++){
 				//aNewParam = new Parameter<ParamType>(s, (unsigned int) _writeTask);
 				//_paramQueue.push_back(Parameter<ParamType>(s));
 				_paramQueue.push_back(new SizedParameter<T,paramNo>(s));
 			}
-		//}
-#endif
+		}
+//#endif
 		_hashValid = false;
 		return s;
 	}
@@ -118,11 +119,13 @@ public:
 		//std::cout << "EventChannel reset" << std::endl;
 		ParamQueue::iterator i;
 		TMLStateChannel::reset();
-	#if paramNo>0
-		for(i=_paramQueue.begin(); i != _paramQueue.end(); ++i)
-			delete dynamic_cast<SizedParameter<T,paramNo>*>(*i);
-		_paramQueue.clear();
-	#endif
+	//#if paramNo>0
+		if (paramNo!=0){
+			for(i=_paramQueue.begin(); i != _paramQueue.end(); ++i)
+				delete dynamic_cast<SizedParameter<T,paramNo>*>(*i);
+			_paramQueue.clear();
+		}
+	//#endif
 		_stateHash.init((HashValueType)_ID, 30);
 		_hashValid=true;
 		//std::cout << "EventChannel reset end" << std::endl; 
@@ -142,8 +145,8 @@ public:
 		//TMLStateChannel::getStateHash(iHash);
 		//iHash->addValue(_stateHash.getHash());
 		if (_significance!=0){
-	#if paramNo>0
-			//if (paramNo!=0){
+	//#if paramNo>0
+			if (paramNo!=0){
 				if (!_hashValid){
 					_stateHash.init((HashValueType)_ID, 30);
 					for(ParamQueue::const_iterator i=_paramQueue.begin(); i != _paramQueue.end(); ++i){
@@ -152,8 +155,8 @@ public:
 					_hashValid = true;
 				}
 				iHash->addValue(_stateHash.getHash());
-			//}
-	#endif
+			}
+	//#endif
 			iHash->addValue(_content);
 		}
 	}
diff --git a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp
index 28f7476021960170e69c51689abeea35d00f24e7..dc09901665be6e0d2b9c7045bc565675df7b37d3 100755
--- a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp
@@ -68,7 +68,8 @@ TMLCommand* TMLExeciCommand::prepareNextTransaction(){
 		}
 	}
 
-	_currTransaction=new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	_currTransaction = new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
 	//std::cout << "new fails? " << _currTransaction->toString() << std::endl;
 	return this;
 }
diff --git a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp
index f63f4724ad04b52c6c33d2475cc2e27dbd8d6467..389d06903e8afda95392f50b1cd38cc52db01bb2 100644
--- a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp
@@ -65,7 +65,8 @@ TMLCommand* TMLExeciRangeCommand::prepareNextTransaction(){
 			if (aNextCommand!=0) return aNextCommand->prepare(false);
 		}
 	}
-	_currTransaction=new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	_currTransaction = new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
 	//std::cout << "new fails? " << _currTransaction->toString() << std::endl;
 	return this;
 }
@@ -98,5 +99,5 @@ void TMLExeciRangeCommand::setRandomValue(unsigned int iValue){
 	//ParamType aMax, aMin;
 	//(_task->*_rangeFunc)(aMin, aMax);
 	_length= _minRange + iValue;
-	_currTransaction=new TMLTransaction(this, _length,_task->getEndLastTransaction());
+	_currTransaction = :: new (&transBuffer) TMLTransaction(this, _length,_task->getEndLastTransaction());
 }
diff --git a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp
index 4d9b39d3d7df7dbd99c523ef497dabf3311c03f8..2da8c78e305cb0cb4647d12e715b5a50b36de4ed 100644
--- a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp
@@ -44,7 +44,7 @@ Ludovic Apvrille, Renaud Pacalet
 #include <TMLTransaction.h>
 #include <Bus.h>
 
-TMLNotifiedCommand::TMLNotifiedCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel,TMLLength* iResultVar, const std::string& iResultVarDescr, const char* iLiveVarList, bool iCheckpoint): TMLCommand(iID, iTask, WAIT_SEND_VLEN, 1, iLiveVarList, iCheckpoint),_channel(iChannel),_resultVar(iResultVar),_resultVarDescr(iResultVarDescr){
+TMLNotifiedCommand::TMLNotifiedCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel,ParamType* iResultVar, const std::string& iResultVarDescr, const char* iLiveVarList, bool iCheckpoint): TMLCommand(iID, iTask, WAIT_SEND_VLEN, 1, iLiveVarList, iCheckpoint),_channel(iChannel),_resultVar(iResultVar),_resultVarDescr(iResultVarDescr){
 	_type=NOTIF;
 }
 
@@ -62,7 +62,8 @@ void TMLNotifiedCommand::execute(){
 }
 
 TMLCommand* TMLNotifiedCommand::prepareNextTransaction(){
-	_currTransaction=new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
 	return this;
 }
 
diff --git a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h
index 1c3da98fc3a632db890c21ecad12d23882f0874d..b9182917af93aed1b4dbab88f2534e654d4d7d32 100644
--- a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h
+++ b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h
@@ -59,7 +59,7 @@ public:
 	\param iLiveVarList Bitmap of live variables
 	\param iCheckpoint Checkpoint Flag
 	*/
-	TMLNotifiedCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel,TMLLength* iResultVar,const std::string& iResultVarDescr, const char* iLiveVarList, bool iCheckpoint);
+	TMLNotifiedCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel,ParamType* iResultVar,const std::string& iResultVarDescr, const char* iLiveVarList, bool iCheckpoint);
 	void execute();
 	//TMLTask* getDependentTask() const;
 	TMLChannel* getChannel() const;
@@ -73,7 +73,7 @@ protected:
 	///Channel on which the event is conveyed
 	TMLEventChannel* _channel;
 	///Index of the statement to execute (this value is passed to TMLTask::executeStatement())
-	TMLLength* _resultVar;
+	ParamType* _resultVar;
 	///String representation of the result variable
 	std::string _resultVarDescr;
 	TMLCommand* prepareNextTransaction();
diff --git a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp
index 8bffd6baf9794079054c54b9add95c5a3f9a2200..c818384faf1896f701a962881b2b8cf468613b2d 100755
--- a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp
@@ -75,7 +75,8 @@ TMLCommand* TMLReadCommand::prepareNextTransaction(){
 		}
 	}
 
-	_currTransaction=new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
 	//std::cout << "before test read" << std::endl;
 	//std::cout << "--begin-- TMLReadCommand::prepareNextTransaction\n"; 
 	_channel->testRead(_currTransaction);
diff --git a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp
index 3e4daa8cc3ee1b3fb0c419db03842a7e63c8bf5d..2fce78bf00b27ff13741ef68a91b6119a165fd38 100644
--- a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp
@@ -62,7 +62,8 @@ void TMLRequestCommand::execute(){
 
 TMLCommand* TMLRequestCommand::prepareNextTransaction(){
 	//std::cout << "prepare bext transaction testWrite prg:" << _progress << " to execute:" << (*_pLength)-_progress << std::endl;
-	_currTransaction=new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction(),_channel);
 	_channel->testWrite(_currTransaction);
 	return this;
 }
diff --git a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp
index 2ee5b462045525b1bf8695b9e482d17c76c1d78c..405dd98d4153a7ec143e158d423a848983cc20ff 100644
--- a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp
@@ -122,7 +122,8 @@ void TMLSelectCommand::execute(){
 TMLCommand* TMLSelectCommand::prepareNextTransaction(){
 	unsigned int i;
 	//std::cout << "SC: New transaction."<< std::endl;
-	_currTransaction=new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
+	_currTransaction = new TMLTransaction(this, _length-_progress,_task->getEndLastTransaction());
 	//std::cout << "SC: loop."<< std::endl;
 	for (i=0;i<_nbOfNextCmds && _maxChannelIndex==0;i++){
 		//std::cout << "SC: inner."<< i<< std::endl;
diff --git a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp
index 356a9eb1b7e68bd2ccc6eda0298bf8b767b0de01..51d4a4d8afd5a1d8cba578dff8dbe7e0d3872fe1 100644
--- a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp
@@ -64,7 +64,8 @@ void TMLSendCommand::execute(){
 }
 
 TMLCommand* TMLSendCommand::prepareNextTransaction(){
-	_currTransaction=new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
 	_channel->testWrite(_currTransaction);
 	return this;
 }
diff --git a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp
index 285597edf432a29c52456e4ae7c49f483342339b..3bbc35e0b9c844cdafbc390d633a60a3f9f6e183 100644
--- a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp
@@ -63,7 +63,8 @@ void TMLWaitCommand::execute(){
 TMLCommand* TMLWaitCommand::prepareNextTransaction(){
 	//std::cout << "wait command length: " << _length  << "  progress: " << _progress << std::endl; 
 	if (_progress==0 && _channel->getRequestChannel()) _task->finished();
-	_currTransaction=new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
 	_channel->testRead(_currTransaction);
 	return this;
 }
diff --git a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp
index 73309c629475ab4d3abce2ebc119564c8e416d53..a3dccdecec533a13fb2ae6a2519e4083d781534e 100755
--- a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp
@@ -77,7 +77,8 @@ TMLCommand* TMLWriteCommand::prepareNextTransaction(){
 		}
 	}
 	
-	_currTransaction=new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
+	_currTransaction = new TMLTransaction(this, _length-_progress, _task->getEndLastTransaction(), _channel);
 	//std::cout << "before test write" << std::endl;
 	//std::cout << "--begin-- TMLWriteCommand::prepareNextTransaction\n"; 
 	_channel->testWrite(_currTransaction);
diff --git a/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp b/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp
index 764a6d9bf4c0c8ee48e1e20319600fb275e353bc..394b09f120f7a60f3e2471d5a5a9e6db44e0edda 100644
--- a/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp
+++ b/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp
@@ -71,7 +71,8 @@ TMLCommand* TMLWriteMultCommand::prepareNextTransaction(){
 	}
 	TMLLength unitsLeft =_length-_progress;
 	//TMLLength minLength;
-	_currTransaction=new TMLTransaction(this, unitsLeft, _task->getEndLastTransaction(), _channels[0]);
+	//_currTransaction = ::new (&transBuffer) TMLTransaction(this, unitsLeft, _task->getEndLastTransaction(), _channels[0]);
+	_currTransaction = new TMLTransaction(this, unitsLeft, _task->getEndLastTransaction(), _channels[0]);
 	//_channels[0]->testWrite(_currTransaction);
 	//minLength=_currTransaction->getVirtualLength();
 	//std::cout << "--begin-- TMLWriteMultCommand::prepareNextTransaction\n"; 
diff --git a/simulators/c++2/src_simulator/arch/Bus.cpp b/simulators/c++2/src_simulator/arch/Bus.cpp
index 53e89250706f4ee97cbdd5ad18bb9d4867d1547f..09499c18d52ce4759c2bd603f7f26c9f5afe6d1d 100644
--- a/simulators/c++2/src_simulator/arch/Bus.cpp
+++ b/simulators/c++2/src_simulator/arch/Bus.cpp
@@ -76,11 +76,12 @@ void Bus::registerTransaction(){
 	_nextTransaction=0;
 }
 
-bool Bus::addTransaction(){
+bool Bus::addTransaction(TMLTransaction* iTransToBeAdded){
 	//std::cout << "Bus add trans " << _nextTransaction << "\n";
 	_endSchedule = _nextTransaction->getEndTime();
 	//std::cout << "set end time to " << _endSchedule << "\n";
-	_transactList.push_back(_nextTransaction);
+	//_transactList.push_back(_nextTransaction);
+	_transactList.push_back(iTransToBeAdded);  //NEW!!!!!
 	_busyCycles += _nextTransaction->getOperationLength();
 #ifdef DEBUG_BUS
 	std::cout << "Bus::addTrans: add trans at bus " << _name << ": " << _nextTransaction->toString() << std::endl;
@@ -99,7 +100,7 @@ void Bus::calcStartTimeLength(TMLTime iTimeSlice) const{
 	
 	//if (_nextTransaction->getOperationLength()!=-1){
 	if (iTimeSlice!=0){
-		_nextTransaction->setVirtualLength(min(_nextTransaction->getVirtualLength(), iTimeSlice *_busWidth/_timePerSample));
+		_nextTransaction->setVirtualLength(max(min(_nextTransaction->getVirtualLength(), iTimeSlice *_busWidth/_timePerSample),(TMLTime)1));
 	}
 	TMLTime aLength = _nextTransaction->getVirtualLength();
 	
diff --git a/simulators/c++2/src_simulator/arch/Bus.h b/simulators/c++2/src_simulator/arch/Bus.h
index 30dc88010472fcf8f6463d82e9945d8c1604ee53..9f0acba7bffafea727b3e4681b0983d1dbbbf04b 100644
--- a/simulators/c++2/src_simulator/arch/Bus.h
+++ b/simulators/c++2/src_simulator/arch/Bus.h
@@ -77,7 +77,7 @@ public:
 	///Determines the next bus transaction to be executed
 	void schedule();
 	///Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions
-	bool addTransaction();
+	bool addTransaction(TMLTransaction* iTransToBeAdded);
 	///Returns a pointer to the transaction determined by the scheduling algorithm
     	/**
       	\return Pointer to transaction
diff --git a/simulators/c++2/src_simulator/arch/BusMaster.h b/simulators/c++2/src_simulator/arch/BusMaster.h
index cf0da5c5a9447c3077c5958e2becc3e2e856c319..7515e32130bc89cd65ad4db5b699233ee2a141a3 100644
--- a/simulators/c++2/src_simulator/arch/BusMaster.h
+++ b/simulators/c++2/src_simulator/arch/BusMaster.h
@@ -103,10 +103,10 @@ public:
 		return _nextTransaction;
 	}
 
-	void addTransaction(){
+	void addTransaction(TMLTransaction* iTransToBeAdded){
 		//std::cout << _name << ": add Trans\n";
 		//std::cout << _name << ": trans added on Bus: " << _nextBus->toString() << std::endl;
-		_nextBus->addTransaction();
+		_nextBus->addTransaction(iTransToBeAdded);
 		_nextTransaction=0;
 		//std::cout << _name << ": end add" << std::endl;
 	}
diff --git a/simulators/c++2/src_simulator/arch/RRPrioScheduler.cpp b/simulators/c++2/src_simulator/arch/RRPrioScheduler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6efcbaf570f9480f263da2152389836d62799f4f
--- /dev/null
+++ b/simulators/c++2/src_simulator/arch/RRPrioScheduler.cpp
@@ -0,0 +1,203 @@
+/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck,
+Ludovic Apvrille, Renaud Pacalet
+ *
+ * ludovic.apvrille AT telecom-paristech.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.
+ *
+ */
+#include <RRPrioScheduler.h>
+#include <TMLTransaction.h>
+#include <TMLCommand.h>
+#include <TMLTask.h>
+
+RRPrioScheduler::RRPrioScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice ,TMLTime iMinSliceSize): WorkloadSource(iPrio), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
+}
+
+RRPrioScheduler::RRPrioScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice ,TMLTime iMinSliceSize, WorkloadSource** aSourceArray, unsigned int iNbOfSources): WorkloadSource(iPrio, aSourceArray, iNbOfSources), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
+}
+
+TMLTime RRPrioScheduler::schedule(TMLTime iEndSchedule){
+	TaskList::iterator i;
+	//std::cout << _name << ": Schedule called \n";
+	TMLTransaction *anOldTransaction=_nextTransaction, *aTempTrans;
+	TMLTime aLowestRunnableTimeFuture=-1,aRunnableTime, aLowestRunnableTimePast=-1;
+	WorkloadSource *aSourcePast=0, *aSourceFuture=0;
+	//, *aScheduledSource=0;
+	bool aSameTaskFound=false;
+	if (_lastSource!=0){
+		//aScheduledSource=_lastSource;
+		_lastSource->schedule(iEndSchedule);
+		if (_lastSource->getNextTransaction(iEndSchedule)!=0 && _lastSource->getNextTransaction(iEndSchedule)->getVirtualLength()!=0){
+			//if (anOldTransaction==0 || _lastSource->getNextTransaction(iEndSchedule)==anOldTransaction || _timeSlice >=_elapsedTime +  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength() + _minSliceSize){
+			if (anOldTransaction==0 || _lastSource->getNextTransaction(iEndSchedule)==anOldTransaction || _timeSlice >=_elapsedTime +  anOldTransaction->getOperationLength() + _minSliceSize){
+				std::cout << "Select same task, remaining: " << _timeSlice - anOldTransaction->getOperationLength() << "\n";
+				aSourcePast=_lastSource;
+				aSameTaskFound=true;
+			}
+		}
+	}
+	if (!aSameTaskFound){
+		//std::cout << _name << ": Second if\n";
+		Priority aHighestPrioPast=-1;
+		
+		for(WorkloadList::iterator i=_workloadList.begin(); i != _workloadList.end(); ++i){
+			//std::cout << "Loop\n";
+			//if (*i!=aScheduledSource)
+			 (*i)->schedule(iEndSchedule);
+			//std::cout << _name << " schedules, before getCurrTransaction " << std::endl;
+			aTempTrans=(*i)->getNextTransaction(iEndSchedule);
+			//std::cout << "after getCurrTransaction " << std::endl;
+			
+			//if ((*i)->getPriority()<aHighestPrioPast){
+				
+			if (aTempTrans!=0 && aTempTrans->getVirtualLength()!=0){
+				aRunnableTime=aTempTrans->getRunnableTime();	
+				if (aRunnableTime<=iEndSchedule){
+					//Past
+					if ((*i)->getPriority()<aHighestPrioPast || ((*i)->getPriority()==aHighestPrioPast && aRunnableTime<aLowestRunnableTimePast)){
+						aHighestPrioPast=(*i)->getPriority();
+						aLowestRunnableTimePast=aRunnableTime;
+						aSourcePast=*i;
+					}
+				}else{
+					//Future
+					if(aRunnableTime<aLowestRunnableTimeFuture){
+						aLowestRunnableTimeFuture=aRunnableTime;
+						aSourceFuture=*i;
+					}
+					
+				}
+			}
+		}
+	}
+	if (aSourcePast==0){
+		_nextTransaction=(aSourceFuture==0)? 0 : aSourceFuture->getNextTransaction(iEndSchedule);
+		_lastSource=aSourceFuture;
+	}else{
+		_nextTransaction=aSourcePast->getNextTransaction(iEndSchedule);
+		_lastSource=aSourcePast;
+	}
+	if (aSameTaskFound){
+		//std::cout << _name << ": Same source found " << _lastSource->toString() << "\n";
+		//if (_nextTransaction!=anOldTransaction){
+		if (_nextTransaction!=anOldTransaction && anOldTransaction!=0){
+			//std::cout << _name << ": Elapsed time increased by " << anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength() << "\n";
+			//_elapsedTime +=  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength();
+			_elapsedTime +=  anOldTransaction->getOperationLength();
+		}
+		//std::cout << "Not crashed\n" ;
+	}else{
+		//if (_lastSource==0)
+			//std::cout << _name << ": No source found\n";
+		//else
+			//std::cout << _name << ": New  source found " << _lastSource->toString() << "\n";
+		 _elapsedTime=0;
+	}
+	//if (_nextTransaction!=0){
+	//	_nextTransaction->setLength(min(_nextTransaction->getOperationLength(), _timeSlice-_elapsedTime));
+	//}
+	//std::cout << "End schedule\n" ;
+	return _timeSlice-_elapsedTime;
+}
+
+TMLTransaction* RRPrioScheduler::getNextTransaction(TMLTime iEndSchedule) const{
+	return _nextTransaction;
+}
+
+void RRPrioScheduler::reset(){
+	WorkloadSource::reset();
+	_nextTransaction=0;
+	_elapsedTime=0;
+	_lastSource=0;
+}
+
+std::string RRPrioScheduler::toString() const{
+	return _name;
+}
+
+RRPrioScheduler::~RRPrioScheduler(){
+	std::cout << _name << ": Scheduler deleted\n";
+}
+
+std::istream& RRPrioScheduler::readObject(std::istream &is){
+	WorkloadSource::readObject(is);
+	READ_STREAM(is,_elapsedTime);
+#ifdef DEBUG_SERIALIZE
+	std::cout << "Read: RRScheduler " << _name << " elapsedTime: " << _elapsedTime << std::endl;
+#endif
+	int aLastSourceIndex;
+	READ_STREAM(is, aLastSourceIndex);
+#ifdef DEBUG_SERIALIZE
+	std::cout << "Read: RRScheduler " << _name << " lastSourceIndex: " << aLastSourceIndex << std::endl;
+#endif
+	if (aLastSourceIndex==-1){
+		_lastSource=0;
+	}else{
+		WorkloadList::iterator i=_workloadList.begin();
+		std::advance(i, aLastSourceIndex);
+		_lastSource=*i;
+	}
+	return is;
+}
+
+std::ostream& RRPrioScheduler::writeObject(std::ostream &os){
+	WorkloadSource::writeObject(os);
+	WRITE_STREAM(os,_elapsedTime);
+#ifdef DEBUG_SERIALIZE
+	std::cout << "Write: RRScheduler " << _name << "  elapsedTime: " << _elapsedTime << std::endl;
+#endif
+	int aLastSourceIndex;
+	if (_lastSource==0){
+		aLastSourceIndex=-1;
+	}else{
+		aLastSourceIndex=0;
+		for(WorkloadList::iterator i=_workloadList.begin(); i != _workloadList.end(); ++i){
+			if (*i==_lastSource)
+				break;
+			else
+				aLastSourceIndex++;
+		}
+	}
+	WRITE_STREAM(os, aLastSourceIndex);
+#ifdef DEBUG_SERIALIZE
+	std::cout << "Write: RRScheduler " << _name << " lastSourceIndex: " << aLastSourceIndex << std::endl;
+#endif
+	return os;
+}
+
+//void RRScheduler::transWasScheduled(SchedulableDevice* iDevice){
+//	if (_lastSource!=0) _lastSource->transWasScheduled(iDevice);
+//}
+
diff --git a/simulators/c++2/src_simulator/arch/RRPrioScheduler.h b/simulators/c++2/src_simulator/arch/RRPrioScheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc9722da763bfbfc2175e9a06b2fbd397a28370b
--- /dev/null
+++ b/simulators/c++2/src_simulator/arch/RRPrioScheduler.h
@@ -0,0 +1,92 @@
+/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck,
+Ludovic Apvrille, Renaud Pacalet
+ *
+ * ludovic.apvrille AT telecom-paristech.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.
+ *
+ */
+#ifndef RRPrioSchedulerH
+#define RRPrioSchedulerH
+#include <WorkloadSource.h>
+
+class TMLTransaction;
+
+///Round Robin Priotity based scheduler
+class RRPrioScheduler: public WorkloadSource{
+public:
+	///Constructor
+    	/**
+	\param iName Name of the scheduler
+      	\param iPrio Priority of the scheduler
+	\param iTimeSlice Time slice which is granted to clients
+	\param iMinSliceSize Minimum size of a time slice
+    	*/
+	RRPrioScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize);
+	//RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice);
+	///Constructor
+    	/**
+	\param iName Name of the scheduler
+      	\param iPrio Priority of the scheduler
+	\param iTimeSlice Time slice which is granted to clients
+	\param iMinSliceSize Minimum size of a time slice
+	\param aSourceArray Array of pointers to workload ressources from which transactions may be received
+	\param iNbOfSources Length of the array
+    	*/
+	RRPrioScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize, WorkloadSource** aSourceArray, unsigned int iNbOfSources);
+	//RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, WorkloadSource** aSourceArray, unsigned int iNbOfSources);
+	///Destructor
+	~RRPrioScheduler();
+	TMLTime schedule(TMLTime iEndSchedule);
+	TMLTransaction* getNextTransaction(TMLTime iEndSchedule) const;
+	void reset();
+	std::istream& readObject(std::istream &is);
+	std::ostream& writeObject(std::ostream &os);
+	std::string toString() const;
+	//void transWasScheduled(SchedulableDevice* iDevice);
+protected:
+	///Name of the scheduler
+	std::string _name;
+	///Next transaction to be executed
+	TMLTransaction* _nextTransaction;
+	///Time slice which is granted to ressources
+	TMLTime _timeSlice;
+	///Minimum size of a time slice
+	TMLTime _minSliceSize;
+	///Consumed portion of a time slice
+	TMLTime _elapsedTime;
+	///Last workload source to which ressource access was granted
+	WorkloadSource* _lastSource;
+};
+#endif
diff --git a/simulators/c++2/src_simulator/arch/RRScheduler.cpp b/simulators/c++2/src_simulator/arch/RRScheduler.cpp
index aab1e1bcef6a7f9d9b35ea21ea820db515e9041d..4b41edb3c8da20272c38d39774d618ff45c21dde 100644
--- a/simulators/c++2/src_simulator/arch/RRScheduler.cpp
+++ b/simulators/c++2/src_simulator/arch/RRScheduler.cpp
@@ -42,10 +42,10 @@ Ludovic Apvrille, Renaud Pacalet
 #include <TMLCommand.h>
 #include <TMLTask.h>
 
-RRScheduler::RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize): WorkloadSource(iPrio), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
+RRScheduler::RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice ,TMLTime iMinSliceSize): WorkloadSource(iPrio), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
 }
 
-RRScheduler::RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize, WorkloadSource** aSourceArray, unsigned int iNbOfSources): WorkloadSource(iPrio, aSourceArray, iNbOfSources), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
+RRScheduler::RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice ,TMLTime iMinSliceSize, WorkloadSource** aSourceArray, unsigned int iNbOfSources): WorkloadSource(iPrio, aSourceArray, iNbOfSources), _name(iName), _nextTransaction(0), _timeSlice(iTimeSlice), _minSliceSize(iMinSliceSize), _elapsedTime(0), _lastSource(0){
 }
 
 TMLTime RRScheduler::schedule(TMLTime iEndSchedule){
@@ -53,14 +53,16 @@ TMLTime RRScheduler::schedule(TMLTime iEndSchedule){
 	//std::cout << _name << ": Schedule called \n";
 	TMLTransaction *anOldTransaction=_nextTransaction, *aTempTrans;
 	TMLTime aLowestRunnableTimeFuture=-1,aRunnableTime, aLowestRunnableTimePast=-1;
-	WorkloadSource *aSourcePast=0, *aSourceFuture=0, *aScheduledSource=0;
+	WorkloadSource *aSourcePast=0, *aSourceFuture=0;
+	//, *aScheduledSource=0;
 	bool aSameTaskFound=false;
-	//if (anOldTransaction!=0){
 	if (_lastSource!=0){
-		aScheduledSource=_lastSource;
+		//aScheduledSource=_lastSource;
 		_lastSource->schedule(iEndSchedule);
 		if (_lastSource->getNextTransaction(iEndSchedule)!=0 && _lastSource->getNextTransaction(iEndSchedule)->getVirtualLength()!=0){
-			if (anOldTransaction==0 || _lastSource->getNextTransaction(iEndSchedule)==anOldTransaction || _timeSlice >=_elapsedTime +  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength() + _minSliceSize){
+			//if (anOldTransaction==0 || _lastSource->getNextTransaction(iEndSchedule)==anOldTransaction || _timeSlice >=_elapsedTime +  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength() + _minSliceSize){
+			if (anOldTransaction==0 || _lastSource->getNextTransaction(iEndSchedule)==anOldTransaction || _timeSlice >=_elapsedTime +  anOldTransaction->getOperationLength() + _minSliceSize){
+				//std::cout << "Select same task, remaining: " << _timeSlice - anOldTransaction->getOperationLength() << "\n";
 				aSourcePast=_lastSource;
 				aSameTaskFound=true;
 			}
@@ -106,7 +108,8 @@ TMLTime RRScheduler::schedule(TMLTime iEndSchedule){
 		//if (_nextTransaction!=anOldTransaction){
 		if (_nextTransaction!=anOldTransaction && anOldTransaction!=0){
 			//std::cout << _name << ": Elapsed time increased by " << anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength() << "\n";
-			_elapsedTime +=  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength();
+			//_elapsedTime +=  anOldTransaction->getBranchingPenalty() + anOldTransaction->getOperationLength();
+			_elapsedTime +=  anOldTransaction->getOperationLength();
 		}
 		//std::cout << "Not crashed\n" ;
 	}else{
diff --git a/simulators/c++2/src_simulator/arch/RRScheduler.h b/simulators/c++2/src_simulator/arch/RRScheduler.h
index 81c0f545d59a5b0fc932a71cfab649804525d410..2b22b060eabdb347c26f13d91fa14e0f0a906a26 100644
--- a/simulators/c++2/src_simulator/arch/RRScheduler.h
+++ b/simulators/c++2/src_simulator/arch/RRScheduler.h
@@ -54,6 +54,7 @@ public:
 	\param iMinSliceSize Minimum size of a time slice
     	*/
 	RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize);
+	//RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice);
 	///Constructor
     	/**
 	\param iName Name of the scheduler
@@ -64,6 +65,7 @@ public:
 	\param iNbOfSources Length of the array
     	*/
 	RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, TMLTime iMinSliceSize, WorkloadSource** aSourceArray, unsigned int iNbOfSources);
+	//RRScheduler(const std::string& iName, Priority iPrio, TMLTime iTimeSlice, WorkloadSource** aSourceArray, unsigned int iNbOfSources);
 	///Destructor
 	~RRScheduler();
 	TMLTime schedule(TMLTime iEndSchedule);
diff --git a/simulators/c++2/src_simulator/arch/SchedulableDevice.h b/simulators/c++2/src_simulator/arch/SchedulableDevice.h
index ea1c8971786ab4439630fb9d64e54d147357b70c..180987e440ac794ddda14cab9566e10cae708bab 100644
--- a/simulators/c++2/src_simulator/arch/SchedulableDevice.h
+++ b/simulators/c++2/src_simulator/arch/SchedulableDevice.h
@@ -67,7 +67,7 @@ public:
 	///Determines the next transaction to be executed
 	virtual void schedule()=0;
 	///Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions
-	virtual bool addTransaction()=0;
+	virtual bool addTransaction(TMLTransaction* iTransToBeAdded)=0;
 	///Returns a pointer to the transaction determined by the scheduling algorithm
     	/**
       	\return Pointer to transaction
diff --git a/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp b/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp
index 9ee5da1a7d1b17c5aca83323c9ae478da3a60bdf..ec8c8530eba02dcb73b3dac654eaea212d17cb5d 100644
--- a/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp
+++ b/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp
@@ -47,15 +47,24 @@ Ludovic Apvrille, Renaud Pacalet
 #include <TMLChannel.h>
 //#include <TransactionListener.h>
 
-SingleCoreCPU::SingleCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler, TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize): CPU(iID, iName, iScheduler), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle),
+SingleCoreCPU::SingleCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler, TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize): CPU(iID, iName, iScheduler), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle)
 #ifdef PENALTIES_ENABLED
-_pipelineSize(iPipelineSize), _taskSwitchingCycles(iTaskSwitchingCycles),_brachingMissrate(iBranchingMissrate), _changeIdleModeCycles(iChangeIdleModeCycles), _cyclesBeforeIdle(iCyclesBeforeIdle),
+, _pipelineSize(iPipelineSize), _taskSwitchingCycles(iTaskSwitchingCycles),_brachingMissrate(iBranchingMissrate)
+, _changeIdleModeCycles(iChangeIdleModeCycles), _cyclesBeforeIdle(iCyclesBeforeIdle)
 #endif 
-_cyclesPerExeci(iCyclesPerExeci), _busyCycles(0), _timePerExeci(_cyclesPerExeci*_timePerCycle)
+, _cyclesPerExeci(iCyclesPerExeci), _busyCycles(0)
 #ifdef PENALTIES_ENABLED
- ,_taskSwitchingTime(_taskSwitchingCycles*_timePerCycle), _timeBeforeIdle(_cyclesBeforeIdle*_timePerCycle), _changeIdleModeTime(_changeIdleModeCycles*_timePerCycle), _pipelineSizeTimesExeci(_pipelineSize * _timePerExeci),_missrateTimesPipelinesize(_brachingMissrate*_pipelineSize)
+, _timePerExeci(_cyclesPerExeci * _timePerCycle * (_pipelineSize *  _brachingMissrate + 100 - _brachingMissrate) /100.0)
+,_taskSwitchingTime(_taskSwitchingCycles*_timePerCycle)
+, _timeBeforeIdle(_cyclesBeforeIdle*_timePerCycle)
+, _changeIdleModeTime(_changeIdleModeCycles*_timePerCycle) 
+#else
+, _timePerExeci(_cyclesPerExeci*_timePerCycle)
 #endif
+//, _pipelineSizeTimesExeci(_pipelineSize * _timePerExeci)
+//,_missrateTimesPipelinesize(_brachingMissrate*_pipelineSize)
 {
+	std::cout << "Time per EXECIiiiiiiiiiiiiiiiiiiiiii: " << _timePerExeci << "\n";
 	//_transactList.reserve(BLOCK_SIZE);
 }
 
@@ -130,11 +139,7 @@ void SingleCoreCPU::calcStartTimeLength(TMLTime iTimeSlice){
 		//calculate length of transaction
 		//if (_nextTransaction->getOperationLength()!=-1){
 		if (iTimeSlice!=0){
-#ifdef PENALTIES_ENABLED
-			_nextTransaction->setVirtualLength(min(_nextTransaction->getVirtualLength(), 100 * iTimeSlice /((_missrateTimesPipelinesize+100) * _timePerExeci)));
-#else
-			_nextTransaction->setVirtualLength(min(_nextTransaction->getVirtualLength(), iTimeSlice /_timePerExeci));
-#endif
+			_nextTransaction->setVirtualLength(max(min(_nextTransaction->getVirtualLength(), (TMLLength)(iTimeSlice /_timePerExeci)), (TMLTime)1));
 		}
 		_nextTransaction->setLength(_nextTransaction->getVirtualLength()*_timePerExeci);
 			
@@ -142,10 +147,6 @@ void SingleCoreCPU::calcStartTimeLength(TMLTime iTimeSlice){
 	}
 #endif
 #ifdef PENALTIES_ENABLED
-	if (_brachingMissrate!=0 && _masterNextTransaction==0){
-		_nextTransaction->setBranchingPenalty(_nextTransaction->getVirtualLength() * _brachingMissrate / 100 *_pipelineSizeTimesExeci);
-	}
-
 	if (_lastTransaction==0 || _lastTransaction->getCommand()->getTask()!=_nextTransaction->getCommand()->getTask()){
 		_nextTransaction->setTaskSwitchingPenalty(_taskSwitchingTime);
 	}
@@ -170,7 +171,7 @@ void SingleCoreCPU::truncateAndAddNextTransAt(TMLTime iTime){
 	
 	if (aNewTransaction!=_nextTransaction){
 		//std::cout << "in if\n";
-		if (truncateNextTransAt(iTime)!=0) addTransaction();
+		if (truncateNextTransAt(iTime)!=0) addTransaction(0);
 		//if (_nextTransaction!=0 && truncateNextTransAt(iTime)!=0) addTransaction(); //NEW!!!!
 		if (_nextTransaction!=0 && _masterNextTransaction!=0) _masterNextTransaction->registerTransaction(0);
 		_nextTransaction = aNewTransaction;
@@ -193,17 +194,13 @@ TMLTime SingleCoreCPU::truncateNextTransAt(TMLTime iTime){
 #endif
 		}else{
 			aNewDuration-=aStaticPenalty;
-			//std::cout << _name << " virtual length before cut: " << _nextTransaction->getVirtualLength() << std::endl;
-			_nextTransaction->setVirtualLength(100* aNewDuration /((_missrateTimesPipelinesize+100) * _timePerExeci));
+			_nextTransaction->setVirtualLength(max((TMLTime)(aNewDuration /_timePerExeci),(TMLTime)1));
 			_nextTransaction->setLength(_nextTransaction->getVirtualLength() *_timePerExeci);
 		}
-		if (_brachingMissrate!=0){
-			_nextTransaction->setBranchingPenalty(_nextTransaction->getVirtualLength() * _brachingMissrate / 100 *_pipelineSizeTimesExeci);
-		}
 #else
-		if (iTime <= _nextTransaction->getStartTime()) return 0;
+		if (iTime <= _nextTransaction->getStartTime()) return 0;  //before: <=
 		TMLTime aNewDuration = iTime - _nextTransaction->getStartTime();
-		_nextTransaction->setVirtualLength(aNewDuration /_timePerExeci);
+		_nextTransaction->setVirtualLength(max((TMLTime)(aNewDuration /_timePerExeci), (TMLTime)1));
 		_nextTransaction->setLength(_nextTransaction->getVirtualLength() *_timePerExeci);
 #endif
 #ifdef DEBUG_CPU
@@ -214,8 +211,9 @@ TMLTime SingleCoreCPU::truncateNextTransAt(TMLTime iTime){
 	return _nextTransaction->getOverallLength();
 }
 
-bool SingleCoreCPU::addTransaction(){
+bool SingleCoreCPU::addTransaction(TMLTransaction* iTransToBeAdded){
 	bool aFinish;
+	//TMLTransaction* aTransCopy=0;
 	if (_masterNextTransaction==0){
 		aFinish=true;
 #ifdef DEBUG_CPU
@@ -230,6 +228,8 @@ bool SingleCoreCPU::addTransaction(){
 		if (aFollowingMaster==0){
 			//std::cout << "1\n";
 			aFinish=true;
+			//aTransCopy = new TMLTransaction(*_nextTransaction);
+			//_nextTransaction = aTransCopy;
 			BusMaster* aTempMaster = getMasterForBus(_nextTransaction->getChannel()->getFirstMaster(_nextTransaction));
 			//std::cout << "2\n";
 			Slave* aTempSlave= _nextTransaction->getChannel()->getNextSlave(_nextTransaction);
@@ -237,9 +237,10 @@ bool SingleCoreCPU::addTransaction(){
 			aTempMaster->addBusContention(_nextTransaction->getStartTime()-max(_endSchedule,_nextTransaction->getRunnableTime()));
 			while (aTempMaster!=0){
 				//std::cout << "3a\n";
-				aTempMaster->addTransaction();
+				aTempMaster->addTransaction(_nextTransaction);
 				//std::cout << "3b\n";
-				if (aTempSlave!=0) aTempSlave->addTransaction(_nextTransaction);
+				//if (aTempSlave!=0) aTempSlave->addTransaction(_nextTransaction);
+				if (aTempSlave!=0) aTempSlave->addTransaction(_nextTransaction);  //NEW
 				//std::cout << "4\n";
 				aTempMaster =_nextTransaction->getChannel()->getNextMaster(_nextTransaction);
 				//std::cout << "5\n";
@@ -335,9 +336,11 @@ void SingleCoreCPU::schedule2HTML(std::ofstream& myfile) const{
 		if (aLength!=0){
 			if (aLength==1){
 				//myfile << "<td title=\""<< aCurrTrans->toShortString() << "\" class=\"t15\"></td>\n";
-				myfile << "<td title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << " bran:" << aCurrTrans->getBranchingPenalty() << "\" class=\"t15\"></td>\n";
+				//myfile << "<td title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << " bran:" << aCurrTrans->getBranchingPenalty() << "\" class=\"t15\"></td>\n";
+				myfile << "<td title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << "\" class=\"t15\"></td>\n";
 			}else{
-				myfile << "<td colspan=\"" << aLength << "\" title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << " bran:" << aCurrTrans->getBranchingPenalty() << "\" class=\"t15\"></td>\n";
+				//myfile << "<td colspan=\"" << aLength << "\" title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << " bran:" << aCurrTrans->getBranchingPenalty() << "\" class=\"t15\"></td>\n";
+				myfile << "<td colspan=\"" << aLength << "\" title=\" idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty() << "\" class=\"t15\"></td>\n";
 			}
 		}
 		aLength=aCurrTrans->getOperationLength();
diff --git a/simulators/c++2/src_simulator/arch/SingleCoreCPU.h b/simulators/c++2/src_simulator/arch/SingleCoreCPU.h
index eb979026da608eded5f00cb0f2fd228242919f2d..6ece8d97b8edeb3466423b9a365d53c491ca0c8e 100644
--- a/simulators/c++2/src_simulator/arch/SingleCoreCPU.h
+++ b/simulators/c++2/src_simulator/arch/SingleCoreCPU.h
@@ -88,7 +88,7 @@ public:
     	//*/
 	//virtual void registerTask(TMLTask* iTask);
 	///Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions
-	virtual bool addTransaction();
+	virtual bool addTransaction(TMLTransaction* iTransToBeAdded);
 	///Returns a pointer to the transaction determined by the scheduling algorithm
     	/**
       	\return Pointer to transaction
@@ -172,7 +172,7 @@ protected:
 	
 	//values deduced from CPU parameters 
 	///Time needed to execute one execi unit
-	TMLTime _timePerExeci;
+	float _timePerExeci;
 #ifdef PENALTIES_ENABLED
 	///Task switching penalty in time units
 	TMLTime _taskSwitchingTime;
@@ -180,10 +180,10 @@ protected:
 	TMLTime _timeBeforeIdle;
 	///Time needed to switch into idle mode
 	TMLTime _changeIdleModeTime;
-	///_pipelineSize * _timePerExeci
-	TMLTime _pipelineSizeTimesExeci;
-	///_brachingMissrate * _pipelineSize
-	unsigned int _missrateTimesPipelinesize;
+	////_pipelineSize * _timePerExeci
+	//TMLTime _pipelineSizeTimesExeci;
+	////_brachingMissrate * _pipelineSize
+	//unsigned int _missrateTimesPipelinesize;
 	//varibales for branch miss calculation
 	////Indicates the number of commands executed since the last branch miss
 	//unsigned int _branchMissReminder;
diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h
index b8a0a11d2423dab8f4af6caee61ea60851518e68..8ff60d56b19864be43b806e52e65c6698796db54 100644
--- a/simulators/c++2/src_simulator/definitions.h
+++ b/simulators/c++2/src_simulator/definitions.h
@@ -81,9 +81,9 @@ using std::max;
 
 #define BUS_ENABLED
 #define WAIT_SEND_VLEN 1
-#undef PENALTIES_ENABLED
+#define PENALTIES_ENABLED
 #undef STATE_HASH_ENABLED
-#define LISTENERS_ENABLED
+#undef LISTENERS_ENABLED
 #undef EBRDD_ENABLED
 //#define DOT_GRAPH_ENABLED
 
diff --git a/simulators/c++2/src_simulator/main.h b/simulators/c++2/src_simulator/main.h
index 8409f8873f06b66488784d602aeecdb128f47386..821abb1443b83ce887bee6f03f7a965b6ca7ac3e 100644
--- a/simulators/c++2/src_simulator/main.h
+++ b/simulators/c++2/src_simulator/main.h
@@ -89,5 +89,7 @@ int main(int len, char ** args) {
 		delete myServer;
 	}
 	delete mySync._simComponents;
+	std::cout << "Terminate\n";
+	return 0;
 }
 #endif
diff --git a/simulators/c++2/src_simulator/sim/SimComponents.cpp b/simulators/c++2/src_simulator/sim/SimComponents.cpp
index 18951d2b7fd79aff01407a978020fdc4f6081bf4..78513d7524b3740ce42c59afe5d97733f5e3134a 100644
--- a/simulators/c++2/src_simulator/sim/SimComponents.cpp
+++ b/simulators/c++2/src_simulator/sim/SimComponents.cpp
@@ -469,6 +469,12 @@ void SimComponents::showTaskStates(){
 				std::cout << "has runnable transaction: " << (*i)->getCurrCommand()->getCurrTransaction()->toString() << "\n";
 		}
 	}
+	for(BusList::const_iterator i=_busList.begin(); i != _busList.end(); ++i){
+		TMLTransaction* nextBusTrans = dynamic_cast<SchedulableDevice*>(*i)->getNextTransaction();
+		if (nextBusTrans!=0){
+			std::cout << "Bus " << (*i)->toString() << " has next trans: " << nextBusTrans->toString() << "\n";
+		}
+	}
 }
 
 bool SimComponents::couldCPUBeIdle(CPU* iCPU){
diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp
index 325ec297f752764dccf7cfb2a06e6594c1e99f8f..63d5706046c1667a1fc50f1f9a03913351e39a83 100644
--- a/simulators/c++2/src_simulator/sim/Simulator.cpp
+++ b/simulators/c++2/src_simulator/sim/Simulator.cpp
@@ -407,7 +407,7 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
 #ifdef DEBUG_KERNEL
 		std::cout << "kernel:simulate: add trans " << commandLET->toString() << std::endl;
 #endif
-		if (cpuLET->addTransaction()){
+		if (cpuLET->addTransaction(0)){
 		 unsigned int nbOfChannels = commandLET->getNbOfChannels();
 		 //bool aRescheduleCoresFlag=false;
 		 for (unsigned int i=0;i<nbOfChannels; i++){
@@ -492,8 +492,9 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
 		//_syncInfo->_server->sendReply("Sleep once again\n");
 		//sleep(1);
 	}
-#ifdef LISTENERS_ENABLED
+
 	bool aSimCompleted = (transLET==0 && !_simComp->getStoppedOnAction());
+#ifdef LISTENERS_ENABLED
 	if (aSimCompleted){
 		NOTIFY_SIM_STOPPED();
 		NOTIFY_EVALUATE();
@@ -501,7 +502,7 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
 #endif
 	gettimeofday(&aEnd,NULL);
 	//std::cout << "The simulation took " << getTimeDiff(aBegin,aEnd) << "usec.\n";
-	//_simComp->showTaskStates();
+	_simComp->showTaskStates();
 	return (aSimCompleted);
 }