Commit 8be71f5c authored by Franck Cecillon's avatar Franck Cecillon
Browse files

Commit changes after test on D19

parent 4a571d08
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NomadModules</name>
<name>nomad-modules</name>
<comment></comment>
<projects>
<project>NomadServer</project>
......
......@@ -92,7 +92,8 @@ void KineticExternalCount::updateNbSlices() {
log(Level::s_Info) << " ScanFlying slice index " << nbSlices() << endlog;
//T cout << " KineticExternalCount::preStart nbSlices " << nbSlices() << endl;
if ((nbSlices() % 10) == 0) {
if ((nbSlices() % 20) == 0) {
//log(Level::s_Info) << " ScanFlying read data " << nbSlices() << endlog;
for (int32 ki = 0; ki < nDetectors(); ++ki) {
detectorControllers[ki]->readParallel(false);
}
......
......@@ -172,10 +172,20 @@ void KineticExternalAcquisitionController::updateActualSliceTable() {
//Use Drivers 0 to have the table
memcpy(m_Slices, m_KineticDrivers[0]->slicesAcq(), totalslices * sizeof(float64));
}
/*for (uint32 i = 0; i < (uint32) totalslices; ++i) {
cout << "DBG************ KineticExternalAcquisitionController slices " << m_Slices[i] << endl;
}*/
//float64 avrg = 0.0;
//float64 stdev = 0.0;
//float64 stdev2 = 0.0;
//for (uint32 i = 0; i < (uint32) totalslices; ++i) {
//cout << "DBG************ KineticExternalAcquisitionController slices " << m_Slices[i] << endl;
//avrg = avrg + m_Slices[i];
//}
//avrg = avrg / totalslices;
//for (int32 j = 0; j < totalslices; ++j) {
//stdev2 = stdev2 + pow((m_Slices[j] - avrg), 2.0);
//}
//stdev = pow((stdev2 / totalslices), 0.5);
//cout << "DBG************ KineticExternalAcquisitionController avrg " << avrg << endl;
//cout << "DBG************ KineticExternalAcquisitionController stdev " << stdev << endl;
}
void KineticExternalAcquisitionController::updateActualSliceTableTime() {
......
......@@ -36,8 +36,8 @@ const std::string D19ScanFlying::TYPE = "d19_scan_flying";
//const float64 D19ScanFlying::DELTA_SUPP = 0.07;
// normal speed
const float64 D19ScanFlying::DELTA_SUPP_FAST = 1.28;
const float64 D19ScanFlying::DELTA_SUPP_MEDIUM = 0.28;
const float64 D19ScanFlying::DELTA_SUPP_SLOW = 0.10;
const float64 D19ScanFlying::DELTA_SUPP_MEDIUM = 0.08;
const float64 D19ScanFlying::DELTA_SUPP_SLOW = 0.02;
const float64 D19ScanFlying::SPEED_FAST=800;
const float64 D19ScanFlying::SPEED_SLOW=38.4;
......@@ -203,6 +203,7 @@ void D19ScanFlying::calculate(float64 fstart, float64 fend, float64 fdelta) {
int32 totalslices = numberOfStepScans() ;
cout << " D19ScanFlying::calculate " << totalslices << endl;
if (m_SlicesOmega){
delete[] m_SlicesOmega;
m_SlicesOmega = nullptr;
......@@ -240,6 +241,27 @@ void D19ScanFlying::calculateFromEnd(float64 fstart, float64 fend, float64 fdelt
scanStart.update(lStart);
}
nbSlices.setpoint.update(numberOfStepScans());
int32 totalslices = numberOfStepScans() ;
cout << " D19ScanFlying::calculateFromEnd " << totalslices << endl;
if (m_SlicesOmega){
delete[] m_SlicesOmega;
m_SlicesOmega = nullptr;
}
m_SlicesOmega = new float64[totalslices];
if (scanDirection() > 0) {
for (uint32 ki = 0; ki < (uint32) totalslices; ++ki) {
m_SlicesOmega[ki] = fstart + ki * fdelta;
}
} else {
for (uint32 ki = 0; ki < (uint32) totalslices; ++ki) {
m_SlicesOmega[ki] = fend - ki * fdelta;
}
}
omegaSliceAct.update(m_SlicesOmega);
omegaSliceAct.setSize(totalslices);
}
void D19ScanFlying::refreshWantedAxisInOutIndexProperty(int32 value) {
......@@ -319,6 +341,7 @@ void D19ScanFlying::start() {
m_scan_active = false;
log(Level::s_Info) << "End of Flying scan on " << m_axisCurrent->getName() << endlog;
axisOmegaFly->percentSpeed = (int32)( VirtualFlyAxis::SP_FAST );
commandStatus.setIdle();
commandProgression = 100;
}
......@@ -346,6 +369,7 @@ void D19ScanFlying::stop() {
m_scan_active = false;
commandStatus.setIdle();
commandProgression = 100;
axisOmegaFly->percentSpeed = (int32)( VirtualFlyAxis::SP_FAST );
log(Level::s_Info) << "stopped" << endlog;
}
......@@ -423,7 +447,7 @@ void D19ScanFlying::initMotor() {
}
void D19ScanFlying::initScan() {
//saveData = true;
saveData = true;
m_KineExtCount->nbSlices.setpoint = nbSlices.setpoint();
m_KineExtCount->saveData = saveData();
m_KineExtCount->subtitle = subtitle();
......
......@@ -100,6 +100,11 @@ DetectorElement::~DetectorElement() {
delete[] m_dset2_data;
}
delete[] m_CorrY_Ind ;
delete[] m_CorrY_A0 ;
delete[] m_CorrY_A1 ;
delete[] m_CorrY_A2;
}
/*
......@@ -319,15 +324,15 @@ void DetectorElement::CalibrateOneSlice(int32* ldata,int32 indSlice) {
}
}
delete[] new_dataY;
delete[] new_dataX;
//delete[] new_dataY;
//delete[] new_dataX;
}else if (do_correctionY == true){
//cout << " do_correctionY " << endl;
for (int32 i = 0; i < sizeDet ; ++i) {
m_LinearData[i] = (int32) round(new_dataY[i]/10000.);
}
delete[] new_dataY;
//delete[] new_dataY;
}else{
//cout << " do_correctionY false " << endl;
......@@ -345,6 +350,16 @@ void DetectorElement::CalibrateOneSlice(int32* ldata,int32 indSlice) {
//cout << "*** slice " << indSlice << " lsumCal "<< lsumCal << " lsumRaw " << lsumRaw << endl;
if (new_dataY != nullptr) {
delete[] new_dataY;
new_dataY = nullptr;
}
if (new_dataX != nullptr) {
delete[] new_dataX;
new_dataX = nullptr;
}
data.sendEvent();
//cout << " Set Data Time Copy " << c12.getTime() << endl;
//cout << " Set Data Total Time " << c1.getTime() << endl;
......@@ -400,7 +415,7 @@ void DetectorElement::setDataForKinetic() {
data.sendEvent();
cout << "FRA 01 "<< endl;
delete[] tempoData;
}
......@@ -655,7 +670,7 @@ void DetectorElement::createCalibrationY(){
}
delete[] dset1_data;
}
void DetectorElement::createCalibrationX() {
......@@ -787,8 +802,7 @@ void DetectorElement::createCalibrationX() {
//cout << " Files calibrationXFileName() number of lines = " << nb_lines << "Time " << c1.getTime() << endl;
// Debug cout << " Files calibrationXFileName sumTT1 " << sumTT1 << "sumT1 " << sumT1 << endl;
}
}
}
......
......@@ -35,11 +35,12 @@ const float64 VirtualFlyAxis::TOL = 0.2; //mm
const float64 VirtualFlyAxis::SP_FAST = 4000;
const float64 VirtualFlyAxis::SP_MEDIUM = 400;
const float64 VirtualFlyAxis::SP_SLOW = 4; // 10
const float64 VirtualFlyAxis::SP_MEDIUM = 20;
const float64 VirtualFlyAxis::SP_SLOW = 10; // 10
// 400 1.5
// 10 60.0006 60.2506
// 40 10.8
// 4 151.252 150.752 153.502 149.502
......@@ -54,7 +55,7 @@ VirtualFlyAxis::VirtualFlyAxis(const string& name) :
// Init property
unit.init(this, SAVE | SPY, "unit");
position.init(this, SAVE | SPY, "actual_position", "wanted_position", "Position");
position.init(this, SAVE | SPY | SCAN, "actual_position", "wanted_position", "Position");
position.setUnit(unit);
offsetPosition.init(this, SAVE, "offset_position");
......@@ -345,9 +346,9 @@ void VirtualFlyAxis::move(bool blocking) {
try {
axisTCPAxis->wantedPosition = m_TCPAxis_SetPoint;
if (axisTCPAxis->wantedPosition() < axisTCPAxis->actualPosition() ){
axisMACAxis->position.setpoint = m_TCPAxis_SetPoint -5 ;
axisMACAxis->position.setpoint = m_TCPAxis_SetPoint ;
} else {
axisMACAxis->position.setpoint = m_TCPAxis_SetPoint +5 ;
axisMACAxis->position.setpoint = m_TCPAxis_SetPoint ;
}
if (percentSpeed() == 3) {
......
......@@ -4,7 +4,7 @@ d19_scan_flying.titleScan=Scan
# ScanPhi
d19_scan_flying.firstLabel=First
d19_scan_flying.lastLabel=Last
d19_scan_flying.deltaLabel=Delta Per step
d19_scan_flying.deltaLabel=Delta
d19_scan_flying.WantedScanTimeLabel=Time
d19_scan_flying.WantedStep=WantedStep
......@@ -13,7 +13,7 @@ d19_scan_flying.ActualStep=ActualStep
d19_scan_flying.degreeValue=~degree
d19_scan_flying.percentSpeed=Percent Speed
d19_scan_flying.percentSpeed=Speed
d19_scan_flying.1SpeedValue=1
d19_scan_flying.1SpeedLabel=Fast Speed
......
......@@ -7,6 +7,7 @@
<text role="d19_scan_flying1" property="scanStart" prefix="d19_scan_flying.firstLabel" />
<text role="d19_scan_flying1" property="scanEnd" prefix="d19_scan_flying.lastLabel" />
<text role="d19_scan_flying1" property="scanDelta" prefix="d19_scan_flying.deltaLabel" />
<combo role="d19_scan_flying1" property="percentSpeed" prefix="d19_scan_flying.percentSpeed" valuesAndLabels="d19_scan_flying.1Speed,d19_scan_flying.2Speed,d19_scan_flying.3Speed"/>
</group>
<newLine/>
......
......@@ -4,6 +4,8 @@
<number_of_lines nb_lines="1"/>
<text role="virtual_FlyAxis1" property="wanted_position" prefix="virtual_FlyAxis.wantedPositionCommandPrefix"/>
<label role="virtual_FlyAxis1" property="unit" spaceBefore="false"/>
<combo role="virtual_FlyAxis1" property="percentSpeed" prefix="virtual_FlyAxis.percentSpeed" valuesAndLabels="virtual_FlyAxis.1Sp,virtual_FlyAxis.2Sp,virtual_FlyAxis.3Sp"/>
<construction>
<simple_image prefix="LEFT_TO_RIGHT_ARROW"/>
<label role="virtual_FlyAxis1" property="wanted_position"/>
......
......@@ -90,10 +90,10 @@ AkdDriver::AkdDriver(const string& name) :
useHisto=false;
registerSpyCommand(COMMAND_READ_DEVICE_CONTAINER, 2);
registerSpyCommand(COMMAND_STATUS_DEVICE_CONTAINER, 2);
registerObserverCommand(COMMAND_READ_DEVICE_CONTAINER, 1);
registerObserverCommand(COMMAND_STATUS_DEVICE_CONTAINER, 1);
registerSpyCommand(COMMAND_READ_DEVICE_CONTAINER, 20);
registerSpyCommand(COMMAND_STATUS_DEVICE_CONTAINER, 20);
registerObserverCommand(COMMAND_READ_DEVICE_CONTAINER, 20);
registerObserverCommand(COMMAND_STATUS_DEVICE_CONTAINER, 20);
}
AkdDriver::~AkdDriver() {
......
......@@ -98,7 +98,7 @@ RealAkdDriver::RealAkdDriver(AkdDriver * owner) :
m_AkdFileDirectory = "/akd/";
m_coef_sens = -1;
}
RealAkdDriver::~RealAkdDriver() {
......@@ -133,7 +133,7 @@ void RealAkdDriver::read() {
uint32 actualPos= (uint32)(static_cast<float32>(owner()->readModbus(POSITION_ACTUAL_VALUE_REGISTER)));
float32 actualPosFloatContent = *(float32 *) &actualPos;
owner()->positionHardware = (float64)(actualPosFloatContent) ; // / (float64)(owner()->ratio()));
owner()->actualPosition = owner()->positionHardware() / (owner()->coefEncoderHardware() * (float64)(owner()->ratio()) );
owner()->actualPosition = m_coef_sens * owner()->positionHardware() / (owner()->coefEncoderHardware() * (float64)(owner()->ratio()) );
usleep(10000);
}
......@@ -298,7 +298,7 @@ void RealAkdDriver::positionMove() {
}
//Using actual_position and wanted_position properties inherited from AxisCommon
float32 wantedPosValue = (float32)( owner()->coefEncoderHardware() * owner()->wantedPosition() * (float32)(owner()->ratio()));
float32 wantedPosValue = (float32)( m_coef_sens * owner()->coefEncoderHardware() * owner()->wantedPosition() * (float32)(owner()->ratio()));
cout << "cons for pos " << owner()->wantedPosition() << " calc " << wantedPosValue << endl;
owner()->setPositionHardware = wantedPosValue ;
......@@ -499,7 +499,7 @@ void RealAkdDriver::readStatus() {
// Set status
int32 status = owner()->readModbus(STATUS_REGISTER);
owner()->status = status;
// cout << " status " << status << endl;
//cout << " status " << status << endl;
if (owner()->execMode() == AkdDriver::SPEED_MODE) {
float64 difference = fabs((owner()->wantedSpeed() - owner()->actualSpeed()));
......
......@@ -142,7 +142,7 @@ private:
static const int32 VAR_CAM_REGISTER;
Counter m_TimeCounter; //! Time counter
int32 m_coef_sens;
};
}
......
Supports Markdown
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