Commit 0a10cb49 authored by legoc's avatar legoc
Browse files

Added VEXPController and AxisRecorder.

parent 8f716bd9
......@@ -5,7 +5,7 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.779576013" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
......@@ -57,7 +57,7 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.867724389" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
......
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "AxisRecorder.h"
#include "controllers/common/family/Families.h"
#include "controllers/common/axis/AxisController.h"
#include "ics/InstrumentManager/InstrumentManager.h"
namespace axis {
const string AxisRecorder::TYPE = "axis_recorder";
AxisRecorder::AxisRecorder(const string& name) :
ExperimentController(name), m_initialDate(common::Date().getTimeUs()) {
setFamily(family::HIDDEN);
string outputFilePath = getenv("HOME");
outputFilePath += "/serverlog/axis.log";
m_dataFile.reset(new ofstream(outputFilePath.c_str()));
}
AxisRecorder::AxisRecorder(const AxisRecorder& controller) :
ExperimentController(controller) {
}
AxisRecorder::~AxisRecorder() {
}
void AxisRecorder::postConfiguration() {
m_experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
map<string, ExperimentController*>::iterator it;
for (it = m_experimentControllersMap.begin(); it != m_experimentControllersMap.end(); it++) {
if (dynamic_cast<axis::AxisController*>(it->second) != 0) {
axis::AxisController* controller = dynamic_cast<axis::AxisController*>(it->second);
controller->attach(this);
registerUpdater(controller->position, &AxisRecorder::updateActualPosition, this, controller->getName());
}
}
}
void AxisRecorder::updateActualPosition(const std::string& controllerName) {
common::Date now;
if (*m_dataFile) {
(*m_dataFile) << (now.getTimeUs() - m_initialDate) << ", " << controllerName << ", " << dynamic_cast<axis::AxisController*>(m_experimentControllersMap[controllerName])->position() << endl;
}
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef AXIS_AXISRECORDER_H
#define AXIS_AXISRECORDER_H
#include <Controller.h>
#include <fstream>
#include <memory>
namespace axis {
class AxisRecorder : public ExperimentController {
public:
//! Type of controller
static const std::string TYPE;
AxisRecorder(const std::string& name);
AxisRecorder(const AxisRecorder& controller);
virtual ~AxisRecorder();
virtual void postConfiguration();
void updateActualPosition(const std::string& controllerName);
private:
std::auto_ptr<std::ofstream> m_dataFile;
int64 m_initialDate;
std::map<string, ExperimentController*> m_experimentControllersMap;
};
}
#endif
<module name="axisrecorder">
<controller class="axis::AxisRecorder"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
</module>
<module name="vexp">
<controller class="vexp::VEXPController"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
</module>
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "VEXPController.h"
#include "controllers/common/family/Families.h"
namespace vexp {
const string VEXPController::TYPE = "vexp_controller";
VEXPController::VEXPController(const string& name) :
ExperimentController(name) {
setFamily(family::HIDDEN);
as.init(this, NOSAVE, "as", "AS");
bs.init(this, NOSAVE, "bs", "BS");
cs.init(this, NOSAVE, "cs", "CS");
aa.init(this, NOSAVE, "aa", "AA");
bb.init(this, NOSAVE, "bb", "BB");
cc.init(this, NOSAVE, "cc", "CC");
ax.init(this, NOSAVE, "ax", "AX");
ay.init(this, NOSAVE, "ay", "AY");
az.init(this, NOSAVE, "az", "AZ");
bx.init(this, NOSAVE, "bx", "BX");
by.init(this, NOSAVE, "by", "BY");
bz.init(this, NOSAVE, "bz", "BZ");
u.init(this, NOSAVE, "Umatrix");
b.init(this, NOSAVE, "Bmatrix");
qh.init(this, NOSAVE, "qh", "QH");
qk.init(this, NOSAVE, "qk", "QK");
ql.init(this, NOSAVE, "ql", "QL");
en.init(this, NOSAVE, "en", "EN");
qm.init(this, NOSAVE, "qm", "QM");
tasSettings.init(this, "tas_settings");
sample.init(this, "sample");
scattering.init(this, "scattering");
incidentBeam.init(this, "incident_beam");
scatteredBeam.init(this, "scattered_beam");
}
VEXPController::~VEXPController() {
}
void VEXPController::postConfiguration() {
registerPropertyCopierByUpdate(tasSettings->as, as);
registerPropertyCopierByUpdate(tasSettings->bs, bs);
registerPropertyCopierByUpdate(tasSettings->cs, cs);
registerPropertyCopierByUpdate(tasSettings->aa, aa);
registerPropertyCopierByUpdate(tasSettings->bb, bb);
registerPropertyCopierByUpdate(tasSettings->cc, cc);
registerPropertyCopierByUpdate(tasSettings->ax, ax);
registerPropertyCopierByUpdate(tasSettings->ax, ax);
registerPropertyCopierByUpdate(tasSettings->ax, ax);
registerPropertyCopierByUpdate(tasSettings->bx, bx);
registerPropertyCopierByUpdate(tasSettings->bx, bx);
registerPropertyCopierByUpdate(tasSettings->bx, bx);
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef VEXP_VEXPCONTROLLER_H
#define VEXP_VEXPCONTROLLER_H
#include "controllers/tas/common/TasSettings.h"
#include "controllers/tas/common/Scattering.h"
#include "controllers/tas/common/Sample.h"
#include "controllers/tas/common/IncidentBeam.h"
#include "controllers/tas/common/TasScatteredBeam.h"
namespace vexp {
class VEXPController : public ExperimentController {
public:
//! Type of controller
static const std::string TYPE;
VEXPController(const std::string& name);
virtual ~VEXPController();
virtual void postConfiguration();
Property<float64> as;
Property<float64> bs;
Property<float64> cs;
Property<float64> aa;
Property<float64> bb;
Property<float64> cc;
Property<float64> ax;
Property<float64> ay;
Property<float64> az;
Property<float64> bx;
Property<float64> by;
Property<float64> bz;
ArrayProperty<float64> u;
ArrayProperty<float64> b;
Property<float64> qh;
Property<float64> qk;
Property<float64> ql;
Property<float64> en;
Property<float64> qm;
ControllerPtr<tas::TasSettings> tasSettings;
ControllerPtr<tas::Sample> sample;
ControllerPtr<tas::Scattering> scattering;
ControllerPtr<tas::IncidentBeam> incidentBeam;
ControllerPtr<tas::TasScatteredBeam> scatteredBeam;
};
}
#endif
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