def get_current_meas(self, port, meas_type): """ This function measures the current :type port: integer :param port: the port on which measurement has to be done :type meas_type: str :param meas_type: the type of measurement to do. Possible values: - "DC" : dc current - "ACDC" : ac+dc rms current - "HIGH" : high current - "LOW" : low current - "MAX" : maximum current - "MIN" : minimum current :rtype: float :return: the result of the measurement """ (err, current, msg) = W.GetCurrentMeasurement(self, port, meas_type) self._error_check(err, msg) return current
def get_current_meas_average(self, port, meas_type, iteration): """ This function measures the current :type port: integer :param port: the port on which measurement has to be done :type meas_type: str :param meas_type: the type of measurement to do. Possible values: - "DC" : dc current - "ACDC" : ac+dc rms current - "HIGH" : high current - "LOW" : low current - "MAX" : maximum current - "MIN" : minimum current :type iteration: int :param duration: number of iteration for the average computing :rtype: float :return: the result of the measurement """ i = 0 average = float(0) while i < iteration: (err, current, msg) = W.GetCurrentMeasurement(self, port, meas_type, log=False) self._error_check(err, msg) # check if the measure is not an aberration if current > 1000: iteration -= 1 continue average += current i += 1 if iteration > 0: return average / iteration else: return average