diff --git a/src/AxisSimulatorThread.cpp b/src/AxisSimulatorThread.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..462786f1b302832c508e0125828f30c5f8cdc881
--- /dev/null
+++ b/src/AxisSimulatorThread.cpp
@@ -0,0 +1,316 @@
+
+#include <AxisSimulatorThread.h>
+#include <math.h>
+#include <TangoExceptionsHelper.h>
+
+/*********************************************************************
+* AxisSimulatorThread::AxisSimulatorThread
+**********************************************************************/
+AxisSimulatorThread::AxisSimulatorThread(Tango::DeviceImpl* _dev) :
+Tango::Thread(),
+Tango::LogAdapter(_dev)
+{
+	// for the device to wait run_undetached is started
+	////this->oc = c;
+// not used
+	this->req = REQ_STOP;
+	this->dev_ = _dev;
+	DEBUG_STREAM <<"AxisSimulatorThread::AxisSimulatorThread <-<-<-"<<endl;
+	this->relative_move = 0.0;
+	this->actual_move = MOVE_STOP;
+	this->health_state = HEALTH_OK;
+	this->polling_period_nsec = 1000000000;
+	this->polling_period_sec = 0;
+	this->limit_low_active = false;
+	this->limit_high_active = false;
+	this->positionned = false;
+
+
+	DEBUG_STREAM <<"AxisSimulatorThread::AxisSimulatorThread ->->->"<<endl;
+}
+/*********************************************************************
+* AxisSimulatorThread::~AxisSimulatorThread
+**********************************************************************/
+AxisSimulatorThread::~AxisSimulatorThread(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::~AxisSimulatorThread <-<-<-"<<endl;	
+}
+/*********************************************************************
+* AxisSimulatorThread::stop
+**********************************************************************/ 
+void AxisSimulatorThread::stop(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::stop <-<-<-"<<endl;
+	this->req = REQ_STOP;
+
+//	void** arg = 0;
+//	this->join(arg);
+	
+}
+/*********************************************************************
+* AxisSimulatorThread::exit
+**********************************************************************/
+void AxisSimulatorThread::exit(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::exit <-<-<-"<<endl;
+	this->req = REQ_EXIT;
+
+//	void** arg = 0;
+//	this->join(arg);
+
+}
+/*********************************************************************
+* AxisSimulatorThread::fwd
+**********************************************************************/ 
+void AxisSimulatorThread::fwd(void)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::fwd <-<-<-"	<<endl;
+	INFO_STREAM <<"speed			: " << this->speed 		<< endl;
+	INFO_STREAM <<"step size		: " << this->step 		<< endl;	
+	if(!this->limit_high_active)
+		this->req = REQ_FORWARD;
+	this->positionned = false;
+	this->calc_polling_period();
+
+}
+/*********************************************************************
+* AxisSimulatorThread::bkwd
+**********************************************************************/ 
+void AxisSimulatorThread::bkwd(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::bkwd <-<-<-"	<<endl;
+	INFO_STREAM <<"speed			: " << this->speed 		<< endl;
+	INFO_STREAM <<"step size		: " << this->step 		<< endl;	
+	if(!this->limit_low_active)
+		this->req = REQ_BACKWARD;
+	positionned = false;
+	this->calc_polling_period();
+
+}
+/*********************************************************************
+* AxisSimulatorThread::simufault
+**********************************************************************/
+void AxisSimulatorThread::simufault(int)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::simufault <-<-<-"<<endl;
+	this->req = REQ_FAULT;
+
+}
+/*********************************************************************
+* AxisSimulatorThread::gotopos
+**********************************************************************/ 
+void AxisSimulatorThread::gotopos(double d)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::gotopos <-<-<-"<<endl;
+	INFO_STREAM <<"speed			: " << this->speed 		<< endl;
+	INFO_STREAM <<"step size		: " << this->step 		<< endl;		
+	this->relative_move = d - this->pos;
+	this->setpoint = d;
+	if(this->relative_move >=0)
+		this->req = REQ_GOTOPOS_FWD;
+	else
+		this->req = REQ_GOTOPOS_BKWD;
+	this->positionned = false;
+	this->calc_polling_period();
+}
+
+/*********************************************************************
+* AxisSimulatorThread::set_speed
+**********************************************************************/ 
+void AxisSimulatorThread::set_speed(double speed)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::set_speed <-<-<-"<<endl;
+	this->speed = speed;
+	this->calc_polling_period();
+}
+
+/*********************************************************************
+* AxisSimulatorThread::calc_polling_period
+	used to simulate the motor speed
+**********************************************************************/
+void AxisSimulatorThread::calc_polling_period(void)
+{
+	if(this->speed < static_cast<double>(0.001))
+		this->speed = static_cast<double>(0.001);
+	double tmp = static_cast<double>((1000000000.0)/this->speed);
+	this->polling_period_nsec = (unsigned long)tmp;	
+	INFO_STREAM<<"polling period (ms)	: " << (double)((double)this->polling_period_nsec/1000000.0)<< endl;	
+}
+
+
+/*********************************************************************
+* SequenceThread::run_undetached
+**********************************************************************/
+void*  AxisSimulatorThread::run_undetached(void* arg)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::run_undetached <-<-<-"<<endl;
+	// signals to the device server that thread is started
+
+
+	this->actual_move = MOVE_STOP;
+	if(this->accuracy <=0)
+		this->accuracy = 1.0;
+	if(this->speed <= static_cast<double>(0.0))
+		this->speed = static_cast<double>(1.0);
+		
+	DEBUG_STREAM<<"*************************  BEGIN THREAD LOOP ***************************"<<endl;
+	do
+	{
+		// some variables to initialise
+
+		// polling period to simulate speed
+
+		// -------------------- 	 SOFTWARE LIMITS SIMULATION 	--------------------
+		// look the software limits if configured
+		// ( via min and max _value properties of attribute Position ):
+		if((this->software_limit_low_valid) && (this->pos <= this->software_limit_low))
+		{
+			DEBUG_STREAM << "LIMIT SWITCH BACKWARD ACTIVE" << endl;
+			this->limit_low_active = true;
+		}
+		else
+		{
+			this->limit_low_active = false;
+		}
+
+		if((this->software_limit_high_valid) &&  (this->pos >= this->software_limit_high))
+		{
+			DEBUG_STREAM << "LIMIT SWITCH FORWARD ACTIVE" << endl;
+			this->limit_high_active = true;
+		}
+		else
+		{
+			this->limit_high_active = false;
+		}
+
+		// -------------------- 	 STATE MACHINE	 --------------------
+		// STOP ACTIVITY
+	
+		if (((this->actual_move == MOVE_FORWARD)	&& (this->req == REQ_STOP))				 					||
+			((this->actual_move == MOVE_BACKWARD)	&& (this->req == REQ_STOP))				 					||
+			((this-> actual_move == POS_OK)			&& (this->req == REQ_FORWARD)) 		 						||
+			((this-> actual_move == POS_OK)			&& (this->req == REQ_GOTOPOS_FWD)	&& !this->positionned)	||
+			((this-> actual_move == POS_OK)			&& (this->req == REQ_BACKWARD))		 						||
+			((this-> actual_move == POS_OK)			&& (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) 	||
+			((this-> actual_move == POS_OK)			&& (this->req == REQ_STOP))				 					||
+			((this-> actual_move == POS_NOK)		&& (this->req == REQ_FORWARD))		 						||
+			((this-> actual_move == POS_NOK) 		&& (this->req == REQ_GOTOPOS_FWD)  && !this->positionned)	||
+			((this-> actual_move == POS_NOK) 		&& (this->req == REQ_BACKWARD)) 	 						||
+			((this-> actual_move == POS_NOK) 		&& (this->req == REQ_GOTOPOS_BKWD) && !this->positionned)	||
+			((this-> actual_move == POS_NOK) 		&& (this->req == REQ_STOP)) )
+		{
+			this->actual_move = MOVE_STOP;
+			DEBUG_STREAM << "actual_move = MOVE_STOP" << endl;
+
+		}
+			
+		// FORWARD ACTIVITY
+		if( ((this->actual_move == MOVE_STOP)		&& (this->req == REQ_FORWARD))  							||
+			((this->actual_move == MOVE_STOP)		&& (this->req == REQ_GOTOPOS_FWD) && !this->positionned)	||
+			((this->actual_move == STOPPED_LSBKWD)	&& (this->req == REQ_FORWARD))  							||
+			((this->actual_move == STOPPED_LSBKWD)	&& (this->req == REQ_GOTOPOS_FWD) && !this->positionned)  )
+		{
+			this->actual_move = MOVE_FORWARD;
+			DEBUG_STREAM << "actual_move = MOVE_FORWARD" << endl;
+		}
+	
+		// BACKWARD ACTIVITY
+		if( ((this->actual_move == MOVE_STOP)		&& (this->req == REQ_BACKWARD))								||
+			((this->actual_move == MOVE_STOP)		&& (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) 	||
+			((this->actual_move == STOPPED_LSFWD)	&& (this->req == REQ_BACKWARD))								||
+			((this->actual_move == STOPPED_LSFWD)	&& (this->req == REQ_GOTOPOS_BKWD) && !this->positionned)	)
+		{
+			this->actual_move = MOVE_BACKWARD;
+			DEBUG_STREAM << "actual_move = MOVE_BACKWARD" << endl;
+		}
+			
+		// ON LIMIT SWITCH FORWARD ACTIVITY
+		if( (this->actual_move == MOVE_FORWARD) && this->limit_high_active )
+		{
+			this->actual_move = STOPPED_LSFWD;
+			DEBUG_STREAM << "actual_move = STOPPED_LSFWD" << endl;
+		}
+			
+		// ON LIMIT SWITCH BACKWARD ACTIVITY
+		if( (this->actual_move == MOVE_BACKWARD) && this->limit_low_active )
+		{
+			this->actual_move = STOPPED_LSBKWD;
+			DEBUG_STREAM << "actual_move = STOPPED_LSBKWD" << endl;
+		}
+		
+		// POS_OK activity : position OK or NOT OK
+		if( ((this->actual_move == MOVE_FORWARD)||(this->actual_move == MOVE_BACKWARD)) && this->positionned )
+		{
+			double delta = fabs((this->pos - this->setpoint));
+			DEBUG_STREAM << "pos : " << pos << " 		setpoint : " << this->setpoint	<< " delta : " << delta << "		 accuracy : " << this->accuracy << endl;
+			if( delta <= this->accuracy )
+			{
+				this->actual_move = POS_OK;
+				DEBUG_STREAM << "actual_move = POS_OK" << endl;
+			}
+			else
+			{
+				this->actual_move = POS_NOK;
+				DEBUG_STREAM << "actual_move = POS_NOT_OK !!!!" << endl;
+			}
+		}
+
+		// -------------------- 	 SIMULATE MOVE	 --------------------
+
+		if( (this->actual_move == MOVE_FORWARD) && !this->limit_high_active )  // si forward on incremente
+		{
+			this->pos += step;
+			DEBUG_STREAM<<"position  : "<<this->pos<<endl;
+//			std::cout << "+" ;
+		}
+		if( (this->actual_move == MOVE_BACKWARD) && !this->limit_low_active )// si backward on decremente
+		{
+			this->pos -= step;
+			DEBUG_STREAM<<"position  : "<<this->pos<<endl;
+//			std::cout << "-" ;
+		}
+
+
+		// -------------------- 	 SIMULATE POSITION OK 	--------------------
+
+		if(!this->positionned && (this->req == REQ_GOTOPOS_BKWD) )
+		{
+			if(this->pos <= this->setpoint)
+			{
+				this->positionned = true;
+			}
+		}
+		if(!this->positionned && (this->req == REQ_GOTOPOS_FWD))
+		{
+			if(this->pos >= this->setpoint)
+			{
+				this->positionned = true;
+			}
+		}
+
+	 // --------------------		POLLING PERIOD slow down if no move 	--------------------
+
+		if( (this->actual_move != MOVE_FORWARD) && (this->actual_move != MOVE_BACKWARD) )
+		{
+			// stopped : polling period of O,1 s
+			this->polling_period_nsec = 1000000000;
+		}
+		
+		// endormir le thread pour le temps
+		this->sleep(this->polling_period_sec, this->polling_period_nsec);	
+	}while(this->req != REQ_EXIT);
+	DEBUG_STREAM<<"*************************  END THREAD LOOP ***************************"<<endl;
+
+	return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/AxisSimulatorThread.h b/src/AxisSimulatorThread.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf06e45b95f9b39a7c8a9f3ac2f5381711f52c10
--- /dev/null
+++ b/src/AxisSimulatorThread.h
@@ -0,0 +1,97 @@
+
+#ifndef _AXIS_SIMULATOR_THREAD_
+#define _AXIS_SIMULATOR_THREAD_
+
+#include <tango.h>
+#include "TangoThread.h"
+
+
+enum MOVING_STATE {MOVE_STOP,MOVE_FORWARD,MOVE_BACKWARD,STOPPED_LSFWD,STOPPED_LSBKWD,POS_OK,POS_NOK};
+enum REQUEST {REQ_EXIT=-1,REQ_STOP,REQ_FORWARD,REQ_BACKWARD,REQ_GOTOPOS_FWD,REQ_GOTOPOS_BKWD,REQ_FAULT};
+enum HEALTH_STATE {HEALTH_FAULT, HEALTH_ALARM, HEALTH_OK};
+
+class AxisSimulatorThread : public Tango::Thread, public Tango::LogAdapter
+{
+public:
+  AxisSimulatorThread(Tango::DeviceImpl* dev   // pointer on the device to simulate
+                      );
+
+
+  virtual ~AxisSimulatorThread(void);
+
+
+
+  double pos;
+  double accel;
+  double decel;
+  double speed;
+  double accuracy;
+  // software limit low an validity
+  double software_limit_low;
+  bool software_limit_low_valid;
+  // software limit high an validity
+  double software_limit_high;
+  bool software_limit_high_valid;
+  // the step size
+  double step;
+
+
+  // command forward, increments on attribute pos
+  void fwd(void);
+  // command backward decrements on attribute pos
+  void bkwd(void);
+  // command stop  stops increments on pos
+  void stop(void);
+  // command exit  ends forever loop
+  void exit(void);
+  // command gotoposition in(de)crements from pos to argin
+  void gotopos(double);
+  // command fix the speed value
+  void set_speed(double);
+  
+  MOVING_STATE moving_state(void) { return this->actual_move; };
+  int get_health_state(void)      { return this->health_state; };
+  // to simulate a fault
+  void simufault(int);
+
+private:
+// omni_condition reapckage ( see TangoThread.h ) for the device to waits the thread startup is done
+  Tango::Condition *oc;
+  Tango::DeviceImpl* dev_ ;
+  MOVING_STATE actual_move;
+  HEALTH_STATE health_state;
+  REQUEST req;
+  // to calculate the period of the thread  to simulate speed
+  void calc_polling_period(void);
+
+// software limit switchs
+  bool limit_low_active;
+  bool limit_high_active;
+  // position OK flag for gotopos
+  bool positionned;
+
+  double relative_move;
+  double setpoint;
+  //virtual void   run(void* arg){};
+  virtual void* run_undetached (void* arg);
+
+//  Tango::Semaphore* sem;
+  unsigned long polling_period_nsec;
+  unsigned long polling_period_sec;
+/*  double* sequence_;
+  double* times_;
+  unsigned long iterations_;
+  double delta_;
+  double timeout_;
+  double polling_period_;
+  unsigned long seq_size_;
+  bool tmo_occured;
+  AttributesHelper* attr_proxy;
+  bool check_read_value;
+  bool error_occured;*/
+
+};
+
+
+
+#endif //_AXIS_SIMULATOR_THREAD_
diff --git a/src/InitializeReferencePositionThread.cpp b/src/InitializeReferencePositionThread.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0ac94d4a171a0307fad99923a7874bd8b5e6851e
--- /dev/null
+++ b/src/InitializeReferencePositionThread.cpp
@@ -0,0 +1,306 @@
+
+#include <InitializeReferencePositionThread.h>
+#include <math.h>
+#include <TangoExceptionsHelper.h>
+
+/*********************************************************************
+* AxisSimulatorThread::AxisSimulatorThread
+**********************************************************************/
+InitializeReferencePositionThread::InitializeReferencePositionThread(
+																			SimulatedMotor * mot, INIT_TYPE it) :
+																			Tango::Thread(),
+																			Tango::LogAdapter(_dev)
+{
+	DEBUG_STREAM <<"InitializeReferencePositionThread::InitializeReferencePositionThread <-<-<-"<<endl;
+
+	// initialize variables
+	// save locally the pointer on the device
+	this->mot = m;
+	// this is for the strategy
+	this->init_type = it;
+	this->req = INIT_START;
+
+	DEBUG_STREAM <<"InitializeReferencePositionThread::InitializeReferencePositionThread ->->->"<<endl;
+}
+/*********************************************************************
+* AxisSimulatorThread::~AxisSimulatorThread
+**********************************************************************/
+InitializeReferencePositionThread::~InitializeReferencePositionThread(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::~AxisSimulatorThread <-<-<-"<<endl;
+}
+/*********************************************************************
+* AxisSimulatorThread::stop
+**********************************************************************/ 
+void InitializeReferencePositionThread::stop(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::stop <-<-<-"<<endl;
+	this->req = INIT_STOP;
+
+//	void** arg = 0;
+//	this->join(arg);
+	
+}
+/*********************************************************************
+* AxisSimulatorThread::exit
+**********************************************************************/
+void InitializeReferencePositionThread::exit(void)
+{
+	DEBUG_STREAM <<"AxisSimulatorThread::exit <-<-<-"<<endl;
+	this->req = INIT_EXIT;
+
+//	void** arg = 0;
+//	this->join(arg);
+
+}
+/*********************************************************************
+* AxisSimulatorThread::fwd
+**********************************************************************/ 
+void InitializeReferencePositionThread::fwd(void)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::fwd <-<-<-"<<endl;
+	DEBUG_STREAM << " speed  : " << this->speed << "			step size : " << this->step << endl;
+	if(!limit_high_active)
+		this->req = REQ_FORWARD;
+	positionned = false;
+	this->calc_polling_period();
+
+}
+/*********************************************************************
+* AxisSimulatorThread::bkwd
+**********************************************************************/ 
+void InitializeReferencePositionThread::bkwd(void)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::bkwd <-<-<-"<<endl;
+	if(!limit_low_active)
+		this->req = REQ_BACKWARD;
+	positionned = false;
+	this->calc_polling_period();
+
+}
+/*********************************************************************
+* AxisSimulatorThread::simufault
+**********************************************************************/
+void InitializeReferencePositionThread::simufault(int)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::simufault <-<-<-"<<endl;
+	this->req = REQ_FAULT;
+
+}
+/*********************************************************************
+* AxisSimulatorThread::gotopos
+**********************************************************************/ 
+void InitializeReferencePositionThread::gotopos(double d)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::gotopos <-<-<-"<<endl;
+	this->relative_move = d - this->pos;
+	this->setpoint = d;
+	if(relative_move >=0)
+		this->req = REQ_GOTOPOS_FWD;
+	else
+		this->req = REQ_GOTOPOS_BKWD;
+		positionned = false;
+		this->calc_polling_period();
+}
+
+
+/*********************************************************************
+* AxisSimulatorThread::calc_polling_period
+	used to simulate the motor speed
+**********************************************************************/
+void InitializeReferencePositionThread::calc_polling_period(void)
+{
+	if(this->speed < static_cast<double>(0.001))
+		this->speed = static_cast<double>(0.001);
+	double tmp = static_cast<double>(1000000.0)/this->speed;
+	this->polling_period_nsec = long(tmp);
+	DEBUG_STREAM << " AxisSimulatorThread::calc_polling_period this->polling_period_nsec = " << long(tmp) <<endl;
+}
+
+
+/*********************************************************************
+* SequenceThread::run_undetached
+**********************************************************************/
+void*  InitializeReferencePositionThread::run_undetached(void* arg)
+{
+	DEBUG_STREAM << "AxisSimulatorThread::run_undetached <-<-<-"<<endl;
+// signals to the device server that thread is started
+
+// wait() and timedwait() do not work
+// try broadcast instead
+	if (oc)
+	{
+		DEBUG_STREAM << "AxisSimulatorThread broadcast"<<endl;
+		oc->broadcast();
+		DEBUG_STREAM << "AxisSimulatorThread broadcasted"<<endl;
+	}
+	else
+		DEBUG_STREAM << "AxisSimulatorThread error : omni_condition not initialised"<<endl;
+
+
+	this->actual_move = MOVE_STOP;
+	if(this->accuracy <=0)
+		this->accuracy = 1.0;
+	if(this->speed <= static_cast<double>(0.0))
+		this->speed = static_cast<double>(1.0);
+
+	do
+	{
+		// some variables to initialise
+//		cout << "." ;
+
+		// polling period to simulate speed
+
+		// -------------------- 	 SOFTWARE LIMITS SIMULATION 	--------------------
+		// look the software limits if configured
+		// ( via min and max _value properties of attribute Position ):
+		if((this->software_limit_low_valid) && (this->pos <= software_limit_low))
+		{
+			DEBUG_STREAM << " LIMIT SWITCH BACKWARD ACTIVE" << endl;
+			this->limit_low_active = true;
+		}
+		else
+		{
+			this->limit_low_active = false;
+		}
+
+		if((this->software_limit_high_valid) &&  (this->pos >= software_limit_high))
+		{
+			DEBUG_STREAM << " LIMIT SWITCH FORWARD ACTIVE" << endl;
+			this->limit_high_active = true;
+		}
+		else
+		{
+			this->limit_high_active = false;
+		}
+
+		// -------------------- 	 STATE MACHINE	 --------------------
+		// STOP ACTIVITY
+		if ( ((this->actual_move == MOVE_FORWARD)  && (this->req == REQ_STOP))				 ||
+				 ((this->actual_move == MOVE_BACKWARD) && (this->req == REQ_STOP))				 ||
+				 ((this-> actual_move == POS_OK)			 && (this->req == REQ_FORWARD)) 		 ||
+				 ((this-> actual_move == POS_OK)			 && (this->req == REQ_GOTOPOS_FWD)	&& !positionned) ||
+				 ((this-> actual_move == POS_OK)			 && (this->req == REQ_BACKWARD))		 ||
+				 ((this-> actual_move == POS_OK)			 && (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
+				 ((this-> actual_move == POS_OK)			 && (this->req == REQ_STOP))				 ||
+				 ((this-> actual_move == POS_NOK) 			&& (this->req == REQ_FORWARD))		 ||
+				 ((this-> actual_move == POS_NOK) 			&& (this->req == REQ_GOTOPOS_FWD)  && !positionned) ||
+				 ((this-> actual_move == POS_NOK) 			&& (this->req == REQ_BACKWARD)) 	 ||
+				 ((this-> actual_move == POS_NOK) 			&& (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
+				 ((this-> actual_move == POS_NOK) 			&& (this->req == REQ_STOP)) )
+		{
+			this->actual_move = MOVE_STOP;
+			DEBUG_STREAM << "this->actual_move = MOVE_STOP;" << endl;
+
+		}
+		// FORWARD ACTIVITY
+		if( ((this->actual_move == MOVE_STOP) 		 && (this->req == REQ_FORWARD))  ||
+				((this->actual_move == MOVE_STOP) 		 && (this->req == REQ_GOTOPOS_FWD) && !positionned) ||
+				((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_FORWARD))  ||
+				((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_GOTOPOS_FWD) && !positionned)  )
+		{
+			actual_move = MOVE_FORWARD;
+			DEBUG_STREAM << "actual_move = MOVE_FORWARD;" << endl;
+		}
+		// BACKWARD ACTIVITY
+		if( ((this->actual_move == MOVE_STOP) 		 && (this->req == REQ_BACKWARD))	||
+				((this->actual_move == MOVE_STOP) 		 && (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
+				((this->actual_move == STOPPED_LSFWD)  && (this->req == REQ_BACKWARD))	||
+				((this->actual_move == STOPPED_LSFWD)  && (this->req == REQ_GOTOPOS_BKWD) && !positionned)	)
+		{
+			actual_move = MOVE_BACKWARD;
+			DEBUG_STREAM << "actual_move = MOVE_BACKWARD;" << endl;
+		}
+		// ON LIMIT SWITCH FORWARD ACTIVITY
+		if( (this->actual_move == MOVE_FORWARD) && limit_high_active )
+		{
+			actual_move = STOPPED_LSFWD;
+			DEBUG_STREAM << " actual_move = STOPPED_LSFWD; " << endl;
+		}
+		// ON LIMIT SWITCH BACKWARD ACTIVITY
+		if( (this->actual_move == MOVE_BACKWARD) && limit_low_active )
+		{
+			actual_move = STOPPED_LSBKWD;
+			DEBUG_STREAM << "actual_move = STOPPED_LSBKWD;" << endl;
+		}
+		// POS_OK activity : position OK or NOT OK
+		if( ((this->actual_move == MOVE_FORWARD)||(this->actual_move == MOVE_BACKWARD)) && positionned )
+		{
+			double delta = fabs((this->pos - this->setpoint));
+			DEBUG_STREAM << " pos : " << pos << " 		setpoint : " << setpoint	<< " delta : " << delta << "		 accuracy : " << accuracy << endl;
+			if( delta <= this->accuracy )
+			{
+				actual_move = POS_OK;
+				DEBUG_STREAM << "actual_move = POS_OK " << endl;
+//				std::cout << "actual_move = POS_OK " << endl;
+			}
+			else
+			{
+				actual_move = POS_NOK;
+				DEBUG_STREAM << "actual_move = POS_NOT_OK !!!!" << endl;
+//				std::cout << "actual_move = POS_NOT_OK !!!!" << endl;
+			}
+		}
+
+		// -------------------- 	 SIMULATE MOVE	 --------------------
+
+		if( (this->actual_move == MOVE_FORWARD) && !limit_high_active )  // si forward on incremente
+		{
+			this->pos += step;
+//			std::cout << "+" ;
+		}
+		if( (this->actual_move == MOVE_BACKWARD) && !limit_low_active )// si backward on decremente
+		{
+			this->pos -= step;
+//			std::cout << "-" ;
+		}
+
+
+		// -------------------- 	 SIMULATE POSITION OK 	--------------------
+
+		if(!positionned && (this->req == REQ_GOTOPOS_BKWD) )
+		{
+			if(this->pos <= this->setpoint)
+			{
+//					this->pos = this->setpoint;
+//				std::cout << "positionned backward at : " << this->pos << endl;
+				positionned = true;
+
+			}
+		}
+		if(!positionned && (this->req == REQ_GOTOPOS_FWD))
+		{
+			if(this->pos >= this->setpoint)
+			{
+//					this->pos = this->setpoint;
+//				std::cout << "positionned forward at : " << this->pos << endl;
+				positionned = true;
+			}
+		}
+
+	 // --------------------		POLLING PERIOD slow down if no move 	--------------------
+
+		if( (this->actual_move != MOVE_FORWARD) && (this->actual_move != MOVE_BACKWARD) )
+		{
+			// stopped : polling period of O,1 s
+			polling_period_nsec = 100000000;
+		}
+		// endormir le thread pour le temps
+		this->sleep(polling_period_sec, polling_period_nsec);
+
+	}while(this->req != REQ_EXIT);
+	cout<<"end sequence"<<endl;
+
+	return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/InitializeReferencePositionThread.h b/src/InitializeReferencePositionThread.h
new file mode 100644
index 0000000000000000000000000000000000000000..02ec57e199de921af6251555d66f4ca26a0d81b0
--- /dev/null
+++ b/src/InitializeReferencePositionThread.h
@@ -0,0 +1,48 @@
+
+#ifndef _INITIALISE_REFERENCE_POSITION_THREAD_
+#define _INITIALISE_REFERENCE_POSITION_THREAD_
+
+#include <tango.h>
+#include "tangothread.h"
+
+
+	enum INIT_TYPE {LS_FORWARD, LS_BACKWARD, LS_HOME, USER_DEFINED, NOT_POSSIBLE};
+	enum RET_VALUE (INIT_SUCCESS, INIT_ERROR, INIT_STOPPED);
+	enum REQ (INIT_EXIT=-1, INIT_STOP, INIT_START, INIT_PAUSE);
+
+class InitializeReferencePositionThread : public Tango::Thread, public Tango::LogAdapter
+{
+public:
+	InitializeReferencePositionThread(SimulatedMotor *m, INIT_TYPE it); 	// pointer on the device to simulate
+	virtual ~InitializeReferencePositionThread(void);
+	// start finding reference position
+	void start(void);
+	// stops finding reference position
+	void stop(void);
+private:
+	// pointer on the motor device to be initialized
+	simulatedMotor * mot ;
+	INIT_TYPE init_type;
+	REQ req;
+
+
+
+	void init_USER_DEFINED(Tango::DevDouvle position);
+	// METHOD : positionning on LS backward
+	void init_LS_BAKWARD(void);
+	void init_LS_FORWARD(void);
+	void init_LS_HOME(void);
+
+
+	//virtual void	 run(void* arg){};
+	virtual void* run_undetached (void* arg);
+
+//	Tango::Semaphore* sem;
+	unsigned long polling_period_nsec;
+	unsigned long polling_period_sec;
+
+};
+
+
+
+#endif //_INITIALISE_REFERENCE_POSITION_THREAD_
diff --git a/src/TangoThread.h b/src/TangoThread.h
new file mode 100644
index 0000000000000000000000000000000000000000..07752ab0ff7a66fa4d9fe1702d0ce98dd68b7912
--- /dev/null
+++ b/src/TangoThread.h
@@ -0,0 +1,983 @@
+
+#ifndef _TangoThread_
+#define _TangoThread_
+
+
+#include <tango.h>
+#include <omnithread.h>
+#include <iostream>
+
+namespace Tango
+{
+
+/**
+* mutex
+*/
+//class Mutex : private omni_mutex
+class Mutex : public omni_mutex
+{
+public:
+  Mutex(void)
+    :omni_mutex()
+  {};
+  
+  ~Mutex(void){}
+  /**
+  * lock mutex
+  */
+  void lock(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_mutex::lock();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Mutex::lock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot lock mutex"),
+        (const char*)("Mutex::lock")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Mutex::unlock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot lock mutex"),
+        (const char*)("Mutex::lock")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Mutex::lock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot lock mutex"),
+        (const char*)("Mutex::lock"));
+    }
+  }
+  /**
+  * unlock mutex
+  */
+  void unlock(void)
+    throw (Tango::DevFailed)
+  { 
+    try{
+      omni_mutex::unlock();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Mutex::unlock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot unlock mutex"),
+        (const char*)("Mutex::unlock")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Mutex::unlock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot unlock mutex"),
+        (const char*)("Mutex::unlock")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Mutex::unlock==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot unlock mutex"),
+        (const char*)("Mutex::unlock"));
+    }
+  }
+  
+private:
+  /**
+  * Dummy copy ctor to prevent copying
+  */
+  Mutex(const Mutex&);
+  /**
+  * Dummy operator = to prevent copying
+  */
+  Mutex& operator=(const Mutex&);
+};
+  
+/**
+* mutex lock. To use a single instance of Mutex. \n
+* example: \n
+* { \n
+* MutexLock ml(mutex); //lock \n
+* ... \n
+* } //unlock \n
+*/
+class MutexLock
+{
+  Mutex& mutex_;
+public:
+  /**
+  * Ctor. lock a mutex
+  * @param _mutex The mutex to lock.
+  */
+  MutexLock(Mutex& _mutex)
+    :mutex_(_mutex)
+  {mutex_.lock();}
+  /**
+  * Dtor. Unlock mutex locked in ctor.
+  */
+  ~MutexLock(void)
+  {mutex_.unlock();}
+private:
+  /**
+  * Dummy copy ctor to prevent copying
+  */
+  MutexLock(const MutexLock&);
+  /**
+  * Dummy operator = to prevent copying
+  */
+  MutexLock& operator=(const MutexLock&);
+};
+
+/**
+* condition
+*/
+//class Condition: private omni_condition
+class Condition: public omni_condition
+{
+public:
+  /**
+  * Ctor.
+  * @param _mutex A pointer to an existing mutex.
+  * There is an implicit lock and unlock around wait() and timedwait()
+  */
+  Condition(Tango::Mutex* _mutex)
+    :omni_condition((omni_mutex*)_mutex)
+  {}
+  
+  ~Condition(void){}
+  /**
+  * Wait for the condition variable to be signalled.
+  * The mutex is implicitly released before waiting and locked again after waking up.
+  * If wait() is called by multiple threads, a signal may wake up more than one thread. \n
+  * See POSIX threads documentation for details.
+  */
+  void wait(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_condition::wait();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Condition::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot wait condition"),
+        (const char*)("Condition::wait")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Condition::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot wait condition"),
+        (const char*)("Condition::wait")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Condition::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot wait condition"),
+        (const char*)("Condition::wait"));
+    }
+  }
+  /**
+  * @param secs The time in seconds to wait (in absolute time).
+  * @param nanosecs The time in nanoseconds to wait (in absolute time).
+  * @see Tango::Thread::get_time() to wait for a relative time from now.
+  * @return 1 if sucessfully signalled, 0 if time expired.
+  */
+  int timedwait(unsigned long secs, unsigned long nanosecs = 0)
+    throw (Tango::DevFailed)
+  {
+    int r ;
+    try{
+      r = omni_condition::timedwait(secs, nanosecs);
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Condition::timedwait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot timedwait condition"),
+        (const char*)("Condition::timedwait")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Condition::timedwait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot timedwait condition"),
+        (const char*)("Condition::timedwait")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Condition::timedwait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot timedwait condition"),
+        (const char*)("Condition::timedwait"));
+    }
+    return r;
+  }
+  /**
+  * If one or more threads have called wait(), signal wakes up at least one of them, possibly more.\n
+  * See POSIX threads documentation for details.
+  */
+  void signal(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_condition::signal();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Condition::signal==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot signal condition"),
+        (const char*)("Condition::signal")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Condition::signal==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot signal condition"),
+        (const char*)("Condition::signal")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Condition::signal==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot signal condition"),
+        (const char*)("Condition::signal"));
+    }
+  }
+  /**
+  * broadcast is like signal() but wakes all threads which have called wait()
+  */
+  void broadcast(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_condition::broadcast();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Condition::broadcast==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot broadcast condition"),
+        (const char*)("Condition::broadcast")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Condition::broadcast==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot broadcast condition"),
+        (const char*)("Condition::broadcast")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Condition::broadcast==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot broadcast condition"),
+        (const char*)("Condition::broadcast"));
+    }
+  }
+private:
+  /**
+  * Dummy copy ctor to prevent copying
+  */
+  Condition(const Condition&);
+  /**
+  * Dummy operator = to prevent copying
+  */
+  Condition& operator=(const Condition&);
+};
+
+
+/**
+* Counting semaphore
+*/
+class Semaphore : private omni_semaphore
+{
+public:
+  /**
+  * Ctor.
+  * @param initial_value The value from which to start to increment with wait() (or trywait()) or decremenent with post().
+  */
+  Semaphore(unsigned int initial_value = 1)
+    :omni_semaphore(initial_value)
+  {}
+  ~Semaphore(void){}
+  /**
+  * If semaphore value is > 0 then decrement it and carry on. If it's 0 then block.
+  */
+  void wait(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_semaphore::wait();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Semaphore::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot wait semaphore"),
+        (const char*)("Semaphore::wait")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Semaphore::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot wait semaphore"),
+        (const char*)("Semaphore::wait")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Semaphore::wait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot wait semaphore"),
+        (const char*)("Semaphore::wait"));
+    }
+  }
+  /**
+  * If semaphore value is > 0 then decrement it and carry on. If it's already 0 then return 0.
+  */
+  int trywait(void)
+    throw (Tango::DevFailed)
+  {
+    int r;
+    try{
+      r= omni_semaphore::trywait();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Semaphore::trywait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot trywait semaphore"),
+        (const char*)("Semaphore::trywait")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Semaphore::trywait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot trywait semaphore"),
+        (const char*)("Semaphore::trywait")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Semaphore::trywait==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot trywait semaphore"),
+        (const char*)("Semaphore::trywait"));
+    }
+    return r;
+  }
+  /**
+  * If any threads are blocked in wait(), wake one of them up. 
+  * Otherwise increment the value of the semaphore.
+  */
+  void post(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_semaphore::post();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Semaphore::post==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot post semaphore"),
+        (const char*)("Semaphore::post")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Semaphore::post==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot post semaphore"),
+        (const char*)("Semaphore::post")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Semaphore::post==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot post semaphore"),
+        (const char*)("Semaphore::post"));
+    }
+  }
+
+private:
+  /**
+  * Dummy copy ctor to prevent copying
+  */
+  Semaphore(const Semaphore&);
+  /**
+  * Dummy operator = to prevent copying
+  */
+  Semaphore& operator=(const Semaphore&); 
+};
+
+/**
+* semaphore lock. To use a single instance of Semaphore. \n
+* example: \n
+* { \n
+* SemaphoreLock ml(sem); //wait \n
+* ... \n
+* } //post \n
+*/
+/**
+* semaphore lock
+*/
+class SemaphoreLock
+{
+  Semaphore& sem;
+public:
+  /**
+  * 
+  */
+  SemaphoreLock(Semaphore& s):sem(s){sem.wait();}
+  /**
+  * 
+  */
+  ~SemaphoreLock(void){sem.post();}
+private:
+  /**
+  * Dummy copy ctor to prevent copying
+  */
+  SemaphoreLock(const SemaphoreLock&);
+  /**
+  * Dummy operator = to prevent copying
+  */
+  SemaphoreLock& operator=(const SemaphoreLock&); 
+};
+
+
+/**
+* thread
+*/
+class Thread : private omni_thread
+{
+
+public:
+  /**
+  * Priority of the thread.
+  */
+  enum thread_priority
+  {
+    LOW = omni_thread::PRIORITY_LOW,
+    NORMAL = omni_thread::PRIORITY_NORMAL,
+    HIGH = omni_thread::PRIORITY_HIGH
+  };
+  /**
+  * State of the thread
+  */
+  enum thread_state
+  {
+    NEW = omni_thread::STATE_NEW,
+      RUNNING = omni_thread::STATE_RUNNING,
+      TERMINATED = omni_thread::STATE_TERMINATED
+  };
+  /**
+  * Ctor of a detached thread running the given function.
+  * @param fn The function to run.
+  * @param arg The input argument of the given function.
+  * @param pri The priority of the thread.
+  */
+  Thread(void (*fn)(void*), void* arg = NULL, thread_priority pri = NORMAL)
+    :omni_thread(fn, arg, (omni_thread::priority_t)pri)
+  {}
+  /**
+  * Ctor of an undetached thread running the given function (can have a return value).
+  * @param fn The function to run.
+  * @param arg The input argument of the given function.
+  * @param pri The priority of the thread.
+  */
+   Thread(void* (*fn)(void*), void* arg = NULL, thread_priority pri = NORMAL)
+    :omni_thread(fn, arg, (omni_thread::priority_t)pri)
+  {}
+  /**
+  * Ctor of a thread thread that will run either run() or run_undetached()
+  * @param arg The input argument of run() or run_undetached()
+  * @param pri The priority of the thread
+  */
+  Thread(void* arg=NULL, thread_priority pri = NORMAL)
+    :omni_thread(arg, (omni_thread::priority_t)pri)
+  {}
+  /**
+  * Call run() or the given function (depends on ctor called).
+  */
+  void start(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::start();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::start==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot start thread"),
+        (const char*)("Thread::start")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::start==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot start thread"),
+        (const char*)("Thread::start")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::start==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot start thread"),
+        (const char*)("Thread::start"));
+    }
+  }
+  /**
+  * Causes the calling thread waiting for the completion of this thread.
+  * @param arg The value returned by the method called with start() or start_undetached().
+  * Only undetached threads can be joined.
+  */
+  void join(void** arg)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::join(arg);
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::join==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot join thread"),
+        (const char*)("Thread::join")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::join==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot join thread"),
+        (const char*)("Thread::join")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::join==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot join thread"),
+        (const char*)("Thread::join"));
+    }
+  }
+  /**
+  * Set the priority of the thread.
+  */
+  void set_priority(thread_priority prio) 
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::set_priority((omni_thread::priority_t)prio); 
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::set_priority==="<<endl;
+      Tango::Except::throw_exception(
+      (const char*)("THREAD_FATAL_ERROR"),
+      (const char*)("Cannot set priority "),
+      (const char*)("Thread::set_priority")
+      );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::set_priority==="<<endl;
+      Tango::Except::throw_exception(
+      (const char*)("THREAD_INVALID_ERROR"),
+      (const char*)("Cannot set priority"),
+      (const char*)("Thread::set_priority")
+      );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::set_priority==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot set priority"),
+        (const char*)("Thread::set_priority"));
+    }
+  }
+  /**
+  * Causes the calling thread to terminate.
+  */
+  static void exit(void* return_value = NULL)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::exit(return_value);
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::exit==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot exit "),
+        (const char*)("Thread::exit")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::exit==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot exit"),
+        (const char*)("Thread::exit")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::exit==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot exit"),
+        (const char*)("Thread::exit"));
+    }
+    
+  }
+  /**
+  * allow another thread to run.
+  */
+  static void yield(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::yield();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::yield==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot yield "),
+        (const char*)("Thread::yield")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::yield==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot yield"),
+        (const char*)("Thread::yield")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::yield==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot yield"),
+        (const char*)("Thread::yield"));
+    }
+  }
+  /**
+  * Sleep for the time specified.
+  */
+  static void sleep(unsigned long secs, unsigned long nanosecs = 0)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::sleep(secs, nanosecs);
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::sleep==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot sleep "),
+        (const char*)("Thread::sleep")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::sleep==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot sleep"),
+        (const char*)("Thread::sleep")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::sleep==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot sleep"),
+        (const char*)("Thread::sleep"));
+    }
+  }
+  /**
+  * Calculate an absolute time in seconds and nanoseconds, for using Condition::timedwait()
+  * @param rel_sec The desired relative time (seconds part). 
+  * @param rel_nsec The desired relative time (nanoseconds part). 
+  * @param abs_sec The absolute time returned (seconds part). 
+  * @param abs_nsec The absolute time returned (nanoseconds part). 
+  */
+  static void get_time(unsigned long* abs_sec, unsigned long* abs_nsec,
+    unsigned long rel_sec = 0, unsigned long rel_nsec=0)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::get_time(abs_sec, abs_nsec, rel_sec, rel_nsec);
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::get_time==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot get time "),
+        (const char*)("Thread::get_time")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::get_time==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot get time"),
+        (const char*)("Thread::get_time")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::get_time==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get time"),
+        (const char*)("Thread::get_time"));
+    }
+  }
+  /**
+  * Set the size of the stack.
+  */
+  static void stacksize(unsigned long sz)
+    throw (Tango::DevFailed)
+  { 
+    try{ 
+      omni_thread::stacksize(sz); 
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot set stacksize "),
+        (const char*)("Thread::stacksize")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot set stacksize"),
+        (const char*)("Thread::stacksize")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot set stacksize"),
+        (const char*)("Thread::stacksize"));
+    }
+  }
+   /**
+  * Get the size of the stack.
+  */
+  static unsigned long stacksize()
+    throw (Tango::DevFailed)
+  { 
+    try{ 
+      return omni_thread::stacksize();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot get stacksize "),
+        (const char*)("Thread::stacksize")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot get stacksize"),
+        (const char*)("Thread::stacksize")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::stacksize==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get stacksize"),
+        (const char*)("Thread::stacksize"));
+    }
+  }
+  
+  /**
+  * Get the priority of the thread.
+  */
+  thread_priority priority(void)
+    throw (Tango::DevFailed)
+  { 
+    try{ 
+      return (thread_priority)omni_thread::priority();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::priority==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot get priority "),
+        (const char*)("Thread::priority")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::priority==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot get priority"),
+        (const char*)("Thread::priority")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::priority==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get priority"),
+        (const char*)("Thread::priority"));
+    }
+  }
+  
+  /**
+  * Get the current state of the thread
+  */
+  thread_state state(void)
+    throw (Tango::DevFailed)
+  { 
+    try{ 
+      return (thread_state)omni_thread::state();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::state==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot get state "),
+        (const char*)("Thread::state")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::state==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot get state"),
+        (const char*)("Thread::state")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::state==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get state"),
+        (const char*)("Thread::state"));
+    }
+  }
+
+  
+  /**
+  * @return The id of the thread
+  */
+  int id(void)
+    throw (Tango::DevFailed)
+  { 
+    try{ 
+      return omni_thread::id();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::id==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot get id "),
+        (const char*)("Thread::id")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::id==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot get id"),
+        (const char*)("Thread::id")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::id==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get id"),
+        (const char*)("Thread::id"));
+    }
+  }
+  /**
+  * Will run the member function run_undetached()
+  */
+  void  start_undetached(void)
+    throw (Tango::DevFailed)
+  {
+    try{
+      omni_thread::start_undetached();
+    }catch(omni_thread_fatal)
+    {
+      cout<<"===exception Thread::start_undetached==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_FATAL_ERROR"),
+        (const char*)("Cannot start_undetached thread"),
+        (const char*)("Thread::start_undetached")
+        );
+    }catch(omni_thread_invalid)
+    {
+      cout<<"===exception Thread::start undetached==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("THREAD_INVALID_ERROR"),
+        (const char*)("Cannot start undetached thread"),
+        (const char*)("Thread::start_undetached")
+        );      
+    }catch(...)
+    {
+      cout<<"===exception Thread::id==="<<endl;
+      Tango::Except::throw_exception(
+        (const char*)("UNKNOWN_ERROR"),
+        (const char*)("Cannot get start undetached thread"),
+        (const char*)("Thread::start_undetached"));
+    }
+  }
+protected:
+  virtual ~Thread(void){}
+private:
+  /**
+  * When construct with Thread(void* arg=NULL, thread_priority pri = NORMAL), this function is called by start()
+  */
+  virtual void run(void* arg){}
+  /**
+  * When construct with Thread(void* arg=NULL, thread_priority pri = NORMAL), this function is called by start_undetached()
+  */
+  virtual void* run_undetached(void* arg){return NULL;}
+
+  
+  Thread(const Thread&);
+  Thread& operator=(const Thread&);
+
+};
+
+}
+
+#endif //_TangoThread_