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
35f30de9
Commit
35f30de9
authored
Oct 28, 2019
by
ics
Browse files
Added check of limits in VEXPController
parent
b72ad314
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/controllers/vexp/VEXPController.cpp
View file @
35f30de9
...
...
@@ -250,87 +250,113 @@ void VEXPController::postConfiguration() {
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
)
{
// Reset status.
calculationStatus
.
setIdle
();
// Ki.
incidentBeam
->
calcki
=
ki
;
// calca1, calca2, calcStatus are calculated.
incidentBeam
->
calculate
(
tas
::
Beam
::
K_MODE
);
calca1
=
toDouble
(
incidentBeam
->
calca1
());
calca2
=
toDouble
(
incidentBeam
->
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.
if
(
incidentBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
}
else
if
(
incidentBeam
->
calcStatus
.
isWarning
())
{
calculationStatus
.
setWarning
();
}
//cout << "Ki -> status " << incidentBeam->calcStatus() << endl;
// Kf.
scatteredBeam
->
calckf
=
kf
;
// calca1, calca2, calcStatus are calculated.
scatteredBeam
->
calculate
(
tas
::
Beam
::
K_MODE
);
calca5
=
toDouble
(
scatteredBeam
->
calca5
());
calca6
=
toDouble
(
scatteredBeam
->
calca6
());
// Manage the status.
if
(
scatteredBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
}
else
if
(
scatteredBeam
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
try
{
// Ki.
incidentBeam
->
calcki
=
ki
;
// calca1, calca2, calcStatus are calculated.
incidentBeam
->
calculate
(
tas
::
Beam
::
K_MODE
);
calca1
=
toDouble
(
incidentBeam
->
calca1
());
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.
if
(
incidentBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
}
else
if
(
incidentBeam
->
calcStatus
.
isWarning
())
{
calculationStatus
.
setWarning
();
}
//cout << "Ki -> status " << incidentBeam->calcStatus() << endl;
// Kf.
scatteredBeam
->
calckf
=
kf
;
// calca1, calca2, calcStatus are calculated.
scatteredBeam
->
calculate
(
tas
::
Beam
::
K_MODE
);
calca5
=
toDouble
(
scatteredBeam
->
calca5
());
calca6
=
toDouble
(
scatteredBeam
->
calca6
());
checkAxisLimits
(
a5Controller
,
calca5
());
checkAxisLimits
(
a6Controller
,
calca6
());
// Manage the status.
if
(
scatteredBeam
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
}
else
if
(
scatteredBeam
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
}
//cout << "Kf -> status " << scatteredBeam->calcStatus() << endl;
// Q.
scattering
->
calcqh
=
qh
;
scattering
->
calcqk
=
qk
;
scattering
->
calcql
=
ql
;
scattering
->
calcen
=
2.072
*
(
ki
*
ki
-
kf
*
kf
);
scattering
->
calcki
=
ki
;
scattering
->
calckf
=
kf
;
// Calculate by fixing Ki.
scattering
->
calculate
(
tas
::
Beam
::
K_MODE
,
1
);
calca3
=
toDouble
(
scattering
->
calca3
());
calca3p
=
toDouble
(
scattering
->
calca3p
());
calca4
=
toDouble
(
scattering
->
calca4
());
checkAxisLimits
(
a3Controller
,
calca3
());
checkAxisLimits
(
a3pController
,
calca3p
());
checkAxisLimits
(
a4Controller
,
calca4
());
// 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.
if
(
scattering
->
calcStatus
.
isError
())
{
calculationStatus
.
setError
();
}
else
if
(
scattering
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
cerr
<<
"Warning: Calculated Kf are different"
<<
endl
;
}
}
//cout << "Kf -> status " << scatteredBeam->calcStatus() << endl;
// Q.
scattering
->
calcqh
=
qh
;
scattering
->
calcqk
=
qk
;
scattering
->
calcql
=
ql
;
scattering
->
calcen
=
2.072
*
(
ki
*
ki
-
kf
*
kf
);
scattering
->
calcki
=
ki
;
scattering
->
calckf
=
kf
;
// Calculate by fixing Ki.
scattering
->
calculate
(
tas
::
Beam
::
K_MODE
,
1
);
calca3
=
toDouble
(
scattering
->
calca3
());
calca3p
=
toDouble
(
scattering
->
calca3p
());
calca4
=
toDouble
(
scattering
->
calca4
());
// 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.
if
(
scattering
->
calcStatus
.
isError
())
{
catch
(...)
{
calculationStatus
.
setError
();
}
else
if
(
scattering
->
calcStatus
.
isWarning
()
&&
!
calculationStatus
.
isError
())
{
calculationStatus
.
setWarning
();
cerr
<<
"Warning: Calculated Kf are different"
<<
endl
;
}
//cout << "Q -> status " << scattering->calcStatus() << endl;
}
...
...
src/controllers/vexp/VEXPController.h
View file @
35f30de9
...
...
@@ -64,6 +64,7 @@ public:
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
);
Property
<
float64
>
as
;
...
...
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