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
9b0da85a
Commit
9b0da85a
authored
Apr 30, 2015
by
Cristina Cocho
Browse files
Improved CountWithSpectro "special" module
parent
28501f10
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/controllers/lss/d22special/CountWithSpectro.cpp
View file @
9b0da85a
...
...
@@ -18,6 +18,8 @@
#include
"CountWithSpectro.h"
#include
"controllers/common/family/Families.h"
#include
"PersistenceServices/DataFile/NexusDataFile.h"
#include
<boost/date_time/posix_time/posix_time.hpp>
#include
<common/base/Date.h>
namespace
d22special
{
...
...
@@ -35,7 +37,7 @@ CountWithSpectro::CountWithSpectro(const std::string & name) :
spectro
.
init
(
this
,
"spectro"
);
count
.
init
(
this
,
"count"
);
integrationTime
.
init
(
this
,
SAVE
,
"integration_time"
);
//
It is in
seconds!
integrationTime
.
init
(
this
,
SAVE
,
"integration_time"
);
//
in micro
seconds!
numSpectroMeasures
.
init
(
this
,
SAVE
,
"num_spectro"
);
timeType
.
init
(
this
,
SAVE
,
"time_type"
);
countTime
.
init
(
this
,
SAVE
,
"count_time"
);
...
...
@@ -45,7 +47,8 @@ CountWithSpectro::CountWithSpectro(const std::string & name) :
zSize
.
init
(
this
,
SAVE
,
"z_size"
);
totalYData
.
init
(
this
,
NOSAVE
,
"total_yData"
);
initialTime
.
init
(
this
,
NOSAVE
,
"initial_time"
);
measureDuration
.
init
(
this
,
NOSAVE
,
"measure_duration"
);
}
CountWithSpectro
::~
CountWithSpectro
()
{
...
...
@@ -64,6 +67,8 @@ void CountWithSpectro::postConfiguration() {
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
);
}
void
CountWithSpectro
::
updateProgression
()
{
...
...
@@ -71,12 +76,11 @@ void CountWithSpectro::updateProgression() {
}
void
CountWithSpectro
::
start
()
{
//Important! convert the time (seconds) into microseconds -> the driver needs it in that unit
float64
timeInMicrosec
=
integrationTime
()
*
1000000
;
spectro
->
integrationTime
=
timeInMicrosec
;
//Time already in microseconds!
spectro
->
integrationTime
=
integrationTime
();
//check the total time of spectro measurement is smaller than the count time
float64
spectroTime
=
integrationTime
()
*
numSpectroMeasures
();
float64
spectroTime
=
integrationTime
()
*
0.000001
*
numSpectroMeasures
();
//should be in seconds
float64
countTime
=
getCountTimeInSec
();
//count->time.setpoint();
if
(
spectroTime
<
countTime
)
{
...
...
@@ -110,8 +114,8 @@ void CountWithSpectro::start() {
void
CountWithSpectro
::
stop
()
{
if
(
commandStatus
.
isRunning
())
{
count
->
stop
Command
();
spectro
->
stop
Command
();
count
->
stop
Parallel
();
spectro
->
stop
Parallel
();
}
commandStatus
.
setWarning
();
...
...
@@ -124,7 +128,6 @@ void CountWithSpectro::saveSpectroData() {
int32
numor
=
any_cast
<
int32
>
(
count
->
getValue
(
"numor"
));
NexusDataFile
::
appendTo
(
numor
,
"NxD22SpecialServerFile.xml"
,
"NxD22SpecialClientFile.xml"
);
}
void
CountWithSpectro
::
startCount
()
{
...
...
@@ -133,16 +136,26 @@ void CountWithSpectro::startCount() {
void
CountWithSpectro
::
startSpectro
()
{
common
::
Date
startTime
=
common
::
Date
();
initialTime
=
startTime
.
toString
(
"%H:%M:%S"
);
common
::
Date
formerTime
=
startTime
;
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
());
spectro
->
startCommand
();
int32
ySize
=
spectro
->
yData
.
getSize
();
//be careful, maybe the driver gives us a different size
int32
ySize
=
YSIZE
;
float64
*
tempYData
=
spectro
->
yData
();
for
(
int32
j
=
0
;
j
<
ySize
;
j
++
)
{
m_totalYData
[
ySize
*
i
+
j
]
=
tempYData
[
j
];
}
formerTime
=
time
;
}
}
}
...
...
@@ -163,6 +176,7 @@ void CountWithSpectro::initArray() {
memset
(
m_totalYData
,
0
,
totalSize
*
sizeof
(
int32
));
//set to zero
totalYData
.
update
(
m_totalYData
);
totalYData
.
setSize
(
totalSize
);
}
float64
CountWithSpectro
::
getCountTimeInSec
()
{
...
...
src/controllers/lss/d22special/CountWithSpectro.h
View file @
9b0da85a
...
...
@@ -55,6 +55,8 @@ public:
Property
<
int32
>
zSize
;
ArrayProperty
<
int32
>
totalYData
;
DynamicProperty
<
int32
>
measureDuration
;
Property
<
std
::
string
>
initialTime
;
void
refreshNumSpectroMeasures
(
int32
number
);
void
updateProgression
();
...
...
src/controllers/lss/d22special/gui/count_with_spectro/count_with_spectro.properties
View file @
9b0da85a
count_with_spectro.integration_timePrefix
=
Integration time
count_with_spectro.integration_timeSuffix
=
s
count_with_spectro.integration_timeSuffix
=
~mu
s
count_with_spectro.numSpectro
=
Num. Spectros
count_with_spectro.countTime
=
Time
...
...
src/controllers/lss/d22special/gui/count_with_spectro/count_with_spectroCommandView.xml
View file @
9b0da85a
<plugin>
<controller
type=
"count_with_spectro"
role=
"count_with_spectro1"
/>
<text
role=
"count_with_spectro1"
property=
"count_time"
prefix=
"count_with_spectro.countTime"
/>
<text
role=
"count_with_spectro1"
property=
"count_time"
prefix=
"count_with_spectro.countTime"
key=
"countTimeText"
/>
<radio
role=
"count_with_spectro1"
property=
"time_type"
valuesAndLabels=
"count_with_spectro.h,count_with_spectro.m,count_with_spectro.s"
spaceBefore=
"false"
/>
<text
role=
"count_with_spectro1"
property=
"integration_time"
prefix=
"count_with_spectro.integration_timePrefix"
suffix=
"count_with_spectro.integration_timeSuffix"
/>
<text
role=
"count_with_spectro1"
property=
"num_spectro"
prefix=
"count_with_spectro.numSpectro"
/>
<text
role=
"count_with_spectro1"
property=
"integration_time"
prefix=
"count_with_spectro.integration_timePrefix"
suffix=
"count_with_spectro.integration_timeSuffix"
key=
"spectroTimeText"
/>
<text
role=
"count_with_spectro1"
property=
"num_spectro"
prefix=
"count_with_spectro.numSpectro"
key=
"numSpectroMeasuresText"
/>
</plugin>
\ No newline at end of file
src/controllers/lss/d22special/gui/count_with_spectro/count_with_spectroPlugin.xml
View file @
9b0da85a
<controller_plugin_config
type=
"count_with_spectro"
>
<image
key=
"COUNT"
/>
<settings
view=
"count_with_spectroView.xml"
/>
<command
view=
"count_with_spectroCommandView.xml"
/>
<image
key=
"COUNT"
/>
<settings
view=
"count_with_spectroView.xml"
>
<swt_plugin_peer
class=
"SWTCountWithSpectroControllerSetupPluginPeer"
/>
</settings>
<command
view=
"count_with_spectroCommandView.xml"
>
<swt_plugin_peer
class=
"SWTCountWithSpectroControllerCommandPluginPeer"
/>
</command>
</controller_plugin_config>
\ No newline at end of file
src/controllers/lss/d22special/gui/count_with_spectro/count_with_spectroProperties.xml
View file @
9b0da85a
<controller
type=
"count_with_spectro"
>
<property
name=
"num_spectro"
type=
"int32"
max_length=
"3"
/>
</controller>
\ No newline at end of file
src/controllers/lss/d22special/gui/count_with_spectro/count_with_spectroView.xml
View file @
9b0da85a
<plugin>
<controller
type=
"count_with_spectro"
role=
"count_with_spectro1"
/>
<group
title=
"count_with_spectro.countGroup"
>
<text
role=
"count_with_spectro1"
property=
"count_time"
prefix=
"count_with_spectro.countTime"
/>
<text
role=
"count_with_spectro1"
property=
"count_time"
prefix=
"count_with_spectro.countTime"
key=
"countTimeText"
/>
<radio
role=
"count_with_spectro1"
property=
"time_type"
valuesAndLabels=
"count_with_spectro.h,count_with_spectro.m,count_with_spectro.s"
spaceBefore=
"false"
/>
</group>
<newline
/>
<group
title=
"count_with_spectro.spectroGroup"
>
<text
role=
"count_with_spectro1"
property=
"integration_time"
prefix=
"count_with_spectro.integration_timePrefix"
suffix=
"count_with_spectro.integration_timeSuffix"
/>
<text
role=
"count_with_spectro1"
property=
"num_spectro"
prefix=
"count_with_spectro.numSpectro"
/>
<text
role=
"count_with_spectro1"
property=
"integration_time"
prefix=
"count_with_spectro.integration_timePrefix"
suffix=
"count_with_spectro.integration_timeSuffix"
key=
"spectroTimeText"
/>
<text
role=
"count_with_spectro1"
property=
"num_spectro"
prefix=
"count_with_spectro.numSpectro"
key=
"numSpectroMeasuresText"
/>
</group>
</plugin>
\ No newline at end of file
src/drivers/oceanoptics/QE65000Driver.cpp
View file @
9b0da85a
...
...
@@ -18,7 +18,7 @@
#include
"QE65000Driver.h"
#include
"RealQE65000Driver.h"
#include
"
Perfect
QE65000Driver.h"
#include
"
Simulated
QE65000Driver.h"
#include
"QE65000State.h"
#include
"drivers/global/DriversCommands.h"
...
...
@@ -33,7 +33,7 @@ QE65000Driver::QE65000Driver(const std::string& name) : DeviceDriver(name) {
registerParentFunction
(
RS232_FUNCTION
);
//need to specify parent function
//Register states --> up to now only RealState
registerStates
(
new
RealQE65000Driver
(
this
),
new
Perfect
QE65000Driver
(
this
),
new
Perfect
QE65000Driver
(
this
));
registerStates
(
new
RealQE65000Driver
(
this
),
new
Simulated
QE65000Driver
(
this
),
new
Simulated
QE65000Driver
(
this
));
//Init Properties
integrationTime
.
init
(
this
,
SAVE
,
"integration_time"
);
...
...
src/drivers/oceanoptics/QE65000Driver.h
View file @
9b0da85a
...
...
@@ -30,7 +30,7 @@ public:
static
const
int32
PLUGGED
;
static
const
int32
UNPLUGGED
;
Property
<
int32
>
integrationTime
;
Property
<
int32
>
integrationTime
;
//Time in microseconds!!
Property
<
bool
>
isActive
;
ArrayProperty
<
float64
>
yData
;
...
...
src/drivers/oceanoptics/
Perfect
QE65000Driver.cpp
→
src/drivers/oceanoptics/
Simulated
QE65000Driver.cpp
View file @
9b0da85a
...
...
@@ -16,32 +16,48 @@
* limitations under the Licence.
*/
#include
"
Perfect
QE65000Driver.h"
#include
"
Simulated
QE65000Driver.h"
namespace
oceanoptics
{
Perfect
QE65000Driver
::
Perfect
QE65000Driver
(
QE65000Driver
*
owner
)
:
QE65000State
(
owner
)
{
Simulated
QE65000Driver
::
Simulated
QE65000Driver
(
QE65000Driver
*
owner
)
:
QE65000State
(
owner
)
{
}
Perfect
QE65000Driver
::~
Perfect
QE65000Driver
()
{
Simulated
QE65000Driver
::~
Simulated
QE65000Driver
()
{
}
void
Perfect
QE65000Driver
::
init
()
{
void
Simulated
QE65000Driver
::
init
()
{
}
void
PerfectQE65000Driver
::
measure
()
{
cout
<<
"measuring in perfect mode!"
<<
endl
;
void
SimulatedQE65000Driver
::
measure
()
{
//Simulate integrationTime taken into account
usleep
(
owner
()
->
integrationTime
());
//Assume spectrum length is always the same (1044)
int32
length
=
1044
;
float64
*
tempXData
=
new
float64
[
length
];
float64
*
tempYData
=
new
float64
[
length
];
for
(
int32
j
=
0
;
j
<
length
;
j
++
)
{
tempXData
[
j
]
=
j
;
tempYData
[
j
]
=
j
+
100
;
}
owner
()
->
xData
.
set
(
tempXData
);
owner
()
->
xData
.
setSize
(
length
);
owner
()
->
yData
.
set
(
tempYData
);
owner
()
->
yData
.
setSize
(
length
);
}
void
PerfectQE65000Driver
::
stop
()
{
cout
<<
"stopping in perfect mode"
<<
endl
;
void
SimulatedQE65000Driver
::
stop
()
{
m_owner
->
sendProgressEvent
(
PROGRESSION_END_DEVICE_CONTAINER
);
}
void
Perfect
QE65000Driver
::
readStatus
()
{
void
Simulated
QE65000Driver
::
readStatus
()
{
// cout << "reading status in perfect mode" << endl;
}
...
...
src/drivers/oceanoptics/
Perfect
QE65000Driver.h
→
src/drivers/oceanoptics/
Simulated
QE65000Driver.h
View file @
9b0da85a
...
...
@@ -24,11 +24,11 @@
namespace
oceanoptics
{
class
Perfect
QE65000Driver
:
public
QE65000State
{
class
Simulated
QE65000Driver
:
public
QE65000State
{
public:
Perfect
QE65000Driver
(
QE65000Driver
*
owner
);
virtual
~
Perfect
QE65000Driver
();
Simulated
QE65000Driver
(
QE65000Driver
*
owner
);
virtual
~
Simulated
QE65000Driver
();
virtual
void
init
();
virtual
void
measure
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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