Python example to do automated load tests for power supplies with HP 6632B

130 views
Skip to first unread message

Richard Klingler

unread,
Aug 4, 2014, 6:19:35 AM8/4/14
to gpib...@googlegroups.com
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')




 

Richard Klingler

unread,
Aug 4, 2014, 6:21:05 AM8/4/14
to gpib...@googlegroups.com
Here's the PNG output:


power5v3a-sense.png

Cheh

unread,
Aug 4, 2014, 11:12:54 PM8/4/14
to gpib...@googlegroups.com
Hi Richard,

thanks for sharing this with us. It's great to see a real example on Python. Very interesting for me.


Reply all
Reply to author
Forward
0 new messages