Commit 44632742 authored by ics's avatar ics
Browse files

Added calculationError property to refine the error shown in vEXP

parent ffceb507
......@@ -80,6 +80,8 @@ VEXPController::VEXPController(const string& name) :
calca6.init(this, NOSAVE, "calca6");
calculationStatus.init(this, NOSAVE, "calculation_status");
calculationError.init(this, NOSAVE, "calculation_error");
errorMessage.init(this, NOSAVE, "error_message");
moveModel.init(this, SAVE, "move_model");
......@@ -254,21 +256,11 @@ 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, int32 fx) {
// Reset status.
calculationStatus.setIdle();
calculationError = 0;
try {
// Ki.
......@@ -280,20 +272,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
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();
calculationError = incidentBeam->calcError();
}
else if (incidentBeam->calcStatus.isWarning()) {
calculationStatus.setWarning();
......@@ -310,12 +292,10 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
calca5 = toDouble(scatteredBeam->calca5());
calca6 = toDouble(scatteredBeam->calca6());
checkAxisLimits(a5Controller, calca5());
checkAxisLimits(a6Controller, calca6());
// Manage the status.
if (scatteredBeam->calcStatus.isError()) {
calculationStatus.setError();
calculationError = scatteredBeam->calcError();
}
else if (scatteredBeam->calcStatus.isWarning() && !calculationStatus.isError()) {
calculationStatus.setWarning();
......@@ -338,20 +318,19 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
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 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.
if (scattering->calcStatus.isError()) {
calculationStatus.setError();
calculationError = scattering->calcError();
}
else if (scattering->calcStatus.isWarning() && !calculationStatus.isError()) {
calculationStatus.setWarning();
......@@ -360,9 +339,12 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
}
catch (...) {
calculationStatus.setError();
calculationError = 0;
}
//cout << "Q -> status " << scattering->calcStatus() << endl;
// if (calculationError() != 0) {
// cout << "VEXP error " << calculationError() << endl;
// }
}
}
......@@ -64,7 +64,6 @@ 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, int32 fx);
Property<float64> as;
......@@ -114,6 +113,7 @@ public:
Property<float64> calca6;
StatusProperty calculationStatus;
Property<int32> calculationError;
Property<std::string> errorMessage;
Property<bool> moveModel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment