Thread Engine

Added thread simulation capabilty with a new motor named thread_engine.

- thread_engine not yet tested and debugged.

- changed minor sintax of global code for better integration