Commit 40c57439 authored by legoc's avatar legoc
Browse files
parents b7daacda 3789171a
......@@ -40,10 +40,10 @@ AxisRecorder::AxisRecorder(const string& name) :
AxisRecorder::AxisRecorder(const AxisRecorder& controller) :
ExperimentController(controller) {
}
AxisRecorder::~AxisRecorder() {
m_dataFile.release();
}
void AxisRecorder::postConfiguration() {
......
......@@ -16,9 +16,10 @@
* limitations under the Licence.
*/
#include "controllers/common/family/Families.h"
#include "DirectCamera.h"
#include "controllers/common/family/Families.h"
using namespace std;
namespace dif_s {
......
Camerasetting.setup=Setup
Camerasetting.actual=Actual
Camerasetting.divisors=Divisors
Camerasetting.wanted_time=Time
Camerasetting.actual_time=Time
Camerasetting.wanted_kine=Nb Frame
Camerasetting.vbind=VBinning
Camerasetting.hbind=HBinning
# Mode combo
Camerasetting.2048Label=1*1
Camerasetting.2048Value=1
Camerasetting.1024Label=2*2
Camerasetting.1024Value=2
Camerasetting.512Label=4*4
Camerasetting.512Value=4
Camerasetting.orientation=Orientation
# Mode check
Camerasetting.hflipPrefix=H Flip
Camerasetting.hflipCheckedValue=1
Camerasetting.hflipUncheckedValue=0
Camerasetting.vflipPrefix=V Flip
Camerasetting.vflipCheckedValue=1
Camerasetting.vflipUncheckedValue=0
Camerasetting.rotatePrefix=Rotation
Camerasetting.bindPrefix=Binning
Camerasetting.CW90Label=CW 90
Camerasetting.CW90Value=1
Camerasetting.CCW90Label=CCW 90
Camerasetting.CCW90Value=2
Camerasetting.NoneLabel=None
Camerasetting.NoneValue=0
Camerasetting.modePrefix=Mode
Camerasetting.kine= Frame
Camerasetting.CountLabel=Single
Camerasetting.CountValue=1
Camerasetting.KineLabel=Multi
Camerasetting.KineValue=3
Camerasetting.FVBPrefix= Full Vertical Binning
Camerasetting.modeFVBCheckedValue=true
Camerasetting.modeFVBUncheckedValue=false
Camerasetting.wanted_temperature=Wanted Temp
Camerasetting.actual_temperature=Actual Temp
<plugin>
<controller type="Camerasetting" role="Camerasetting1" />
<property_switcher role="Camerasetting1" property="wantedmode"
switcher_key="modeSwitcher" />
<number_of_lines nb_lines="2" />
<combo role="Camerasetting1" property="wantedhBinning" prefix="Camerasetting.bindPrefix"
valuesAndLabels="Camerasetting.2048,Camerasetting.1024,Camerasetting.512" />
<combo role="Camerasetting1" property="wantedvBinning" prefix="Camerasetting.bindPrefix"
valuesAndLabels="Camerasetting.2048,Camerasetting.1024,Camerasetting.512" />
<combo role="Camerasetting1" property="wantedmode" prefix="Camerasetting.modePrefix"
valuesAndLabels="Camerasetting.Count,Camerasetting.Kine" />
<switchable_composite switcher_key="modeSwitcher"
switch_values="3">
<text role="Camerasetting1" property="nbKine" prefix="Camerasetting.wanted_kine" />
</switchable_composite>
</plugin>
<controller_plugin_config type="Camerasetting">
<image key="HARDWARE_MMODULE"/>
<settings view="CamerasettingView.xml"/>
<command view="CamerasettingCommandView.xml"/>
</controller_plugin_config>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<controller type="Camerasetting">
<property name="wantedvBinning" type="long">
</property>
<property name="actualvBinning" type="long">
</property>
<property name="wantedhBinning" type="long">
</property>
<property name="actualhBinning" type="long">
</property>
<!-- <property name="hflip" type="long"> -->
<!-- </property> -->
<!-- <property name="vflip" type="long"> -->
<!-- </property> -->
<!-- <property name="rotate" type="long"> -->
<!-- </property> -->
<property name="actualmode" type="long">
</property>
<property name="wantedmode" type="long">
</property>
<property name="nbKine" type="long">
</property>
<property name="temperature" type="long">
</property>
<property name="kineTime" type="double">
</property>
<property name="modeFVB" type="boolean">
</property>
</controller>
<plugin>
<controller type="Cyclopssetting" role="Cyclopssetting1" />
<property_switcher role="Cyclopssetting1" property="wantedmode"
switcher_key="modeSwitcher" />
<property_switcher role="Cyclopssetting1" property="modeFVB"
switcher_key="modeFVB" />
<newLine />
<check role="Cyclopssetting1" property="modeFVB" prefix="Cyclopssetting.FVBPrefix" checkBoxValues="Cyclopssetting.modeFVB"/>
<newLine/>
<property_switcher role="Cyclopssetting1" property="modeFVB" switcher_key="by_switcher"/>
<switchable_composite switcher_key="by_switcher" switch_values="true">
</switchable_composite>
<switchable_composite switcher_key="by_switcher" switch_values="false">
<table_composite nbColumns="3">
<group title="Cyclopssetting.hbind">
<combo role="Cyclopssetting1" property="wantedhBinning"
prefix="Cyclopssetting.bindPrefix" valuesAndLabels="Cyclopssetting.2048,Cyclopssetting.1024,Cyclopssetting.512" />
<newLine />
</group>
<group title="Cyclopssetting.vbind">
<combo role="Cyclopssetting1" property="wantedvBinning"
prefix="Cyclopssetting.bindPrefix" valuesAndLabels="Cyclopssetting.2048,Cyclopssetting.1024,Cyclopssetting.512" />
<newLine />
</group>
<newLine />
<!-- <group title="Cyclopssetting.orientation"> -->
<!-- <check role="Cyclopssetting1" property="hflip" -->
<!-- prefix="Cyclopssetting.hflipPrefix" checkBoxValues="Cyclopssetting.hflip" /> -->
<!-- <newLine /> -->
<!-- <check role="Cyclopssetting1" property="vflip" -->
<!-- prefix="Cyclopssetting.vflipPrefix" checkBoxValues="Cyclopssetting.vflip" /> -->
<!-- <newLine /> -->
<!-- <combo role="Cyclopssetting1" property="rotate" -->
<!-- prefix="Cyclopssetting.rotatePrefix" valuesAndLabels="Cyclopssetting.None,Cyclopssetting.CW90,Cyclopssetting.CCW90" /> -->
<!-- </group> -->
<!-- <newLine /> -->
</table_composite>
</switchable_composite>
<group title="Cyclopssetting.kine">
<combo role="Cyclopssetting1" property="wantedmode"
prefix="Cyclopssetting.modePrefix" valuesAndLabels="Cyclopssetting.Count,Cyclopssetting.Kine" />
<newLine />
<switchable_composite switcher_key="modeSwitcher"
switch_values="3">
<text role="Cyclopssetting1" property="nbKine"
prefix="Cyclopssetting.wanted_kine" />
</switchable_composite>
</group>
</plugin>
\ No newline at end of file
/*
* 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 "controllers/common/family/Families.h"
#include "CyclopsDataHeader.h"
#include <InstrumentManager/InstrumentManager.h>
namespace cyclops {
const string CyclopsDataHeader::TYPE = "cyclops_dataheader";
const string CyclopsDataHeader::SEP_VALUE = ":";
const string CyclopsDataHeader::SEP_PARAM = ",";
const string CyclopsDataHeader::END = "*";
/*
* Constructor
*/
CyclopsDataHeader::CyclopsDataHeader(const string& name) :
utilities::CountSpy(name) {
setFamily(family::HIDDEN);
registerFunction(TYPE);
m_CamDriver.init(this, "cammeraDriver");
m_Title.init(this, "title");
m_SampleSettings.init(this, "sample_settings");
m_ScanInfo.init(this, "scan_info");
m_CyclopsSetting.init(this, "cyclops_setting");
map<string, ExperimentController*> experimentControllersMap =
InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
map<string, ExperimentController*>::iterator it;
for (it = experimentControllersMap.begin(); it != experimentControllersMap.end(); it++) {
if (dynamic_cast<axis::AxisController*>(it->second) != 0) {
axis::AxisController* axis = dynamic_cast<axis::AxisController*>(it->second);
m_AxisControllers.push_back(axis);
}
}
}
/*
* Destructor
*/
CyclopsDataHeader::~CyclopsDataHeader() {
}
/*
* postConfiguration
*/
void CyclopsDataHeader::postConfiguration() {
utilities::CountSpy::postConfiguration();
}
/*
* updateProperty
*/
void CyclopsDataHeader::updateProperty(ChangeAspect* aChangeAspect) {
string propertyName = aChangeAspect->getStringParam();
string controllername = aChangeAspect->getControllerName();
int32 i;
for (i = 0; i < (int32) m_CountControllers.size(); ++i) {
if (m_CountControllers[i]->getName() == controllername) {
break;
}
}
if (i < (int32) m_CountControllers.size()) {
if (propertyName == statusMessage.getName()) {
boost::any propvalue = dynamic_cast<AbstractController*>(m_CountControllers[i])->getValue(propertyName);
if (any_cast<string>(propvalue) == "Writing parameters") {
createHeader();
}
}
}
utilities::CountSpy::updateProperty(aChangeAspect);
}
/*
* createHeader
*/
void CyclopsDataHeader::createHeader() {
ostringstream header;
header << " ";
create_a(header, "instrument", m_Title->instrumentName());
create_a(header, "dated", m_Title->startTime());
create_a(header, "user", m_Title->userName());
create_a(header, "l.c.", m_Title->localContactName());
create_a(header, "commentary", m_Title->title());
if (m_ScanInfo->running()) {
create_a(header, "scan_angle", m_ScanInfo->firstControllerName());
}
else {
create_a(header, "scan_angle", "none");
}
create_i(header, "kctrl", 4, 0);
create_i(header, "manip", m_ScanInfo->firstIndex(), 0);
create_i(header, "nbang", m_ScanInfo->nbController(), 0);
create_i(header, "nkmes", m_ScanInfo->nbStep(), 0);
create_i(header, "npmes", m_ScanInfo->actualStep(), 0);
create_i(header, "jcode", modeint(), 0);
create_i(header, "count", 0, 0);
create_i(header, "gain", m_CyclopsSetting->gain(), 0);
create_i(header, "mode", m_CyclopsSetting->mode(), 0);
create_i(header, "nacq", m_CyclopsSetting->nbKine(), 0);
vector<axis::AxisController*>::iterator iter = m_AxisControllers.begin();
while(iter != m_AxisControllers.end()) {
ostringstream name;
name << "angle_" << (*iter)->getName();
create_f(header, name.str(), (*iter)->position(), 8 ,2);
++iter;
}
create_f(header, "scan_start", m_ScanInfo->firstStartValue(), 8 ,2);
create_f(header, "scan_width", m_ScanInfo->firstWidthValue(), 8 ,2);
create_f(header, "scan_step", m_ScanInfo->firstStepValue(), 8 ,2);
if (m_SampleSettings->useMag() == true) {
create_f(header, "magf", m_SampleSettings->getMagController()->field(), 8 ,2);
}
if (m_SampleSettings->useTemp() == true) {
create_f(header, "temp", m_SampleSettings->getMainSampleTempController()->regulationTemperature(), 8 ,2);
create_f(header, "stpt", m_SampleSettings->getMainSampleTempController()->setpointTemperature(), 8 ,2);
create_f(header, "reqt", m_SampleSettings->getMainSampleTempController()->wantedTemperature(), 8 ,2);
create_f(header, "samp", m_SampleSettings->getMainSampleTempController()->sampleTemperature(), 8 ,2);
create_f(header, "heat", m_SampleSettings->getMainSampleTempController()->power(), 8 ,2);
if (m_SampleSettings->getSecSampleTempController()->isEnabled() == true) {
create_f(header, "temp2", m_SampleSettings->getSecSampleTempController()->regulationTemperature(), 8 ,2);
create_f(header, "stpt2", m_SampleSettings->getSecSampleTempController()->setpointTemperature(), 8 ,2);
create_f(header, "reqt2", m_SampleSettings->getSecSampleTempController()->wantedTemperature(), 8 ,2);
create_f(header, "samp2", m_SampleSettings->getSecSampleTempController()->sampleTemperature(), 8 ,2);
create_f(header, "heat2", m_SampleSettings->getSecSampleTempController()->power(), 8 ,2);
}
else {
create_f(header, "temp2", -1., 8 ,2);
}
}
header << END;
m_CamDriver->header = header.str();
}
/*
* create_a
*/
void CyclopsDataHeader::create_a(ostream& out, const string& name, const string& value) {
out << name << SEP_VALUE << value << SEP_PARAM;
}
/*
* create_i
*/
void CyclopsDataHeader::create_i(ostream& out, const string& name, int32 value, uint32 nbch) {
ostringstream buf;
if (nbch > 0) {
buf.width(nbch);
}
buf << value;
create_a(out, name, buf.str());
}
/*
* create_f
*/
void CyclopsDataHeader::create_f(ostream& out, const string& name, float64 value, uint32 nbch, uint32 nbdec) {
ostringstream buf;
if (nbch > 0) {
buf.width(nbch);
}
buf.precision(nbdec);
buf << value;
create_a(out, name, buf.str());
}
}
/*
* 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.
*/
/*!
* \brief class cyclops camera data settings
* \author J. Locatelli
* \date 21-11-2019
*/
#ifndef CYCLOPSDATAHEADER_H
#define CYCLOPSDATAHEADER_H
#include <Controller.h>
#include "CyclopsSetting.h"
#include "controllers/common/utilities/CountSpy.h"
#include "controllers/common/acquisition/ExperimentData.h"
#include "controllers/common/axis/AxisController.h"
#include "controllers/common/sample_environment/environment/SampleSettings.h"
#include "controllers/common/scanlegacy/ScanInfo.h"
#include "drivers/photonic/psl/PslDriver.h"
namespace cyclops {
/*!
* \class cyclops data server path setiing
* \brief Configure data path and name for cyclops data server
*/
class CyclopsDataHeader: public utilities::CountSpy {
public:
//! Type of controller
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
CyclopsDataHeader(const std::string& name);
/*!
* \brief Destructor
*/
virtual ~CyclopsDataHeader();
virtual void updateProperty(ChangeAspect* aChangeAspect);
/*!
* Properties
*/
private:
/*!
* \brief Method called before changing the property value
* This method is called after setting configuration during the creation of controller.
*/
virtual void postConfiguration();
DriverPtr<psl::PslDriver> m_CamDriver;
ControllerPtr<acquisition::ExperimentData> m_Title;
ControllerPtr<sample_environment::SampleSettings> m_SampleSettings;
ControllerPtr<scan::ScanInfo> m_ScanInfo;
ControllerPtr<CyclopsSetting> m_CyclopsSetting;
std::vector<axis::AxisController*> m_AxisControllers;
void createHeader();
void create_a(std::ostream& out, const std::string& name, const std::string& value);
void create_i(std::ostream& out, const std::string& name, int32 value, uint32 nbch);
void create_f(std::ostream& out, const std::string& name, float64 value, uint32 nbch, uint32 nbdec);
static const std::string SEP_VALUE;
static const std::string SEP_PARAM;
static const std::string END;
};
}
#endif //CYCLOPSDATAHEADER_H
/*
* 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 "controllers/common/family/Families.h"
#include "CyclopsDataPath.h"
#include <boost/filesystem/operations.hpp>
namespace cyclops {
const string CyclopsDataPath::TYPE = "cyclops_datapath";
/*
* Constructor
*/
CyclopsDataPath::CyclopsDataPath(const string& name) :
ExperimentController(name), controller::Start(this) {
setFamily(family::ACQUISITION, family::SETTING);
datapath.init(this, SAVE, "datapath");
dataname.init(this, SAVE, "dataname");
registerFunction(TYPE);
m_CamDriver.init(this, "cammeraDriver");
m_Title.init(this, "title");
}
/*
* Destructor
*/
CyclopsDataPath::~CyclopsDataPath() {
}
/*
* postConfiguration
*/
void CyclopsDataPath::postConfiguration() {
registerUpdater(m_Title->numor, &CyclopsDataPath::updateNumor, this);
updateNumor();
}
/*
* start
*/
void CyclopsDataPath::start() {
commandProgression = 0;
commandStatus.setRunning();
// Create path in /users/data if not existed
boost::filesystem::path path = "/users/data";
path /= datapath();
if (boost::filesystem::is_regular_file(path)) {
log(Level::s_Error) << "error path name existed as regular file " << path.string() << endlog;
commandStatus.setError();
}
else {
if (boost::filesystem::is_directory(path) == false) {
boost::filesystem::create_directory(path);
log(Level::s_Info) << "create local data path " << path.string() << endlog;
}
m_CamDriver->fileDirectory = datapath();
m_CamDriver->fileName = dataname();
log(Level::s_Info) << "set data path " << datapath() << " and name " << dataname() << endlog;
commandStatus.setIdle();
}
commandProgression = 0;
}