def psSetCurrent(self, newCurrent): if newCurrent is not None: if not isinstance(newCurrent, Value): newCurrent = Value(float(newCurrent), 'A') self.psCurrent = newCurrent.inUnitsOf('A') self.psCurrent = max(-CURRENT_LIMIT, min(CURRENT_LIMIT, self.psCurrent)) return self.psCurrent
def current(self, current=None): ''' change the current setpoint. ''' if current is None: return self.setCurrent if not isinstance(current, Value): current = Value(float(current), 'A') self.setCurrent = current.inUnitsOf('A') self.setCurrent = max(-CURRENT_LIMIT, min(CURRENT_LIMIT, self.setCurrent)) return self.setCurrent