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

xavier :

6517 model management added and tested :
-> problem to check : no SRQ !
parent 216ee1fd
Branches
Tags
No related merge requests found
......@@ -9,9 +9,15 @@
//
// $Author: xavela $
//
// $Revision: 1.10 $
// $Revision: 1.11 $
//
// $Log: not supported by cvs2svn $
// Revision 1.10 2008/04/15 12:51:59 xavela
// xavier :
// - SRQ management changed :
// * ReadStatusByteRegister method added
// * IsSrqLineUP added
//
// Revision 1.9 2008/02/15 10:17:55 xavela
// xavier :
// - command abort added for SCPI Keithleys
......@@ -131,14 +137,14 @@ public:
virtual void set_triggercount (short trigcounts);
void set_triggerdelay (std::string trigdelay);
void set_triggerdelayAuto (std::string trigdelAuto);
void set_averagecount (std::string avercounts);
void set_averagecontrol (std::string averctrl);
virtual void set_averagecount (std::string avercounts);
virtual void set_averagecontrol (std::string averctrl);
std::string get_knplc (void);
std::string get_triggercount (void);
std::string get_triggerdelay (void);
std::string get_triggerdelayAuto(void);
std::string get_averagecount (void);
std::string get_averagecontrol(void);
virtual std::string get_averagecount (void);
virtual std::string get_averagecontrol(void);
virtual void clear_buffer (void);
virtual void store_raw_input (void);
virtual void start_storing (void);
......
......@@ -103,6 +103,15 @@ public:
std::string get_averagecount (void);
std::string get_averagecontrol (void);
void read_data_with_no_timestamp(void);
/**
* \brief K_6517 specifics commands
*/
std::string get_averagecount_K6517 (void);
void set_averagecount_K6517 (std::string averageCountStr);
std::string get_averagecontrol_K6517(void);
void set_averagecontrol_K6517 (std::string nbAverTCtrl);
void averageStateON_K6517 (void);
void averageStateOFF_K6517 (void);
/**
* \brief Electrometer : Buffer config
*/
......
......@@ -67,8 +67,8 @@ private:
//- method to obtain the range index
void update_range (void);
float _numPLC;
short _trigCounts;
double _numPLC;
int _trigCounts;
};
/** @} */ //- end addtogroup
......
......@@ -72,8 +72,8 @@ private:
//- method to obtain the range index
void update_range (void);
float _numPLC;
short _trigCounts;
double _numPLC;
int _trigCounts;
};
/** @} */ //- end addtogroup
......
......@@ -76,8 +76,8 @@ private:
void update_range (void);
std::string _kmode;
float _numPLC;
short _trigCounts;
double _numPLC;
int _trigCounts;
};
......
......@@ -58,6 +58,26 @@ public:
void setOhmMeterMode (void);
void setCoulombMeterMode(void);
/**
* \brief Specifics commands.
*/
std::string get_averagecount (void);
void set_averagecount (std::string nbAvCntStr);
std::string get_averagecontrol(void);
void set_averagecontrol (std::string nbAverTCtrl);
void averageStateON (void);
void averageStateOFF (void);
/**
* \brief Methods to configure the integration mode.
*/
void set_knplc (float);
void set_triggercount (short);
void set_buffer_size (short);
void init_keithley (void);
/**
* \brief The integration time (sec).
*/
void set_integrationTime (double);
//- TODO :
// SCPI_Filters* _ddcFilters;
// SCPI_Triggers* _ddcTriggers;
......@@ -65,6 +85,8 @@ private:
//- method to obtain the range index
void update_range (void);
std::string _kmode;
double _numPLC;
int _trigCounts;
};
......
......@@ -11,9 +11,15 @@
//
// $Author: xavela $
//
// $Revision: 1.11 $
// $Revision: 1.12 $
//
// $Log: not supported by cvs2svn $
// Revision 1.11 2008/04/15 12:52:14 xavela
// xavier :
// - SRQ management changed :
// * ReadStatusByteRegister method added
// * IsSrqLineUP added
//
// Revision 1.10 2008/02/15 10:17:57 xavela
// xavier :
// - command abort added for SCPI Keithleys
......@@ -419,6 +425,8 @@ std::string AbstractElectrometerClass::electrometer_status (void)
//- if no error the error code is 0
if( XString<short>::convertFromString(&argout[0]) != ON)
set_electroState(ALARM);
else
set_electroState(ON);
}
catch(...)
{
......
......@@ -590,16 +590,27 @@ std::string cmd_to_send("");
void KeithleySCPIProtocol::set_averagecount (std::string nbAverageCount)
{
std::string cmd_to_send("");
std::string tmpMode;
//- send command
cmd_to_send = "AVER:COUN " + nbAverageCount;
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::set_averagecount
// ============================================================================
void KeithleySCPIProtocol::set_averagecount_K6517 (std::string cmd_to_send)
{
std::string tmpMode("");
//- get electrometer mode
// tmpMode = get_mode( );
tmpMode = get_mode( );
//- erase bad caracters
// tmpMode.erase(tmpMode.find("\n") );
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = "AVER:COUN " + nbAverageCount;
cmd_to_send = tmpMode + ":AVER:COUN " + cmd_to_send ;
_communication_link->write(cmd_to_send);
}
......@@ -608,17 +619,29 @@ std::string tmpMode;
// ============================================================================
std::string KeithleySCPIProtocol::get_averagecount (void)
{
std::string cmd_to_send("");
//- send command
cmd_to_send = "AVER:COUNt?" ;
return _communication_link->write_read(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::get_averagecount
// ============================================================================
std::string KeithleySCPIProtocol::get_averagecount_K6517 (void)
{
std::string cmd_to_send("");
std::string tmpMode;
//- get electrometer mode
// tmpMode = get_mode( );
tmpMode = get_mode( );
//- erase bad caracters
// tmpMode.erase(tmpMode.find("\n") );
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = "AVER:COUNt?" ;
cmd_to_send = tmpMode + ":AVER:COUNt?" ;
return _communication_link->write_read(cmd_to_send);
}
......@@ -628,7 +651,7 @@ std::string tmpMode;
void KeithleySCPIProtocol::set_averagecontrol (std::string nbAverageControl)
{
std::string cmd_to_send("");
std::string tmpMode;
std::string tmpMode("");
//- get electrometer mode
// tmpMode = get_mode( );
......@@ -638,13 +661,32 @@ std::string tmpMode;
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::set_averagecontrol
// ============================================================================
void KeithleySCPIProtocol::set_averagecontrol_K6517 (std::string nbAverageControl)
{
std::string cmd_to_send("");
std::string tmpMode("");
//- get electrometer mode
tmpMode = get_mode( );
//- erase bad caracters
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = tmpMode + ":AVER:TCON " + nbAverageControl;
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::get_averagecontrol
// ============================================================================
std::string KeithleySCPIProtocol::get_averagecontrol (void)
{
std::string cmd_to_send("");
std::string tmpMode;
std::string tmpMode("");
//- get electrometer mode
// tmpMode = get_mode( );
......@@ -654,6 +696,25 @@ std::string tmpMode;
return _communication_link->write_read(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::get_averagecount
// ============================================================================
std::string KeithleySCPIProtocol::get_averagecontrol_K6517 (void)
{
std::string cmd_to_send("");
std::string tmpMode("");
//- get electrometer mode
tmpMode = get_mode( );
//- erase bad caracters
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = tmpMode + ":AVER:TCONtrol?" ;
return _communication_link->write_read(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::clear_registers
// ============================================================================
......@@ -679,6 +740,25 @@ std::string cmd_to_send("");
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::averageStateON_K6517
// ============================================================================
void KeithleySCPIProtocol::averageStateON_K6517 (void)
{
std::string cmd_to_send("");
std::string tmpMode("");
//- get electrometer mode
tmpMode = get_mode( );
//- erase bad caracters
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = tmpMode + ":AVER ON" ;
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::averageStateOFF
// ============================================================================
......@@ -691,6 +771,25 @@ std::string cmd_to_send("");
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::averageStateOFF_K6517
// ============================================================================
void KeithleySCPIProtocol::averageStateOFF_K6517 (void)
{
std::string cmd_to_send("");
std::string tmpMode("");
//- get electrometer mode
tmpMode = get_mode( );
//- erase bad caracters
tmpMode.erase(tmpMode.find("\n") );
//- send command
cmd_to_send = tmpMode + ":AVER OFF" ;
_communication_link->write(cmd_to_send);
}
// ============================================================================
// KeithleySCPIProtocol::reset
// ============================================================================
......
......@@ -18,6 +18,7 @@ static long KEITHLEY_MODEL = 6517;
#include <iostream>
#include <sstream>
#include <string>
#include <math.h> //- for ceil
#include <Xstring.h>
#include "Keithley_6517.h"
#include "KeithleySCPIProtocol.h"
......@@ -236,7 +237,7 @@ void Keithley_6517::setCoulombMeterMode (void)
}
// ============================================================================
// Keithley_6487::update_range
// Keithley_6517::update_range
// ============================================================================
void Keithley_6517::update_range (void)
{
......@@ -317,3 +318,188 @@ double delta = 0;
//- update the range with the index found
this->_range = idx;
}
// ============================================================================
// Keithley_6517::get_averagecount
// ============================================================================
std::string Keithley_6517::get_averagecount (void)
{
std::string averCountStr("");
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
averCountStr = _kscpi->get_averagecount_K6517();
return averCountStr;
}
// ============================================================================
// Keithley_6517::set_averagecount
// ============================================================================
void Keithley_6517::set_averagecount (std::string nbAverCountStr)
{
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
_kscpi->set_averagecount_K6517(nbAverCountStr);
}
// ============================================================================
// Keithley_6517::get_averagecontrol
// ============================================================================
std::string Keithley_6517::get_averagecontrol (void)
{
std::string nbAverCtrlStr("");
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
nbAverCtrlStr = _kscpi->get_averagecontrol_K6517();
return nbAverCtrlStr;
}
// ============================================================================
// Keithley_6517::set_averagecontrol
// ============================================================================
void Keithley_6517::set_averagecontrol (std::string nbAverCtrlStr)
{
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
_kscpi->set_averagecontrol_K6517(nbAverCtrlStr);
}
// ============================================================================
// Keithley_6517::averageStateON
// ============================================================================
void Keithley_6517::averageStateON (void)
{
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
_kscpi->averageStateON_K6517();
}
// ============================================================================
// Keithley_6517::averageStateOFF
// ============================================================================
void Keithley_6517::averageStateOFF (void)
{
//- this model needs to prefix this command with the current mode
KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
if(_kscpi)
_kscpi->averageStateOFF_K6517();
}
// ============================================================================
// Keithley_6517::set_knplc
// ============================================================================
void Keithley_6517::set_knplc (float numPLC)
{
std::stringstream cmd_to_send;
if(numPLC <= 0 || numPLC > 10.0)
{
// std::cout << "Keithley_6517::set_knplc -> " << numPLC << std::endl;
throw electrometer::ElectrometerException("OUT_OF_RANGE",
"Invalid number of PLC.\n Please enter a value in the range 0.01 to 10.0.",
"Keithley_6517::set_knplc( ).");
}
//- just for internal use
_numPLC = numPLC;
cmd_to_send << numPLC << std::endl;
//- default conversion rate
_electrometerProtocol->set_knplc(cmd_to_send.str());
}
// ============================================================================
// Keithley_6517::set_triggercount
// ============================================================================
void Keithley_6517::set_triggercount (short trigCounts)
{
std::stringstream cmd_to_send;
if(trigCounts == 0 || trigCounts > 99999)
{
throw electrometer::ElectrometerException("OUT_OF_RANGE",
"Invalid trigger count.\n Please enter a value in the range 1 to 99999 or set -1 for INFinite.",
"Keithley_6517::set_triggercount( ).");
}
if(trigCounts < 0)
cmd_to_send << "INF" << std::endl;
else
cmd_to_send << trigCounts << std::endl;
//- just for internal use
_trigCounts = trigCounts;
//- default conversion rate
_electrometerProtocol->set_triggercount(cmd_to_send.str());
}
// ============================================================================
// Keithley_6517::set_buffer_size
// ============================================================================
void Keithley_6517::set_buffer_size (short size)
{
std::stringstream cmd_to_send;
if(size < 1 || size > 10000)
{
throw electrometer::ElectrometerException("OUT_OF_RANGE",
"Invalid buffer size. \nPlease enter a value in the range 1 to 10000.",
"Keithley_6517::set_buffer_size( ).");
}
//- just for internal use
_size = size;
cmd_to_send << size << std::endl;
//- default conversion rate
_electrometerProtocol->set_buffer_size(cmd_to_send.str());
}
// ============================================================================
// Keithley_6517::set_integrationTime
// ============================================================================
void Keithley_6517::set_integrationTime (double seconds)
{
//- set the number of Power Line Cycle(s) -> Fast integration
_numPLC = 0.05;
//- set the number of trigger(s) ~ buffer size
_trigCounts = (short)ceil(seconds / _numPLC);
if(_trigCounts > 99999)
_trigCounts = 99999;
}
// ============================================================================
// Keithley_6517::init_keithley : command to perform an integration cycle
// ============================================================================
void Keithley_6517::init_keithley (void)
{
//- clear all registers
_electrometerProtocol->clear_registers();
//- get data only (no timestamp info ... wanted!)
_electrometerProtocol->read_data_with_no_timestamp();
//- Set integration rate in line cycles
this->set_knplc(_numPLC);
//- Set trigger model to take to N readings
this->set_triggercount(_trigCounts);
//- Set buffer size
this->set_buffer_size(_size);
//- clear previous data
_electrometerProtocol->clear_buffer();
//- Store raw input
// _electrometerProtocol->store_raw_input();
//- Start storing on next reading
_electrometerProtocol->start_storing();
//- Enable SRQ on buffer full
_electrometerProtocol->enable_SRQBufferFull();
//- Trigger readings
_electrometerProtocol->init_keithley();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment