As an exercise I wrote a little script that controls one of my many HP 6632B power supplies...
The power supply can not only source power, but also sink current programmable via GPIB...
which makes it perfect to do automated load testing for power supplies as the voltage
can be read out during the automation...
This script steps through several current sink settings and plots the result as a PNG file:
Feel free to use...if you modify/enhance, please feed back :-)
import matplotlib.pyplot as plt
import time
from Gpib import *
fig = plt.figure()
x = []
y = []
inst = Gpib(0,5)
inst.write("VOLT 0")
inst.write("CURR 0.01")
time.sleep(0.5)
inst.write("OUTPUT ON")
time.sleep(0.5)
for i in range (0, 30):
sink = (i + 1) * 0.1
inst.write("CURR " + str(sink))
time.sleep(1)
inst.write("MEAS:VOLT?")
voltage = inst.read(200)
x.append(sink)
y.append(voltage)
plt.scatter(sink, voltage)
plt.draw()
print voltage, sink
inst.write("OUTPUT OFF")
inst.write("CURR 0")
plt.ylabel('Voltage (V)')
plt.xlabel('Current (A)')
plt.ylim(0,6)
plt.xlim(0,3)
plt.grid()
plt.show()
fig.savefig('power5v3a-sense.png')