Commit f93ba00e authored by Locatelli's avatar Locatelli

Integrate stuff for simulation (Charles Dewhurst) D11, D22 and D33

parent 6d783595
......@@ -53,6 +53,9 @@ public:
virtual bool isCounting() const = 0;
virtual bool isPausing() const = 0;
virtual void setNoDataRead() = 0;
virtual void clearNoDataRead() = 0;
void init(const std::string& name);
};
......
......@@ -82,6 +82,7 @@ Count::Count(const string& name) {
totalReps.update(1);
localReps.update(1);
m_ListModeBlock = nullptr;
m_NoDataRead = false;
// Disable histogramming
setHistogramming(false);
......@@ -145,10 +146,10 @@ void Count::postConfiguration() {
// TODO gate registerUpdater(axisDriver->axisStatus, &Count::updateActualCycle, this);
registerUpdater(masterDetector->detSum, &Count::updateMasterDetectorDetSum, this);
if (nMonitors() >= 1) {
registerUpdater(m_Monitors[0]->detSum, &Count::updateMonitor1DetSum, this);
registerUpdater(monitors[0]->detSum, &Count::updateMonitor1DetSum, this);
}
if (nMonitors() >= 2) {
registerUpdater(m_Monitors[1]->detSum, &Count::updateMonitor2DetSum, this);
registerUpdater(monitors[1]->detSum, &Count::updateMonitor2DetSum, this);
}
registerUpdater(experimentData->numor, &Count::updateNumor, this);
registerUpdater(gate->gateStatus, &Count::updateStatus, this);
......@@ -244,7 +245,7 @@ void Count::refreshNMonitorsProperty(int32 value) throw (CannotSetValue) {
for (int32 i = 0; i < value; ++i) {
string os = "monitor" + lexical_cast<string>(i + 1);
m_Monitors[i].init(this, os);
monitors[i].init(this, os);
}
}
......@@ -353,7 +354,7 @@ void Count::updateActualTime(float64 value, bool readdata) {
if (((m_OldActualTimeForUpdate + m_ReadUpdateTimeSec) <= time())
|| ((m_OldActualTimeForUpdate < 1.) && (time() > 1.))) {
// Wait finishing writing data before re-reading avoid to mixed n and n-1 data values
if (experimentData->isDataSaved() == true) {
if ((experimentData->isDataSaved() == true) && (m_NoDataRead == false)) {
for (int32 ki = 0; ki < nDetectors(); ++ki) {
detectorControllers[ki]->readParallel(false);
}
......@@ -428,7 +429,7 @@ void Count::updateMasterDetectorDetSum() {
void Count::updateMonitor1DetSum() {
if (m_Counting) {
// mon1Sum.update(m_Monitors[0]->detSum());
mon1Sum = m_Monitors[0]->detSum();
mon1Sum = monitors[0]->detSum();
float64 ltime = 0;
if (m_UseMasterAcq == false) {
ltime = time() + m_TimeSetPointSecond * (currentLocalReps() - 1);
......@@ -438,9 +439,9 @@ void Count::updateMonitor1DetSum() {
// Calculate rate
if (ltime > 0.001) {
//float64 rate = sum / time;
m_Monitors[0]->setDetectorRate(ltime);
monitors[0]->setDetectorRate(ltime);
// mon1Rate.update(m_Monitors[0]->detRate());
mon1Rate = m_Monitors[0]->detRate();
mon1Rate = monitors[0]->detRate();
}
}
}
......@@ -451,7 +452,7 @@ void Count::updateMonitor1DetSum() {
void Count::updateMonitor2DetSum() {
if (m_Counting) {
// mon2Sum.update(m_Monitors[1]->detSum());
mon2Sum = m_Monitors[1]->detSum();
mon2Sum = monitors[1]->detSum();
float64 ltime = 0;
if (m_UseMasterAcq == false) {
ltime = time() + m_TimeSetPointSecond * (currentLocalReps() - 1);
......@@ -461,9 +462,9 @@ void Count::updateMonitor2DetSum() {
// Calculate rate
if (ltime > 0.001) {
//float64 rate = sum / time;
m_Monitors[1]->setDetectorRate(ltime);
monitors[1]->setDetectorRate(ltime);
// mon2Rate.update(m_Monitors[1]->detRate());
mon2Rate = m_Monitors[1]->detRate();
mon2Rate = monitors[1]->detRate();
}
}
}
......@@ -734,7 +735,7 @@ void Count::start() {
break;
}
if ((localReps() > 1) && (iLocalRep < (localReps() - 1)) && (isStopped() == false)) {
if ((localReps() > 1) && (iLocalRep < (localReps() - 1)) && (isStopped() == false) && (m_NoDataRead == false)) {
for (int32 ki = 0; ki < nDetectors(); ++ki) {
detectorControllers[ki]->readParallel(false);
}
......@@ -759,7 +760,7 @@ void Count::start() {
* Write the final data at the end
* Use synchronize read, be sure data was read for saving on file
*/
if (Simulated::activated == false) {
if ((Simulated::activated == false) && (m_NoDataRead == false)) {
statusMessage.update(READING_DATA_MESSAGE);
Parallel::begin();
for (int32 ki = 0; ki < nDetectors(); ++ki) {
......@@ -1242,4 +1243,5 @@ void Count::setListModeContext() {
}
}
}
......@@ -91,6 +91,7 @@ public:
virtual void start();
ControllerPtr<DetectorElement> masterDetector;
ControllerPtr<DetectorElement> monitors[2];
/**
* Multiple count type we need array
......@@ -114,6 +115,9 @@ public:
static const std::string CLOSE_DATA_MESSAGE;
static const std::string IDLE_MESSAGE;
virtual void setNoDataRead();
virtual void clearNoDataRead();
protected:
virtual void postConfiguration();
......@@ -157,7 +161,6 @@ protected:
/**
* MasterDetector is used to give the sum to UI
*/
ControllerPtr<DetectorElement> m_Monitors[2];
int32 m_nRegisteredConfigurationDetectors;
......@@ -184,8 +187,23 @@ protected:
ListModeBlock* m_ListModeBlock;
void setListModeContext();
bool m_NoDataRead;
};
/*
* setNoDataRead
*/
inline void Count::setNoDataRead() {
m_NoDataRead = true;
}
/*
* clearNoDataRead
*/
inline void Count::clearNoDataRead() {
m_NoDataRead = false;
}
}
#endif // COUNT_H
......@@ -47,10 +47,10 @@ void FcuCount::postConfiguration() {
m_FcuMasterDetector.copy(masterDetector);
if (nMonitors() > 0) {
m_FcuMonitors[0].copy(m_Monitors[0]);
m_FcuMonitors[0].copy(monitors[0]);
}
if (nMonitors() > 1) {
m_FcuMonitors[1].copy(m_Monitors[1]);
m_FcuMonitors[1].copy(monitors[1]);
}
m_FcuAcquisitionControllers.resize(nDetectors());
for (int32 i = 0; i < nDetectors(); ++i) {
......
......@@ -511,4 +511,18 @@ bool CountController::isPausing() const {
return count->isPausing();
}
/*
* setNoDataRead
*/
void CountController::setNoDataRead() {
count->setNoDataRead();
}
/*
* clearNoDataRead
*/
void CountController::clearNoDataRead() {
count->clearNoDataRead();
}
}
......@@ -70,6 +70,9 @@ public:
void logRepeaterCount();
virtual void setNoDataRead();
virtual void clearNoDataRead();
/**
* Properties
*/
......
......@@ -155,7 +155,7 @@ void CountSpy::updateProperty(ChangeAspect* aChangeAspect) {
refreshCountController(m_CountControllers[i]);
m_LastCounting = true;
counting = true;
time.update(0);
// time.update(0);
}
if (m_CountControllers[i]->isCounting()) {
try {
......@@ -253,6 +253,9 @@ void CountSpy::updateProperty(ChangeAspect* aChangeAspect) {
else if (propertyName == timeType.getName()) {
timeType.update(any_cast<string>(propvalue));
}
else if (propertyName == statusMessage.getName()) {
statusMessage.update(any_cast<string>(propvalue));
}
else if (propertyName == commandProgression.getName()) {
if (any_cast<int32>(propvalue) >= 100L){
m_LastCounting = false;
......@@ -417,6 +420,9 @@ void CountSpy::refreshCountController(acquisition::AbstractCount* aController) {
else if (propertyName == timeType.getName()) {
timeType.update(any_cast<string>(propvalue));
}
else if (propertyName == statusMessage.getName()) {
statusMessage.update(any_cast<string>(propvalue));
}
else if (propertyName == commandProgression.getName()) {
countProgression.update(any_cast<int32>(propvalue));
}
......@@ -505,4 +511,17 @@ string CountSpy::getImageName() {
}
return "";
}
void CountSpy::setNoDataRead() {
for (vector<acquisition::AbstractCount*>::iterator iter = m_CountControllers.begin(); iter != m_CountControllers.end(); ++iter) {
(*iter)->setNoDataRead();
}
}
void CountSpy::clearNoDataRead() {
for (vector<acquisition::AbstractCount*>::iterator iter = m_CountControllers.begin(); iter != m_CountControllers.end(); ++iter) {
(*iter)->clearNoDataRead();
}
}
}
......@@ -73,6 +73,9 @@ public:
void doPause();
void doResume();
void setNoDataRead();
void clearNoDataRead();
std::string getImageName();
protected:
......
......@@ -58,10 +58,10 @@ void FcuCount::postConfiguration() {
m_FcuMasterDetector.copy(masterDetector);
if (nMonitors() > 0) {
m_FcuMonitors[0].copy(m_Monitors[0]);
m_FcuMonitors[0].copy(monitors[0]);
}
if (nMonitors() > 1) {
m_FcuMonitors[1].copy(m_Monitors[1]);
m_FcuMonitors[1].copy(monitors[1]);
}
m_FcuAcquisitionControllers.resize(nDetectors());
for (int32 i = 0; i < nDetectors(); ++i) {
......@@ -142,10 +142,10 @@ void FcuCount::updateMonitor1DetSum() {
if (m_Counting) {
Count::updateMonitor1DetSum();
if (m_FcuGate->actualSlice() == 1) {
moniP = m_Monitors[0]->data()[0];
moniP = monitors[0]->data()[0];
}
else if (m_FcuGate->actualSlice() == 2) {
moniM = m_Monitors[0]->data()[1];
moniM = monitors[0]->data()[1];
}
}
}
......
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use ac 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 "CollimationProperties.h"
namespace lss {
const std::string CollimationProperties::TYPE = "collimation_properties";
/*
* Contructor
*/
CollimationProperties::CollimationProperties(const std::string& name) : ExperimentController(name) {
sourceAperture.init(this, NOSAVE, "sourceAperture");
selectedApertInfo.init(this, NOSAVE, "selected_ApertInfo");
collimation.init(this, SAVE | SPY, "actual_collimation", "wanted_collimation", "Collimation");
selectedColSetup.init(this, SAVE | SPY, "selected_colSetup");
ap_size.init(this, SAVE, "ap_size");
}
}
/*
* 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 COLLIMATIONPROPERTIES_H
#define COLLIMATIONPROPERTIES_H
#include <Controller.h>
namespace lss {
class CollimationProperties : public ExperimentController {
public:
//! Type of controller
static const std::string TYPE;
/*!
* \brief Constructor
*/
CollimationProperties(const std::string& name);
/*!
* Properties
*/
Property<std::string> sourceAperture; // D11
ArrayProperty<float64> selectedApertInfo; // D22 //For nexus files -> keep track of the selected aperture (depends on colSetup value)
Property<float64, SETPOINT> collimation; // D11
Property<float64> selectedColSetup; // D22
ArrayProperty<int32> ap_size; // D33
};
}
#endif // COLLIMATIONPROPERTIES_H
......@@ -22,6 +22,7 @@
#include "D11Diaphragm.h"
#include "CollimationController.h"
#include "../common/CollimationProperties.h"
#include <controllers/common/state/stateio/AttenuatorController.h>
#include "controllers/common/axis/AxisController.h"
#include <drivers/legacy/alcyon/automated11/AutomateD11Driver.h>
......@@ -29,7 +30,7 @@
namespace d11 {
class D11CollimationSetting : public ExperimentController,
class D11CollimationSetting : public lss::CollimationProperties,
public controller::Stoppable {
public:
......@@ -45,28 +46,20 @@ public:
static const int32 NUMBER_OF_DIAPHRAGMS;
static const std::string ATTENUATOR_IN_VALUE;
Property<float64> wantedCollimation;
Property<float64> actualCollimation;
Property<float64> guideExitCrossSectionWidth;
Property<float64> guideExitCrossSectionHeight;
Property<std::string> unit;
Property<int32> diaphragmActualPosition2;
Property<int32> diaphragmActualPosition3;
Property<int32> diaphragmActualPosition4;
Property<int32> diaphragmActualPosition5;
Property<int32, SETPOINT> diaphragmPosition2;
Property<int32, SETPOINT> diaphragmPosition3;
Property<int32, SETPOINT> diaphragmPosition4;
Property<int32, SETPOINT> diaphragmPosition5;
Property<int32> diaphragm6ActualPosition; // read from automate (can not be changed by Nomad)
Property<int32> diaphragmWantedPosition2;
Property<int32> diaphragmWantedPosition3;
Property<int32> diaphragmWantedPosition4;
Property<int32> diaphragmWantedPosition5;
Property<int32> status;
DynamicProperty<float64> diaphragmsDistance;
Property<float64> sourceDistance;
Property<std::string> sourceAperture;
DynamicProperty<int32> diaphragm2AperturesValues;
DynamicProperty<int32> diaphragm3AperturesValues;
......
This diff is collapsed.
......@@ -19,19 +19,27 @@
#ifndef D11SETTINGCONTROLLER_H
#define D11SETTINGCONTROLLER_H
#include <string>
#include "D11Diaphragm.h"
#include "DetectorAxis.h"
#include "CollimationController.h"
#include "controllers/lss/common/LSSWavelength.h"
#include <drivers/legacy/alcyon/automated11/AutomateD11Driver.h>
#include <Controller.h>
namespace lss {
class LSSWavelength;
}
namespace axis {
class AxisController;
}
namespace stateio {
class AttenuatorController;
}
class AutomateD11Driver;
namespace d11 {
class D11Setting : public ExperimentController,
public controller::Stoppable {
class D11Diaphragm;
class DetectorAxis;
class D11CollimationSetting;
class D11Setting: public ExperimentController, public controller::Stoppable {
public:
static const std::string TYPE;
......@@ -40,33 +48,22 @@ public:
D11Setting(const std::string& name);
D11Setting(const D11Setting& controller);
virtual ~D11Setting();
virtual void postConfiguration();
Property<float64> wantedWavelength;
Property<float64> actualWavelength;
Property<float64> wantedDet;
Property<float64> actualDet;
Property<float64, SETPOINT> wavelength;
Property<float64, SETPOINT> det;
Property<float64> actualTry;
Property<float64> wantedCollimation;
Property<float64> actualCollimation;
Property<float64, SETPOINT> collimation;
Property<std::string> unit;
Property<float64> wantedBx;
Property<float64> actualBx;
Property<float64> wantedBy;
Property<float64> actualBy;
Property<int32> diaphragmActualPosition2;
Property<int32> diaphragmActualPosition3;
Property<int32> diaphragmActualPosition4;
Property<int32> diaphragmActualPosition5;
Property<float64, SETPOINT> bx;
Property<float64, SETPOINT> by;
Property<int32> diaphragmWantedPosition2;
Property<int32> diaphragmWantedPosition3;
Property<int32> diaphragmWantedPosition4;
Property<int32> diaphragmWantedPosition5;
Property<int32, SETPOINT> diaphragmPosition2;
Property<int32, SETPOINT> diaphragmPosition3;
Property<int32, SETPOINT> diaphragmPosition4;
Property<int32, SETPOINT> diaphragmPosition5;
Property<std::string> wantedAtt;
Property<std::string> d11SettingsStatus;
......@@ -99,7 +96,6 @@ public:
DynamicProperty<std::string> attenuationValues;
Property<int32> nbAttenuations;
protected:
virtual void start();
......@@ -124,19 +120,24 @@ private:
void onTryPositionChange();
void onWavelengthChange();
void updateCollimationSetpoint();
void updateDiaphragmPosition2Setpoint();
void updateDiaphragmPosition3Setpoint();
void updateDiaphragmPosition4Setpoint();
void updateDiaphragmPosition5Setpoint();
void updateDiaphragmPosition2();
void updateDiaphragmPosition3();
void updateDiaphragmPosition4();
void updateDiaphragmPosition5();
ControllerPtr<stateio::AttenuatorController> m_Attenuator;
ControllerPtr<axis::AxisController> m_Disk2;
ControllerPtr<axis::AxisController> m_Disk3;
ControllerPtr<axis::AxisController> m_Disk4;
ControllerPtr<axis::AxisController> m_Disk5;
ControllerPtr<d11::CollimationController> m_Collimation;
ControllerPtr<d11::D11Diaphragm> m_Diaphragm;
ControllerPtr<D11CollimationSetting> m_CollimationSetting;
ControllerPtr<D11Diaphragm> m_Diaphragm;
ControllerPtr<axis::AxisController> m_Bx;
ControllerPtr<axis::AxisController> m_By;
ControllerPtr<DetectorAxis> m_Det;
ControllerPtr<axis::AxisController> m_Try;
ControllerPtr<lss::LSSWavelength> m_Lambda;
DriverPtr<AutomateD11Driver> m_Automate;
virtual void updateStatus();
virtual void updateProgression();
......
......@@ -29,11 +29,10 @@ const int32 D22CollimationSetup::CIRCULAR_MODE = 1; //1 = All diaphragms to Rect
const int32 D22CollimationSetup::FREE_MODE = 2; //2 = Free choice, get values introduced in interface
D22CollimationSetup::D22CollimationSetup(const std::string & contName) :
ExperimentController(contName), controller::Stoppable(this), StartWithoutShutter(this) {
lss::CollimationProperties(contName), controller::Stoppable(this), StartWithoutShutter(this) {
setFamily(family::BEAM_PARAMETERS, family::COLLIMATION);
selectedColSetup.init(this, SAVE | SPY, "selected_colSetup");
directionColInfo.init(this, SAVE, "direction_colInfo");
numberOfDiaAxis.init(this, SAVE, "number_diaAxis");
......@@ -50,14 +49,14 @@ D22CollimationSetup::D22CollimationSetup(const std::string & contName) :
diaphragmMode.init(this, SAVE, "diaphragm_mode");
selectedApertInfo.init(this, NOSAVE, "selected_ApertInfo");
m_col.init(this, "D22Coll");
m_diaphragm.init(this, "D22Dia");
m_att.init(this, "D22Att");
m_fastShutter.init(this, "D22FastShutter");
m_stopActivated = false;
}
D22CollimationSetup::~D22CollimationSetup() {
......
......@@ -21,6 +21,7 @@
#include <Controller.h>
#include "D22Collimation.h"
#include "../../common/CollimationProperties.h"
#include "D22Diaphragm.h"
#include "controllers/common/state/stateio/ShutterController.h"
#include "controllers/common/state/stateaxis/StateAxisController.h"
......@@ -47,7 +48,7 @@ public:
class D22CollimationSetup: public ::ExperimentController, public controller::Stoppable, public StartWithoutShutter {
class D22CollimationSetup: public lss::CollimationProperties, public controller::Stoppable, public StartWithoutShutter {
public:
static const std::string TYPE;
......@@ -55,7 +56,6 @@ public:
static const int32 CIRCULAR_MODE;
static const int32 FREE_MODE;
Property<float64> selectedColSetup;
Property<std::string> directionColInfo;
//Properties related to diaphragm settings
......@@ -72,9 +72,6 @@ public:
Property<int32> diaphragmMode;
//For nexus files -> keep track of the selected aperture (depends on colSetup value)
ArrayProperty<float64> selectedApertInfo;
D22CollimationSetup(const std::string & contName);
virtual ~D22CollimationSetup();
virtual void postConfiguration();
......
......@@ -29,15 +29,13 @@ namespace d33 {
const string LSSCollimationSetting::TYPE = "lsscollimationsetting";
LSSCollimationSetting::LSSCollimationSetting(const std::string & contName) :
ExperimentController(contName), controller::Stoppable(this) {
lss::CollimationProperties(contName), controller::Stoppable(this) {
registerFunction(TYPE);
setFamily(family::SETTING);
collimation.init(this, SAVE| SPY, "actual_collimation","wanted_collimation","Collimation");
collimation.setFlags(SAVE | SPY);
dia1.init(this, SAVE,"diaphragm_actual_position_1", "diaphragm_wanted_position_1");
dia2.init(this, SAVE,"diaphragm_actual_position_2", "diaphragm_wanted_position_2");
dia3.init(this, SAVE,"diaphragm_actual_position_3", "diaphragm_wanted_position_3");
......@@ -46,7 +44,7 @@ LSSCollimationSetting::LSSCollimationSetting(const std::string & contName) :
unit.init(this, SAVE, "unit");
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");
......
......@@ -23,22 +23,21 @@
#include "D33Collimation.h"
#include "LSSDiaphragm.h"
#include "controllers/common/state/stateaxis/StateAxisController.h"
#include "../common/CollimationProperties.h"
namespace d33 {
class LSSCollimationSetting: public ::ExperimentController, public controller::Stoppable {
class LSSCollimationSetting: public lss::CollimationProperties, public controller::Stoppable {
public:
static const std::string TYPE;
Property<float64, SETPOINT> collimation; //! Actual and wanted position property
Property<int32, SETPOINT> dia1;
Property<int32, SETPOINT> dia2;
Property<int32, SETPOINT> dia3;
Property<int32, SETPOINT> dia4;
Property<int32, SETPOINT> dia5;
Property<std::string> unit;
ArrayProperty<int32> ap_size;
DynamicProperty<int32> diaphValues;
DynamicProperty<std::string> diaphLabels;
......
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