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
44632742
Commit
44632742
authored
Oct 29, 2019
by
ics
Browse files
Added calculationError property to refine the error shown in vEXP
parent
ffceb507
Changes
2
Show whitespace changes
Inline
Side-by-side
src/controllers/vexp/VEXPController.cpp
View file @
44632742
...
@@ -80,6 +80,8 @@ VEXPController::VEXPController(const string& name) :
...
@@ -80,6 +80,8 @@ VEXPController::VEXPController(const string& name) :
calca6
.
init
(
this
,
NOSAVE
,
"calca6"
);
calca6
.
init
(
this
,
NOSAVE
,
"calca6"
);
calculationStatus
.
init
(
this
,
NOSAVE
,
"calculation_status"
);
calculationStatus
.
init
(
this
,
NOSAVE
,
"calculation_status"
);
calculationError
.
init
(
this
,
NOSAVE
,
"calculation_error"
);
errorMessage
.
init
(
this
,
NOSAVE
,
"error_message"
);
errorMessage
.
init
(
this
,
NOSAVE
,
"error_message"
);
moveModel
.
init
(
this
,
SAVE
,
"move_model"
);
moveModel
.
init
(
this
,
SAVE
,
"move_model"
);
...
@@ -254,21 +256,11 @@ void VEXPController::postConfiguration() {
...
@@ -254,21 +256,11 @@ void VEXPController::postConfiguration() {
updateProperties
();
updateProperties
();
}
}
void
VEXPController
::
checkAxisLimits
(
ControllerPtr
<
axis
::
AxisController
>&
axis
,
float64
value
)
throw
(
CannotSetValue
)
{
if
((
value
-
axis
->
maxPosition
())
>
0.0000001
)
{
cerr
<<
"vEXP out of limits for "
<<
axis
->
getName
()
<<
endl
;
throw
CannotSetValue
();
}
else
if
((
value
-
axis
->
minPosition
())
<
-
0.0000001
)
{
cerr
<<
"vEXP out of limits for "
<<
axis
->
getName
()
<<
endl
;
throw
CannotSetValue
();
}
}
void
VEXPController
::
calculate
(
float64
ki
,
float64
kf
,
float64
qh
,
float64
qk
,
float64
ql
,
int32
fx
)
{
void
VEXPController
::
calculate
(
float64
ki
,
float64
kf
,
float64
qh
,
float64
qk
,
float64
ql
,
int32
fx
)
{
// Reset status.
// Reset status.
calculationStatus
.
setIdle
();
calculationStatus
.
setIdle
();
calculationError
=
0
;
try
{
try
{
// Ki.
// Ki.
...
@@ -280,20 +272,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
...
@@ -280,20 +272,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
calca1
=
toDouble
(
incidentBeam
->
calca1
());
calca1
=
toDouble
(
incidentBeam
->
calca1
());
calca2
=
toDouble
(
incidentBeam
->
calca2
());
calca2
=
toDouble
(
incidentBeam
->
calca2
());
checkAxisLimits
(
a1Controller
,
calca1
());
checkAxisLimits
(
a2Controller
,
calca2
());
// cout << "calc A1 " << calca1() << endl;
// cout << "calc A2 " << calca2() << endl;
// cout << "calc A3 " << calca3() << endl;
// cout << "calc A3P " << calca3p() << endl;
// cout << "calc A4 " << calca4() << endl;
// cout << "calc A5 " << calca5() << endl;
// cout << "calc A6 " << calca6() << endl << endl;
// Manage the status.
// Manage the status.
if
(
incidentBeam
->
calcStatus
.
isError
())
{
if
(
incidentBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
calculationStatus
.
setError
();
calculationError
=
incidentBeam
->
calcError
();
}
}
else
if
(
incidentBeam
->
calcStatus
.
isWarning
())
{
else
if
(
incidentBeam
->
calcStatus
.
isWarning
())
{
calculationStatus
.
setWarning
();
calculationStatus
.
setWarning
();
...
@@ -310,12 +292,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
...
@@ -310,12 +292,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
calca5
=
toDouble
(
scatteredBeam
->
calca5
());
calca5
=
toDouble
(
scatteredBeam
->
calca5
());
calca6
=
toDouble
(
scatteredBeam
->
calca6
());
calca6
=
toDouble
(
scatteredBeam
->
calca6
());
checkAxisLimits
(
a5Controller
,
calca5
());
checkAxisLimits
(
a6Controller
,
calca6
());
// Manage the status.
// Manage the status.
if
(
scatteredBeam
->
calcStatus
.
isError
())
{
if
(
scatteredBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
calculationStatus
.
setError
();
calculationError
=
scatteredBeam
->
calcError
();
}
}
else
if
(
scatteredBeam
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
else
if
(
scatteredBeam
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
calculationStatus
.
setWarning
();
...
@@ -338,20 +318,19 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
...
@@ -338,20 +318,19 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
calca3p
=
toDouble
(
scattering
->
calca3p
());
calca3p
=
toDouble
(
scattering
->
calca3p
());
calca4
=
toDouble
(
scattering
->
calca4
());
calca4
=
toDouble
(
scattering
->
calca4
());
checkAxisLimits
(
a3Controller
,
calca3
());
// cout << "calc A1 " << calca1() << endl;
checkAxisLimits
(
a3pController
,
calca3p
());
// cout << "calc A2 " << calca2() << endl;
checkAxisLimits
(
a4Controller
,
calca4
());
// cout << "calc A3 " << calca3() << endl;
// cout << "calc A3P " << calca3p() << endl;
// cout << "calc A4 " << calca4() << endl;
// cout << "calc A5 " << calca5() << endl;
// cout << "calc A6 " << calca6() << endl << endl;
// cout << "calc A1 " << calca1() << endl;
// cout << "calc A2 " << calca2() << endl;
// cout << "calc A3 " << calca3() << endl;
// cout << "calc A4 " << calca4() << endl;
// cout << "calc A5 " << calca5() << endl;
// cout << "calc A6 " << calca6() << endl << endl;
// Manage the status.
// Manage the status.
if
(
scattering
->
calcStatus
.
isError
())
{
if
(
scattering
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
calculationStatus
.
setError
();
calculationError
=
scattering
->
calcError
();
}
}
else
if
(
scattering
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
else
if
(
scattering
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
calculationStatus
.
setWarning
();
...
@@ -360,9 +339,12 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
...
@@ -360,9 +339,12 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
}
}
catch
(...)
{
catch
(...)
{
calculationStatus
.
setError
();
calculationStatus
.
setError
();
calculationError
=
0
;
}
}
//cout << "Q -> status " << scattering->calcStatus() << endl;
// if (calculationError() != 0) {
// cout << "VEXP error " << calculationError() << endl;
// }
}
}
}
}
src/controllers/vexp/VEXPController.h
View file @
44632742
...
@@ -64,7 +64,6 @@ public:
...
@@ -64,7 +64,6 @@ public:
virtual
void
postConfiguration
();
virtual
void
postConfiguration
();
void
checkAxisLimits
(
ControllerPtr
<
axis
::
AxisController
>&
axis
,
float64
value
)
throw
(
CannotSetValue
);
void
calculate
(
float64
ki
,
float64
kf
,
float64
qh
,
float64
qk
,
float64
ql
,
int32
fx
);
void
calculate
(
float64
ki
,
float64
kf
,
float64
qh
,
float64
qk
,
float64
ql
,
int32
fx
);
Property
<
float64
>
as
;
Property
<
float64
>
as
;
...
@@ -114,6 +113,7 @@ public:
...
@@ -114,6 +113,7 @@ public:
Property
<
float64
>
calca6
;
Property
<
float64
>
calca6
;
StatusProperty
calculationStatus
;
StatusProperty
calculationStatus
;
Property
<
int32
>
calculationError
;
Property
<
std
::
string
>
errorMessage
;
Property
<
std
::
string
>
errorMessage
;
Property
<
bool
>
moveModel
;
Property
<
bool
>
moveModel
;
...
...
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