Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
67dd8d90
Commit
67dd8d90
authored
Jan 05, 2016
by
Jerome Locatelli
Browse files
Merge of branch Instrument_RC_174
parent
8bc1677a
Changes
132
Hide whitespace changes
Inline
Side-by-side
.cproject
View file @
67dd8d90
...
...
@@ -14,7 +14,7 @@
</extensions>
</storageModule>
<storageModule
moduleId=
"cdtBuildSystem"
version=
"4.0.0"
>
<configuration
artifactName=
"${ProjName}"
buildArtefactType=
"org.eclipse.cdt.build.core.buildArtefactType.exe"
buildProperties=
"org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.build
Type.debug
,org.eclipse.cdt.build.core.build
Artefact
Type=org.eclipse.cdt.build.core.build
ArtefactType.exe
"
cleanCommand=
"rm -rf"
description=
""
id=
"cdt.managedbuild.config.gnu.exe.debug.779576013"
name=
"Debug"
parent=
"cdt.managedbuild.config.gnu.exe.debug"
>
<configuration
artifactName=
"${ProjName}"
buildArtefactType=
"org.eclipse.cdt.build.core.buildArtefactType.exe"
buildProperties=
"org.eclipse.cdt.build.core.build
Artefact
Type=org.eclipse.cdt.build.core.build
ArtefactType.exe
,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.build
Type.debug
"
cleanCommand=
"rm -rf"
description=
""
id=
"cdt.managedbuild.config.gnu.exe.debug.779576013"
name=
"Debug"
parent=
"cdt.managedbuild.config.gnu.exe.debug"
>
<folderInfo
id=
"cdt.managedbuild.config.gnu.exe.debug.779576013."
name=
"/"
resourcePath=
""
>
<toolChain
id=
"cdt.managedbuild.toolchain.gnu.exe.debug.1794005325"
name=
"Linux GCC"
superClass=
"cdt.managedbuild.toolchain.gnu.exe.debug"
>
<targetPlatform
id=
"cdt.managedbuild.target.gnu.platform.exe.debug.1935120537"
name=
"Debug Platform"
superClass=
"cdt.managedbuild.target.gnu.platform.exe.debug"
/>
...
...
@@ -25,7 +25,7 @@
<option
id=
"gnu.cpp.compiler.exe.debug.option.debugging.level.1951401360"
name=
"Debug Level"
superClass=
"gnu.cpp.compiler.exe.debug.option.debugging.level"
value=
"gnu.cpp.compiler.debugging.level.max"
valueType=
"enumerated"
/>
<option
id=
"gnu.cpp.compiler.option.include.paths.221887624"
name=
"Include paths (-I)"
superClass=
"gnu.cpp.compiler.option.include.paths"
valueType=
"includePath"
>
<listOptionValue
builtIn=
"false"
value=
""${workspace_loc:/NomadServer/src/ics}""
/>
<listOptionValue
builtIn=
"false"
value=
"
/users/stereo/RawDataManager/include
"
/>
<listOptionValue
builtIn=
"false"
value=
"
"${workspace_loc:/NomadModules/src}"
"
/>
</option>
<inputType
id=
"cdt.managedbuild.tool.gnu.cpp.compiler.input.1751055782"
superClass=
"cdt.managedbuild.tool.gnu.cpp.compiler.input"
/>
</tool>
...
...
@@ -47,8 +47,6 @@
</tool>
</toolChain>
</folderInfo>
<fileInfo
id=
"cdt.managedbuild.config.gnu.exe.debug.779576013.1142121045"
name=
"RealStereoElecDriver.h"
rcbsApplicability=
"disable"
resourcePath=
"src/drivers/stereo_elec/RealStereoElecDriver.h"
toolsToInvoke=
""
/>
<fileInfo
id=
"cdt.managedbuild.config.gnu.exe.debug.779576013.1892460713"
name=
"StereoElecDriver.h"
rcbsApplicability=
"disable"
resourcePath=
"src/drivers/stereo_elec/StereoElecDriver.h"
toolsToInvoke=
""
/>
</configuration>
</storageModule>
<storageModule
moduleId=
"org.eclipse.cdt.core.externalSettings"
/>
...
...
@@ -68,7 +66,7 @@
</extensions>
</storageModule>
<storageModule
moduleId=
"cdtBuildSystem"
version=
"4.0.0"
>
<configuration
artifactName=
"${ProjName}"
buildArtefactType=
"org.eclipse.cdt.build.core.buildArtefactType.exe"
buildProperties=
"org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.build
Type.releas
e,org.eclipse.cdt.build.core.build
Artefact
Type=org.eclipse.cdt.build.core.build
ArtefactType.ex
e"
cleanCommand=
"rm -rf"
description=
""
id=
"cdt.managedbuild.config.gnu.exe.release.867724389"
name=
"Release"
parent=
"cdt.managedbuild.config.gnu.exe.release"
>
<configuration
artifactName=
"${ProjName}"
buildArtefactType=
"org.eclipse.cdt.build.core.buildArtefactType.exe"
buildProperties=
"org.eclipse.cdt.build.core.build
Artefact
Type=org.eclipse.cdt.build.core.build
ArtefactType.ex
e,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.build
Type.releas
e"
cleanCommand=
"rm -rf"
description=
""
id=
"cdt.managedbuild.config.gnu.exe.release.867724389"
name=
"Release"
parent=
"cdt.managedbuild.config.gnu.exe.release"
>
<folderInfo
id=
"cdt.managedbuild.config.gnu.exe.release.867724389."
name=
"/"
resourcePath=
""
>
<toolChain
id=
"cdt.managedbuild.toolchain.gnu.exe.release.1095010789"
name=
"Linux GCC"
superClass=
"cdt.managedbuild.toolchain.gnu.exe.release"
>
<targetPlatform
id=
"cdt.managedbuild.target.gnu.platform.exe.release.703158621"
name=
"Debug Platform"
superClass=
"cdt.managedbuild.target.gnu.platform.exe.release"
/>
...
...
build.sh
View file @
67dd8d90
...
...
@@ -21,7 +21,7 @@ autoconf
automake
--gnu
--add-missing
export
CXXFLAGS
=
"-Wall -Wconversion -O2 -g -pthread"
export
CXXFLAGS
=
"
$CXXFLAGS
-Wall -Wconversion -O2 -g -pthread"
cd
build
...
...
modgen.jar
View file @
67dd8d90
No preview for this file type
src/controllers/lss/d22special/CountWithSpectro.cpp
View file @
67dd8d90
...
...
@@ -36,12 +36,14 @@ CountWithSpectro::CountWithSpectro(const std::string & name) :
spectro
.
init
(
this
,
"spectro"
);
count
.
init
(
this
,
"count"
);
spectroSwitcher
.
init
(
this
,
"spectro
S
witcher"
);
spectroSwitcher
.
init
(
this
,
"spectro
_s
witcher"
);
integrationTime
.
init
(
this
,
SAVE
,
"integration_time"
);
//in microseconds!
numSpectroMeasures
.
init
(
this
,
SAVE
,
"num_spectro"
);
numTotalMeasures
.
init
(
this
,
SAVE
,
"num_total_measures"
);
timeType
.
init
(
this
,
SAVE
,
"time_type"
);
countTime
.
init
(
this
,
SAVE
,
"count_time"
);
scansToAverage
.
init
(
this
,
SAVE
,
"scans_average"
);
xSize
.
init
(
this
,
SAVE
,
"x_size"
);
ySize
.
init
(
this
,
SAVE
,
"y_size"
);
...
...
@@ -55,6 +57,10 @@ CountWithSpectro::CountWithSpectro(const std::string & name) :
measureDuration
.
init
(
this
,
NOSAVE
,
"measure_duration"
);
yDataArraySecondChannel
.
init
(
this
,
NOSAVE
,
"yDataArray_secondChannel"
);
//initialize pointers
m_yDataArray
=
NULL
;
m_yDataArraySecondChannel
=
NULL
;
}
CountWithSpectro
::~
CountWithSpectro
()
{
...
...
@@ -62,23 +68,37 @@ CountWithSpectro::~CountWithSpectro() {
}
void
CountWithSpectro
::
postConfiguration
()
{
xSize
=
XSIZE
;
xSize
=
spectro
->
size
()
;
ySize
=
numSpectroMeasures
();
zSize
=
1
;
subtitle
=
count
->
subtitle
();
registerRefresher
(
numSpectroMeasures
,
&
CountWithSpectro
::
refreshNumSpectroMeasures
,
this
);
registerRefresher
(
useSwitcher
,
&
CountWithSpectro
::
refreshUseSwitcher
,
this
);
registerUpdater
(
count
->
subtitle
,
&
CountWithSpectro
::
updateSubtitle
,
this
);
registerProgression
(
count
,
&
CountWithSpectro
::
updateProgression
,
this
);
// initSwitcherArrays(); //init both arrays to avoid errors
}
void
CountWithSpectro
::
refreshNumSpectroMeasures
(
int32
number
)
{
ySize
=
number
;
//This property is only used to save the data in nexus file
//initialize here the dynamic properties
measureDuration
.
resize
(
number
);
if
(
useSwitcher
())
{
measureDuration
.
resize
(
number
*
2
);
numTotalMeasures
=
number
*
2
;
}
else
{
measureDuration
.
resize
(
number
);
numTotalMeasures
=
number
;
}
}
void
CountWithSpectro
::
refreshUseSwitcher
(
bool
value
)
{
if
(
value
)
{
numTotalMeasures
=
numSpectroMeasures
()
*
2
;
//using switcher
}
else
{
numTotalMeasures
=
numSpectroMeasures
();
}
measureDuration
.
resize
(
numTotalMeasures
());
}
void
CountWithSpectro
::
updateProgression
()
{
...
...
@@ -91,75 +111,85 @@ void CountWithSpectro::updateSubtitle() {
void
CountWithSpectro
::
start
()
{
if
(
!
useSwitcher
())
{
//to avoid problems of synchronization, get the xSize any time we do a measure
xSize
=
spectro
->
size
();
spectro
->
scansToAverage
=
scansToAverage
();
//Time already in microseconds!
spectro
->
integrationTime
=
integrationTime
();
if
(
spectro
->
isConnected
())
{
if
(
!
useSwitcher
())
{
//check the total time of spectro measurement is smaller than the count time
float64
spectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
();
//should be in seconds
float64
countTime
=
getCountTimeInSec
();
//count->time.setpoint();
//Time already in microseconds!
spectro
->
integrationTime
=
integrationTime
();
if
(
spectroTime
<=
countTime
)
{
//check the total time of spectro measurement is smaller than the count time (comparison in seconds!)
float64
spectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
()
*
scansToAverage
();
float64
countTime
=
getCountTimeInSec
();
setupCountParams
();
if
(
spectroTime
<=
countTime
)
{
initArrays
();
//before initArray
()
setupCountParams
()
;
commandStatus
.
setRunning
();
spectro
->
mode
=
QE65000Controller
::
COUNT_SINGLE
;
initArrays
();
//before initArray()
//Launch count and spectro at the same time
// Run the threads in parallel in a group
boost
::
thread_group
group
;
commandStatus
.
setRunning
();
spectro
->
mode
=
QE65000Controller
::
COUNT_SINGLE
;
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startCount
,
this
));
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startSpectro
,
this
));
//Launch count and spectro at the same time
// Run the threads in parallel in a group
boost
::
thread_group
group
;
// Wait for the termination of the threads
group
.
join_all
(
);
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startCount
,
this
));
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startSpectro
,
this
)
);
//
Get data
saveSpectroData
();
//
Wait for the termination of the threads
group
.
join_all
();
commandStatus
.
setIdle
();
spectro
->
mode
=
QE65000Controller
::
IDLE
;
}
//Get data
saveSpectroData
();
}
else
{
//Suppose here we also keep the same rule as before (but now is double)
spectroSwitcher
->
integrationTime
=
integrationTime
();
spectroSwitcher
->
numberOfCycles
=
1
;
commandStatus
.
setIdle
();
spectro
->
mode
=
QE65000Controller
::
IDLE
;
}
//check the total time of spectro measurement is smaller than the count time
float64
spectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
()
*
2
;
//!!!!!!!!!!!!!!
float64
countTime
=
getCountTimeInSec
();
}
else
{
//Suppose here we also keep the same rule as before (but now is double)
spectroSwitcher
->
numberOfCycles
=
1
;
//even if it is not clear, the number of cycles will be established by this controller
spectroSwitcher
->
integrationTime
=
integrationTime
();
if
(
spectroTime
<=
countTime
)
{
//check the total time of spectro measurement is smaller than the count time
float64
spectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
()
*
scansToAverage
()
*
2
;
//left and right measure
float64
countTime
=
getCountTimeInSec
();
setupCountParams
();
if
(
spectroTime
<=
countTime
)
{
initAr
ra
y
s
();
setupCountPa
ra
m
s
();
commandStatus
.
setRunning
();
spectro
->
mode
=
QE65000Controller
::
COUNT_SWITCHER
;
initArrays
();
//Launch count and spectro at the same time
// Run the threads in parallel in a group
boost
::
thread_group
group
;
commandStatus
.
setRunning
();
spectro
->
mode
=
QE65000Controller
::
COUNT_SWITCHER
;
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startCount
,
this
));
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startSwitcher
,
this
));
//Launch count and spectro at the same time
// Run the threads in parallel in a group
boost
::
thread_group
group
;
// Wait for the termination of the threads
group
.
join_all
(
);
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startCount
,
this
));
group
.
create_thread
(
boost
::
bind
(
&
CountWithSpectro
::
startSwitcher
,
this
)
);
//
Get data
saveSwitcherSpectroData
();
//
Wait for the termination of the threads
group
.
join_all
();
commandStatus
.
setIdle
();
spectro
->
mode
=
QE65000Controller
::
IDLE
;
//Get data
saveSwitcherSpectroData
();
commandStatus
.
setIdle
();
spectro
->
mode
=
QE65000Controller
::
IDLE
;
}
}
//clean arrays
initArrays
();
}
}
...
...
@@ -167,6 +197,7 @@ void CountWithSpectro::stop() {
if
(
commandStatus
.
isRunning
())
{
count
->
stopParallel
();
spectro
->
stopParallel
();
spectroSwitcher
->
stopParallel
();
}
commandStatus
.
setWarning
();
...
...
@@ -182,6 +213,8 @@ void CountWithSpectro::startSpectro() {
initialTime
=
startTime
.
toString
(
"%H:%M:%S"
);
common
::
Date
formerTime
=
startTime
;
int32
sleepTime
=
calculateWaitingTimeInSec
();
for
(
int
i
=
0
;
i
<
numSpectroMeasures
();
i
++
)
{
if
(
commandStatus
.
isRunning
())
{
...
...
@@ -191,32 +224,35 @@ void CountWithSpectro::startSpectro() {
spectro
->
startCommand
();
int32
ySize
=
YSIZE
;
int32
ySize
=
spectro
->
size
()
;
float64
*
tempYData
=
spectro
->
yData
();
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
m_yDataArray
[
ySize
*
i
+
j
]
=
tempYData
[
j
];
}
formerTime
=
time
;
sleep
(
sleepTime
);
}
}
}
void
CountWithSpectro
::
startSwitcher
()
{
common
::
Date
startTime
=
common
::
Date
();
initialTime
=
startTime
.
toString
(
"%H:%M:%S"
);
common
::
Date
formerTime
=
startTime
;
int32
sleepTime
=
calculateWaitingTimeInSec
();
common
::
Date
initialTime
=
common
::
Date
();
for
(
int
i
=
0
;
i
<
numSpectroMeasures
();
i
++
)
{
if
(
commandStatus
.
isRunning
())
{
common
::
Date
time
=
common
::
Date
();
common
::
Duration
duration
=
time
-
formerTime
;
measureDuration
.
set
(
i
,
duration
.
getMilliseconds
());
spectroSwitcher
->
setInitialTime
(
initialTime
);
spectroSwitcher
->
startCommand
();
int32
ySize
=
YSIZE
;
int32
ySize
=
spectro
->
size
()
;
float64
*
tempLeftYData
=
spectroSwitcher
->
yLeftData
();
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
m_yDataArray
[
ySize
*
i
+
j
]
=
tempLeftYData
[
j
];
...
...
@@ -227,7 +263,11 @@ void CountWithSpectro::startSwitcher() {
m_yDataArraySecondChannel
[
ySize
*
i
+
j
]
=
tempRightYData
[
j
];
}
formerTime
=
time
;
measureDuration
.
set
((
i
*
2
),
spectroSwitcher
->
durationLeft
());
measureDuration
.
set
((
i
*
2
+
1
),
spectroSwitcher
->
durationRight
());
initialTime
=
common
::
Date
();
sleep
(
sleepTime
);
}
}
}
...
...
@@ -245,7 +285,7 @@ void CountWithSpectro::initArrays() {
delete
[]
m_yDataArraySecondChannel
;
}
int32
totalSize
=
YSIZE
*
numSpectroMeasures
();
int32
totalSize
=
spectro
->
size
()
*
numSpectroMeasures
();
m_yDataArray
=
new
int32
[
totalSize
];
memset
(
m_yDataArray
,
0
,
totalSize
*
sizeof
(
int32
));
//set to zero
yDataArray
.
update
(
m_yDataArray
);
...
...
@@ -268,6 +308,7 @@ void CountWithSpectro::saveSpectroData() {
}
void
CountWithSpectro
::
saveSwitcherSpectroData
()
{
int32
totalSize
=
YSIZE
*
numSpectroMeasures
();
yDataArray
.
update
(
m_yDataArray
);
yDataArray
.
setSize
(
totalSize
);
...
...
@@ -277,7 +318,6 @@ void CountWithSpectro::saveSwitcherSpectroData() {
int32
numor
=
any_cast
<
int32
>
(
count
->
getValue
(
"numor"
));
NexusDataFile
::
appendTo
(
numor
,
"NxD22SpecialServerFile.xml"
,
"NxD22SpecialClientFile.xml"
);
}
float64
CountWithSpectro
::
getCountTimeInSec
()
{
...
...
@@ -289,9 +329,33 @@ float64 CountWithSpectro::getCountTimeInSec() {
}
else
if
(
timeType
()
==
"s"
)
{
time
=
countTime
();
}
return
time
;
}
/**
* This method calculates the waiting time necessary to distribute the spectrometer measures (in both single or switcher mode) equally through the acquisition time
*/
float64
CountWithSpectro
::
calculateWaitingTimeInSec
()
{
//Convert all units into seconds
float64
totalSpectroTime
;
float64
switcherSleep
=
(
spectroSwitcher
->
SLEEP_TIME_MICROSEC
)
*
0.000001
;
//0.0001;
float64
singleWaitTime
=
0.0
;
if
(
numSpectroMeasures
()
>
1
)
{
int32
scansToAverage
=
spectro
->
scansToAverage
();
if
(
useSwitcher
())
{
totalSpectroTime
=
2
*
(
integrationTime
()
*
0.000001
*
numSpectroMeasures
()
*
scansToAverage
+
switcherSleep
);
}
else
{
totalSpectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
()
*
scansToAverage
;
}
float64
countTime
=
getCountTimeInSec
();
float64
totalWaitTime
=
(
countTime
-
totalSpectroTime
);
singleWaitTime
=
0.95
*
(
totalWaitTime
/
(
numSpectroMeasures
()
-
1
));
//0.95 -> factor to avoid having spectro measures just at the end
}
return
singleWaitTime
;
}
}
src/controllers/lss/d22special/CountWithSpectro.h
View file @
67dd8d90
...
...
@@ -50,13 +50,17 @@ public:
Property
<
int32
>
integrationTime
;
Property
<
int32
>
numSpectroMeasures
;
Property
<
int32
>
scansToAverage
;
Property
<
int32
>
numTotalMeasures
;
Property
<
bool
>
useSwitcher
;
Property
<
std
::
string
>
timeType
;
Property
<
float64
>
countTime
;
Property
<
std
::
string
>
subtitle
;
Property
<
int32
>
xSize
;
Property
<
int32
>
ySize
;
Property
<
int32
>
zSize
;
Property
<
std
::
string
>
subtitle
;
Property
<
bool
>
useSwitcher
;
ArrayProperty
<
int32
>
yDataArray
;
ArrayProperty
<
int32
>
yDataArraySecondChannel
;
...
...
@@ -65,8 +69,10 @@ public:
Property
<
std
::
string
>
initialTime
;
void
refreshNumSpectroMeasures
(
int32
number
);
void
refreshUseSwitcher
(
bool
value
);
void
updateProgression
();
void
updateSubtitle
();
void
update
();
private:
void
saveSpectroData
();
...
...
@@ -77,6 +83,7 @@ private:
void
initArrays
();
void
setupCountParams
();
float64
getCountTimeInSec
();
float64
calculateWaitingTimeInSec
();
int32
*
m_yDataArray
;
int32
*
m_yDataArraySecondChannel
;
...
...
src/controllers/lss/d22special/D22SampleSequencer.cpp
deleted
100644 → 0
View file @
8bc1677a
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include
<Controller.h>
#include
"D22SampleSequencer.h"
#include
"controllers/common/family/Families.h"
#include
"PersistenceServices/DataFile/NexusDataFile.h"
namespace
d22special
{
const
string
D22SampleSequencer
::
TYPE
=
"d22_sample_sequencer"
;
D22SampleSequencer
::
D22SampleSequencer
(
const
std
::
string
&
name
)
:
::
SampleSequencer
(
name
,
""
)
{
registerFunction
(
TYPE
);
setFamily
(
family
::
SAMPLE_ENVIRONMENT
);
//init properties
integrationTime
.
init
(
this
,
SAVE
,
"integration_time"
);
scansToAverage
.
init
(
this
,
SAVE
,
"scan_average"
);
useSpectro
.
init
(
this
,
SAVE
,
"useSpectro"
);
spectroController
.
init
(
this
,
"spectro"
);
m_started
=
false
;
}
D22SampleSequencer
::~
D22SampleSequencer
()
{
}
void
D22SampleSequencer
::
postConfiguration
()
{
SampleSequencer
::
postConfiguration
();
}
void
D22SampleSequencer
::
execute
(
const
string
&
command
,
bool
blocking
,
bool
logging
)
{
spectroController
->
mode
=
QE65000Controller
::
SEQUENCE
;
if
(
command
==
START_COMMAND
)
{
m_started
=
true
;
}
else
if
(
command
==
STOP_COMMAND
)
{
m_started
=
false
;
}
SampleSequencer
::
execute
(
command
,
blocking
,
logging
);
//Once the last count is done force to do another spectro measure
if
(
command
==
START_COMMAND
)
{
doLastMeasure
();
m_started
=
false
;
}
// spectroController->mode = QE65000Controller::ALONE;
}
void
D22SampleSequencer
::
updateProperty
(
ChangeAspect
*
aChangeAspect
)
{
SampleSequencer
::
updateProgress
(
aChangeAspect
);
string
propertyName
=
aChangeAspect
->
getStringParam
();
if
(
propertyName
==
"actual_cha"
)
{
int32
actualSlot
=
any_cast
<
int32
>
(
m_sampleChanger
->
getValue
(
propertyName
));
spectroController
->
setPlotName
(
actualSlot
);
actualSlotNumber
=
actualSlot
;
}
else
if
(
propertyName
==
"status_message"
)
{
std
::
string
countStatus
=
any_cast
<
std
::
string
>
(
m_Count
->
getValue
(
propertyName
));
if
(
countStatus
==
"Idle"
&&
m_started
==
true
)
{
// only save spectro if count has been started from this controller
getSpectro
();
}
}
else
if
(
propertyName
==
"numor"
)
{
lastNumor
=
any_cast
<
int32
>
(
m_Count
->
getValue
(
propertyName
));
}
}
void
D22SampleSequencer
::
refreshSetValue
(
string
propertyName
,
const
boost
::
any
aValue
)
throw
(
CannotSetValue
)
{
SampleSequencer
::
refreshSetValue
(
propertyName
,
aValue
);
}
void
D22SampleSequencer
::
getSpectro
()
{
spectroController
->
start
();
//Copy data in nexus file (remember it is delayed in one position)
if
(
actualSlotNumber
>
1
)
{
int32
numor
=
any_cast
<
int32
>
(
m_Count
->
getValue
(
"numor"
));
NexusDataFile
::
appendTo
(
numor
-
1
,
"NxD22SpecialServerFile.xml"
,
"NxD22SpecialClientFile.xml"
);
}
}
void
D22SampleSequencer
::
doLastMeasure
()
{
//Last measure = move sample (using sampleChanger) + get spectro + save data in nexus file
Sender
<
ClientCommand
>::
begin
();
Sender
<
ClientCommand
>::
post
(
ClientCommand
(
m_sampleChanger
,
START_COMMAND
));
Sender
<
ClientCommand
>::
endIf
();
spectroController
->
start
();
int32
numor
=
any_cast
<
int32
>
(
m_Count
->
getValue
(
"numor"
));
NexusDataFile
::
appendTo
(
numor
,
"NxD22SpecialServerFile.xml"
,
"NxD22SpecialClientFile.xml"
);
// cout << "adding new data (theoretically) in data file: " << numor << " value of last numor: " << lastNumor << endl;
}
}
/*
void D22SampleSequencer::postConfiguration() {
SampleSequencer::postConfiguration();
//Set up measuring mode in spectro controller
// spectroController->mode = QE65000Controller::SEQUENCE;
registerUpdater(sampleChanger->slot, &D22SampleSequencer::updateActualSlot, this);
registerUpdater(count->statusMessage, &D22SampleSequencer::updateStatusMessage, this);
registerUpdater(count->numor, &D22SampleSequencer::updateNumor, this);
registerUpdater(spectroController->integrationTime, &D22SampleSequencer::updateIntegrationTime, this);
registerUpdater(spectroController->scansToAverage, &D22SampleSequencer::updateScansToAverage, this);
}
void D22SampleSequencer::updateActualSlot() {
spectroController->setPlotName(sampleChanger->slot());
actualSlotNumber = sampleChanger->slot();
}
void D22SampleSequencer::updateStatusMessage() {
std::string countStatus = count->statusMessage();
if (countStatus == "Idle") {
getSpectro();
}
}
void D22SampleSequencer::updateNumor() {
lastNumor = count->numor();
}
void D22SampleSequencer::updateIntegrationTime() {
integrationTime = spectroController->integrationTime();
}
void D22SampleSequencer::updateScansToAverage() {
scansToAverage = spectroController->scansToAverage();
}
void D22SampleSequencer::start() {
commandStatus.setRunning();
spectroController->mode = QE65000Controller::SEQUENCE;
d22::SampleSequencer::start();
//Once the last count is done force to do another spectro measure
doLastMeasure();
commandStatus.setIdle();
spectroController->mode = QE65000Controller::ALONE;
}
void D22SampleSequencer::stop() {
commandStatus.setWarning();
d22::SampleSequencer::stop();
}
void D22SampleSequencer::getSpectro() {
//Check the sampleSequencer is running
if (commandStatus.isRunning()) {
spectroController->start();
//Copy data in nexus file (remember it is delayed in one position)
if (actualSlotNumber > 1 && commandStatus.isRunning()) {
int32 numor = any_cast<int32>(count->getValue("numor"));
cout << "appending data to nexus file! (1)" << numor - 1 << endl;
NexusDataFile::appendTo(numor - 1, "NxD22SpecialServerFile.xml", "NxD22SpecialClientFile.xml");
}
}
}