//---------------------------------------------------------- // Module Scheduler //---------------------------------------------------------- #include "module_Scheduler.h" #include "Exec/prr.h" void orc_Mod_Scheduler::init() { // Orccad Version: 3.2 // Module : Scheduler // Initialisation File // // Module Ports : // // Time Methods usable in module files: // GetLocalTime(): return relative period time as double value // GetCurrentTime(): return global period time as double value // // Date of creation : Mon Sep 29 10:13:55 2008 //finding the pointers of all MTs mt = Mt_ptr->GetRobotTaskPtr()->GetRTList_MT()->get_Mt_ptr(); int end; if (mt==NULL) end=TRUE; else end=FALSE; // while(!end) // { // if(strcmp(mt->getMTname(),"mt_X4_MT_0")==0) {Mt_ptr_0 = mt;printf("0\n"); } // else if (strcmp(mt->getMTname(),"mt_X4_MT_1")==0) {Mt_ptr_1 = mt;printf("1\n");} // else if (strcmp(mt->getMTname(),"mt_X4_MT_2")==0) {Mt_ptr_2 = mt;printf("2\n");} // else if (strcmp(mt->getMTname(),"mt_X4_MT_3")==0) {Mt_ptr_3 = mt;printf("3\n");;} // else if (strcmp(mt->getMTname(),"mt_X4_MT_4")==0) {Mt_ptr_4 = mt;printf("4\n");} // mt=mt->getNext(); // if (mt==NULL) // end=TRUE; // } // printf("--- FIRST MT %s\n",Mt_ptr_0->getMTname()); // printf("--- MT %s\n",Mt_ptr_1->getMTname()); // printf("--- MT %s\n",Mt_ptr_2->getMTname()); // printf("--- MT %s\n",Mt_ptr_3->getMTname()); // printf("--- LAST MT %s\n",Mt_ptr_4->getMTname()); // printf("INIT TIME %lld \n",(orcGetExecTime(Mt_ptr_0->get_MtId()))); // printf("MTgetExecTime %lld \n",Mt_ptr_0->MTgetExecTime()); // printf("--- MT %s\n",Mt_ptr_4->getMTname()); // printf("INIT TIME %lld \n",(orcGetExecTime(Mt_ptr_4->get_MtId()))); // printf("MTgetExecTime %lld \n",Mt_ptr_4->MTgetExecTime()); } void orc_Mod_Scheduler::param() { plugParam(); } void orc_Mod_Scheduler::reparam() { } void orc_Mod_Scheduler::compute( ) { // Orccad Version: 3.2 // Module : Scheduler // Computation File // // Module Ports : // // // Date of creation : Mon Sep 29 10:13:55 2008 //A feedback scheduler can go here // printf("--- MT %s\n",Mt_ptr_0->getMTname()); // // we can check its exec. time since last call preemption deduced (Xenomai only) // printf("MTgetExecTime %lld \n",Mt_ptr_0->MTgetExecTime()); // //check its total exec. time from the begining, preemption deduced (Xenomai only) // printf("total ExecTime %lld \n",(orcGetExecTime(Mt_ptr_0->get_MtId()))); // //record the response time of its last execution // printf("last response time %lld \n",Mt_ptr_0->get_resp_time()); // //sum the response times from beginning // printf("total response time %lld \n",Mt_ptr_0->get_tot_time()); // //check its sampling period // printf("period %lf\n", Mt_ptr_0->GetSampleTime()); // //change its sampling time // Mt_ptr_0->SetSampleTime(0.01); } void orc_Mod_Scheduler::end() { // Orccad Version: 3.2 // Module : Scheduler // End File // // Module Ports : // // // Date of creation : Mon Sep 29 10:13:55 2008 // printf("INIT TIME %lld \n",(orcGetExecTime(Mt_ptr_0->get_MtId()))); // printf("MTgetExecTime %lld \n",Mt_ptr_0->MTgetExecTime()); // printf("--- MT %s\n",Mt_ptr_4->getMTname()); // printf("INIT TIME %lld \n",(orcGetExecTime(Mt_ptr_4->get_MtId()))); // printf("MTgetExecTime %lld \n",Mt_ptr_4->MTgetExecTime()); return; } // End class orc_Mod_Scheduler