Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
21d84629
Commit
21d84629
authored
Sep 10, 2014
by
Cristina Cocho
Browse files
oh la la lets see if this time is the last one... changes in spectro!
parent
dd0cf5c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/controllers/lss/d22special/D22SampleSequencer.cpp
View file @
21d84629
...
...
@@ -17,28 +17,32 @@
*/
#include <Controller.h>
#include "D22SampleSequencer.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
);
D22SampleSequencer
::
D22SampleSequencer
(
const
std
::
string
&
name
)
:
::
SampleSequencer
(
name
,
""
)
{
registerFunction
(
TYPE
);
//init properties
useSpectro
.
init
(
this
,
SAVE
,
"useSpectro"
);
spectroController
.
init
(
this
,
"spectro"
);
};
//init properties
useSpectro
.
init
(
this
,
SAVE
,
"useSpectro"
);
spectroController
.
init
(
this
,
"spectro"
);
}
D22SampleSequencer
::~
D22SampleSequencer
()
{
}
void
D22SampleSequencer
::
execute
(
const
string
&
command
,
bool
blocking
,
bool
logging
)
{
//necessary?
void
D22SampleSequencer
::
execute
(
const
string
&
command
,
bool
blocking
,
bool
logging
)
{
//necessary?
spectroController
->
mode
=
QE65000Controller
::
SEQUENCE
;
SampleSequencer
::
execute
(
command
,
blocking
,
logging
);
//Once the last count is done force to do another spectro measure
if
(
command
==
START_COMMAND
)
{
doLastMeasure
();
}
spectroController
->
mode
=
QE65000Controller
::
ALONE
;
//cout << "executing command " << command << " in D22SampleSequencer" << endl;
}
void
D22SampleSequencer
::
postConfiguration
()
{
...
...
@@ -54,13 +58,16 @@ void D22SampleSequencer::updateProperty(ChangeAspect* aChangeAspect) {
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"
)
{
//Get the spectro at the end of each count
getSpectro
();
}
}
else
if
(
propertyName
==
"numor"
)
{
lastNumor
=
any_cast
<
int32
>
(
m_Count
->
getValue
(
propertyName
));
}
}
...
...
@@ -70,10 +77,25 @@ void D22SampleSequencer::refreshSetValue(string propertyName, const boost::any a
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;
}
}
src/controllers/lss/d22special/D22SampleSequencer.h
View file @
21d84629
...
...
@@ -52,6 +52,10 @@ public:
private:
void
getSpectro
();
void
doLastMeasure
();
int32
actualSlotNumber
;
int32
lastNumor
;
};
...
...
src/controllers/spectrometer/DualSwitchSpectroController.cpp
View file @
21d84629
...
...
@@ -52,9 +52,6 @@ DualSwitchSpectroController::~DualSwitchSpectroController() {
void
DualSwitchSpectroController
::
postConfiguration
()
{
registerProgression
(
spectroController
,
&
DualSwitchSpectroController
::
updateProgression
,
this
);
//Set up measuring mode in spectro controller
// spectroController->mode = QE65000Controller::SWITCH;
}
void
DualSwitchSpectroController
::
start
()
{
...
...
@@ -69,9 +66,9 @@ void DualSwitchSpectroController::start() {
executionStatus
.
update
(
"idle"
);
int32
cyclesNumber
=
numberOfCycles
();
while
(
cyclesNumber
>
0
)
{
while
(
cyclesNumber
>
0
&&
!
m_StopActivated
)
{
co
ut
<<
"executing cycle: "
<<
cyclesNumber
<<
endl
;
co
mmandProgression
=
(
numberOfCycles
()
-
cyclesNumber
)
*
100
/
numberOfCycles
()
;
// First: start switcher -> we begin for LEFT position (== IN)
m_dualSwitcher
->
setValue
(
AbstractIOController
::
IO_WANTED_VALUE_PROPERTY
,
string
(
IO_SHUTTER_IN_DEVICE_CONTAINER
));
...
...
@@ -127,12 +124,13 @@ void DualSwitchSpectroController::start() {
}
void
DualSwitchSpectroController
::
stop
()
{
m_StopActivated
=
true
;
commandProgression
=
100
;
}
void
DualSwitchSpectroController
::
updateProgression
()
{
int32
progression
=
0
;
commandProgression
=
progression
;
//
int32 progression = 0;
//
commandProgression = progression;
}
void
DualSwitchSpectroController
::
updateData
()
{
...
...
src/controllers/spectrometer/QE65000Controller.cpp
View file @
21d84629
...
...
@@ -51,14 +51,18 @@ QE65000Controller::~QE65000Controller() {
void
QE65000Controller
::
postConfiguration
()
{
//Pass info to the driver
registerRefresher
(
integrationTime
,
&
QE65000Controller
::
refreshIntegrationTime
,
this
);
registerRefresher
(
integrationTime
,
&
QE65000Controller
::
refreshIntegrationTime
,
this
);
//Get info from driver
registerUpdater
(
spectroDriver
->
yData
,
&
QE65000Controller
::
updateYData
,
this
);
registerUpdater
(
spectroDriver
->
status
,
&
QE65000Controller
::
updateStatus
,
this
);
registerUpdater
(
spectroDriver
->
yData
,
&
QE65000Controller
::
updateYData
,
this
);
registerUpdater
(
spectroDriver
->
status
,
&
QE65000Controller
::
updateStatus
,
this
);
//need to register the progression to see it??
registerProgression
(
spectroDriver
,
&
QE65000Controller
::
updateProgression
,
this
);
registerProgression
(
spectroDriver
,
&
QE65000Controller
::
updateProgression
,
this
);
//Set initial property values
spectroStatusMessage
.
update
(
"UNPLUGGED"
);
...
...
@@ -92,8 +96,8 @@ void QE65000Controller::updateProgression() {
void
QE65000Controller
::
start
()
{
commandProgression
=
0
;
m_StopActivated
=
false
;
cout
<<
"execution mode"
<<
mode
()
<<
endl
;
if
(
mode
()
!=
SEQUENCE
)
{
numor
.
update
(
0
);
}
...
...
@@ -103,9 +107,14 @@ void QE65000Controller::start() {
delete
[]
yData
();
//Take into account number of scans to average
if
(
scansToAverage
()
==
0
)
{
if
(
scansToAverage
()
==
1
)
{
commandProgression
=
50
;
spectroDriver
.
execute
(
"start"
,
false
);
//ask Yannick that!
commandProgression
=
75
;
//x data
int32
xSize
=
spectroDriver
->
xData
.
getSize
();
xData
.
update
(
spectroDriver
->
xData
());
...
...
@@ -132,36 +141,48 @@ void QE65000Controller::start() {
float64
*
finalYData
;
for
(
int32
i
=
0
;
i
<
scansToAverage
();
i
++
)
{
spectroDriver
.
execute
(
"start"
,
false
);
//ask Yannick that!
//During first scan get size of array and initialize everything
if
(
i
==
0
)
{
ySize
=
spectroDriver
->
yData
.
getSize
();
tempYData
=
new
float64
[
ySize
];
finalYData
=
new
float64
[
ySize
];
}
if
(
!
m_StopActivated
)
{
commandProgression
=
i
*
100
/
scansToAverage
();
spectroDriver
.
execute
(
"start"
,
false
);
//During first scan get size of array and initialize everything
if
(
i
==
0
)
{
ySize
=
spectroDriver
->
yData
.
getSize
();
tempYData
=
new
float64
[
ySize
];
finalYData
=
new
float64
[
ySize
];
//to avoid problems with incorrect initial values initialize content of both arrays to zero
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
tempYData
[
j
]
=
0
;
finalYData
[
j
]
=
0
;
}
}
//y data
tempYData
=
spectroDriver
->
yData
();
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
finalYData
[
j
]
=
finalYData
[
j
]
+
tempYData
[
j
];
if
(
i
==
scansToAverage
()
-
1
)
{
finalYData
[
j
]
=
finalYData
[
j
]
/
scansToAverage
();
cout
<<
"final data: "
<<
finalYData
[
j
]
<<
endl
;
//y data
tempYData
=
spectroDriver
->
yData
();
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
finalYData
[
j
]
=
finalYData
[
j
]
+
tempYData
[
j
];
if
(
i
==
scansToAverage
()
-
1
)
{
finalYData
[
j
]
=
finalYData
[
j
]
/
scansToAverage
();
}
}
}
}
int32
xSize
=
spectroDriver
->
xData
.
getSize
();
xData
.
update
(
spectroDriver
->
xData
());
xData
.
setSize
(
xSize
);
if
(
!
m_StopActivated
)
{
int32
xSize
=
spectroDriver
->
xData
.
getSize
();
xData
.
update
(
spectroDriver
->
xData
());
xData
.
setSize
(
xSize
);
yData
.
update
(
finalYData
);
yData
.
setSize
(
ySize
);
yData
.
update
(
finalYData
);
yData
.
setSize
(
ySize
);
//To take those changes into account do the following:
xData
.
sendEvent
();
yData
.
sendEvent
();
//To take those changes into account do the following:
xData
.
sendEvent
();
yData
.
sendEvent
();
}
commandProgression
=
99
;
spectroDriver
.
execute
(
"stop"
,
false
);
...
...
@@ -171,6 +192,7 @@ void QE65000Controller::start() {
void
QE65000Controller
::
stop
()
{
spectroDriver
.
execute
(
"stop"
,
false
);
m_StopActivated
=
true
;
commandProgression
=
100
;
}
...
...
src/controllers/spectrometer/QE65000Controller.h
View file @
21d84629
...
...
@@ -67,6 +67,9 @@ public:
void
setPlotName
(
int32
plotId
);
private:
bool
m_StopActivated
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment