Commit 994dacbe authored by Franck Cecillon's avatar Franck Cecillon

correction

parent 4c3567ee
......@@ -26,7 +26,7 @@ namespace d50 {
const string SampleChanger::TYPE = "d50samplechanger";
const float64 SampleChanger::SAMPLECHANGER_TOLERANCE_LINES =0.1;
const float64 SampleChanger::SAMPLECHANGER_TOLERANCE_COLOMNS =0.05;
const float64 SampleChanger::SAMPLECHANGER_TOLERANCE_COLOMNS =0.1;
const int32 SampleChanger::SAMPLECHANGER_MAX =75;
const int32 SampleChanger::SAMPLECHANGER_LINES =5;
......@@ -41,7 +41,7 @@ SampleChanger::SampleChanger(const string& name) :
setFamily(family::ACQUISITION);
registerFunction(TYPE);
Cha.init(this, SAVE , "actual_cha" , "wanted_cha");
Cha.init(this, SAVE , "actual_cha" , "wanted_cha","CHA");
ChaIndiceLine.init(this, SAVE , "ind_cha_line" , "wanted_cha_line");
ChaIndiceColumns.init(this, SAVE , "ind_cha_col" , "wanted_cha_col");
useOneCha.init(this, SAVE , "use_one_cha");
......@@ -55,8 +55,8 @@ SampleChanger::SampleChanger(const string& name) :
shtGap2Value.init(this, SAVE , "shtGap2Value");
nChanger.init(this, SAVE, "number_changer");
trsSlots.init(this, SAVE, "trs_slots");
shtSlots.init(this, SAVE, "sht_slots");
trsSlots.init(this, NOSAVE, "trs_slots");
shtSlots.init(this, NOSAVE, "sht_slots");
ChangerIndice.init(this, SAVE, "ChangerIndice");
changerSubTitle .init(this, SAVE, "changerSubTitle");
......@@ -115,7 +115,7 @@ void SampleChanger::postConfiguration() {
lChangerName = "Changer " + lexical_cast<string>(lind+1);
lindiceCHA = 1000*ki +kj;
ChangerIndice.set(lind, lindiceCHA);
changerSubTitle.set(lind, lChangerName);
//changerSubTitle.set(lind, lChangerName);
trsSlots.set(lind, kj);
shtSlots.set(lind, ki);
......@@ -165,7 +165,11 @@ void SampleChanger::caculate_CHAposition() {
float64 fLineInd,fColInd;
int32 iLineInd,iColInd;
fLineInd = fabs(shtValue() / shtGapValue());
if (shtValue() < 60){
fLineInd = fabs(shtValue() / shtGapValue());
} else {
fLineInd = fabs( (shtValue()-shtGap2Value()) / shtGapValue());
}
fColInd = trsValue() / trsGapValue();
if ( fabs(fLineInd - round(fLineInd) ) > SAMPLECHANGER_TOLERANCE_LINES){
......@@ -187,13 +191,16 @@ void SampleChanger::caculate_CHAposition() {
iLineInd = round(fLineInd);
iColInd = round(fColInd) ;
Cha = iLineInd*15 + iColInd;
ChaIndiceLine = iLineInd;
ChaIndiceColumns = iColInd;
Cha = 1000*(iLineInd+1) + (iColInd+1);
string_actual_cha = "Cha " + lexical_cast<string>(Cha());
string_actual_cha_subT = changerSubTitle.get(SAMPLECHANGER_COLOMNS*iLineInd + iColInd);
if ((SAMPLECHANGER_COLOMNS*iLineInd + iColInd) <SAMPLECHANGER_MAX ){
string_actual_cha_subT = changerSubTitle.get(SAMPLECHANGER_COLOMNS*iLineInd + iColInd);
}
//cout << " string_actual_cha_subT " << string_actual_cha_subT() << endl;
commandStatus.setIdle();
......@@ -215,25 +222,17 @@ void SampleChanger::start() {
}
int32 wcal = 0;
int32 wline = 0;
shtValue.setpoint = 0;
int32 indiCHAcur = 0;
bool doCHA = true;
while (doCHA) {
trsValue.setpoint = wcal * trsGapValue();
try {
axisTRS->position.setpoint = trsValue.setpoint();
axisSHT->position.setpoint = shtValue.setpoint();
} catch (CannotSetValue&) {
stringstream message;
......@@ -250,8 +249,6 @@ void SampleChanger::start() {
log(Level::s_Info) << Cha << " (" << Cha.setpoint << ")" << endlog;
sleep(1);
count->mode = acquisition::TimeAcquisitionController::TIME_MODE;
// count->timeType = timeType();
......@@ -259,22 +256,25 @@ void SampleChanger::start() {
count->saveData = true;
count->totalReps = 1;
// count->counts.setpoint = counts();
count->subtitle = changerSubTitle.get(indiCHAcur);
count->startCommand(true);
if (indiCHAcur < SAMPLECHANGER_MAX){
count->subtitle = changerSubTitle.get(indiCHAcur);
}
//count->startCommand(true);
usleep(100);
wcal++;
if (wcal == SAMPLECHANGER_COLOMNS){
wcal = 0;
wline++;
if (wline == 2){
shtValue.setpoint = shtValue.setpoint()- ( shtGapValue()+ shtGap2Value());
shtValue.setpoint = shtValue.setpoint()+( shtGapValue()+ shtGap2Value());
}else {
shtValue.setpoint = shtValue.setpoint()- shtGapValue();
shtValue.setpoint = shtValue.setpoint()+ shtGapValue();
}
}
indiCHAcur++;
if ( ( (wline ==SAMPLECHANGER_LINES ) && (wcal == SAMPLECHANGER_COLOMNS) ) || (m_stopped == true) ) {
cout << " wline "<< wline << endl;
if ( ( wline == SAMPLECHANGER_LINES ) || (m_stopped == true) ) {
doCHA = false;
}
......@@ -289,7 +289,7 @@ void SampleChanger::stop() {
Parallel::begin();
axisTRS->stopParallel(false);
axisSHT->stopParallel(false);
count->stopParallel(false);
Parallel::end();
m_stopped = true;
log(Level::s_Info) << "stopped " << Cha << " (" << Cha.setpoint << ")" << endlog;
......@@ -301,10 +301,10 @@ void SampleChanger::load() {
char_separator<char> sep(" \t");
sendProgressEvent(0);
cout << " SampleChanger::load SampleChanger::load SampleChanger::load SampleChanger::load " << endl;
//cout << " SampleChanger::load SampleChanger::load SampleChanger::load SampleChanger::load " << endl;
int32 i = 0;
try {
string fileName = "/home/dpt/cecillon/Desktop/SampleList.txt";
string fileName = "/users/d50/Desktop/SampleList.txt";
ifstream ifs;
ifs.open(fileName.c_str());
if (ifs.is_open()) {
......
......@@ -26,6 +26,6 @@ d50samplechanger.TimeSuffix=sec
d50samplechanger.changerSubTPrefix=Sub Title
d50samplechanger.changerNamePrefix=Indice Changer
d50samplechanger1.load2Prefix=file Desktop/SampleList.txt
d50samplechanger1.loadPrefix=Reload
d50samplechanger.load2Prefix=file Desktop/SampleList.txt
d50samplechanger.loadPrefix=Reload
<plugin>
<!-- <controller type="d17samplechanger" role="d17samplechanger1"/>
<number_of_lines nb_lines="1"/>
<property_combo role="d17samplechanger1" property="wanted_cha" prefix="d17samplechanger.chaLabel"/>
<construction>
<simple_image prefix="LEFT_TO_RIGHT_ARROW"/>
<label role="d17samplechanger1" property="wanted_cha"/>
</construction>
<running>
<label role="d17samplechanger1" property="actual_cha"/>
<simple_image prefix="LEFT_TO_RIGHT_ARROW"/>
<label role="d17samplechanger1" property="wanted_cha"/>
</running>
<finished>
<simple_image prefix="TICK"/>
<label role="d17samplechanger1" property="actual_cha"/>
</finished> -->
<text role="d50samplechanger1" property="wanted_time" prefix="d50samplechanger.TimePrefix" suffix="d50samplechanger.TimeSuffix"/>
</plugin>
......@@ -11,7 +11,7 @@
<switchable_composite switcher_key="simpleAdvancedModeSwitcher" switch_values="LESS_OPTIONS_BUTTON">
<group title="d50samplechanger.T1">
<simple_label prefix="d50samplechanger.load2Prefix" spaceBefore="false"/>
<button role="d50samplechanger1" command="load" prefix="d50samplechanger1.loadPrefix" key="load" />
<button role="d50samplechanger1" command="load" prefix="d50samplechanger.loadPrefix" key="load" />
<newLine/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment