From 5be6c9bc4b1f731f4406a817f2779891d00fe211 Mon Sep 17 00:00:00 2001
From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr>
Date: Wed, 17 Mar 2010 11:57:04 +0000
Subject: [PATCH] VSource control added !

---
 include/AbstractElectrometerClass.h | 11 ++++++++++-
 include/KeithleySCPIProtocol.h      |  5 +++++
 include/Keithley_6517.h             |  2 ++
 pom.xml                             |  2 +-
 src/AbstractElectrometerClass.cpp   | 25 ++++++++++++++++++++++++-
 src/KeithleySCPIProtocol.cpp        | 23 +++++++++++++++++++++++
 src/Keithley_6517.cpp               | 27 +++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h
index 0363a86..f71fafb 100644
--- a/include/AbstractElectrometerClass.h
+++ b/include/AbstractElectrometerClass.h
@@ -9,9 +9,12 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.18 $
+// $Revision: 1.19 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.18  2010/03/17 10:00:15  xavela
+// VSource output added for K_6517
+//
 // Revision 1.17  2009/10/14 15:26:17  xavela
 // KeithleyMemory leak fixed.
 // Novelec part updated
@@ -196,8 +199,14 @@ public:
 	virtual short get_buffer_size			(void);
 	virtual short get_triggerMode			(void) { return _trigMod;};
 
+	/**
+	*  \brief  VSource operations (only for K_6517)
+	*
+	*/
   virtual void enable_VSourceOutput (void);
   virtual void disable_VSourceOutput(void);
+  virtual void set_VSourceValue     (double volts);
+  virtual double get_VSourceValue   (void);
 
 	/**
 	*  \brief Novelec Electrometer methods
diff --git a/include/KeithleySCPIProtocol.h b/include/KeithleySCPIProtocol.h
index 5db7cce..3f36f9a 100644
--- a/include/KeithleySCPIProtocol.h
+++ b/include/KeithleySCPIProtocol.h
@@ -74,8 +74,13 @@ public:
 	void setVoltMeterMode	  (void);
 	void setOhmMeterMode	  (void);
 	void setCoulombMeterMode(void);
+	/**
+	*  \brief VSource operations.
+	*/
   void setVSourceOutputON (void);
   void setVSourceOutputOFF(void);
+  void setVSourceValue     (double volts);
+  std::string getVSourceValue   (void);
 
 	/**
 	*  \brief Electrometer : cmd to get electrometer data.
diff --git a/include/Keithley_6517.h b/include/Keithley_6517.h
index 11aad3e..0c8d22a 100644
--- a/include/Keithley_6517.h
+++ b/include/Keithley_6517.h
@@ -89,6 +89,8 @@ public:
 	*/
   void enable_VSourceOutput (void);
   void disable_VSourceOutput(void);
+  void set_VSourceValue     (double volts);
+  double get_VSourceValue   (void);
 
 	//-	TODO :
 	//	SCPI_Filters*	_ddcFilters;
diff --git a/pom.xml b/pom.xml
index ab80765..9cfb636 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
    </parent>
    <groupId>fr.soleil.lib</groupId>
    <artifactId>Electrometers-${aol}-${library}-${mode}</artifactId>
-   <version>2.4.0</version>
+   <version>2.5.0</version>
    <packaging>nar</packaging>
    <name>Electrometers library</name>
    <description>Electrometers library</description>
diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp
index b95edfb..f55de82 100644
--- a/src/AbstractElectrometerClass.cpp
+++ b/src/AbstractElectrometerClass.cpp
@@ -11,9 +11,12 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.20 $
+// $Revision: 1.21 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.20  2010/03/17 10:00:15  xavela
+// VSource output added for K_6517
+//
 // Revision 1.19  2009/10/14 15:26:17  xavela
 // KeithleyMemory leak fixed.
 // Novelec part updated
@@ -649,6 +652,26 @@ void AbstractElectrometerClass::disable_VSourceOutput (void)
 											"AbstractElectrometerClass::disable_VSourceOutput( ).");
 }
 
+// ============================================================================
+// AbstractElectrometerClass::set_VSourceValue
+// ============================================================================
+void AbstractElectrometerClass::set_VSourceValue (double) 
+{
+	throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
+											"This Electrometer does not support this command.",
+											"AbstractElectrometerClass::set_VSourceValue( ).");
+}
+
+// ============================================================================
+// AbstractElectrometerClass::get_VSourceValue
+// ============================================================================
+double AbstractElectrometerClass::get_VSourceValue (void) 
+{
+	throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
+											"This Electrometer does not support this command.",
+											"AbstractElectrometerClass::get_VSourceValue( ).");
+}
+
 // ============================================================================
 // AbstractElectrometerClass::get_ElectroMeterPolarity
 // ============================================================================
diff --git a/src/KeithleySCPIProtocol.cpp b/src/KeithleySCPIProtocol.cpp
index eaf2d54..6b3be01 100644
--- a/src/KeithleySCPIProtocol.cpp
+++ b/src/KeithleySCPIProtocol.cpp
@@ -332,6 +332,29 @@ std::stringstream cmd_to_send;
 	_communication_link->write(cmd_to_send.str());
 }
 
+// ============================================================================
+// KeithleySCPIProtocol::setVSourceValue
+// ============================================================================
+void KeithleySCPIProtocol::setVSourceValue (double voltsValue) 
+{
+std::stringstream cmd_to_send;
+
+	//- send command
+  cmd_to_send << "SOUR:VOLT " << voltsValue << std::endl;
+	_communication_link->write(cmd_to_send.str());
+}
+
+// ============================================================================
+// KeithleySCPIProtocol::getVSourceValue
+// ============================================================================
+std::string KeithleySCPIProtocol::getVSourceValue (void) 
+{
+std::string cmd_to_send("SOUR:VOLT?");
+
+	//- send command
+	return _communication_link->write_read(cmd_to_send);
+}
+
 // ============================================================================
 // KeithleySCPIProtocol::get_mode
 // ============================================================================
diff --git a/src/Keithley_6517.cpp b/src/Keithley_6517.cpp
index f8b35f1..aa2f2bc 100644
--- a/src/Keithley_6517.cpp
+++ b/src/Keithley_6517.cpp
@@ -282,6 +282,33 @@ void Keithley_6517::disable_VSourceOutput (void)
 		_kscpi->setVSourceOutputOFF();
 }
 
+// ============================================================================
+// Keithley_6517::set_VSourceValue
+// ============================================================================
+void Keithley_6517::set_VSourceValue (double volts) 
+{
+	KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
+	if(_kscpi)
+		_kscpi->setVSourceValue(volts);
+}
+
+// ============================================================================
+// Keithley_6517::set_VSourceValue
+// ============================================================================
+double Keithley_6517::get_VSourceValue (void) 
+{
+  std::string response("");
+  double volts;
+
+	KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol);
+	if(_kscpi)
+		response = _kscpi->getVSourceValue();
+
+	volts = XString<double>::convertFromString(response);
+
+  return volts;
+}
+
 // ============================================================================
 // Keithley_6517::update_range
 // ============================================================================
-- 
GitLab