...
 
Commits (3)
......@@ -34,7 +34,7 @@ const string ExternalChopperFreq::TYPE = "external_freq";
/*
* Constructor
*/
ExternalChopperFreq::ExternalChopperFreq(const string& name) : acquisition::LinkerMpdaChopper(name) {
ExternalChopperFreq::ExternalChopperFreq(const string& name) : acquisition::LinkerMpdaChopper(name),controller::Stoppable(this){
setFamily(family::ACQUISITION);
......@@ -54,6 +54,18 @@ ExternalChopperFreq::ExternalChopperFreq(const string& name) : acquisition::Link
*/
ExternalChopperFreq::~ExternalChopperFreq() {
}
/*
* start
*/
void ExternalChopperFreq::start() {
// Execute the read command on Driver
speedChopperForMpda.setpoint=externalFreq() * 60;
speedChopperForMpda=externalFreq() * 60;
}
void ExternalChopperFreq::stop() {
// Execute the read command on Driver
}
/*
......
......@@ -35,7 +35,7 @@ namespace acquisition {
* \brief Contains information about the sample(s) of the current selected proposal
*
*/
class ExternalChopperFreq: public acquisition::LinkerMpdaChopper {
class ExternalChopperFreq: public acquisition::LinkerMpdaChopper, public controller::Stoppable{
public:
......@@ -59,6 +59,11 @@ public:
*/
Property<float64> externalFreq;
/*
* read
*/
virtual void start();
virtual void stop();
......
......@@ -3,6 +3,6 @@
<image key="TITLE"/>
<settings view="external_freqView.xml"/>
<command view="external_freqCommandView.xml" sequential_fixed="true"/>
<command view="external_freqCommandView.xml" />
</controller_plugin_config>
......@@ -65,10 +65,14 @@ void ShuttleAxisController::refreshWantedPositionProperty(float64 value) throw (
secondPosition = axisDriver2->actualPosition();
}
if (fabs(secondPosition - (m_PositionSetPoint - position.offset())) > nocollision_dist()) {
cout << "ShuttleAxisController::refreshWantedPositionProperty "<< (fabs(secondPosition - (value - position.offset())) )<< endl;
if (fabs(secondPosition - (value - position.offset())) > nocollision_dist()) {
AxisController::refreshWantedPositionProperty(value);
} else {
throw CannotSetValue();
sendErrorEvent(BELOW_LOW_LIMIT_ERROR, "Collision risk");
throw CannotSetValue(LIMIT_STR);
throw CannotSetValue();
}
}
/*
......@@ -90,7 +94,7 @@ void ShuttleAxisController::start() {
commandProgression = 100;
return;
}
sleep(12);
commandProgression = 100;
}
......
......@@ -2,24 +2,19 @@
<controller type="pickupnto1" role="pickupnto11"/>
<number_of_lines nb_lines="1"/>
<property_switcher role="pickupnto11" property="mode" switcher_key="pickupnto1.modeSwitcher"/>
<combo role="pickupnto11" property="mode" prefix="pickupnto1.modePrefix" valuesAndLabels="pickupnto1.modesingle,pickupnto1.modemulti" />
<switchable_composite switcher_key="pickupnto1.modeSwitcher" switch_values="single">
<switchable_composite switcher_key="pickupnto.modeSwitcher" switch_values="single">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterSinglePrefix"/>
</switchable_composite>
<switchable_composite switcher_key="pickupnto1.modeSwitcher" switch_values="multi">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterPrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.slavePrefix"/>
<switchable_composite switcher_key="pickupnto.modeSwitcher" switch_values="multi">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.slavePrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.masterPrefix"/>
</switchable_composite>
<text role="pickupnto11" property="delay" prefix="pickupnto1.delayPrefix"/>
</plugin>
......@@ -12,8 +12,8 @@
</switchable_composite>
<switchable_composite switcher_key="pickupnto1.modeSwitcher" switch_values="multi">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterPrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.slavePrefix"/>
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.slavePrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.masterPrefix"/>
</switchable_composite>
<newLine/>
......
......@@ -112,20 +112,20 @@ void D33ChopperCommand::start() {
ControllerPtr<d33::D33ChopperController> chopper_tab[4]={m_CH1,m_CH2,m_CH3,m_CH4};
// int32 chopper_Dir[4]={1,-1,1,-1};
if (selectorDriver->speed() > 0) {
// wantedSelTime = 5;
int32 aspeed = 0;
selectorDriver->speed.setpoint= aspeed;
selectorDriver->startCommand(true);
} else {
// wantedSelTime = 0;
axisselector->state.setpoint="0";
axisselector->startCommand(true);
// cout << "axisselector" << endl;
}
//
// if (selectorDriver->speed() > 0) {
// // wantedSelTime = 5;
// int32 aspeed = 0;
//
// selectorDriver->speed.setpoint= aspeed;
// selectorDriver->startCommand(true);
// } else {
// // wantedSelTime = 0;
// axisselector->state.setpoint="0";
// axisselector->startCommand(true);
//
// // cout << "axisselector" << endl;
// }
sendProgressEvent(0);
// m_Status = 0;
// updateValue(STATUS_PROPERTY, m_Status);
......
......@@ -19,7 +19,7 @@
#ifndef D33CHOPPERSETTING_H
#define D33CHOPPERSETTING_H
#include <Controller.h>
#include "controllers/common/acquisition/gg/LinkerMpdaChopper.h"
#include "D33ChopperController.h"
#include "D33ChopperCommand.h"
#include "PickUpController.h"
......@@ -28,6 +28,8 @@
#include "controllers/common/state/stateaxis/StateAxisController.h"
#include "controllers/common/state/stateaxis/StateAxisSwitchesController.h"
#include "controllers/common/acquisition/mode/TofAcquisitionController.h"
#include "controllers/common/chopper/PickUpNto1Controller.h"
/*! File D33ChopperSetting.cpp
*\brief Configure the resoltioon of the instrument (Chopper drive)
*\version 1.0
......@@ -47,7 +49,7 @@
namespace d33 {
class D33ChopperSetting : public ExperimentController, public controller::Stoppable {
class D33ChopperSetting : public acquisition::LinkerMpdaChopper , public controller::Stoppable {
public:
static const std::string TYPE;
......@@ -201,6 +203,7 @@ private:
virtual void updateSelectorPosition();
virtual void updateWlfPosition();
void writeMpda(float64 speed);
......@@ -262,7 +265,9 @@ private:
ControllerPtr<d33::D33ChopperController> chopper4Driver; //!< link to chopper 4
ControllerPtr<stateaxis::StateAxisController> wlfDriver; //
ControllerPtr<d33::PickUpController> pickupDriver; //
//ControllerPtr<d33::PickUpController> pickupDriver; //
ControllerPtr<chopper::PickUpNto1Controller > pickUpNto1Controller ;
ControllerPtr<axis::ShuttleAxisController> detecteur1;
ControllerPtr<axis::ShuttleAxisController> detecteur2;
......@@ -270,7 +275,12 @@ private:
ControllerPtr<selector::SelectorController> selectorDriver;
ControllerPtr<d33::D33ChopperCommand> chopperCommand;//
ControllerPtr<acquisition::TofAcquisitionController> tofParam;//
ControllerPtr<acquisition::TofAcquisitionController> tofParam2;//
ControllerPtr<stateaxis::StateAxisController> m_Att;
//ControllerPtr<acquisition::MpdaController> m_Mpda3; //! Link
DriverPtr<acquisition::MpdaCommon> m_Mpda1;
DriverPtr<acquisition::MpdaCommon> m_Mpda2;
/**
......
......@@ -37,11 +37,11 @@ D33TofVariableAcquisitionController::D33TofVariableAcquisitionController(const s
tof_distance.init(this, SAVE, "tof_distance");
nDrivers.init(this, SAVE, "nDrivers");
tofFractionalWidths.init(this, SAVE, "tof_times");
tofFractionalWidths.init(this, SAVE, "tof_frac_times");
m_TofTimes = NULL;
m_TofMin = 0;
m_TofMax = 0;
m_ChannelsTable = NULL;
//m_ChannelsTable = NULL;
m_ChannelsTableSize = 0;
/*
......@@ -52,7 +52,7 @@ D33TofVariableAcquisitionController::D33TofVariableAcquisitionController(const s
// registerRefresher(wantedMaxTime, &D33TofVariableAcquisitionController::refreshWantedMaxTimeProperty, this);
// registerRefresher(wantedNChannels, &D33TofVariableAcquisitionController::refreshWantedNChannelsProperty, this);
refreshWantedNChannelsProperty(2);
//refreshWantedNChannelsProperty(2);
m_ChopperSetting.init(this, "chopperSetting");
m_nRegisteredDrivers = nDrivers();
tof_distance = 30.6125;
......@@ -63,8 +63,8 @@ D33TofVariableAcquisitionController::D33TofVariableAcquisitionController(const s
*/
D33TofVariableAcquisitionController::~D33TofVariableAcquisitionController() {
delete[] m_TofTimes;
if (m_ChannelsTable)
delete[] m_ChannelsTable;
// if (m_ChannelsTable)
// delete[] m_ChannelsTable;
}
......@@ -85,7 +85,7 @@ void D33TofVariableAcquisitionController::postConfiguration() {
registerRefresher(delay.setpoint, &D33TofVariableAcquisitionController::refreshWantedDelayProperty, this);
registerUpdater(m_ChopperSetting->tof_distance, &D33TofVariableAcquisitionController::updateTofDistanceProperty, this);
registerUpdater(m_ChopperSetting->lambda_max, &D33TofVariableAcquisitionController::updateLambdaMaxProperty, this);
// registerUpdater(m_ChopperSetting->lambda_max, &D33TofVariableAcquisitionController::updateLambdaMaxProperty, this);
if (useMasterAcq() == true) {
registerUpdater(m_MasterAcqDriver->nbPickup, &D33TofVariableAcquisitionController::updateActualNbPickup, this);
......@@ -124,8 +124,12 @@ void D33TofVariableAcquisitionController::refreshNDriversProperty(int32 value) t
* refreshWantedNChannelsProperty
*/
void D33TofVariableAcquisitionController::refreshWantedNChannelsProperty(int32 value) throw (CannotSetValue) {
// cout << "???????? D33TofVariableAcquisitionController::refreshWantedNChannelsProperty "<< value << endl;
// Create a new table of flight times
delete[] m_TofTimes;
if (m_TofTimes){
delete[] m_TofTimes;
}
m_TofTimes = new float64[value + 1];
tofFractionalWidths.update(m_TofTimes);
tofFractionalWidths.setSize(value + 1);
......@@ -221,13 +225,13 @@ void D33TofVariableAcquisitionController::calculateTofTable() {
int32 NbConstChannels;
int32 NBFractionalChannels;
cout << "MinLambda " << minLambda.setpoint() << " MaxLambda " << maxLambda.setpoint() << endl;
cout << "MaxTime " << maxTime.setpoint() << " wantedFraction " << fraction.setpoint() << endl;
cout << "tof_distance() " << tof_distance() << endl;
// cout << "MinLambda " << minLambda.setpoint() << " MaxLambda " << maxLambda.setpoint() << endl;
// cout << "MaxTime " << maxTime.setpoint() << " wantedFraction " << fraction.setpoint() << endl;
// cout << "tof_distance() " << tof_distance() << endl;
m_TofMin = minLambda.setpoint() * tof_distance() / 3956;
m_TofMax = maxLambda.setpoint() * tof_distance() / 3956;
cout << "m_TofMin = " << m_TofMin << " m_TofMax = " << m_TofMax << endl;
// cout << "m_TofMin = " << m_TofMin << " m_TofMax = " << m_TofMax << endl;
// Calculate flight times
dt0 = fraction.setpoint() * m_TofMin;
......@@ -237,14 +241,16 @@ void D33TofVariableAcquisitionController::calculateTofTable() {
//NBFractionalChannels=floor(log10(wantedMaxTime.setpoint())- log10(m_TofMin)) / log10(1+wantedFraction.setpoint());
NBFractionalChannels = (int) floor(log10(m_TofMax / m_TofMin) / log10(1 + fraction.setpoint())) + 1;
cout << "NBFractionalChannels " << NBFractionalChannels << endl;
// cout << "NBFractionalChannels " << NBFractionalChannels << endl;
nChannels.setpoint = NbConstChannels + NBFractionalChannels;
delete[] m_TofTimes;
if (m_TofTimes){
delete[] m_TofTimes;
}
m_TofTimes = new float64[nChannels.setpoint()];
tofTimes.update(m_TofTimes);
tofTimes.setSize(nChannels.setpoint());
tofFractionalWidths.update(m_TofTimes);
tofFractionalWidths.setSize(nChannels.setpoint());
m_ChannelsTableSize = nChannels.setpoint();
if (m_ChannelsTableSum)
......@@ -255,28 +261,24 @@ void D33TofVariableAcquisitionController::calculateTofTable() {
delete[] m_DiffChannelsTableSum;
m_DiffChannelsTableSum = new float64[m_ChannelsTableSize];
if (m_ChannelsTable)
delete[] m_ChannelsTable;
m_ChannelsTable = new float64[m_ChannelsTableSize];
cout << "wantedNChannels.setpoint() " << nChannels.setpoint() << endl;
// cout << "wantedNChannels.setpoint() " << nChannels.setpoint() << endl;
m_TofTimes[0] = m_TofMin;
cout << "channel[0]= " << m_TofTimes[0] << endl;
// cout << "channel[0]= " << m_TofTimes[0] << endl;
for (int32 i = 0; i < NbConstChannels; ++i) {
m_TofTimes[i] = dt0 * 1000000.;
// cout << "channel["<<i<<"] = "<<m_TofTimes[i]<<endl;
// // cout << "channel["<<i<<"] = "<<m_TofTimes[i]<<endl;
}
cout << "NbConstChannels " << NbConstChannels << endl;
// cout << "NbConstChannels " << NbConstChannels << endl;
float32 sumchannel = 0.0;
for (int32 i = 1; i < NBFractionalChannels + 1; ++i) {
m_TofTimes[i + NbConstChannels - 1] = m_TofMin * fraction.setpoint() * pow((1 + fraction.setpoint()), (i - 1))
* 1000000.;
// cout << "channel["<<i+ NbConstChannels-1<<"] = "<<m_TofTimes[i+ NbConstChannels-1]<<endl;
// // cout << "channel["<<i+ NbConstChannels-1<<"] = "<<m_TofTimes[i+ NbConstChannels-1]<<endl;
sumchannel = sumchannel + m_TofTimes[i + NbConstChannels - 1];
}
cout << "sumchannel==" << sumchannel << endl;
// cout << "sumchannel==" << sumchannel << endl;
tofTimes.update(m_TofTimes);
tofTimes.setSize(m_ChannelsTableSize);
......@@ -288,53 +290,48 @@ void D33TofVariableAcquisitionController::calculateTofTable() {
m_DiffChannelsTableSum[ki] = m_TofTimes[ki] - m_TofTimes[ki - 1];
}
// Debug
// // Debug
// int32 d1 = 0;
cout << "Channel Table (millSec) " << endl;
for (int32 ki = 0; ki < nChannels.setpoint(); ki++) {
cout << " cha[" << ki << "] = " << m_TofTimes[ki] << " Sum " << m_ChannelsTableSum[ki] << " Diff "
<< m_DiffChannelsTableSum[ki] << endl;
;
// if (d1==3){
// d1 = 0;
// cout << endl;
// }else { d1++; }
}
// cout << "Channel Table (millSec) " << endl;
// for (int32 ki = 0; ki < nChannels.setpoint(); ki++) {
// cout << " cha[" << ki << "] = " << m_TofTimes[ki] << " Sum " << m_ChannelsTableSum[ki] << " Diff "
// << m_DiffChannelsTableSum[ki] << endl;
// }
int32 local_pickupTimePeriod;
float64 local_pickupTimePeriod;
MpdaCommon* test = dynamic_cast<MpdaCommon*>(m_TimeGateDriver.get());
if (test != NULL) {
local_pickupTimePeriod = (int) (test->pickupTimePeriod()) * 100.;
cout << "============= local_pickupTimePeriod " << local_pickupTimePeriod << endl;
local_pickupTimePeriod = (int) (test->pickupTimePeriod()) ;
// cout << "============= local_pickupTimePeriod " << local_pickupTimePeriod << endl;
} else {
local_pickupTimePeriod = 100000;
cout << "============= local_pickupTimePeriod default " << local_pickupTimePeriod << endl;
// cout << "============= local_pickupTimePeriod default " << local_pickupTimePeriod << endl;
}
// COU max time -> link chopper period ToDo
for (int32 ki = 0; ki < nChannels.setpoint(); ki++) {
//cout << m_ChannelsTableSum[ki] << " " << ki+1 << endl; ;
if (m_ChannelsTableSum[ki] > local_pickupTimePeriod) {
//// cout << m_ChannelsTableSum[ki] << " " << ki+1 << endl; ;
if (m_ChannelsTableSum[ki]/1000. > local_pickupTimePeriod) {
nChannels.setpoint = ki - 1;
cout << " Time Max LUT reached resize number channel to " << nChannels.setpoint() << endl;
}
}
cout << "sumchannel==" << sumchannel << endl;
// cout << "sumchannel==" << sumchannel << endl;
tofTimes.update(m_TofTimes);
tofTimes.setSize(m_ChannelsTableSize);
// writeParams();
calculateLUT(m_ChannelsTableSum, local_pickupTimePeriod);
// // Debug
cout << "Channel Table (millSec) " <<endl;
for (int32 ki =0 ; ki < nChannels.setpoint() ; ki++) {
cout << " cha["<< ki <<"] = "<<m_TofTimes[ki] << " Sum "<<m_ChannelsTableSum[ki] << " Diff " << m_DiffChannelsTableSum[ki] << endl; ;
}
//// // Debug
// // cout << "Channel Table (millSec) " <<endl;
// for (int32 ki =0 ; ki < nChannels.setpoint() ; ki++) {
// cout << " cha["<< ki <<"] = "<<m_TofTimes[ki] << " Sum "<<m_ChannelsTableSum[ki] << " Diff " << m_DiffChannelsTableSum[ki] << endl; ;
// }
// writeParams();
// to test quickly writeParams();
}
/*
......
......@@ -137,13 +137,12 @@ private :
void updateActualNbPickup();
float64* m_TofTimes;
//float64* m_TofTimes;
float64 m_TofMin;
float64 m_TofMax;
int32 m_ChannelsTableSize;
float64* m_ChannelsTable;
//int32 m_ChannelsTableSize;
//float64* m_ChannelsTable;
int32* m_ChannelsTableSum;
float64* m_DiffChannelsTableSum;
ControllerPtr<d33::D33ChopperSetting> chopperSetting;//
......
......@@ -47,6 +47,8 @@ LSSCollimationSetting::LSSCollimationSetting(const std::string & contName) :
diaphValues.init(this, NOSAVE, "diaph_values");
diaphLabels.init(this, NOSAVE, "diaph_labels");
ap_size.init(this, SAVE, "ap_size");
sourceDistance.init(this, NOSAVE, "sourceDistance"); // according to collimation value, the source distance will be set to nearest <= diaphragm position
sourceAperture.init(this, NOSAVE, "sourceAperture");
m_Collimation.init(this, "col");
m_Diaphragm.init(this, "dia");
......
......@@ -46,6 +46,8 @@ public:
DynamicProperty<int32> multipleDiaphValue;
Property<int32> numberOfPosition;
Property<float64> sourceDistance;
Property<std::string> sourceAperture;
LSSCollimationSetting(const std::string & contName);
......
......@@ -9,8 +9,8 @@
<combo role="pickup1" property="wanted_chopper" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.chopper" />
</switchable_composite>
<switchable_composite switcher_key="pickup.wanted_modeSwitcher" switch_values="1">
<combo role="pickup1" property="wanted_master_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.master" />
<combo role="pickup1" property="wanted_slave_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.slave" />
<combo role="pickup1" property="wanted_master_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.slave" />
<combo role="pickup1" property="wanted_slave_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.master" />
</switchable_composite>
</plugin>
......
......@@ -7,7 +7,7 @@
<combo role="pickup1" property="wanted_chopper" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.chopper" spaceBefore="false"/>
</switchable_composite>
<switchable_composite switcher_key="pickup.wanted_modeSwitcher" switch_values="1">
<combo role="pickup1" property="wanted_master_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.master" spaceBefore="false"/>
<combo role="pickup1" property="wanted_slave_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.slave"/>
<combo role="pickup1" property="wanted_master_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.slave" spaceBefore="false"/>
<combo role="pickup1" property="wanted_slave_pickup" valuesAndLabels="pickup.ch1,pickup.ch2,pickup.ch3,pickup.ch4" prefix="pickup1.master"/>
</switchable_composite>
</plugin>
......@@ -30,13 +30,12 @@
namespace fughcp {
const std::string FugHCPDriver::TYPE = "FugHCP";
const std::string FugHCPDriver::TYPE = "OldFugHCP";
/*
* Constructor
*/
FugHCPDriver::FugHCPDriver(const std::string& name) : voltage::VoltageCommon(name) {
driver::RS232::init(name);
registerStates(new RealFugHCPDriver(this), new PerfectFugHCPDriver(this), new SimulatedFugHCPDriver(this));
......
......@@ -40,7 +40,7 @@ namespace fughcp {
* The FugHCP device is a windows computer which running the Fug software made with LabView.
* It is connected to the nomad server using RS232 protocol.
*/
class FugHCPDriver: public voltage::VoltageCommon, public driver::RS232 {
class FugHCPDriver: public voltage::VoltageCommon {
friend class RealFugHCPDriver;
friend class PerfectFugHCPDriver;
......@@ -70,6 +70,13 @@ public:
Property<float64> currentLimit;
protected:
virtual void writeFug(const std::string& aData, bool doClear = false) {
}
virtual void readFug(std::string& aData, const std::string aEnd) {
}
private:
/*!
......
/*
* 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 Main class for the FugHCP device driver
* \author J. Locatelli
* \date 15-04-2011
*/
#include "GPIBFugHCPDriver.h"
namespace fughcp {
const std::string GPIBFugHCPDriver::TYPE = "GPIBFugHCP";
/*
* Constructor
*/
GPIBFugHCPDriver::GPIBFugHCPDriver(const std::string& name) : FugHCPDriver(name) {
driver::Gpib::init(name);
}
/*
* Destructor
*/
GPIBFugHCPDriver::~GPIBFugHCPDriver() {
}
/*
* writeFug
*/
void GPIBFugHCPDriver::writeFug(const std::string& aData, bool doClear) {
write(aData, false);
}
/*
* readFug
*/
void GPIBFugHCPDriver::readFug(std::string& aData, const std::string aEnd) {
read(aData, aEnd);
}
}
/*
* 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 Main class for the FugHCP device driver
* \author J. Locatelli
* \date 15-04-2011
*/
#ifndef GPIBFUGHCPDRIVER_H
#define GPIBFUGHCPDRIVER_H
#include "FugHCPDriver.h"
#include "drivers/global/Gpib.h"
namespace fughcp {
/*!
* \class FugHCPDriver
* \brief Main class for the FugHCP device driver
*
* \par
* Class for FugHCP driver. Implements DeviceDriver methods.
* \par
* The FugHCP device is a windows computer which running the Fug software made with LabView.
* It is connected to the nomad server using GPIB protocol.
*/
class GPIBFugHCPDriver: public FugHCPDriver, public driver::Gpib {
public:
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the device driver
*/
GPIBFugHCPDriver(const std::string& name);
/**
* \brief Destructor.
*/
virtual ~GPIBFugHCPDriver();
virtual void writeFug(const std::string& aData, bool doClear = false);
virtual void readFug(std::string& aData, const std::string aEnd);
};
}
#endif //FUGHCPDRIVER_H
<module name="fughcp">
<driver class="fughcp::FugHCPDriver"/>
<driver class="fughcp::RS232FugHCPDriver"/>
<driver class="fughcp::GPIBFugHCPDriver"/>
</module>
\ 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.
*/
/*!
* \brief Main class for the FugHCP device driver
* \author J. Locatelli
* \date 15-04-2011
*/
#include "RS232FugHCPDriver.h"
namespace fughcp {
const std::string RS232FugHCPDriver::TYPE = "FugHCP";
/*
* Constructor
*/
RS232FugHCPDriver::RS232FugHCPDriver(const std::string& name) : FugHCPDriver(name) {
driver::RS232::init(name);
}
/*
* Destructor
*/
RS232FugHCPDriver::~RS232FugHCPDriver() {
}
/*
* writeFug
*/
void RS232FugHCPDriver::writeFug(const std::string& aData, bool doClear) {
write(aData, doClear);
}
/*
* readFug
*/
void RS232FugHCPDriver::readFug(std::string& aData, const std::string aEnd) {
read(aData, aEnd);
}
}
/*
* 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 Main class for the FugHCP device driver
* \author J. Locatelli
* \date 15-04-2011
*/
#ifndef RS232FUGHCPDRIVER_H
#define RS232FUGHCPDRIVER_H
#include "FugHCPDriver.h"
#include "drivers/global/RS232.h"
namespace fughcp {
/*!
* \class FugHCPDriver
* \brief Main class for the FugHCP device driver
*
* \par
* Class for FugHCP driver. Implements DeviceDriver methods.
* \par
* The FugHCP device is a windows computer which running the Fug software made with LabView.
* It is connected to the nomad server using RS232 protocol.
*/
class RS232FugHCPDriver: public FugHCPDriver, public driver::RS232 {
public:
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the device driver
*/
RS232FugHCPDriver(const std::string& name);
/**
* \brief Destructor.
*/
virtual ~RS232FugHCPDriver();
virtual void writeFug(const std::string& aData, bool doClear = false);
virtual void readFug(std::string& aData, const std::string aEnd);
};
}
#endif //FUGHCPDRIVER_H
......@@ -62,8 +62,8 @@ void RealFugHCPDriver::readStatus() {
string status;
ostringstream buf_out1;
buf_out1 << GET_STATUS << TERMINATOR;
owner()->write(buf_out1.str(), true);
owner()->read(status, TERMINATOR);
owner()->writeFug(buf_out1.str(), true);
owner()->readFug(status, TERMINATOR);
char OutputStatus = status[CHAR_OUTPUT_POS_STATUS];
// Test System status
switch (OutputStatus) {
......@@ -141,8 +141,8 @@ void RealFugHCPDriver::read() {
ostringstream buf1;
buf1 << READ_VOLTAGE << TERMINATOR;
owner()->write(buf1.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf1.str());
owner()->readFug(buf_in, TERMINATOR);
istringstream sbuf2(buf_in.substr(3));
float64 outputVoltage;
......@@ -153,8 +153,8 @@ void RealFugHCPDriver::read() {
ostringstream buf2;
buf2 << READ_CURRENT << TERMINATOR;
owner()->write(buf2.str());
owner()->read(buf_in2, TERMINATOR);
owner()->writeFug(buf2.str());
owner()->readFug(buf_in2, TERMINATOR);
istringstream sbuf3(buf_in2.substr(3));
float64 outputCurrent;
......@@ -170,11 +170,11 @@ void RealFugHCPDriver::readInfos() {
string buf_in;
ostringstream buf_out;
buf_out << READ_VERSION << TERMINATOR;
owner()->write(buf_out.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf_out.str());
owner()->readFug(buf_in, TERMINATOR);
// remove \n
buf_in.resize(buf_in.size() - TERMINATOR_SIZE);
owner()->version = buf_in;
owner()->version.update(buf_in);
}
/*
......@@ -236,8 +236,8 @@ string RealFugHCPDriver::writeFugHCP(const std::string& aCommand) {
ostringstream buf_out;
string buf_in;
buf_out << aCommand << TERMINATOR;
owner()->write(buf_out.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf_out.str());
owner()->readFug(buf_in, TERMINATOR);
return buf_in;
}
......
GPIBFugHCP.microampere=~microA
GPIBFugHCP.volt=V
#Group Testing
GPIBFugHCP.actual_current=Actual Current
GPIBFugHCP.actual_volt=Actual Voltage
GPIBFugHCP.wanted_volt=Wanted Voltage
GPIBFugHCP.status=Status
GPIBFugHCP.outputOnValue=1
GPIBFugHCP.currentControlValue=2
GPIBFugHCP.voltageControlValue=4
GPIBFugHCP.positiveValue=8
GPIBFugHCP.changingValue=16
GPIBFugHCP.inToleranceValue=32
GPIBFugHCP.localValue=64
GPIBFugHCP.outputOnLabel=Output ON
GPIBFugHCP.currentControlLabel=Current Control
GPIBFugHCP.voltageControlLabel=Voltage Control
GPIBFugHCP.positiveLabel=Negative
GPIBFugHCP.changingLabel=Changing Current
GPIBFugHCP.inToleranceLabel=In Tolerance
GPIBFugHCP.localLabel=Local
GPIBFugHCP.outputOnImage=RUNNING_STATUS
GPIBFugHCP.currentControlImage=
GPIBFugHCP.voltageControlImage=
GPIBFugHCP.positiveImage=
GPIBFugHCP.changingImage=RUNNING_STATUS
GPIBFugHCP.inToleranceImage=FINISHED_STATUS
GPIBFugHCP.localImage=WARNING_STATUS
#Group parameters
GPIBFugHCP.version=Version
GPIBFugHCP.max=Maximum
GPIBFugHCP.min=Minimum
GPIBFugHCP.tolerance=Tolerance (+/-)
GPIBFugHCP.voltageTitle=Voltage
#Labels Commands
GPIBFugHCP.readInfos=Read Infos
GPIBFugHCP.on=ON
GPIBFugHCP.off=OFF
<controller_plugin_config type="GPIBFugHCP">
<image key="VOLTAGE"/>
<settings view="GPIBFugHCPView.xml"/>
</controller_plugin_config>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<controller type="GPIBFugHCP">
<property name="wanted_volt" type="float64" max_length="8">
<property_range min_property="min_volt" max_property="max_volt"/>
<decimal_format nb_decimal_places="1"/>
</property>
<property name="actual_volt" type="float64" max_length="8">
<decimal_format nb_decimal_places="1"/>
</property>
<property name="actual_current" type="float64" max_length="8">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="tolerance" type="float64" max_length="8">
<decimal_format nb_decimal_places="1"/>
</property>
<property name="max_volt" type="float64" max_length="8">
<decimal_format nb_decimal_places="1"/>
</property>
<property name="min_volt" type="float64" max_length="8">
<decimal_format nb_decimal_places="1"/>
</property>
<property name="status" type="int32">
</property>
<property name="version" type="String">
</property>
</controller>
<plugin>
<controller type="GPIBFugHCP" role="GPIBFugHCP1"/>
<label role="GPIBFugHCP1" property="version" prefix="GPIBFugHCP.version"/>
<newLine/>
<group title="GPIBFugHCP.voltageTitle">
<text role="GPIBFugHCP1" property="max_volt" prefix="GPIBFugHCP.max" suffix="GPIBFugHCP.volt" spaceBefore="false"/>
<newLine/>
<text role="GPIBFugHCP1" property="min_volt" prefix="GPIBFugHCP.min" suffix="GPIBFugHCP.volt"/>
<newLine/>
<text role="GPIBFugHCP1" property="tolerance" prefix="GPIBFugHCP.tolerance" suffix="GPIBFugHCP.volt"/>
</group>
<newLine/>
<button role="GPIBFugHCP1" command="readInfos" prefix="GPIBFugHCP.readInfos"/>
<button role="GPIBFugHCP1" command="on" prefix="GPIBFugHCP.on"/>
<button role="GPIBFugHCP1" command="off" prefix="GPIBFugHCP.off"/>
<summary>
<summary_content>
<simple_label prefix="GPIBFugHCP.actual_current" spaceBefore="false"/>
<label role="GPIBFugHCP1" property="actual_current" suffix="GPIBFugHCP.microampere" font_size="14" spaceBefore="false"/>
<newLine/>
<simple_label prefix="GPIBFugHCP.actual_volt"/>
<label role="GPIBFugHCP1" property="actual_volt" suffix="GPIBFugHCP.volt" font_size="14" spaceBefore="false"/>
<newLine/>
<text role="GPIBFugHCP1" property="wanted_volt" suffix="GPIBFugHCP.volt" prefix="GPIBFugHCP.wanted_volt"/>
<newLine/>
<simple_label prefix="GPIBFugHCP.status"/>
<status role="GPIBFugHCP1" property="status" valuesImagesAndLabels="GPIBFugHCP.outputOn,GPIBFugHCP.currentControl,GPIBFugHCP.voltageControl,GPIBFugHCP.positive,GPIBFugHCP.changing,GPIBFugHCP.inTolerance,GPIBFugHCP.local" font_size="14" spaceBefore="false"/>
</summary_content>
</summary>
</plugin>
......@@ -376,7 +376,7 @@ int32 RealD33AstriumChopperComputerDriver::decodeStatus(
if (loc6 != string::npos) {
istringstream sbuf(astring);
sbuf >> along;
// cout<<"actual MASTER " << along<<endl;
// cout<<"actual MASTER " << along<<endl;
m_IsMaster=along;
aDeviceDriver->updateValue(CHOPPER_ACTUAL_MASTER_DEVICE_CONTAINER,
along);
......
......@@ -75,12 +75,12 @@ void RealChopperFaulhaberDriver::readStatus() {
m_owner->write(buf1.str());
m_owner->read(buf_in, CHOPPERFAULHABER_ECHO_TERMINATOR);
cout << "READ_STATE---> " << buf_in << endl;
// cout << "READ_STATE---> " << buf_in << endl;
buf << CHOPPERFAULHABER_READ_SPEED_COMMAND << CHOPPERFAULHABER_TERMINATOR;
m_owner->write(buf.str());
m_owner->read(buf_in, CHOPPERFAULHABER_ECHO_TERMINATOR);
cout << "READ_SPEED---> " << buf_in << endl;
// cout << "READ_SPEED---> " << buf_in << endl;
istringstream sbuf(buf_in);
sbuf >> rspeed;
m_owner->updateValue(CHOPPER_ACTUAL_SPEED_DEVICE_CONTAINER,rspeed);
......