Пример #1
0
 def power_on(self):
     """
     This function powers on the power supply
     :raise: raises TestEquipmentException in case of failure
     """
     (err, msg) = W.SwitchOn(self)
     self._error_check(err, msg)
Пример #2
0
 def set_voltage_protection_level(self, level):
     """
     Sets the overvoltage protection level
     :type level: float
     :param level: the level to set
     """
     (err, msg) = W.SetVoltageProtectionLevel(self, level)
     self._error_check(err, msg)
Пример #3
0
 def set_curr_sense_detector(self, detector):
     """
     Sets the sense detector
     :type detector: str
     :param detector: the detector to set ("ACDC" | "DC")
     """
     (err, msg) = W.SetCurrSenseDetector(self, detector)
     self._error_check(err, msg)
Пример #4
0
 def set_over_current_protection_state(self, state):
     """
     Sets overcurrent protection state
     :type state: str
     :param state: the state to set
     """
     (err, msg) = W.SetOverCurrentProtectionState(self, state)
     self._error_check(err, msg)
Пример #5
0
 def set_compensation_mode(self, mode):
     """
     Sets the compensation mode
     :type mode: str
     :param mode: the mode to set
     """
     (err, msg) = W.SetCompensationMode(self, mode)
     self._error_check(err, msg)
Пример #6
0
 def set_coupling_mode(self, mode):
     """
     Sets the coupling mode
     :type mode: str
     :param mode: the mode to set ("ALL" | "NONE")
     """
     (err, msg) = W.SetCouplingMode(self, mode)
     self._error_check(err, msg)
Пример #7
0
 def set_resistance(self, level):
     """
     Sets the output resistance of the power supply
     :type level: float
     :param level: the resistance to set
     """
     (err, msg) = W.SetResistance(self, level)
     self._error_check(err, msg)
Пример #8
0
 def set_sense_protect(self, state):
     """
     Sets the open sense lead detection state
     :type state: str
     :param state: the state to set
     """
     (err, msg) = W.SetSenseProtect(self, state)
     self._error_check(err, msg)
Пример #9
0
 def get_eq_id(self):
     """
     Gets the ID of the equipment
     :rtype: str
     :return: the identification str of the equipment
     """
     (err, eqt_id, msg) = W.GetEqID(self)
     self._error_check(err, msg)
     return eqt_id
Пример #10
0
 def set_output_state(self, state, output):
     """
     Sets the output state
     :type state: str
     :param state: the state to set ("ON" | "OFF")
     :type output: integer
     :param output: the output to set
     """
     (err, msg) = W.SetOutputState(self, state, output)
     self._error_check(err, msg)
Пример #11
0
 def set_current_voltage(self, voltage, port):
     """
     This function sets the current voltage of power supply
     :param voltage: current voltage to set
     :param port: port number on which the voltage level has to be set
     :rtype: none
     :raise: raises TestEquipmentException in case of failure
     """
     (err, msg) = W.SetVoltageLevel(self, voltage, port)
     self._error_check(err, msg)
Пример #12
0
 def set_max_current(self, max_cur, port):
     """
     This function sets the maximum current allowed of power supply
     :param max_cur: maximum current allowed
     :param port: port number on which the current level has to be set
     :rtype: none
     :raise: raises TestEquipmentException in case of failure
     """
     (err, msg) = W.SetMaxCurrent(self, max_cur, port)
     self._error_check(err, msg)
Пример #13
0
 def release(self):
     """
     Release the equipment and all associated resources
     """
     self.get_logger().info("Release")
     if self.get_handle() is not None:
         (err, msg) = W.Disconnect(self)
         self.unload_driver()
         self._error_check(err, msg)
         # Update handle value
         self._set_handle(None)
Пример #14
0
 def __connect_via_GPIB(self):
     """
     Connect to the equipment via GPIB interface
     """
     if self.get_handle() is None:
         board_id = int(self._bench_params.get_param_value("GPIBBoardId"))
         gpib_addr = int(self._bench_params.get_param_value("GPIBAddress"))
         (err, handle, msg) = W.Connect(self, board_id, gpib_addr)
         self._error_check(err, msg)
         # Update handle value
         self._set_handle(handle)
Пример #15
0
 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
Пример #16
0
    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
Пример #17
0
    def configure_basic_parameters(self):
        """
        Configure basic parameters of the power supply and register power supply
        outputs in equipment catalog dictionary
        """
        self.perform_full_preset()

        ps_params = self.get_bench_params()
        # Sort power supply parameters list
        ps_params_list = ps_params.get_parameters_name()
        ps_params_list.sort()

        # Set the compensation mode
        if ps_params.has_parameter("CompensationMode"):
            mode = str(ps_params.get_param_value("CompensationMode"))
            self.set_compensation_mode(mode)

        # Set sense protection using
        if ps_params.has_parameter("SenseProtect"):
            protect = str(ps_params.get_param_value("SenseProtect"))
            W.SetSenseProtect(self, protect)
        # Set over current protection state using
        # OverProtectState parameter
        if ps_params.has_parameter("OverProtectState"):
            state = str(ps_params.get_param_value("OverProtectState"))
            self.set_over_current_protection_state(state)
        # Set current source using CurrentSource
        if ps_params.has_parameter("CurrentSource"):
            detector = str(ps_params.get_param_value("CurrentSource"))
            self.set_curr_sense_detector(detector)

        # Set Voltage protection level using VoltageProtectLevel parameter
        if ps_params.has_parameter("VoltageProtectLevel"):
            level = float(ps_params.get_param_value("VoltageProtectLevel"))
            self.set_voltage_protection_level(level)

        # Set resistance using Resistance parameter
        if ps_params.has_parameter("Resistance"):
            resistance = float(ps_params.get_param_value("Resistance"))
            self.set_resistance(resistance)
        # Set the protection delay using delay parameter
        if ps_params.has_parameter("ProtectDelay"):
            delay = float(ps_params.get_param_value("ProtectDelay"))
            self.set_protection_delay(delay)

        # Configure each output of the power supply
        for attr_name in ps_params_list:

            if "OUTPUT" in attr_name:

                output_params = ps_params.get_parameters(attr_name)
                output_type = output_params.get_param_value("Type")

                # Set output properties if type is not NONE
                if output_type == "NONE":
                    continue

                port = int(output_params.get_param_value("PortNumber"))
                max_cur = float(output_params.get_param_value("MaxCurrent"))
                voltage = float(output_params.get_param_value("Voltage"))

                # Disable the output
                self.set_output_state("OFF", port)
                # Set the max current using CurrrentLevel and PortNumber
                self.set_max_current(max_cur, port)
                # Set voltage level using VoltageLevel and PortNumber
                self.set_current_voltage(voltage, port)
                # Enable the output
                self.set_output_state("ON", port)
Пример #18
0
 def perform_full_preset(self):
     """
     Resets all equipment parameters to their default values
     """
     (err, msg) = W.PerformFullPreset(self)
     self._error_check(err, msg)