Skip to content

Commit

Permalink
add shunt cal api support for nidaqmx python
Browse files Browse the repository at this point in the history
  • Loading branch information
charitylxy committed Jan 5, 2024
1 parent f5c7da3 commit 3103c71
Show file tree
Hide file tree
Showing 7 changed files with 790 additions and 0 deletions.
28 changes: 28 additions & 0 deletions generated/nidaqmx/_base_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,34 @@ def is_task_done(self, task):
def load_task(self, session_name):
raise NotImplementedError

@abc.abstractmethod
def perform_bridge_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, bridge_resistance,
skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, bridge_resistance,
skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def perform_strain_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def perform_strain_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
Expand Down
54 changes: 54 additions & 0 deletions generated/nidaqmx/_grpc_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,60 @@ def load_task(self, session_name):
metadata=metadata)
return response.task, response.new_session_initialized

def perform_bridge_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, bridge_resistance,
skip_unsupported_channels):
response = self._invoke(
self._client.PerformBridgeShuntCal,
grpc_types.PerformBridgeShuntCalRequest(
task=task, channel=channel,
shunt_resistor_value=shunt_resistor_value,
shunt_resistor_location=shunt_resistor_location,
bridge_resistance=bridge_resistance,
skip_unsupported_channels=skip_unsupported_channels))

def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, bridge_resistance,
skip_unsupported_channels):
response = self._invoke(
self._client.PerformBridgeShuntCalEx,
grpc_types.PerformBridgeShuntCalExRequest(
task=task, channel=channel,
shunt_resistor_value=shunt_resistor_value,
shunt_resistor_location=shunt_resistor_location,
shunt_resistor_select=shunt_resistor_select,
shunt_resistor_source=shunt_resistor_source,
bridge_resistance=bridge_resistance,
skip_unsupported_channels=skip_unsupported_channels))

def perform_strain_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, skip_unsupported_channels):
response = self._invoke(
self._client.PerformStrainShuntCal,
grpc_types.PerformStrainShuntCalRequest(
task=task, channel=channel,
shunt_resistor_value=shunt_resistor_value,
shunt_resistor_location=shunt_resistor_location,
skip_unsupported_channels=skip_unsupported_channels))

def perform_strain_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, skip_unsupported_channels):
response = self._invoke(
self._client.PerformStrainShuntCalEx,
grpc_types.PerformStrainShuntCalExRequest(
task=task, channel=channel,
shunt_resistor_value=shunt_resistor_value,
shunt_resistor_location=shunt_resistor_location,
shunt_resistor_select=shunt_resistor_select,
shunt_resistor_source=shunt_resistor_source,
skip_unsupported_channels=skip_unsupported_channels))

def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
_validate_array_dtype(read_array, numpy.float64)
Expand Down
73 changes: 73 additions & 0 deletions generated/nidaqmx/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3877,6 +3877,79 @@ def load_task(self, session_name):
self.check_for_error(error_code)
return task, new_session_initialized

def perform_bridge_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, bridge_resistance,
skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformBridgeShuntCal
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str,
ctypes.c_double, ctypes.c_long, ctypes.c_double,
c_bool32]

error_code = cfunc(
task, channel, shunt_resistor_value, shunt_resistor_location,
bridge_resistance, skip_unsupported_channels)
self.check_for_error(error_code)

def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, bridge_resistance,
skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformBridgeShuntCalEx
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str,
ctypes.c_double, ctypes.c_long, ctypes.c_long,
ctypes.c_long, ctypes.c_double, c_bool32]

error_code = cfunc(
task, channel, shunt_resistor_value, shunt_resistor_location,
shunt_resistor_select, shunt_resistor_source, bridge_resistance,
skip_unsupported_channels)
self.check_for_error(error_code)

def perform_strain_shunt_cal(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformStrainShuntCal
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str,
ctypes.c_double, ctypes.c_long, c_bool32]

error_code = cfunc(
task, channel, shunt_resistor_value, shunt_resistor_location,
skip_unsupported_channels)
self.check_for_error(error_code)

def perform_strain_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformStrainShuntCalEx
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str,
ctypes.c_double, ctypes.c_long, ctypes.c_long,
ctypes.c_long, c_bool32]

error_code = cfunc(
task, channel, shunt_resistor_value, shunt_resistor_location,
shunt_resistor_select, shunt_resistor_source,
skip_unsupported_channels)
self.check_for_error(error_code)

def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
samps_per_chan_read = ctypes.c_int()
Expand Down
144 changes: 144 additions & 0 deletions generated/nidaqmx/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,150 @@ def is_task_done(self):

return is_task_done

def perform_strain_shunt_cal(
self, channel="", shunt_resistor_value=100000,
shunt_resistor_location=0, skip_unsupported_channels=False):
"""
Performs shunt calibration for the specified channels of the task.
The instances of this polymorphic VI correspond to the type of bridge
sensor. Refer to the calibration procedure for your module for detailed
calibration instructions.
Performs shunt calibration for the specified channels using a strain
gage sensor.
Args:
task/channel in: specifies name of the task or a list of virtual
channels to which the operation applies. If you provide a
list of virtual channels, NI-DAQmx creates a task automatically.
channels: specifies a subset of virtual channels in the task that you
want to calibrate. Use this input if you do not want to calibrate
all the channels in the task or if some channels in the task measure
non-bridge-based sensors. If the input is empty, this VI attempts to
calibrate all virtual channels in the task.
shunt resistor value: specifies the shunt resistance in ohms.
shunt resistor location: specifies the location of the shunt resistor.
skip unsupported channels: specifies whether or not to skip channels that
do not support calibration. If skip unsupported channels is TRUE, this
VI calibrates only supported channels. If FALSE, this VI calibrates the
channels specified by channels. The default is FALSE.
"""
self._interpreter.perform_strain_shunt_cal(
self._handle, channel, shunt_resistor_value,
shunt_resistor_location, skip_unsupported_channels)

def perform_strain_shunt_cal_ex(
self, channel="", shunt_resistor_value=10000,
shunt_resistor_location=0, shunt_resistor_select=0,
shunt_resistor_source=0, skip_unsupported_channels=False):
"""
Performs shunt calibration for the specified channels of the task.
The instances of this polymorphic VI correspond to the type of bridge
sensor. Refer to the calibration procedure for your module for detailed
calibration instructions.
Performs shunt calibration for the specified channels using a strain
gage sensor.
Args:
task/channel in: specifies name of the task or a list of virtual
channels to which the operation applies. If you provide a
list of virtual channels, NI-DAQmx creates a task automatically.
channels: specifies a subset of virtual channels in the task that you
want to calibrate. Use this input if you do not want to calibrate
all the channels in the task or if some channels in the task measure
non-bridge-based sensors. If the input is empty, this VI attempts to
calibrate all virtual channels in the task.
shunt resistor value: specifies the shunt resistance in ohms.
shunt resistor location: specifies the location of the shunt resistor.
shunt resistor select: specifies which shunt calibration switch to enable.
shunt resistor source: specifies which shunt to use.
skip unsupported channels: specifies whether or not to skip channels that
do not support calibration. If skip unsupported channels is TRUE, this
VI calibrates only supported channels. If FALSE, this VI calibrates the
channels specified by channels. The default is FALSE.
"""
self._interpreter.perform_strain_shunt_cal_ex(
self._handle, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, skip_unsupported_channels)

def perform_bridge_shunt_cal(
self, channel="", shunt_resistor_value=100000,
shunt_resistor_location=0, bridge_resistance=120,
skip_unsupported_channels=False):
"""
Performs shunt calibration for the specified channels of the task.
The instances of this polymorphic VI correspond to the type of bridge
sensor. Refer to the calibration procedure for your module for detailed
calibration instructions.
Performs shunt calibration for the specified channels using a bridge sensor.
Args:
task/channel in: specifies name of the task or a list of virtual
channels to which the operation applies. If you provide a
list of virtual channels, NI-DAQmx creates a task automatically.
channels: specifies a subset of virtual channels in the task that you
want to calibrate. Use this input if you do not want to calibrate
all the channels in the task or if some channels in the task measure
non-bridge-based sensors. If the input is empty, this VI attempts to
calibrate all virtual channels in the task.
shunt resistor value: specifies the shunt resistance in ohms.
shunt resistor location: specifies the location of the shunt resistor.
bridge resistance: specifies the bridge resistance in ohms. A value of -1
means to use the nominal bridge resistance specified when you created
the virtual channel.
skip unsupported channels: specifies whether or not to skip channels that
do not support calibration. If skip unsupported channels is TRUE, this
VI calibrates only supported channels. If FALSE, this VI calibrates the
channels specified by channels. The default is FALSE.
"""
self._interpreter.perform_bridge_shunt_cal(
self._handle, channel, shunt_resistor_value,
shunt_resistor_location, bridge_resistance,
skip_unsupported_channels)

def perform_bridge_shunt_cal_ex(
self, channel="", shunt_resistor_value=100000,
shunt_resistor_location=0, shunt_resistor_select=0,
shunt_resistor_source=0, bridge_resistance=120,
skip_unsupported_channels=False):
"""
Performs shunt calibration for the specified channels of the task.
The instances of this polymorphic VI correspond to the type of bridge
sensor. Refer to the calibration procedure for your module for detailed
calibration instructions.
Performs shunt calibration for the specified channels using a bridge sensor.
Args:
task/channel in: specifies name of the task or a list of virtual
channels to which the operation applies. If you provide a
list of virtual channels, NI-DAQmx creates a task automatically.
channels: specifies a subset of virtual channels in the task that you
want to calibrate. Use this input if you do not want to calibrate
all the channels in the task or if some channels in the task measure
non-bridge-based sensors. If the input is empty, this VI attempts to
calibrate all virtual channels in the task.
shunt resistor value: specifies the shunt resistance in ohms.
shunt resistor location: specifies the location of the shunt resistor.
shunt resistor select: specifies which shunt calibration switch to enable.
shunt resistor source: specifies which shunt to use.
bridge resistance: specifies the bridge resistance in ohms. A value of -1
means to use the nominal bridge resistance specified when you created
the virtual channel.
skip unsupported channels: specifies whether or not to skip channels that
do not support calibration. If skip unsupported channels is TRUE, this
VI calibrates only supported channels. If FALSE, this VI calibrates the
channels specified by channels. The default is FALSE.
"""
self._interpreter.perform_bridge_shunt_cal_ex(
self._handle, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
shunt_resistor_source, bridge_resistance,
skip_unsupported_channels)

def read(self, number_of_samples_per_channel=NUM_SAMPLES_UNSET,
timeout=10.0):
"""
Expand Down
Loading

0 comments on commit 3103c71

Please sign in to comment.