diff options
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/hardware/power_supply/keysight_e3612a.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/qolab/hardware/power_supply/keysight_e3612a.py b/qolab/hardware/power_supply/keysight_e3612a.py index bb99bc3..f2720b4 100644 --- a/qolab/hardware/power_supply/keysight_e3612a.py +++ b/qolab/hardware/power_supply/keysight_e3612a.py @@ -1,5 +1,6 @@ from qolab.hardware.basic import BasicInstrument from qolab.hardware.power_supply import PowerSupplySCPI +import time class KeysightE3612A(PowerSupplySCPI): """ Keysight E3612A power supply """ @@ -80,6 +81,26 @@ class KeysightE3612A(PowerSupplySCPI): return( float(rstr) ) @BasicInstrument.tsdb_append + def setChanIout(self, chNum, val, currentPrecision=5e-6, currentHeadRoom=1e-3, dwellTime=0.1): + """ + Tuning Vout to achieve desired Iout. + Generally setting current limit will maintain current near but not exact to desired. + This function will try to guess the correct Vout value + """ + iDesired = val + self.setChanIlimit(chNum, val+currentHeadRoom) + # here we assume that hook up is already made, so we can estimate source resistance + for i in range(10): + iOut=self.getChanIout(chNum) + if abs(iOut-iDesired) <= currentPrecision: + break + vOut=self.getChanVout(chNum) + R=vOut/iOut + vDesired = R*iDesired + self.setChanVlimit(chNum, vDesired) + time.sleep(dwellTime) + + @BasicInstrument.tsdb_append def getChanIlimit(self, chNum): qstr = f'SOURce:CURR? (@{chNum})' rstr = self.query(qstr) @@ -87,6 +108,7 @@ class KeysightE3612A(PowerSupplySCPI): @BasicInstrument.tsdb_append def setChanIlimit(self, chNum, val): + """ Set current limit, seems to be >=0.002 """ cmnd = f'SOURCe:CURR {val},(@{chNum})' rstr = self.write(cmnd) |