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
13c22fde
Commit
13c22fde
authored
May 05, 2020
by
yannick legoc
Browse files
Added scan data in VEXPController
parent
480b56c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/controllers/vexp/VEXPController.cpp
View file @
13c22fde
...
@@ -123,6 +123,8 @@ VEXPController::VEXPController(const string& name) :
...
@@ -123,6 +123,8 @@ VEXPController::VEXPController(const string& name) :
a6Controller
.
init
(
this
,
"A6"
);
a6Controller
.
init
(
this
,
"A6"
);
scanController
.
init
(
this
,
"scan"
);
scanController
.
init
(
this
,
"scan"
);
vexpDetector
.
init
(
this
,
"vexp_detector"
);
}
}
VEXPController
::
VEXPController
(
const
VEXPController
&
controller
)
:
VEXPController
::
VEXPController
(
const
VEXPController
&
controller
)
:
...
@@ -244,6 +246,8 @@ void VEXPController::updateScanStatus() {
...
@@ -244,6 +246,8 @@ void VEXPController::updateScanStatus() {
updateFloat64PropertyValue
(
kfScan
,
kf
());
updateFloat64PropertyValue
(
kfScan
,
kf
());
updateInt32PropertyValue
(
fxScan
,
fx
());
updateInt32PropertyValue
(
fxScan
,
fx
());
updateInt32PropertyValue
(
ssScan
,
ss
());
updateInt32PropertyValue
(
ssScan
,
ss
());
m_scanData
.
clear
();
}
}
}
}
else
{
else
{
...
@@ -251,6 +255,21 @@ void VEXPController::updateScanStatus() {
...
@@ -251,6 +255,21 @@ void VEXPController::updateScanStatus() {
}
}
}
}
void
VEXPController
::
updateDetector
()
{
// Update the scan data.
int
i
=
scanController
->
actualStep
.
get
(
0
);
if
(
i
>=
m_scanData
.
size
())
{
m_scanData
.
resize
(
i
);
}
if
(
i
>
0
)
{
m_scanData
[
i
-
1
]
=
vexpDetector
->
detSum
();
}
}
void
VEXPController
::
updateProperties
()
{
void
VEXPController
::
updateProperties
()
{
// Copy the values.
// Copy the values.
...
@@ -390,6 +409,8 @@ void VEXPController::postConfiguration() {
...
@@ -390,6 +409,8 @@ void VEXPController::postConfiguration() {
registerUpdater
(
scanController
->
nSteps
,
&
VEXPController
::
updateNbPoints
,
this
);
registerUpdater
(
scanController
->
nSteps
,
&
VEXPController
::
updateNbPoints
,
this
);
registerStatus
(
scanController
,
&
VEXPController
::
updateScanStatus
,
this
);
registerStatus
(
scanController
,
&
VEXPController
::
updateScanStatus
,
this
);
registerUpdater
(
vexpDetector
->
idata
,
&
VEXPController
::
updateDetector
,
this
);
updateProperties
();
updateProperties
();
m_spyPublisher
=
application
::
Publisher
::
create
(
"vexp_spy"
);
m_spyPublisher
=
application
::
Publisher
::
create
(
"vexp_spy"
);
...
@@ -553,6 +574,12 @@ std::string VEXPController::getSpyData() {
...
@@ -553,6 +574,12 @@ std::string VEXPController::getSpyData() {
writer
.
Key
(
"nameScan"
);
writer
.
Int
(
scanController
->
numor
());
writer
.
Key
(
"nameScan"
);
writer
.
Int
(
scanController
->
numor
());
writer
.
Key
(
"startingTime"
);
writer
.
String
(
scanController
->
startingTime
().
c_str
());
writer
.
Key
(
"startingTime"
);
writer
.
String
(
scanController
->
startingTime
().
c_str
());
writer
.
Key
(
"dataScan"
);
writer
.
StartArray
();
for
(
int
i
=
0
;
i
<
m_scanData
.
size
();
++
i
)
{
writer
.
Double
(
m_scanData
[
i
]);
}
writer
.
EndArray
();
writer
.
EndObject
();
writer
.
EndObject
();
return
s
.
GetString
();
return
s
.
GetString
();
...
...
src/controllers/vexp/VEXPController.h
View file @
13c22fde
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "controllers/tas/common/IncidentBeam.h"
#include "controllers/tas/common/IncidentBeam.h"
#include "controllers/tas/common/TasScatteredBeam.h"
#include "controllers/tas/common/TasScatteredBeam.h"
#include "controllers/common/scanlegacy/ParameterizableScan1D.h"
#include "controllers/common/scanlegacy/ParameterizableScan1D.h"
#include "VEXPDetectorSimulator.h"
#include <cameo/cameo.h>
#include <cameo/cameo.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/stringbuffer.h>
#include <memory>
#include <memory>
...
@@ -78,6 +79,8 @@ public:
...
@@ -78,6 +79,8 @@ public:
void
updateNbPoints
(
int
index
);
void
updateNbPoints
(
int
index
);
void
updateScanStatus
();
void
updateScanStatus
();
void
updateDetector
();
virtual
void
postConfiguration
();
virtual
void
postConfiguration
();
private:
private:
...
@@ -168,6 +171,8 @@ private:
...
@@ -168,6 +171,8 @@ private:
std
::
mutex
m_publisherMutex
;
std
::
mutex
m_publisherMutex
;
std
::
unique_ptr
<
std
::
thread
>
m_periodicUpdateThread
;
std
::
unique_ptr
<
std
::
thread
>
m_periodicUpdateThread
;
std
::
vector
<
float64
>
m_scanData
;
// Controllers.
// Controllers.
ControllerPtr
<
tas
::
TasSettings
>
tasSettings
;
ControllerPtr
<
tas
::
TasSettings
>
tasSettings
;
ControllerPtr
<
tas
::
Sample
>
sample
;
ControllerPtr
<
tas
::
Sample
>
sample
;
...
@@ -184,6 +189,8 @@ private:
...
@@ -184,6 +189,8 @@ private:
ControllerPtr
<
axis
::
AxisController
>
a6Controller
;
ControllerPtr
<
axis
::
AxisController
>
a6Controller
;
ControllerPtr
<
scan
::
ParameterizableScan1D
>
scanController
;
ControllerPtr
<
scan
::
ParameterizableScan1D
>
scanController
;
ControllerPtr
<
DetectorSimulator
>
vexpDetector
;
};
};
}
}
...
...
src/controllers/vexp/VEXPDetectorSimulator.cpp
View file @
13c22fde
...
@@ -37,6 +37,8 @@ DetectorSimulator::DetectorSimulator(const string& name) :
...
@@ -37,6 +37,8 @@ DetectorSimulator::DetectorSimulator(const string& name) :
simulationFile
.
init
(
this
,
SAVE
,
"simulation_file"
);
simulationFile
.
init
(
this
,
SAVE
,
"simulation_file"
);
intensity
.
init
(
this
,
NOSAVE
,
"intensity"
);
intensity
.
init
(
this
,
NOSAVE
,
"intensity"
);
detSum
.
init
(
this
,
NOSAVE
,
"detector_sum"
);
idata
.
init
(
this
,
NOSAVE
,
"idata"
);
}
}
DetectorSimulator
::
DetectorSimulator
(
const
DetectorSimulator
&
controller
)
:
DetectorSimulator
::
DetectorSimulator
(
const
DetectorSimulator
&
controller
)
:
...
@@ -131,13 +133,18 @@ void DetectorSimulator::updateData() {
...
@@ -131,13 +133,18 @@ void DetectorSimulator::updateData() {
m_accessor
.
querySqwTree
(
m_dataHandle
,
h
,
k
,
l
,
e
,
s
);
m_accessor
.
querySqwTree
(
m_dataHandle
,
h
,
k
,
l
,
e
,
s
);
//detector->detSum = (scattering->qh() + scattering->qk() + scattering->ql()) * 10.0;
// Update the detector sum applying the coef.
//m_detector->detSum = 200.0 - ((m_scattering->qh() - 1.0) * 1000.0);
float64
sum
=
s
*
m_coef
;
detSum
=
sum
;
m_detector
->
detSum
=
sum
;
m_detector
->
detSum
=
s
*
m_coef
;
// Increase idata to trigger VEXPController.
idata
=
idata
()
+
1
;
cout
<<
"updateData "
<<
m_detector
->
detSum
()
cout
<<
"updateData "
<<
m_detector
->
detSum
()
<<
", scattering "
<<
m_scattering
->
qh
()
<<
", "
<<
m_scattering
->
qk
()
<<
", "
<<
m_scattering
->
ql
()
<<
", "
<<
m_scattering
->
en
()
<<
endl
;
<<
", scattering "
<<
m_scattering
->
qh
()
<<
", "
<<
m_scattering
->
qk
()
<<
", "
<<
m_scattering
->
ql
()
<<
", "
<<
m_scattering
->
en
()
<<
endl
;
}
}
}
}
src/controllers/vexp/VEXPDetectorSimulator.h
View file @
13c22fde
...
@@ -39,6 +39,8 @@ public:
...
@@ -39,6 +39,8 @@ public:
Property
<
std
::
string
>
simulationFile
;
Property
<
std
::
string
>
simulationFile
;
Property
<
float64
>
intensity
;
Property
<
float64
>
intensity
;
Property
<
float64
>
detSum
;
Property
<
int32
>
idata
;
// Incremented to trigger the updater of VEXPController.
private:
private:
void
loadSimulationFile
();
void
loadSimulationFile
();
...
...
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