Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
For the NI 4050 and NI 4060, the error codes returned for self-test
failures include the following:
- NIDMM_ERROR_AC_TEST_FAILURE
- NIDMM_ERROR_DC_TEST_FAILURE
- NIDMM_ERROR_RESISTANCE_TEST_FAILURE
These error codes indicate that the DMM should be repaired.
For the NI 4080/4081/4082 and the NI 4070/4071/4072, the error code
returned for a self-test failure is NIDMM_ERROR_SELF_TEST_FAILURE.
This error code indicates that the DMM should be repaired.
'''
vi_ctype = visatype.ViSession(self._vi) # case 1
self_test_result_ctype = visatype.ViInt16() # case 14
self_test_message_ctype = (visatype.ViChar * 256)() # case 11
error_code = self._library.niDMM_self_test(vi_ctype, ctypes.pointer(self_test_result_ctype), self_test_message_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding)
For the NI 4050 and NI 4060, the error codes returned for self-test
failures include the following:
- NIDMM_ERROR_AC_TEST_FAILURE
- NIDMM_ERROR_DC_TEST_FAILURE
- NIDMM_ERROR_RESISTANCE_TEST_FAILURE
These error codes indicate that the DMM should be repaired.
For the NI 4080/4081/4082 and the NI 4070/4071/4072, the error code
returned for a self-test failure is NIDMM_ERROR_SELF_TEST_FAILURE.
This error code indicates that the DMM should be repaired.
'''
vi_ctype = visatype.ViSession(self._vi) # case 1
self_test_result_ctype = visatype.ViInt16() # case 14
self_test_message_ctype = (visatype.ViChar * 256)() # case 11
error_code = self._library.niDMM_self_test(vi_ctype, ctypes.pointer(self_test_result_ctype), self_test_message_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding)
def self_cal(self):
'''self_cal
For the NI 4080/4081/4082 and the NI 4070/4071/4072, executes the
self-calibration routine to maintain measurement accuracy.
Note:
This function calls reset, and any configurations previous to
the call will be lost. All attributes will be set to their default
values after the call returns.
'''
vi_ctype = visatype.ViSession(self._vi) # case 1
error_code = self._library.niDMM_SelfCal(vi_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
def _get_error(self):
'''_get_error
Returns the error information associated with the
**Instrument_Handle**. This function retrieves and then clears the
error information for the session. If you leave the
**Instrument_Handle** unwired, this function retrieves and then clears
the error information for the process.
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)
Tip:
This method requires repeated capabilities (usually channels). If called directly on the
nidmm.Session object, then the method will use all repeated capabilities in the session.
You can specify a subset of repeated capabilities using the Python index notation on an
nidmm.Session instance, and calling this method on the result.:
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)
The valid range is 0–86400000. The default value is
NIDMM_VAL_TIME_LIMIT_AUTO (-1). The DMM calculates the timeout
automatically.
Returns:
reading_array (list of float): An array of measurement values.
Note:
The size of the **Reading_Array** must be at least the size that you
specify for the **Array_Size** parameter.
actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM.
'''
vi_ctype = visatype.ViSession(self._vi) # case 1
maximum_time_ctype = visatype.ViInt32(maximum_time) # case 9
array_size_ctype = visatype.ViInt32(array_size) # case 8
reading_array_ctype = (visatype.ViReal64 * array_size)() # case 13
actual_number_of_points_ctype = visatype.ViInt32() # case 14
error_code = self._library.niDMM_FetchMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, ctypes.pointer(actual_number_of_points_ctype))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return [float(reading_array_ctype[i]) for i in range(array_size_ctype.value)]
open cable compensation **Conductance** and **Susceptance** values. You
can use the return values of this function as inputs to
configure_open_cable_comp_values.
This function returns an error if the value of the function
attribute is not set to NIDMM_VAL_CAPACITANCE (1005) or
NIDMM_VAL_INDUCTANCE (1006).
Returns:
conductance (float): **conductance** is the measured value of open cable compensation
**conductance**.
susceptance (float): **susceptance** is the measured value of open cable compensation
**susceptance**.
'''
vi_ctype = visatype.ViSession(self._vi) # case 1
conductance_ctype = visatype.ViReal64() # case 14
susceptance_ctype = visatype.ViReal64() # case 14
error_code = self._library.niDMM_PerformOpenCableComp(vi_ctype, ctypes.pointer(conductance_ctype), ctypes.pointer(susceptance_ctype))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return float(conductance_ctype.value), float(susceptance_ctype.value)