Skip to content
Snippets Groups Projects
Commit e2844609 authored by Xavier ELATTAOUI's avatar Xavier ELATTAOUI
Browse files

- config checked at init :

-> range set to 1000. if not
-> if Bias is not Minus and/or HV is not ON => device state is ALARM.
parent 9fc26b29
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<groupId>fr.soleil.device</groupId> <groupId>fr.soleil.device</groupId>
<artifactId>LoCuM_4-${aol}-${mode}</artifactId> <artifactId>LoCuM_4-${aol}-${mode}</artifactId>
<version>2.1.6</version> <version>2.2.0</version>
<packaging>nar</packaging> <packaging>nar</packaging>
<name>LoCuM_4</name> <name>LoCuM_4</name>
<description>LoCuM_4 device</description> <description>LoCuM_4 device</description>
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<dependencies/>
<scm> <scm>
<connection>${scm.connection.cvs.tango-ds}:Instrumentation/LoCuM_4</connection> <connection>${scm.connection.cvs.tango-ds}:Instrumentation/LoCuM_4</connection>
<developerConnection>${scm.developerConnection.cvs.tango-ds}:Instrumentation/LoCuM_4</developerConnection> <developerConnection>${scm.developerConnection.cvs.tango-ds}:Instrumentation/LoCuM_4</developerConnection>
......
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/LoCuM_4/src/LoCuM_4.cpp,v 1.23 2010-04-30 10:33:22 nleclercq Exp $"; static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/LoCuM_4/src/LoCuM_4.cpp,v 1.24 2012-10-12 10:21:59 xavela Exp $";
//+============================================================================= //+=============================================================================
// //
// file : LoCuM_4.cpp // file : LoCuM_4.cpp
...@@ -11,11 +11,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio ...@@ -11,11 +11,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
// //
// project : TANGO Device Server // project : TANGO Device Server
// //
// $Author: nleclercq $ // $Author: xavela $
// //
// $Revision: 1.23 $ // $Revision: 1.24 $
// //
// $Log: not supported by cvs2svn $ // $Log: not supported by cvs2svn $
// Revision 1.23 2010/04/30 10:33:22 nleclercq
// Fixed "" char pb
//
// Revision 1.22 2010/04/30 08:19:34 nleclercq // Revision 1.22 2010/04/30 08:19:34 nleclercq
// Adding debug logs // Adding debug logs
// //
...@@ -114,6 +117,9 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio ...@@ -114,6 +117,9 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
#include <math.h> #include <math.h>
#include <iostream> #include <iostream>
//- default range expected when device starts
const double DEFAULT_RANGE = 1000.;
namespace LoCuM_4_ns namespace LoCuM_4_ns
{ {
...@@ -245,6 +251,12 @@ namespace LoCuM_4_ns ...@@ -245,6 +251,12 @@ namespace LoCuM_4_ns
create_proxy_Serialline(), create_proxy_Serialline(),
"create_proxy_Serialline", "create_proxy_Serialline",
"LoCuM_4::always_executed_hook()"); "LoCuM_4::always_executed_hook()");
//- configure the Locum HW
if ( this->mySerial )
{
this->configure();
}
} }
} }
//+---------------------------------------------------------------------------- //+----------------------------------------------------------------------------
...@@ -271,10 +283,9 @@ namespace LoCuM_4_ns ...@@ -271,10 +283,9 @@ namespace LoCuM_4_ns
{ {
DEBUG_STREAM << "LoCuM_4::read_gain(Tango::Attribute &attr) entering... "<< endl; DEBUG_STREAM << "LoCuM_4::read_gain(Tango::Attribute &attr) entering... "<< endl;
_DEV_TRY(response = write_read("$01:CONF?",true), "read range", "LoCuM_4::read_gain"); this->get_config();
// response string like "S1_100�A,S2_Plus,HV_OFF,Ext_OFF,Bias+_ON,Auto_OFF," // response string like "S1_100�A,S2_Plus,HV_OFF,Ext_OFF,Bias+_ON,Auto_OFF,"
_DEV_TRY(*attr_gain_read = get_range(response), "get range value", "LoCuM_4::read_gain"); _DEV_TRY(*attr_gain_read = get_range(response), "get range value", "LoCuM_4::read_gain");
attr.set_value(attr_gain_read); attr.set_value(attr_gain_read);
...@@ -442,6 +453,8 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin) ...@@ -442,6 +453,8 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
{ {
DEBUG_STREAM << "LoCuM_4::dev_state(): entering... !" << endl; DEBUG_STREAM << "LoCuM_4::dev_state(): entering... !" << endl;
Tango::DevState argout = Tango::UNKNOWN;
// create devices proxy if it does not exist // create devices proxy if it does not exist
dev_status_ = "serial proxy = " + serialProxyName + "\n"; dev_status_ = "serial proxy = " + serialProxyName + "\n";
...@@ -449,12 +462,26 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin) ...@@ -449,12 +462,26 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
if(mySerial==0) if(mySerial==0)
{ {
dev_status_ += "no more communication with locum4 amplifier\n"; dev_status_ += "no more communication with locum4 amplifier\n";
return Tango::FAULT; argout = Tango::FAULT;
}else }
else if ( !this->_isBiasValueMinus )
{
dev_status_ += "Bias voltage source is not set to \"Minus\".\n";
argout = Tango::ALARM;
}
else if ( !this->_isHV_On )
{
dev_status_ += "HV is not \"ON\".\n";
argout = Tango::ALARM;
}
else
{ {
dev_status_ += "locum is fine \n"; dev_status_ += "locum is fine \n";
return Tango::ON; argout = Tango::ON;
} }
set_state(argout);
return argout;
} }
//+------------------------------------------------------------------ //+------------------------------------------------------------------
...@@ -492,6 +519,8 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin) ...@@ -492,6 +519,8 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
s<<"Bias Voltage is OFF\n"; s<<"Bias Voltage is OFF\n";
} }
*/ */
set_status(dev_status_.c_str());
return dev_status_.c_str(); return dev_status_.c_str();
} }
...@@ -653,6 +682,45 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin) ...@@ -653,6 +682,45 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
} }
// ********************************************************************************************
// get_config()
//
// description: sends "conf?" command
//
// **********************************************************************************************
void LoCuM_4::get_config()
{
// response string like "S1_100�A,S2_Plus,HV_OFF,Ext_OFF,Bias+_ON,Auto_OFF,"
_DEV_TRY(this->response = write_read("$01:CONF?",true), "read range", "LoCuM_4::read_gain");
}
// ********************************************************************************************
// configure()
//
// description: checks the locum configuration at init
// 1) if range is not 1000.0 -> apply it
// 2) BIAS voltage source value (i.e. S2) must be "Minus" -> if not, set device state to ALARM
// 3) HV (S3) must be "On" -> if not, set device state to ALARM
//
// **********************************************************************************************
void LoCuM_4::configure()
{
//- get locum config
this->get_config();
//- check that range == 1000, S2_value2 == Minus (BIAS voltage source) and HV_value3 == ON
double range = this->get_range(this->response);
if ( range != DEFAULT_RANGE )
this->set_manual_range(DEFAULT_RANGE);
//- extract S2 value
size_t s2_ValIdx = this->response.find("S2_Minus");
if ( s2_ValIdx == std::string::npos )
this->_isBiasValueMinus = false;
//- extract S3 value
size_t s3_ValIdx = this->response.find("HV_ON");
if ( s3_ValIdx == std::string::npos )
this->_isHV_On = false;
}
// ******************************************************************************************** // ********************************************************************************************
// get_range() // get_range()
// //
...@@ -697,7 +765,7 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin) ...@@ -697,7 +765,7 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
range = config.substr(index_underscore + 1, index_comma - 4); range = config.substr(index_underscore + 1, index_comma - 4);
//-DEBUG_STREAM << "LoCuM_4::get_range::range token: " << range << std::endl; //-DEBUG_STREAM << "LoCuM_4::get_range::range token: " << range << std::endl;
int i = 0; unsigned int i = 0;
int c = '0'; int c = '0';
while (::isdigit(unsigned char(c)) && i < range.size()) while (::isdigit(unsigned char(c)) && i < range.size())
c = range[++i]; c = range[++i];
......
...@@ -6,11 +6,14 @@ ...@@ -6,11 +6,14 @@
// //
// project : LoCuM_4 // project : LoCuM_4
// //
// $Author: vince_soleil $ // $Author: xavela $
// //
// $Revision: 1.15 $ // $Revision: 1.16 $
// //
// $Log: not supported by cvs2svn $ // $Log: not supported by cvs2svn $
// Revision 1.15 2010/03/25 18:21:00 vince_soleil
// "Migration_Tango7"
//
// Revision 1.14 2008/10/10 09:40:42 buteau // Revision 1.14 2008/10/10 09:40:42 buteau
// tentative de correction pour crash DSErver // tentative de correction pour crash DSErver
// //
...@@ -66,8 +69,8 @@ ...@@ -66,8 +69,8 @@
#include "Xstring.h" #include "Xstring.h"
#include <tango.h> #include <tango.h>
/** /**
* @author $Author: vince_soleil $ * @author $Author: xavela $
* @version $Revision: 1.15 $ * @version $Revision: 1.16 $
*/ */
// Add your own constants definitions here. // Add your own constants definitions here.
...@@ -276,12 +279,16 @@ private: ...@@ -276,12 +279,16 @@ private:
bool local; bool local;
std::string response,cmd; std::string response,cmd;
std::string dev_status_; std::string dev_status_;
bool _isBiasValueMinus; //- BIAS config
bool _isHV_On; //- High Voltage state
//methodes //methodes
std::string write_read(std::string cmd_to_send,bool reading_expected); std::string write_read(std::string cmd_to_send,bool reading_expected);
void create_proxy_Serialline(void); void create_proxy_Serialline(void);
double get_range(std::string config); double get_range(std::string config);
std::string convert_range_double_to_string(double value); std::string convert_range_double_to_string(double value);
void get_config(void);
void configure(void);
}; };
} // namespace_ns } // namespace_ns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment