How to use the nidmm.errors.handle_error function in nidmm

To help you get started, we’ve selected a few nidmm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ni / nimi-python / generated / nidmm / session.py View on Github external
Returns the current **Temperature** of the device.

        Note: The NI 4050 and NI 4060 are not supported.

        Args:
            options (string): Reserved.

        Returns:
            temperature (float): Returns the current **temperature** of the device.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        options_ctype = ctypes.create_string_buffer(options.encode(self._encoding))  # case 3
        temperature_ctype = visatype.ViReal64()  # case 14
        error_code = self._library.niDMM_GetDevTemp(vi_ctype, options_ctype, ctypes.pointer(temperature_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return float(temperature_ctype.value)
github ni / nimi-python / generated / nidmm / session.py View on Github external
| 0 | Running                    |
                +---+----------------------------+
                | 1 | Finished with backlog      |
                +---+----------------------------+
                | 2 | Finished with no backlog   |
                +---+----------------------------+
                | 3 | Paused                     |
                +---+----------------------------+
                | 4 | No acquisition in progress |
                +---+----------------------------+
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        acquisition_backlog_ctype = visatype.ViInt32()  # case 14
        acquisition_status_ctype = visatype.ViInt16()  # case 14
        error_code = self._library.niDMM_ReadStatus(vi_ctype, ctypes.pointer(acquisition_backlog_ctype), ctypes.pointer(acquisition_status_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus(acquisition_status_ctype.value)
github ni / nimi-python / generated / nidmm / session.py View on Github external
error code. This may happen if an external trigger has not been
                received, or if the specified timeout is not long enough for the
                acquisition to complete.

                The valid range is 0–86400000. The default value is
                NIDMM_VAL_TIME_LIMIT_AUTO (-1). The DMM calculates the timeout
                automatically.

        Returns:
            reading (float): The measured value returned from the DMM.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        maximum_time_ctype = visatype.ViInt32(maximum_time)  # case 9
        reading_ctype = visatype.ViReal64()  # case 14
        error_code = self._library.niDMM_Read(vi_ctype, maximum_time_ctype, ctypes.pointer(reading_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return float(reading_ctype.value)
github ni / nimi-python / generated / nidmm / session.py View on Github external
ac_maximum_frequency_hz (float): Specifies the maximum expected frequency component of the input signal
                in hertz within the device limits. This parameter is used only for error
                checking and verifies that the value of this parameter is less than the
                maximum frequency of the device.

                This parameter affects the DMM only when you set the
                function attribute to AC measurements. The driver sets the
                AC_MAX_FREQ attribute to this value. The valid range is 1
                Hz–300 kHz for the NI 4080/4081/4082 and the NI 4070/4071/4072, 10
                Hz–100 Hz for the NI 4065, and 20 Hz–25 kHz for the NI 4050 and NI 4060.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        ac_minimum_frequency_hz_ctype = visatype.ViReal64(ac_minimum_frequency_hz)  # case 9
        ac_maximum_frequency_hz_ctype = visatype.ViReal64(ac_maximum_frequency_hz)  # case 9
        error_code = self._library.niDMM_ConfigureACBandwidth(vi_ctype, ac_minimum_frequency_hz_ctype, ac_maximum_frequency_hz_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / nidmm / session.py View on Github external
Returns:
            error_code (int): Returns the **error_code** for the session or execution thread. If you
                pass 0 for the **Buffer_Size**, you can pass VI_NULL for this
                parameter.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        error_code_ctype = visatype.ViStatus()  # case 14
        buffer_size_ctype = visatype.ViInt32()  # case 7
        description_ctype = None  # case 12
        error_code = self._library.niDMM_GetError(vi_ctype, ctypes.pointer(error_code_ctype), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True)
        buffer_size_ctype = visatype.ViInt32(error_code)  # case 7.5
        description_ctype = (visatype.ViChar * buffer_size_ctype.value)()  # case 12.5
        error_code = self._library.niDMM_GetError(vi_ctype, ctypes.pointer(error_code_ctype), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True)
        return int(error_code_ctype.value), description_ctype.value.decode(self._encoding)
github ni / nimi-python / generated / nidmm / session.py View on Github external
| NIDMM_VAL_TEMP_RTD_PT3911       |
                +---------------------------------+
                | NIDMM_VAL_TEMP_RTD_PT3928       |
                +---------------------------------+
                | \*No standard. Check the TCR.   |
                +---------------------------------+
            rtd_resistance (float): Specifies the RTD resistance in ohms at 0 °C. NI-DMM uses this value to
                set the RTD Resistance property. The default is 100 (Ω).
        '''
        if type(rtd_type) is not enums.RTDType:
            raise TypeError('Parameter mode must be of type ' + str(enums.RTDType))
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        rtd_type_ctype = visatype.ViInt32(rtd_type.value)  # case 10
        rtd_resistance_ctype = visatype.ViReal64(rtd_resistance)  # case 9
        error_code = self._library.niDMM_ConfigureRTDType(vi_ctype, rtd_type_ctype, rtd_resistance_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / nidmm / session.py View on Github external
(-3.0). The default is 0.001 V.

                Note:
                NI-DMM ignores this parameter for capacitance and inductance
                measurements on the NI 4072. To achieve better resolution for such
                measurements, use the LC_NUMBER_MEAS_TO_AVERAGE
                attribute.
        '''
        if type(measurement_function) is not enums.Function:
            raise TypeError('Parameter mode must be of type ' + str(enums.Function))
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        measurement_function_ctype = visatype.ViInt32(measurement_function.value)  # case 10
        range_ctype = visatype.ViReal64(range)  # case 9
        resolution_absolute_ctype = visatype.ViReal64(resolution_absolute)  # case 9
        error_code = self._library.niDMM_ConfigureMeasurementAbsolute(vi_ctype, measurement_function_ctype, range_ctype, resolution_absolute_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / nidmm / session.py View on Github external
Returns:
            month (int): Indicates the **month** of the last calibration.
            day (int): Indicates the **day** of the last calibration.
            year (int): Indicates the **year** of the last calibration.
            hour (int): Indicates the **hour** of the last calibration.
            minute (int): Indicates the **minute** of the last calibration.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        cal_type_ctype = visatype.ViInt32(cal_type)  # case 9
        month_ctype = visatype.ViInt32()  # case 14
        day_ctype = visatype.ViInt32()  # case 14
        year_ctype = visatype.ViInt32()  # case 14
        hour_ctype = visatype.ViInt32()  # case 14
        minute_ctype = visatype.ViInt32()  # case 14
        error_code = self._library.niDMM_GetCalDateAndTime(vi_ctype, cal_type_ctype, ctypes.pointer(month_ctype), ctypes.pointer(day_ctype), ctypes.pointer(year_ctype), ctypes.pointer(hour_ctype), ctypes.pointer(minute_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value)
github ni / nimi-python / generated / nidmm / session.py View on Github external
def abort(self):
        '''abort

        Aborts a previously initiated measurement and returns the DMM to the
        Idle state.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        error_code = self._library.niDMM_Abort(vi_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / nidmm / session.py View on Github external
session['0,1']._get_attribute_vi_boolean(attribute_id)

        Args:
            attribute_id (int): Pass the ID of an attribute.

        Returns:
            attribute_value (bool): Returns the current value of the attribute. Pass the address of a
                ViBoolean variable.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case 1
        channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding))  # case 2
        attribute_id_ctype = visatype.ViAttr(attribute_id)  # case 9
        attribute_value_ctype = visatype.ViBoolean()  # case 14
        error_code = self._library.niDMM_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, ctypes.pointer(attribute_value_ctype))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return bool(attribute_value_ctype.value)