Commit ffceb507 authored by yannick legoc's avatar yannick legoc
Browse files

Using fix mode to calculate the VEXPController angles

parent 35f30de9
...@@ -56,6 +56,7 @@ VEXPController::VEXPController(const string& name) : ...@@ -56,6 +56,7 @@ VEXPController::VEXPController(const string& name) :
ql.init(this, NOSAVE, "ql"); ql.init(this, NOSAVE, "ql");
en.init(this, NOSAVE, "en"); en.init(this, NOSAVE, "en");
qm.init(this, NOSAVE, "qm"); qm.init(this, NOSAVE, "qm");
fx.init(this, NOSAVE, "fx");
ki.init(this, NOSAVE, "ki"); ki.init(this, NOSAVE, "ki");
kf.init(this, NOSAVE, "kf"); kf.init(this, NOSAVE, "kf");
...@@ -129,9 +130,10 @@ void VEXPController::refreshCalcParameters(const std::string& value) { ...@@ -129,9 +130,10 @@ void VEXPController::refreshCalcParameters(const std::string& value) {
rapidjson::Value& qh = document["qh"]; rapidjson::Value& qh = document["qh"];
rapidjson::Value& qk = document["qk"]; rapidjson::Value& qk = document["qk"];
rapidjson::Value& ql = document["ql"]; rapidjson::Value& ql = document["ql"];
rapidjson::Value& fx = document["fx"];
// Calculate the angles and the status. // Calculate the angles and the status.
calculate(ki.GetDouble(), kf.GetDouble(), qh.GetDouble(), qk.GetDouble(), ql.GetDouble()); calculate(ki.GetDouble(), kf.GetDouble(), qh.GetDouble(), qk.GetDouble(), ql.GetDouble(), fx.GetInt());
} }
double toDouble(double value) { double toDouble(double value) {
...@@ -185,6 +187,7 @@ void VEXPController::updateProperties() { ...@@ -185,6 +187,7 @@ void VEXPController::updateProperties() {
ql.update(scattering->ql()); ql.update(scattering->ql());
en.update(scattering->en()); en.update(scattering->en());
qm.update(scattering->qm()); qm.update(scattering->qm());
fx.update(scattering->fx());
ki.update(incidentBeam->ki()); ki.update(incidentBeam->ki());
kf.update(scatteredBeam->kf()); kf.update(scatteredBeam->kf());
...@@ -222,6 +225,7 @@ void VEXPController::postConfiguration() { ...@@ -222,6 +225,7 @@ void VEXPController::postConfiguration() {
registerPropertyCopierByUpdate(scattering->ql, ql); registerPropertyCopierByUpdate(scattering->ql, ql);
registerPropertyCopierByUpdate(scattering->en, en); registerPropertyCopierByUpdate(scattering->en, en);
registerPropertyCopierByUpdate(scattering->qm, qm); registerPropertyCopierByUpdate(scattering->qm, qm);
registerPropertyCopierByUpdate(scattering->fx, fx);
registerPropertyCopierByUpdate(incidentBeam->ki, ki); registerPropertyCopierByUpdate(incidentBeam->ki, ki);
registerPropertyCopierByUpdate(scatteredBeam->kf, kf); registerPropertyCopierByUpdate(scatteredBeam->kf, kf);
...@@ -261,7 +265,7 @@ void VEXPController::checkAxisLimits(ControllerPtr<axis::AxisController>& axis, ...@@ -261,7 +265,7 @@ void VEXPController::checkAxisLimits(ControllerPtr<axis::AxisController>& axis,
} }
} }
void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, float64 ql) { void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, float64 ql, int32 fx) {
// Reset status. // Reset status.
calculationStatus.setIdle(); calculationStatus.setIdle();
...@@ -328,7 +332,7 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f ...@@ -328,7 +332,7 @@ void VEXPController::calculate(float64 ki, float64 kf, float64 qh, float64 qk, f
scattering->calckf = kf; scattering->calckf = kf;
// Calculate by fixing Ki. // Calculate by fixing Ki.
scattering->calculate(tas::Beam::K_MODE, 1); scattering->calculate(tas::Beam::K_MODE, fx);
calca3 = toDouble(scattering->calca3()); calca3 = toDouble(scattering->calca3());
calca3p = toDouble(scattering->calca3p()); calca3p = toDouble(scattering->calca3p());
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
virtual void postConfiguration(); virtual void postConfiguration();
void checkAxisLimits(ControllerPtr<axis::AxisController>& axis, float64 value) throw (CannotSetValue); void checkAxisLimits(ControllerPtr<axis::AxisController>& axis, float64 value) throw (CannotSetValue);
void calculate(float64 ki, float64 kf, float64 qh, float64 qk, float64 ql); void calculate(float64 ki, float64 kf, float64 qh, float64 qk, float64 ql, int32 fx);
Property<float64> as; Property<float64> as;
Property<float64> bs; Property<float64> bs;
...@@ -89,6 +89,7 @@ public: ...@@ -89,6 +89,7 @@ public:
Property<float64> ql; Property<float64> ql;
Property<float64> en; Property<float64> en;
Property<float64> qm; Property<float64> qm;
Property<int32> fx;
Property<float64> ki; Property<float64> ki;
Property<float64> kf; Property<float64> kf;
......
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