From faa913fcd72eb997f0ad2ad450e727b4e7ff3931 Mon Sep 17 00:00:00 2001 From: Leon Teichroeb Date: Sat, 5 Jun 2021 14:41:58 +0200 Subject: [PATCH] Fixed error in voltage limit computation. --- cage_func.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cage_func.py b/cage_func.py index 988322c..da7dbb1 100644 --- a/cage_func.py +++ b/cage_func.py @@ -135,7 +135,7 @@ class Axis: # determine voltage limit to be set on PSU, must be high enough to not limit the current: # min. 8V, max. max_volts, in-between as needed with current value (+margin to not limit current) - maxVoltage = min(max(1.3 * value * self.resistance, 8), self.max_volts) # limit voltage + maxVoltage = min(max(1.3 * abs(value) * self.resistance, 8), self.max_volts) # limit voltage if self.connected == "Connected": # only try to command the PSU if its actually connected self.device.set_current(abs(value), self.channel) # set desired current self.device.set_voltage(maxVoltage, self.channel) # set voltage limit