Skip to content

Commit

Permalink
handover of self.value as float + software averaging function impleme…
Browse files Browse the repository at this point in the history
…nted

Bugfix: self.value is now handed over explizitly as float. This fix was necessary for the "Test Field" function to work properly as contrary tp values out of the sweep list, the text field hands over its content in string format.

Added Feature: the SMU class offers the option of averaging values. The E36xxA instruments offer a read-back resolution (model dependend) down to 1mA, often saving the use of an additional DMM. By sampling multiple measurement values, the readout can be stabilized conderable, making these PSUs suitable for recording DC curves on their own for many simple parts. This is now implemented, offering the option of averaging with a simple click of an options box within the SMU class GUI.
  • Loading branch information
Code-Craftsman-Christian authored Oct 29, 2024
1 parent 5586a25 commit c42221d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/SMU-Keysight_E3632A/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def set_GUIparameter(self):
"RouteOut": ["Front"],
"Compliance": 1,
"RangeVoltage": ["15 V / 7 A", "30 V / 4 A"],
"Average": 1,
}

return gui_parameter
Expand All @@ -90,7 +91,12 @@ def get_GUIparameter(self, parameter={}):
# self.channel = int(parameter["Channel"])

self.voltage_range = parameter["RangeVoltage"]

self.average = int(parameter["Average"])

if self.average == 0:
msg = ("Average of 0 not possible. Disable average by setting it to 1.")
raise Exception(msg)

def initialize(self):
self.port.write("*IDN?")
identifier = self.port.read()
Expand Down Expand Up @@ -148,7 +154,7 @@ def poweroff(self):
self.port.write("OUTP:STAT OFF")

def apply(self):
if self.value > 15.45 and float(self.currentlimit) > 4.12:
if float(self.value) > 15.45 and float(self.currentlimit) > 4.12:
msg = ("The next requested step would exceed 15.45 V with current limit higher than 4.12 A.\n\n"
"Please either stop at 15.45 V max or lower current compliance limit to 4.12 A max.")
raise Exception(msg)
Expand All @@ -159,10 +165,16 @@ def apply(self):
time.sleep(0.1)

def measure(self):
self.port.write("MEAS:VOLT?")
self.v = float(self.port.read())
self.port.write("MEAS:CURR?")
self.i = float(self.port.read())
self.v = 0
self.i = 0
for n in range(self.average):
self.port.write("MEAS:VOLT?")
self.v = self.v + float(self.port.read())
self.port.write("MEAS:CURR?")
self.i = self.i + float(self.port.read())

self.v = self.v / self.average
self.i = self.i / self.average

def call(self):
return [self.v, self.i]
Expand Down

0 comments on commit c42221d

Please sign in to comment.