Commit efc66d3f authored by Jean-Luc Pons's avatar Jean-Luc Pons

Added AGC filter length

parent 51c3a6c6
...@@ -131,6 +131,7 @@ if(thread==NULL) { \ ...@@ -131,6 +131,7 @@ if(thread==NULL) { \
// DataSource | Tango::DevEnum Scalar // DataSource | Tango::DevEnum Scalar
// Attenuation | Tango::DevULong Scalar // Attenuation | Tango::DevULong Scalar
// AGC_Enable | Tango::DevBoolean Scalar // AGC_Enable | Tango::DevBoolean Scalar
// AGC_FilterLength | Tango::DevLong Scalar
// OffsetTune | Tango::DevLong Scalar // OffsetTune | Tango::DevLong Scalar
// CompensateTune | Tango::DevBoolean Scalar // CompensateTune | Tango::DevBoolean Scalar
// Calib_Enable | Tango::DevBoolean Scalar // Calib_Enable | Tango::DevBoolean Scalar
...@@ -286,6 +287,7 @@ void LiberaSparkSRBPM::delete_device() ...@@ -286,6 +287,7 @@ void LiberaSparkSRBPM::delete_device()
delete[] attr_DataSource_read; delete[] attr_DataSource_read;
delete[] attr_Attenuation_read; delete[] attr_Attenuation_read;
delete[] attr_AGC_Enable_read; delete[] attr_AGC_Enable_read;
delete[] attr_AGC_FilterLength_read;
delete[] attr_OffsetTune_read; delete[] attr_OffsetTune_read;
delete[] attr_CompensateTune_read; delete[] attr_CompensateTune_read;
delete[] attr_Calib_Enable_read; delete[] attr_Calib_Enable_read;
...@@ -382,6 +384,7 @@ void LiberaSparkSRBPM::init_device() ...@@ -382,6 +384,7 @@ void LiberaSparkSRBPM::init_device()
attr_DataSource_read = new DataSourceEnum[1]; attr_DataSource_read = new DataSourceEnum[1];
attr_Attenuation_read = new Tango::DevULong[1]; attr_Attenuation_read = new Tango::DevULong[1];
attr_AGC_Enable_read = new Tango::DevBoolean[1]; attr_AGC_Enable_read = new Tango::DevBoolean[1];
attr_AGC_FilterLength_read = new Tango::DevLong[1];
attr_OffsetTune_read = new Tango::DevLong[1]; attr_OffsetTune_read = new Tango::DevLong[1];
attr_CompensateTune_read = new Tango::DevBoolean[1]; attr_CompensateTune_read = new Tango::DevBoolean[1];
attr_Calib_Enable_read = new Tango::DevBoolean[1]; attr_Calib_Enable_read = new Tango::DevBoolean[1];
...@@ -552,6 +555,7 @@ void LiberaSparkSRBPM::init_device() ...@@ -552,6 +555,7 @@ void LiberaSparkSRBPM::init_device()
lastAGCtime = 0; lastAGCtime = 0;
maxAdcBuff.clear(); maxAdcBuff.clear();
attr_BPIStation_read[0] = false; attr_BPIStation_read[0] = false;
attr_AGC_FilterLength_read[0] = 1;
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::init_device /*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::init_device
} }
...@@ -571,7 +575,6 @@ void LiberaSparkSRBPM::get_device_property() ...@@ -571,7 +575,6 @@ void LiberaSparkSRBPM::get_device_property()
aGCMaxADC = 5000; aGCMaxADC = 5000;
kH = 0; kH = 0;
kV = 0; kV = 0;
maxADCAvgLength = 1;
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::get_device_property_before /*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::get_device_property_before
...@@ -584,7 +587,6 @@ void LiberaSparkSRBPM::get_device_property() ...@@ -584,7 +587,6 @@ void LiberaSparkSRBPM::get_device_property()
dev_prop.push_back(Tango::DbDatum("KV")); dev_prop.push_back(Tango::DbDatum("KV"));
dev_prop.push_back(Tango::DbDatum("BPM_Set_List")); dev_prop.push_back(Tango::DbDatum("BPM_Set_List"));
dev_prop.push_back(Tango::DbDatum("BPM_Geometry")); dev_prop.push_back(Tango::DbDatum("BPM_Geometry"));
dev_prop.push_back(Tango::DbDatum("MaxADCAvgLength"));
// is there at least one property to be read ? // is there at least one property to be read ?
if (dev_prop.size()>0) if (dev_prop.size()>0)
...@@ -665,17 +667,6 @@ void LiberaSparkSRBPM::get_device_property() ...@@ -665,17 +667,6 @@ void LiberaSparkSRBPM::get_device_property()
// And try to extract BPM_Geometry value from database // And try to extract BPM_Geometry value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> bPM_Geometry; if (dev_prop[i].is_empty()==false) dev_prop[i] >> bPM_Geometry;
// Try to initialize MaxADCAvgLength from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> maxADCAvgLength;
else {
// Try to initialize MaxADCAvgLength from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> maxADCAvgLength;
}
// And try to extract MaxADCAvgLength value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> maxADCAvgLength;
} }
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::get_device_property_after) ENABLED START -----*/ /*----- PROTECTED REGION ID(LiberaSparkSRBPM::get_device_property_after) ENABLED START -----*/
...@@ -1631,6 +1622,41 @@ void LiberaSparkSRBPM::write_AGC_Enable(Tango::WAttribute &attr) ...@@ -1631,6 +1622,41 @@ void LiberaSparkSRBPM::write_AGC_Enable(Tango::WAttribute &attr)
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_AGC_Enable /*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_AGC_Enable
} }
//-------------------------------------------------------- //--------------------------------------------------------
/**
* Read attribute AGC_FilterLength related method
* Description:
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::read_AGC_FilterLength(Tango::Attribute &attr)
{
DEBUG_STREAM << "LiberaSparkSRBPM::read_AGC_FilterLength(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::read_AGC_FilterLength) ENABLED START -----*/
attr.set_value(attr_AGC_FilterLength_read);
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::read_AGC_FilterLength
}
//--------------------------------------------------------
/**
* Write attribute AGC_FilterLength related method
* Description:
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::write_AGC_FilterLength(Tango::WAttribute &attr)
{
DEBUG_STREAM << "LiberaSparkSRBPM::write_AGC_FilterLength(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevLong w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::write_AGC_FilterLength) ENABLED START -----*/
attr_AGC_FilterLength_read[0] = w_val;
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_AGC_FilterLength
}
//--------------------------------------------------------
/** /**
* Read attribute OffsetTune related method * Read attribute OffsetTune related method
* Description: * Description:
...@@ -3494,7 +3520,7 @@ Tango::DevState LiberaSparkSRBPM::dev_state() ...@@ -3494,7 +3520,7 @@ Tango::DevState LiberaSparkSRBPM::dev_state()
Tango::DevULong umaxADC; Tango::DevULong umaxADC;
self->read_attribute("MaxADC") >> umaxADC; self->read_attribute("MaxADC") >> umaxADC;
maxAdcBuff.push_back((double)umaxADC); maxAdcBuff.push_back((double)umaxADC);
if( (int)maxAdcBuff.size()>maxADCAvgLength ) if( (int)maxAdcBuff.size() > attr_AGC_FilterLength_read[0] )
maxAdcBuff.erase(maxAdcBuff.begin()); maxAdcBuff.erase(maxAdcBuff.begin());
......
...@@ -275,8 +275,6 @@ public: ...@@ -275,8 +275,6 @@ public:
vector<string> bPM_Set_List; vector<string> bPM_Set_List;
// BPM_Geometry: BPM geometry (Large or Small) // BPM_Geometry: BPM geometry (Large or Small)
string bPM_Geometry; string bPM_Geometry;
// MaxADCAvgLength: Averaginf of MaxADC for AGC control
Tango::DevLong maxADCAvgLength;
// Attribute data members // Attribute data members
public: public:
...@@ -309,6 +307,7 @@ public: ...@@ -309,6 +307,7 @@ public:
DataSourceEnum *attr_DataSource_read; DataSourceEnum *attr_DataSource_read;
Tango::DevULong *attr_Attenuation_read; Tango::DevULong *attr_Attenuation_read;
Tango::DevBoolean *attr_AGC_Enable_read; Tango::DevBoolean *attr_AGC_Enable_read;
Tango::DevLong *attr_AGC_FilterLength_read;
Tango::DevLong *attr_OffsetTune_read; Tango::DevLong *attr_OffsetTune_read;
Tango::DevBoolean *attr_CompensateTune_read; Tango::DevBoolean *attr_CompensateTune_read;
Tango::DevBoolean *attr_Calib_Enable_read; Tango::DevBoolean *attr_Calib_Enable_read;
...@@ -720,6 +719,16 @@ public: ...@@ -720,6 +719,16 @@ public:
virtual void read_AGC_Enable(Tango::Attribute &attr); virtual void read_AGC_Enable(Tango::Attribute &attr);
virtual void write_AGC_Enable(Tango::WAttribute &attr); virtual void write_AGC_Enable(Tango::WAttribute &attr);
virtual bool is_AGC_Enable_allowed(Tango::AttReqType type); virtual bool is_AGC_Enable_allowed(Tango::AttReqType type);
/**
* Attribute AGC_FilterLength related methods
* Description:
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_AGC_FilterLength(Tango::Attribute &attr);
virtual void write_AGC_FilterLength(Tango::WAttribute &attr);
virtual bool is_AGC_FilterLength_allowed(Tango::AttReqType type);
/** /**
* Attribute OffsetTune related methods * Attribute OffsetTune related methods
* Description: * Description:
......
...@@ -29,10 +29,6 @@ ...@@ -29,10 +29,6 @@
<type xsi:type="pogoDsl:StringType"/> <type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties> </deviceProperties>
<deviceProperties name="MaxADCAvgLength" description="Averaginf of MaxADC for AGC control">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="1000" isDynamic="false"> <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="1000" isDynamic="false">
<argin description="none"> <argin description="none">
<type xsi:type="pogoDsl:VoidType"/> <type xsi:type="pogoDsl:VoidType"/>
...@@ -316,6 +312,14 @@ ...@@ -316,6 +312,14 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes> </attributes>
<attributes name="AGC_FilterLength" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="sample" standardUnit="" displayUnit="" format="%3d" maxValue="" minValue="1" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="OffsetTune" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> <attributes name="OffsetTune" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/> <dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/> <changeEvent fire="false" libCheckCriteria="false"/>
......
...@@ -353,19 +353,6 @@ void LiberaSparkSRBPMClass::set_default_property() ...@@ -353,19 +353,6 @@ void LiberaSparkSRBPMClass::set_default_property()
} }
else else
add_wiz_dev_prop(prop_name, prop_desc); add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "MaxADCAvgLength";
prop_desc = "Averaginf of MaxADC for AGC control";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
} }
//-------------------------------------------------------- //--------------------------------------------------------
...@@ -1198,6 +1185,31 @@ void LiberaSparkSRBPMClass::attribute_factory(vector<Tango::Attr *> &att_list) ...@@ -1198,6 +1185,31 @@ void LiberaSparkSRBPMClass::attribute_factory(vector<Tango::Attr *> &att_list)
agc_enable->set_memorized_init(true); agc_enable->set_memorized_init(true);
att_list.push_back(agc_enable); att_list.push_back(agc_enable);
// Attribute : AGC_FilterLength
AGC_FilterLengthAttrib *agc_filterlength = new AGC_FilterLengthAttrib();
Tango::UserDefaultAttrProp agc_filterlength_prop;
// description not set for AGC_FilterLength
// label not set for AGC_FilterLength
agc_filterlength_prop.set_unit("sample");
// standard_unit not set for AGC_FilterLength
// display_unit not set for AGC_FilterLength
agc_filterlength_prop.set_format("%3d");
// max_value not set for AGC_FilterLength
agc_filterlength_prop.set_min_value("1");
// max_alarm not set for AGC_FilterLength
// min_alarm not set for AGC_FilterLength
// max_warning not set for AGC_FilterLength
// min_warning not set for AGC_FilterLength
// delta_t not set for AGC_FilterLength
// delta_val not set for AGC_FilterLength
agc_filterlength->set_default_properties(agc_filterlength_prop);
// Not Polled
agc_filterlength->set_disp_level(Tango::OPERATOR);
agc_filterlength->set_memorized();
agc_filterlength->set_memorized_init(true);
att_list.push_back(agc_filterlength);
// Attribute : OffsetTune // Attribute : OffsetTune
OffsetTuneAttrib *offsettune = new OffsetTuneAttrib(); OffsetTuneAttrib *offsettune = new OffsetTuneAttrib();
Tango::UserDefaultAttrProp offsettune_prop; Tango::UserDefaultAttrProp offsettune_prop;
......
...@@ -471,6 +471,21 @@ public: ...@@ -471,6 +471,21 @@ public:
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_AGC_Enable_allowed(ty);} {return (static_cast<LiberaSparkSRBPM *>(dev))->is_AGC_Enable_allowed(ty);}
}; };
// Attribute AGC_FilterLength class definition
class AGC_FilterLengthAttrib: public Tango::Attr
{
public:
AGC_FilterLengthAttrib():Attr("AGC_FilterLength",
Tango::DEV_LONG, Tango::READ_WRITE) {};
~AGC_FilterLengthAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<LiberaSparkSRBPM *>(dev))->read_AGC_FilterLength(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<LiberaSparkSRBPM *>(dev))->write_AGC_FilterLength(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_AGC_FilterLength_allowed(ty);}
};
// Attribute OffsetTune class definition // Attribute OffsetTune class definition
class OffsetTuneAttrib: public Tango::Attr class OffsetTuneAttrib: public Tango::Attr
{ {
......
...@@ -576,6 +576,26 @@ bool LiberaSparkSRBPM::is_AGC_Enable_allowed(TANGO_UNUSED(Tango::AttReqType type ...@@ -576,6 +576,26 @@ bool LiberaSparkSRBPM::is_AGC_Enable_allowed(TANGO_UNUSED(Tango::AttReqType type
return true; return true;
} }
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_AGC_FilterLength_allowed()
* Description : Execution allowed for AGC_FilterLength attribute
*/
//--------------------------------------------------------
bool LiberaSparkSRBPM::is_AGC_FilterLength_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for AGC_FilterLength attribute in Write access.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::AGC_FilterLengthStateAllowed_WRITE) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::AGC_FilterLengthStateAllowed_WRITE
// Not any excluded states for AGC_FilterLength attribute in read access.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::AGC_FilterLengthStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::AGC_FilterLengthStateAllowed_READ
return true;
}
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
* Method : LiberaSparkSRBPM::is_OffsetTune_allowed() * Method : LiberaSparkSRBPM::is_OffsetTune_allowed()
......
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