Commit 10bede9e authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Add Jungfrau dual UDP interface support

parent 9d5cb233
...@@ -61,6 +61,9 @@ class Model ...@@ -61,6 +61,9 @@ class Model
int getNbDetModules() int getNbDetModules()
{ return m_nb_det_modules; } { return m_nb_det_modules; }
virtual void setNbUDPInterfaces(int nb_udp_ifaces);
virtual void getNbUDPInterfaces(int& nb_udp_ifaces);
virtual std::string getName() = 0; virtual std::string getName() = 0;
virtual void getPixelSize(double& x_size, double& y_size) = 0; virtual void getPixelSize(double& x_size, double& y_size) = 0;
...@@ -107,6 +110,7 @@ class Model ...@@ -107,6 +110,7 @@ class Model
Camera *m_cam; Camera *m_cam;
Type m_type; Type m_type;
int m_nb_det_modules; int m_nb_det_modules;
int m_nb_udp_ifaces;
protected: protected:
AutoPtr<sls::Detector> m_det; AutoPtr<sls::Detector> m_det;
......
...@@ -44,6 +44,9 @@ public: ...@@ -44,6 +44,9 @@ public:
SlsDetector::Camera *getCamera(); SlsDetector::Camera *getCamera();
SlsDetector::Type getType(); SlsDetector::Type getType();
virtual void setNbUDPInterfaces(int nb_udp_ifaces);
virtual void getNbUDPInterfaces(int& nb_udp_ifaces /Out/);
virtual std::string getName() = 0; virtual std::string getName() = 0;
virtual void getPixelSize(double& x_size /Out/, virtual void getPixelSize(double& x_size /Out/,
double& y_size /Out/) = 0; double& y_size /Out/) = 0;
......
Subproject commit 53ef69b518173783db09a3fd48fbf23568503b91 Subproject commit 66605a5c056cc42494397f5947931b82e1aea3ef
...@@ -427,6 +427,12 @@ void Camera::setModel(Model *model) ...@@ -427,6 +427,12 @@ void Camera::setModel(Model *model)
if (!m_model) if (!m_model)
return; return;
int nb_udp_ifaces;
m_model->getNbUDPInterfaces(nb_udp_ifaces);
DEB_ALWAYS() << "Using " << m_model->getName()
<< " with " << getNbDetModules() << "x" << nb_udp_ifaces
<< " UDP interfaces";
int nb_items = m_model->getNbFrameMapItems(); int nb_items = m_model->getNbFrameMapItems();
m_frame_map.setNbItems(nb_items); m_frame_map.setNbItems(nb_items);
m_model->updateFrameMapItems(&m_frame_map); m_model->updateFrameMapItems(&m_frame_map);
......
...@@ -171,7 +171,7 @@ void Jungfrau::getDACInfo(NameList& name_list, IntList& idx_list, ...@@ -171,7 +171,7 @@ void Jungfrau::getDACInfo(NameList& name_list, IntList& idx_list,
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
#define JUNGFRAU_DAC(x) {x, 0} #define JUNGFRAU_DAC(x) {x, 0}
#define JUNGFRAU_DAC_MV(x) {x, 1} #define JUNGFRAU_DAC_MV(x) {x, 1}
static struct DACData { static struct DACData {
DACIndex idx; DACIndex idx;
...@@ -240,9 +240,12 @@ void Jungfrau::getTimeRanges(TimeRanges& time_ranges) ...@@ -240,9 +240,12 @@ void Jungfrau::getTimeRanges(TimeRanges& time_ranges)
{ {
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
double min_exp = 10; int nb_udp_ifaces;
double min_period = 1000; getNbUDPInterfaces(nb_udp_ifaces);
double min_lat = 500;
double min_exp = 0.1;
double min_period = 1000 / nb_udp_ifaces;
double min_lat = 0.1;
time_ranges.min_exp_time = min_exp * 1e-6; time_ranges.min_exp_time = min_exp * 1e-6;
time_ranges.max_exp_time = 1e3; time_ranges.max_exp_time = 1e3;
...@@ -374,12 +377,17 @@ void Jungfrau::prepareAcq() ...@@ -374,12 +377,17 @@ void Jungfrau::prepareAcq()
{ {
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
m_in_process.clear(); FrameType nb_frames;
Camera *cam = getCamera(); Camera *cam = getCamera();
cam->getNbFrames(m_nb_frames); cam->getNbFrames(nb_frames);
m_next_frame = 0;
m_last_frame = -1; {
AutoMutex l = lock();
m_in_process.clear();
m_nb_frames = nb_frames;
m_next_frame = 0;
m_last_frame = -1;
}
ThreadList::iterator tit, tend = m_thread_list.end(); ThreadList::iterator tit, tend = m_thread_list.end();
for (tit = m_thread_list.begin(); tit != tend; ++tit) for (tit = m_thread_list.begin(); tit != tend; ++tit)
......
...@@ -34,6 +34,10 @@ Model::Model(Camera *cam, Type type) ...@@ -34,6 +34,10 @@ Model::Model(Camera *cam, Type type)
DEB_PARAM() << DEB_VAR1(type); DEB_PARAM() << DEB_VAR1(type);
m_nb_det_modules = m_cam->getNbDetModules(); m_nb_det_modules = m_cam->getNbDetModules();
sls::Result<int> res;
EXC_CHECK(res = m_det->getNumberofUDPInterfaces());
const char *err_msg = "Numbers of UDP interfaces are different";
EXC_CHECK(m_nb_udp_ifaces = res.tsquash(err_msg));
} }
Model::~Model() Model::~Model()
...@@ -47,9 +51,27 @@ Model::~Model() ...@@ -47,9 +51,27 @@ Model::~Model()
void Model::updateCameraModel() void Model::updateCameraModel()
{ {
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
m_cam->setModel(this); m_cam->setModel(this);
} }
void Model::setNbUDPInterfaces(int nb_udp_ifaces)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(nb_udp_ifaces);
if (nb_udp_ifaces != m_nb_udp_ifaces)
THROW_HW_ERROR(NotSupported)
<< "Invalid number of UDP interfaces: " << nb_udp_ifaces
<< ", only " << m_nb_udp_ifaces << " supported";
}
void Model::getNbUDPInterfaces(int& nb_udp_ifaces)
{
DEB_MEMBER_FUNCT();
nb_udp_ifaces = m_nb_udp_ifaces;
DEB_RETURN() << DEB_VAR1(nb_udp_ifaces);
}
void Model::updateTimeRanges() void Model::updateTimeRanges()
{ {
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
......
Supports Markdown
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