Skip to content
Snippets Groups Projects
Commit ff28a1e0 authored by Alain BUTEAU's avatar Alain BUTEAU
Browse files

Pb MANTIS 9936

parent 565bdf7e
Branches
Tags
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.21 2008-03-03 16:50:37 sebleport Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.22 2008-07-29 17:13:39 buteau Exp $";
//+=============================================================================
//
// file : CYBERSTARx1000.cpp
......@@ -11,11 +11,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
//
// project : TANGO Device Server
//
// $Author: sebleport $
// $Author: buteau $
//
// $Revision: 1.21 $
// $Revision: 1.22 $
//
// $Log: not supported by cvs2svn $
// Revision 1.21 2008/03/03 16:50:37 sebleport
// - read part of windowWidth and windowCenterPosition attributes added
//
// Revision 1.20 2008/02/28 11:35:00 buteau
// - tests DIFFABS du 28/08
//
......@@ -109,7 +112,7 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
#include <CYBERSTARx1000.h>
#include <CYBERSTARx1000Class.h>
const double SCA_UPPER_THRESHOLD_MAX=10.0; // in volts
const double SCA_LOWER_THRESHOLD_MIN=0.0; // in volts
const double PEAKING_TIME_VALUE1= 300.0; //possible values for peaking time are 300, 500, 1000 and 3000 ns
const double PEAKING_TIME_VALUE2= 500.0;
......@@ -118,7 +121,7 @@ const double PEAKING_TIME_VALUE4= 3000.0;
const double MAX_THRESHOLD_SIZE=10.0 ; //dont move threshold by more than x Volts otherwise instrument doesnt apply voltages
const double SLEEPING_TIME_BETWEEN_THRESHOLD_INCREMENTS=00000000; // After last tests it seems that it is useless to wait
const double ERROR_MARGIN_In_VOLTS =0.01 ; // rounded errors between set and read points due to electronic rounding value to 3.1%f format
const double ERROR_MARGIN_In_VOLTS =0.021 ; // rounded errors between set and read points due to electronic rounding value to 3.1%f format
namespace CYBERSTARx1000_ns
{
......@@ -234,13 +237,13 @@ namespace CYBERSTARx1000_ns
//------------------------------------------------------------------
serialProxyName="";
tolerance = -1;
maxThreshold = -1;
// Read device properties from database.(Automatic code generation)
//------------------------------------------------------------------
Tango::DbData dev_prop;
dev_prop.push_back(Tango::DbDatum("SerialProxyName"));
dev_prop.push_back(Tango::DbDatum("Tolerance"));
dev_prop.push_back(Tango::DbDatum("MaxThreshold"));
// Call database and extract values
//--------------------------------------------
......@@ -260,14 +263,14 @@ namespace CYBERSTARx1000_ns
// And try to extract SerialProxyName value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> serialProxyName;
// Try to initialize Tolerance from class property
// Try to initialize MaxThreshold from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> tolerance;
// Try to initialize Tolerance from default device value
if (cl_prop.is_empty()==false) cl_prop >> maxThreshold;
// Try to initialize MaxThreshold from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> tolerance;
// And try to extract Tolerance value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> tolerance;
if (def_prop.is_empty()==false) def_prop >> maxThreshold;
// And try to extract MaxThreshold value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> maxThreshold;
......@@ -282,11 +285,11 @@ namespace CYBERSTARx1000_ns
(const char*) "CYBERSTARx1000::get_device_property()");
}
if(tolerance == -1)
if(maxThreshold == -1)
{
Tango::Except::throw_exception(
(const char*) "TANGO_CONFIGURATION_ERROR",
(const char*) "tolerance property = -1 (default value)",
(const char*) "MaxThreshold property = -1 (default value)",
(const char*) "CYBERSTARx1000::get_device_property()");
}
}
......@@ -981,12 +984,12 @@ namespace CYBERSTARx1000_ns
attr_scaLowerThreshold_write = attr_windowCenterPosition_write - attr_windowWidth_write/2;
// check upper and lower values before writing on hardware
if(attr_scaUpperThreshold_write<=SCA_UPPER_THRESHOLD_MAX && attr_scaLowerThreshold_write>=SCA_LOWER_THRESHOLD_MIN )
if(attr_scaUpperThreshold_write<=maxThreshold && attr_scaLowerThreshold_write>=SCA_LOWER_THRESHOLD_MIN )
{
update_lower(attr_scaLowerThreshold_write);
update_upper(attr_scaUpperThreshold_write);
//ATTENTION : Absurd behaviour of the Cyberstar . We must reapply volatges on lower threshold again !!
//ATTENTION : Absurd behaviour of the Cyberstar . We must reapply voltages on lower threshold again !!
// DONT suppress following line event if it seems stupid
update_lower(attr_scaLowerThreshold_write);
......@@ -1030,6 +1033,13 @@ namespace CYBERSTARx1000_ns
read_upper();
read_lower();
/*
cout << "****" << endl;
cout << "attr_scaUpperThreshold_write=" << attr_scaUpperThreshold_write << endl;
cout << "attr_scaUpperThreshold_read=" << (*attr_scaUpperThreshold_read) <<endl;
cout << "attr_scaLowerThreshold_write=" << attr_scaLowerThreshold_write << endl;
cout << "attr_scaLowerThreshold_read=" << (*attr_scaLowerThreshold_read) << endl;
*/
// value read on the hardware is troncated so test must take into account small difference between read and setpoint
if ( (fabs(attr_scaUpperThreshold_write -(*attr_scaUpperThreshold_read)) > ERROR_MARGIN_In_VOLTS) ||
(fabs(attr_scaLowerThreshold_write -(*attr_scaLowerThreshold_read))> ERROR_MARGIN_In_VOLTS) )
......
......@@ -6,11 +6,14 @@
//
// project : CYBERSTARx1000
//
// $Author: sebleport $
// $Author: buteau $
//
// $Revision: 1.15 $
// $Revision: 1.16 $
//
// $Log: not supported by cvs2svn $
// Revision 1.15 2008/03/03 16:50:37 sebleport
// - read part of windowWidth and windowCenterPosition attributes added
//
// Revision 1.14 2008/02/27 17:35:31 buteau
// - tests DIFFABS du 27/08
//
......@@ -81,8 +84,8 @@
//using namespace Tango;
/**
* @author $Author: sebleport $
* @version $Revision: 1.15 $
* @author $Author: buteau $
* @version $Revision: 1.16 $
*/
// Add your own constants definitions here.
......@@ -163,9 +166,9 @@ namespace CYBERSTARx1000_ns
*/
string serialProxyName;
/**
* tolerance percentage of Lower and Upper threshold attribute values
* Maximum voltage for upper threshold attribute
*/
Tango::DevFloat tolerance;
Tango::DevFloat maxThreshold;
//@}
/**@name Constructors
......
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000Class.cpp,v 1.10 2008-02-27 11:32:25 buteau Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000Class.cpp,v 1.11 2008-07-29 17:13:39 buteau Exp $";
static const char *TagName = "$Name: not supported by cvs2svn $";
static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
//+=============================================================================
......@@ -14,9 +14,12 @@ static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/
//
// $Author: buteau $
//
// $Revision: 1.10 $
// $Revision: 1.11 $
//
// $Log: not supported by cvs2svn $
// Revision 1.10 2008/02/27 11:32:25 buteau
// - tests DIFFABS du 27/08
//
// Revision 1.9 2008/02/26 17:56:58 buteau
// - code a relire
//
......@@ -420,11 +423,11 @@ void CYBERSTARx1000Class::set_default_property()
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "Tolerance";
prop_desc = "tolerance percentage of Lower and Upper threshold attribute values";
prop_def = "95";
prop_name = "MaxThreshold";
prop_desc = "Maximum voltage for Upper threshold ";
prop_def = "";
vect_data.clear();
vect_data.push_back("95");
vect_data.push_back("");
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment