diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h index 2e200278aa226fb8424fd5d35c45519fee101689..e4d946c033da945bbba22fff825ee7165652d494 100644 --- a/include/AbstractElectrometerClass.h +++ b/include/AbstractElectrometerClass.h @@ -9,9 +9,14 @@ // // $Author: xavela $ // -// $Revision: 1.6 $ +// $Revision: 1.7 $ // // $Log: not supported by cvs2svn $ +// Revision 1.6 2008/02/13 15:51:44 xavela +// xavier : +// - Integration Mode available for DDC/SCPI devices +// - tests done with a K617 (DDC) and a K6485 (SCPI) +// // Revision 1.5 2008/02/11 16:55:04 xavela // xavier : for DDC part // - integration mode OK (tests done with K_486) @@ -131,6 +136,7 @@ public: virtual void set_buffer_size (short); virtual void set_triggerMode (short); virtual void set_integrationTime (double); + virtual short get_buffer_size (void); /** * \brief Novelec Electrometer methods diff --git a/include/ElectrometerProtocol.h b/include/ElectrometerProtocol.h index 68b180264df9763b34ab08cb8bd484ce87d3ac8b..98414a6bc6c4865acd2e79b9acdbc124ddb1c379 100644 --- a/include/ElectrometerProtocol.h +++ b/include/ElectrometerProtocol.h @@ -12,9 +12,14 @@ // // $Author: xavela $ // -// $Revision: 1.5 $ +// $Revision: 1.6 $ // // $Log: not supported by cvs2svn $ +// Revision 1.5 2008/02/13 15:51:44 xavela +// xavier : +// - Integration Mode available for DDC/SCPI devices +// - tests done with a K617 (DDC) and a K6485 (SCPI) +// // Revision 1.4 2008/02/11 16:55:04 xavela // xavier : for DDC part // - integration mode OK (tests done with K_486) @@ -138,7 +143,7 @@ public: virtual void set_buffer_size (std::string size); virtual void clear_buffer (void); virtual void store_raw_input (void); - virtual void start_storing (void); + virtual void start_storing (void); virtual void enable_SRQBufferFull (void); virtual void disable_SRQBufferFull(void); @@ -150,6 +155,8 @@ public: virtual void enable_readingsFromBuffer_K486_487 (void); virtual void read_data_with_no_timestamp (void); + virtual std::string get_buffer_size (void); + //- only for K_486 and K_487 devices virtual void enable_integrationPeriod (void); diff --git a/include/KeithleyDDCProtocol.h b/include/KeithleyDDCProtocol.h index 9a43a6bebf0f909d1a733f29f24ef5c671c6c2da..2c7777c540ec5c813bac46b4ab45fd1732b17d49 100644 --- a/include/KeithleyDDCProtocol.h +++ b/include/KeithleyDDCProtocol.h @@ -109,6 +109,7 @@ public: void enable_readingsFromBuffer_K486_487 (void); //- only for K_486 and K_487 devices void enable_integrationPeriod (void); + diff --git a/include/KeithleySCPIProtocol.h b/include/KeithleySCPIProtocol.h index 6f4ea1c71f686b9c99700eebac1af478df4dbf20..5158fdd97740197b02b5f5ab1a9b0f255bd4b7a8 100644 --- a/include/KeithleySCPIProtocol.h +++ b/include/KeithleySCPIProtocol.h @@ -111,6 +111,7 @@ public: void enable_SRQBufferFull (void); void disable_SRQBufferFull (void); + std::string get_buffer_size (void); /** * \brief Get Raw Electrometer Status. diff --git a/include/Keithley_486.h b/include/Keithley_486.h index e2719a6f10de88e8c7fa5a7fc395f2744fc56186..6bdc48fa6c3440fc376428cc61e163daa3f04ced 100644 --- a/include/Keithley_486.h +++ b/include/Keithley_486.h @@ -51,7 +51,13 @@ public: void set_buffer_size(short); void set_triggerMode(short); void init_keithley (void); + short get_buffer_size (void) { return _size; }; + /** + * \brief The integration time (sec). + */ + void set_integrationTime (double); + /** * \brief getter(s) & setter(s) */ diff --git a/include/Keithley_487.h b/include/Keithley_487.h index b27ca3e833c8cbacdb052ca1b8b8e9a3cd43473b..75ec182e6a977ba292edd6cd0fa7c28f25e83534 100644 --- a/include/Keithley_487.h +++ b/include/Keithley_487.h @@ -51,6 +51,7 @@ public: void set_buffer_size(short); void set_triggerMode(short); void init_keithley (void); + short get_buffer_size (void) { return _size; }; /** * \brief Electrometer Function(s). @@ -63,6 +64,11 @@ public: std::string get_ElectroMeterMode(void); std::string get_ElectroMeterRange(void); + /** + * \brief The integration time (sec). + */ + void set_integrationTime (double); + /** * \brief Electrometer status. */ diff --git a/include/Keithley_6485.h b/include/Keithley_6485.h index 8456b933158c77de0569242f8004a9c8edf1e815..23a1b5ea04a7ee5cc9ff477a1bd949cc9bfb01f4 100644 --- a/include/Keithley_6485.h +++ b/include/Keithley_6485.h @@ -44,6 +44,11 @@ public: std::vector<double> get_integratedValue (void); std::vector<double> get_fetchValue (void); + /** + * \brief The integration time (sec). + */ + void set_integrationTime (double); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_6487.h b/include/Keithley_6487.h index a1340380fe156fbbadd75e594456ef376c2d5567..1e5f09481c765790c5ad05e30807be0ff5c0f802 100644 --- a/include/Keithley_6487.h +++ b/include/Keithley_6487.h @@ -50,6 +50,11 @@ public: std::vector<double> get_integratedValue (void); std::vector<double> get_fetchValue (void); + /** + * \brief The integration time (sec). + */ + void set_integrationTime (double); + /** * \brief Electrometer Mode. */ diff --git a/include/Keithley_6514.h b/include/Keithley_6514.h index 91552491915b05d040e7f0f343d0837ab1599301..3c74d9dce103924cc301c92de368a362da1b38f5 100644 --- a/include/Keithley_6514.h +++ b/include/Keithley_6514.h @@ -50,6 +50,11 @@ public: std::vector<double> get_integratedValue (void); std::vector<double> get_fetchValue (void); + /** + * \brief The integration time (sec). + */ + void set_integrationTime (double); + /** * \brief Electrometer Mode. */ diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp index 2f25c41bc350ac0cad5ab9724974e9fc35002258..19bd7509cce271fe8250ebf970a1d727bd4914e2 100644 --- a/src/AbstractElectrometerClass.cpp +++ b/src/AbstractElectrometerClass.cpp @@ -11,9 +11,14 @@ // // $Author: xavela $ // -// $Revision: 1.7 $ +// $Revision: 1.8 $ // // $Log: not supported by cvs2svn $ +// Revision 1.7 2008/02/13 15:51:43 xavela +// xavier : +// - Integration Mode available for DDC/SCPI devices +// - tests done with a K617 (DDC) and a K6485 (SCPI) +// // Revision 1.6 2008/02/11 16:55:04 xavela // xavier : for DDC part // - integration mode OK (tests done with K_486) @@ -416,6 +421,16 @@ void AbstractElectrometerClass::set_buffer_size (short size) } +// ============================================================================ +// AbstractElectrometerClass::get_buffer_size +// ============================================================================ +short AbstractElectrometerClass::get_buffer_size () +{ + std::string size = _electrometerProtocol->get_buffer_size(); + + return XString<short>::convertFromString(size); +} + // ============================================================================ // AbstractElectrometerClass::set_integrationTime // ============================================================================ diff --git a/src/ElectrometerProtocol.cpp b/src/ElectrometerProtocol.cpp index 074172d5fc58f5a8a44530c98ba3fda9b9e54edc..4e52171a7b932d67bd5f2a9fd571e60d96b886e2 100644 --- a/src/ElectrometerProtocol.cpp +++ b/src/ElectrometerProtocol.cpp @@ -530,6 +530,16 @@ void ElectrometerProtocol::set_buffer_size (std::string) "ElectrometerProtocol::set_buffer_size( )."); } +// ============================================================================ +// ElectrometerProtocol::get_buffer_size +// ============================================================================ +std::string ElectrometerProtocol::get_buffer_size () +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::get_buffer_size( )."); +} + // ============================================================================ // ElectrometerProtocol::clear_buffer // ============================================================================ diff --git a/src/KeithleySCPIProtocol.cpp b/src/KeithleySCPIProtocol.cpp index 7906ad72a8a488dc7ca567405865d59b6ab159eb..d2c3c1741e43676da7dc1377008dc456327ebe49 100644 --- a/src/KeithleySCPIProtocol.cpp +++ b/src/KeithleySCPIProtocol.cpp @@ -722,6 +722,18 @@ std::string cmd_to_send(""); } +// ============================================================================ +// KeithleySCPIProtocol::get_buffer_size() +// ============================================================================ +std::string KeithleySCPIProtocol::get_buffer_size ( ) +{ +std::string cmd_to_send("TRAC:POIN:ACTual?"); + + //- send command : + return _communication_link->write_read(cmd_to_send); + +} + // ============================================================================ // KeithleySCPIProtocol::clear_buffer() // ============================================================================ diff --git a/src/Keithley_486.cpp b/src/Keithley_486.cpp index 289cce925636d48db37bdb9b33f68d32a7a57734..979a572f5f26c374c163de0aa2691b263f0c0ef6 100644 --- a/src/Keithley_486.cpp +++ b/src/Keithley_486.cpp @@ -19,6 +19,7 @@ static long KEITHLEY_MODEL = 486; #include <stdexcept> #include <sstream> #include <string> +#include <math.h> //- for ceil #include <Xstring.h> #include "Keithley_486.h" #include "KeithleyDDCProtocol.h" @@ -36,6 +37,11 @@ static short K486_rangeLimit = 8; */ static short K486_triggerModeLimit = 7; +/* +* Trigger Mode limit (millisec) +*/ +static int K486_conversionRate = 360; + // ============================================================================ // Keithley_486::Keithley_486 // ============================================================================ @@ -175,6 +181,17 @@ void Keithley_486::set_triggerMode (short trigMod) } +// ============================================================================ +// Keithley_487::set_integrationTime +// ============================================================================ +void Keithley_486::set_integrationTime (double seconds) +{ + double msSeconds = seconds / 1000; + + //- _size set in init_keithley() + _size = (int)ceil(msSeconds / K486_conversionRate); +} + // ============================================================================ // Keithley_486::init_keithley : command to perform an integration cycle // ============================================================================ diff --git a/src/Keithley_487.cpp b/src/Keithley_487.cpp index 0c66e55e97efaa863ba643046545478b4564c3c2..e577dad624cb6935bb5a45a3972c2ca1901a5e7c 100644 --- a/src/Keithley_487.cpp +++ b/src/Keithley_487.cpp @@ -19,6 +19,7 @@ static long KEITHLEY_MODEL = 487; #include <stdexcept> #include <sstream> #include <string> +#include <math.h> //- for ceil #include <Xstring.h> #include "Keithley_487.h" #include "KeithleyDDCProtocol.h" @@ -36,6 +37,10 @@ static short K487_rangeLimit = 8; */ static short K487_triggerModeLimit = 9; +/* +* Trigger Mode limit (millisec) +*/ +static int K487_conversionRate = 360; // ============================================================================ // Keithley_487::Keithley_487 @@ -155,6 +160,17 @@ std::stringstream cmd_to_send; } +// ============================================================================ +// Keithley_487::set_integrationTime +// ============================================================================ +void Keithley_487::set_integrationTime (double seconds) +{ + double msSeconds = seconds / 1000; + + //- _size set in init_keithley() + _size = (int)ceil(msSeconds / K487_conversionRate); +} + // ============================================================================ // Keithley_487::set_triggerMode // ============================================================================ diff --git a/src/Keithley_6485.cpp b/src/Keithley_6485.cpp index 691d6a16d540a9a28893ebb01ce08ec90ded24c6..48bfdd423e647c22f633584394275d677b615a04 100644 --- a/src/Keithley_6485.cpp +++ b/src/Keithley_6485.cpp @@ -18,6 +18,7 @@ static long KEITHLEY_MODEL = 6485; #include <iostream> #include <sstream> #include <string> +#include <math.h> //- for ceil #include <Xstring.h> #include "Keithley_6485.h" #include "KeithleySCPIProtocol.h" @@ -249,6 +250,20 @@ std::stringstream cmd_to_send; _electrometerProtocol->set_buffer_size(cmd_to_send.str()); } +// ============================================================================ +// Keithley_6485::set_integrationTime +// ============================================================================ +void Keithley_6485::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 > 2500) + _trigCounts = 2500; +} + // ============================================================================ // Keithley_6485::init_keithley : command to perform an integration cycle // ============================================================================ diff --git a/src/Keithley_6487.cpp b/src/Keithley_6487.cpp index 45ad5e51bafb390b71ab844d91c0cf57e126f207..656f22691a5d8e5314da19949f65092c703a4079 100644 --- a/src/Keithley_6487.cpp +++ b/src/Keithley_6487.cpp @@ -18,6 +18,7 @@ static long KEITHLEY_MODEL = 6487; #include <iostream> #include <sstream> #include <string> +#include <math.h> //- for ceil #include <Xstring.h> #include "Keithley_6487.h" #include "KeithleySCPIProtocol.h" @@ -254,6 +255,20 @@ std::stringstream cmd_to_send; _electrometerProtocol->set_buffer_size(cmd_to_send.str()); } +// ============================================================================ +// Keithley_6487::set_integrationTime +// ============================================================================ +void Keithley_6487::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 > 3000) + _trigCounts = 3000; +} + // ============================================================================ // Keithley_6487::init_keithley : command to perform an integration cycle // ============================================================================ diff --git a/src/Keithley_6514.cpp b/src/Keithley_6514.cpp index 3a9b7af00cb88921d59f5011a9b94566b1e2fcd7..fd17f290d0dc4fe743d696aa484275b35195e362 100644 --- a/src/Keithley_6514.cpp +++ b/src/Keithley_6514.cpp @@ -18,6 +18,7 @@ static long KEITHLEY_MODEL = 6514; #include <iostream> #include <sstream> #include <string> +#include <math.h> //- for ceil #include <Xstring.h> #include "Keithley_6514.h" #include "KeithleySCPIProtocol.h" @@ -36,6 +37,11 @@ static const short K6514_VOLT_rangeLimit= 2; static const short K6514_OHM_rangeLimit = 8; static const short K6514_COU_rangeLimit = 3; +/* +* Trigger Mode limit (millisec) +*/ +static const int K6514_conversionRate = 175; + // ============================================================================ // Keithley_6514::Keithley_6514 // ============================================================================ @@ -387,6 +393,20 @@ std::stringstream cmd_to_send; _electrometerProtocol->set_buffer_size(cmd_to_send.str()); } +// ============================================================================ +// Keithley_6514::set_integrationTime +// ============================================================================ +void Keithley_6514::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 > 2500) + _trigCounts = 2500; +} + // ============================================================================ // Keithley_6514::init_keithley : command to perform an integration cycle // ============================================================================