diff --git a/src/Vg.cpp b/src/Vg.cpp index a0dedf285ea6ad0ea18bb288d9abccbab3d38d92..2f90f654383431d0e0903e3503901b29aab4bfa9 100644 --- a/src/Vg.cpp +++ b/src/Vg.cpp @@ -193,6 +193,8 @@ void Vg::get_device_property() dev_prop.push_back(Tango::DbDatum("Channel")); dev_prop.push_back(Tango::DbDatum("Timeout")); dev_prop.push_back(Tango::DbDatum("MaxBackOff")); + dev_prop.push_back(Tango::DbDatum("CalibrationFactor")); + dev_prop.push_back(Tango::DbDatum("CalibrationOffset")); // is there at least one property to be read ? if (dev_prop.size()>0) @@ -251,6 +253,28 @@ void Vg::get_device_property() // And try to extract MaxBackOff value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> maxBackOff; + // Try to initialize CalibrationFactor from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> calibrationFactor; + else { + // Try to initialize CalibrationFactor from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> calibrationFactor; + } + // And try to extract CalibrationFactor value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> calibrationFactor; + + // Try to initialize CalibrationOffset from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> calibrationOffset; + else { + // Try to initialize CalibrationOffset from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> calibrationOffset; + } + // And try to extract CalibrationOffset value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> calibrationOffset; + } /*----- PROTECTED REGION ID(Vg::get_device_property_after) ENABLED START -----*/ @@ -365,7 +389,7 @@ void Vg::read_Pressure(Tango::Attribute &attr) attr_name << "Pressure_" << channel; tpg_proxy->read_attribute(attr_name.str().c_str()) >> *attr_Pressure_read; - + *attr_Pressure_read = calibrationFactor**attr_Pressure_read + calibrationOffset; attr.set_value(attr_Pressure_read); } catch (Tango::DevFailed &ex) diff --git a/src/Vg.h b/src/Vg.h index e1dd8c77d30b3a0d94a9eb446a26b65967956feb..004980aaba7abdeb94afcc4dda93b1b7417060ca 100644 --- a/src/Vg.h +++ b/src/Vg.h @@ -59,6 +59,10 @@ public: Tango::DevLong timeout; // MaxBackOff: Tango::DevLong maxBackOff; + // CalibrationFactor: Pressure Calibration Factor + Tango::DevDouble calibrationFactor; + // CalibrationOffset: Pressure Calibration Offset + Tango::DevDouble calibrationOffset; // Attribute data members public: diff --git a/src/Vg.xmi b/src/Vg.xmi index 372b2f524f9c2e95c6e36b0a2b792a54dd2ed9cb..cc78673b30fc11e247e1918fdfb8dbce8344cdd0 100644 --- a/src/Vg.xmi +++ b/src/Vg.xmi @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ASCII"?> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> <classes name="Vg" pogoRevision="9.6"> - <description description="" title="Vg" sourcePath="/home/lorenzo/src/gitlab/cs/ds/vg/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <description description="" title="Vg" sourcePath="/home/graziano/ws/ds/vg/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> <identification contact="at elettra.trieste.it - marco.demarco" author="marco.demarco" emailDomain="elettra.trieste.it" classFamily="Vacuum" siteSpecific="" platform="Unix Like" bus="TCP/UDP" manufacturer="none" reference=""/> </description> @@ -25,6 +25,16 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <DefaultPropValue>60</DefaultPropValue> </deviceProperties> + <deviceProperties name="CalibrationFactor" description="Pressure Calibration Factor"> + <type xsi:type="pogoDsl:DoubleType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <DefaultPropValue>1.0</DefaultPropValue> + </deviceProperties> + <deviceProperties name="CalibrationOffset" description="Pressure Calibration Offset"> + <type xsi:type="pogoDsl:DoubleType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <DefaultPropValue>0.0</DefaultPropValue> + </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="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> diff --git a/src/VgClass.cpp b/src/VgClass.cpp index 3126cb190a7e738ae4eccd4bddf33aad2270c5a0..d1b7b365d31a056e1938d55c2d59421db2bd8050 100644 --- a/src/VgClass.cpp +++ b/src/VgClass.cpp @@ -291,6 +291,34 @@ void VgClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); + prop_name = "CalibrationFactor"; + prop_desc = "Pressure Calibration Factor"; + prop_def = "1.0"; + vect_data.clear(); + vect_data.push_back("1.0"); + 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); + prop_name = "CalibrationOffset"; + prop_desc = "Pressure Calibration Offset"; + prop_def = "0.0"; + vect_data.clear(); + vect_data.push_back("0.0"); + 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); } //--------------------------------------------------------