Skip to content

Commit 23ea226

Browse files
authored
[26Q1] Add features from DAQmx 26.0 release (Calculated Power and A, C-type Thermocouples) (#876)
* add DAQmxCreateAICalculatedPowerChan python api * Fix formatting * Fix codegen error * Add grpc codegen error workaround * Remove waveform changes from nidaqmx proto * Fix PR build * Remove waveform channges from function metadata * Update Changelog * Update nidaqmx MAX config file * Resolve merge conflict * Update 26Q1 MAX config files
1 parent 377cf0a commit 23ea226

File tree

18 files changed

+3088
-2169
lines changed

18 files changed

+3088
-2169
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ All notable changes to this project will be documented in this file.
3535

3636
* ### Major Changes
3737
* (IN PROGRESS behind "WAVEFORM_SUPPORT" feature toggle) Added support for reading and writing Waveform data through gRPC using [NI gRPC Device Server](https://github.com/ni/grpc-device).
38+
* Add support for calculated power channels
39+
* Add support for A and C-type Thermocouples
3840

3941
* ### Known Issues
4042
* ...

generated/nidaqmx/_base_interpreter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@ def create_ai_bridge_chan(
229229
voltage_excit_val, nominal_bridge_resistance, custom_scale_name):
230230
raise NotImplementedError
231231

232+
@abc.abstractmethod
233+
def create_ai_calculated_power_chan(
234+
self, task, voltage_physical_channel, current_physical_channel,
235+
name_to_assign_to_channel, terminal_config, voltage_min_val,
236+
voltage_max_val, current_min_val, current_max_val, units,
237+
shunt_resistor_loc, ext_shunt_resistor_val, custom_scale_name):
238+
raise NotImplementedError
239+
232240
@abc.abstractmethod
233241
def create_ai_charge_chan(
234242
self, task, physical_channel, name_to_assign_to_channel,

generated/nidaqmx/_grpc_interpreter.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,26 @@ def create_ai_bridge_chan(
539539
nominal_bridge_resistance=nominal_bridge_resistance,
540540
custom_scale_name=custom_scale_name))
541541

542+
def create_ai_calculated_power_chan(
543+
self, task, voltage_physical_channel, current_physical_channel,
544+
name_to_assign_to_channel, terminal_config, voltage_min_val,
545+
voltage_max_val, current_min_val, current_max_val, units,
546+
shunt_resistor_loc, ext_shunt_resistor_val, custom_scale_name):
547+
response = self._invoke(
548+
self._client.CreateAICalculatedPowerChan,
549+
grpc_types.CreateAICalculatedPowerChanRequest(
550+
task=task, voltage_physical_channel=voltage_physical_channel,
551+
current_physical_channel=current_physical_channel,
552+
name_to_assign_to_channel=name_to_assign_to_channel,
553+
terminal_config_raw=terminal_config,
554+
voltage_min_val=voltage_min_val,
555+
voltage_max_val=voltage_max_val,
556+
current_min_val=current_min_val,
557+
current_max_val=current_max_val, units_raw=units,
558+
shunt_resistor_loc_raw=shunt_resistor_loc,
559+
ext_shunt_resistor_val=ext_shunt_resistor_val,
560+
custom_scale_name=custom_scale_name))
561+
542562
def create_ai_charge_chan(
543563
self, task, physical_channel, name_to_assign_to_channel,
544564
terminal_config, min_val, max_val, units, custom_scale_name):

generated/nidaqmx/_library_interpreter.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,29 @@ def create_ai_bridge_chan(
696696
voltage_excit_val, nominal_bridge_resistance, custom_scale_name)
697697
self.check_for_error(error_code)
698698

699+
def create_ai_calculated_power_chan(
700+
self, task, voltage_physical_channel, current_physical_channel,
701+
name_to_assign_to_channel, terminal_config, voltage_min_val,
702+
voltage_max_val, current_min_val, current_max_val, units,
703+
shunt_resistor_loc, ext_shunt_resistor_val, custom_scale_name):
704+
cfunc = lib_importer.windll.DAQmxCreateAICalculatedPowerChan
705+
if cfunc.argtypes is None:
706+
with cfunc.arglock:
707+
if cfunc.argtypes is None:
708+
cfunc.argtypes = [
709+
lib_importer.task_handle, ctypes_byte_str,
710+
ctypes_byte_str, ctypes_byte_str, ctypes.c_int,
711+
ctypes.c_double, ctypes.c_double, ctypes.c_double,
712+
ctypes.c_double, ctypes.c_int, ctypes.c_int,
713+
ctypes.c_double, ctypes_byte_str]
714+
715+
error_code = cfunc(
716+
task, voltage_physical_channel, current_physical_channel,
717+
name_to_assign_to_channel, terminal_config, voltage_min_val,
718+
voltage_max_val, current_min_val, current_max_val, units,
719+
shunt_resistor_loc, ext_shunt_resistor_val, custom_scale_name)
720+
self.check_for_error(error_code)
721+
699722
def create_ai_charge_chan(
700723
self, task, physical_channel, name_to_assign_to_channel,
701724
terminal_config, min_val, max_val, units, custom_scale_name):

generated/nidaqmx/_stubs/nidaqmx_pb2.py

Lines changed: 2159 additions & 2153 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/nidaqmx/_stubs/nidaqmx_pb2.pyi

Lines changed: 133 additions & 1 deletion
Large diffs are not rendered by default.

generated/nidaqmx/_stubs/nidaqmx_pb2_grpc.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ def __init__(self, channel):
209209
request_serializer=nidaqmx__pb2.CreateAIBridgeChanRequest.SerializeToString,
210210
response_deserializer=nidaqmx__pb2.CreateAIBridgeChanResponse.FromString,
211211
)
212+
self.CreateAICalculatedPowerChan = channel.unary_unary(
213+
'/nidaqmx_grpc.NiDAQmx/CreateAICalculatedPowerChan',
214+
request_serializer=nidaqmx__pb2.CreateAICalculatedPowerChanRequest.SerializeToString,
215+
response_deserializer=nidaqmx__pb2.CreateAICalculatedPowerChanResponse.FromString,
216+
)
212217
self.CreateAIChargeChan = channel.unary_unary(
213218
'/nidaqmx_grpc.NiDAQmx/CreateAIChargeChan',
214219
request_serializer=nidaqmx__pb2.CreateAIChargeChanRequest.SerializeToString,
@@ -2503,6 +2508,12 @@ def CreateAIBridgeChan(self, request, context):
25032508
context.set_details('Method not implemented!')
25042509
raise NotImplementedError('Method not implemented!')
25052510

2511+
def CreateAICalculatedPowerChan(self, request, context):
2512+
"""Missing associated documentation comment in .proto file."""
2513+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
2514+
context.set_details('Method not implemented!')
2515+
raise NotImplementedError('Method not implemented!')
2516+
25062517
def CreateAIChargeChan(self, request, context):
25072518
"""Missing associated documentation comment in .proto file."""
25082519
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -5167,6 +5178,11 @@ def add_NiDAQmxServicer_to_server(servicer, server):
51675178
request_deserializer=nidaqmx__pb2.CreateAIBridgeChanRequest.FromString,
51685179
response_serializer=nidaqmx__pb2.CreateAIBridgeChanResponse.SerializeToString,
51695180
),
5181+
'CreateAICalculatedPowerChan': grpc.unary_unary_rpc_method_handler(
5182+
servicer.CreateAICalculatedPowerChan,
5183+
request_deserializer=nidaqmx__pb2.CreateAICalculatedPowerChanRequest.FromString,
5184+
response_serializer=nidaqmx__pb2.CreateAICalculatedPowerChanResponse.SerializeToString,
5185+
),
51705186
'CreateAIChargeChan': grpc.unary_unary_rpc_method_handler(
51715187
servicer.CreateAIChargeChan,
51725188
request_deserializer=nidaqmx__pb2.CreateAIChargeChanRequest.FromString,
@@ -7895,6 +7911,23 @@ def CreateAIBridgeChan(request,
78957911
options, channel_credentials,
78967912
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
78977913

7914+
@staticmethod
7915+
def CreateAICalculatedPowerChan(request,
7916+
target,
7917+
options=(),
7918+
channel_credentials=None,
7919+
call_credentials=None,
7920+
insecure=False,
7921+
compression=None,
7922+
wait_for_ready=None,
7923+
timeout=None,
7924+
metadata=None):
7925+
return grpc.experimental.unary_unary(request, target, '/nidaqmx_grpc.NiDAQmx/CreateAICalculatedPowerChan',
7926+
nidaqmx__pb2.CreateAICalculatedPowerChanRequest.SerializeToString,
7927+
nidaqmx__pb2.CreateAICalculatedPowerChanResponse.FromString,
7928+
options, channel_credentials,
7929+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
7930+
78987931
@staticmethod
78997932
def CreateAIChargeChan(request,
79007933
target,

generated/nidaqmx/_stubs/nidaqmx_pb2_grpc.pyi

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@generated by mypy-protobuf. Do not edit manually!
33
isort:skip_file
44
---------------------------------------------------------------------
5-
This file is generated from NI-DAQMX API metadata version 23.0.0
5+
This file is generated from NI-DAQMX API metadata version 26.0.0
66
---------------------------------------------------------------------
77
Proto file for the NI-DAQMX Metadata
88
---------------------------------------------------------------------
@@ -219,6 +219,11 @@ class NiDAQmxStub:
219219
nidaqmx_pb2.CreateAIBridgeChanResponse,
220220
]
221221

222+
CreateAICalculatedPowerChan: grpc.UnaryUnaryMultiCallable[
223+
nidaqmx_pb2.CreateAICalculatedPowerChanRequest,
224+
nidaqmx_pb2.CreateAICalculatedPowerChanResponse,
225+
]
226+
222227
CreateAIChargeChan: grpc.UnaryUnaryMultiCallable[
223228
nidaqmx_pb2.CreateAIChargeChanRequest,
224229
nidaqmx_pb2.CreateAIChargeChanResponse,
@@ -2470,6 +2475,11 @@ class NiDAQmxAsyncStub:
24702475
nidaqmx_pb2.CreateAIBridgeChanResponse,
24712476
]
24722477

2478+
CreateAICalculatedPowerChan: grpc.aio.UnaryUnaryMultiCallable[
2479+
nidaqmx_pb2.CreateAICalculatedPowerChanRequest,
2480+
nidaqmx_pb2.CreateAICalculatedPowerChanResponse,
2481+
]
2482+
24732483
CreateAIChargeChan: grpc.aio.UnaryUnaryMultiCallable[
24742484
nidaqmx_pb2.CreateAIChargeChanRequest,
24752485
nidaqmx_pb2.CreateAIChargeChanResponse,
@@ -4799,6 +4809,13 @@ class NiDAQmxServicer(metaclass=abc.ABCMeta):
47994809
context: _ServicerContext,
48004810
) -> typing.Union[nidaqmx_pb2.CreateAIBridgeChanResponse, collections.abc.Awaitable[nidaqmx_pb2.CreateAIBridgeChanResponse]]: ...
48014811

4812+
@abc.abstractmethod
4813+
def CreateAICalculatedPowerChan(
4814+
self,
4815+
request: nidaqmx_pb2.CreateAICalculatedPowerChanRequest,
4816+
context: _ServicerContext,
4817+
) -> typing.Union[nidaqmx_pb2.CreateAICalculatedPowerChanResponse, collections.abc.Awaitable[nidaqmx_pb2.CreateAICalculatedPowerChanResponse]]: ...
4818+
48024819
@abc.abstractmethod
48034820
def CreateAIChargeChan(
48044821
self,

generated/nidaqmx/constants.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,11 @@ class PowerOutputState(Enum):
479479
OUTPUT_DISABLED = 15503 #: Power output is disabled.
480480

481481

482+
class PowerUnits(Enum):
483+
WATTS = 16203 #: Watts.
484+
FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name.
485+
486+
482487
class PowerUpChannelType(Enum):
483488
CHANNEL_VOLTAGE = 0 #: Voltage Channel
484489
CHANNEL_CURRENT = 1 #: Current Channel
@@ -773,6 +778,8 @@ class ThermocoupleType(Enum):
773778
T = 10086 #: T-type thermocouple.
774779
B = 10047 #: B-type thermocouple.
775780
E = 10055 #: E-type thermocouple.
781+
A = 16208 #: A-type thermocouple.
782+
C = 16209 #: C-type thermocouple.
776783

777784

778785
class TimeUnits(Enum):

generated/nidaqmx/task/channels/_ai_channel.py

Lines changed: 112 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
ExcitationVoltageOrCurrent, FilterResponse, FilterType,
1919
ForceIEPESensorSensitivityUnits, ForceUnits, FrequencyUnits, Impedance1,
2020
InputDataTransferCondition, LVDTSensitivityUnits, LengthUnits,
21-
PowerIdleOutputBehavior, PowerOutputState, PressureUnits, RTDType,
22-
RVDTSensitivityUnits, RawDataCompressionType, ResistanceConfiguration,
23-
ResistanceUnits, ResolutionType, ScaleType, Sense, SensorPowerCfg,
24-
SensorPowerType, ShuntCalSelect, SoundPressureUnits, SourceSelection,
25-
StrainGageBridgeType, StrainGageRosetteMeasurementType,
26-
StrainGageRosetteType, StrainUnits, TemperatureUnits,
27-
TerminalConfiguration, ThermocoupleType, TorqueUnits, UsageTypeAI,
28-
VelocityIEPESensorSensitivityUnits, VelocityUnits, VoltageUnits)
21+
PowerIdleOutputBehavior, PowerOutputState, PowerUnits, PressureUnits,
22+
RTDType, RVDTSensitivityUnits, RawDataCompressionType,
23+
ResistanceConfiguration, ResistanceUnits, ResolutionType, ScaleType,
24+
Sense, SensorPowerCfg, SensorPowerType, ShuntCalSelect,
25+
SoundPressureUnits, SourceSelection, StrainGageBridgeType,
26+
StrainGageRosetteMeasurementType, StrainGageRosetteType, StrainUnits,
27+
TemperatureUnits, TerminalConfiguration, ThermocoupleType, TorqueUnits,
28+
UsageTypeAI, VelocityIEPESensorSensitivityUnits, VelocityUnits,
29+
VoltageUnits)
2930

3031

3132
class AIChannel(Channel):
@@ -882,6 +883,90 @@ def ai_bridge_units(self, val):
882883
def ai_bridge_units(self):
883884
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x2f92)
884885

886+
@property
887+
def ai_calculated_power_current_max(self):
888+
"""
889+
float: Specifies the current maximum value you expect to
890+
measure. This value is in the units you specify with a units
891+
property. When you query this property, it returns the
892+
coerced current maximum value that the device can measure
893+
with the current settings.
894+
"""
895+
896+
val = self._interpreter.get_chan_attribute_double(self._handle, self._name, 0x31ef)
897+
return val
898+
899+
@ai_calculated_power_current_max.setter
900+
def ai_calculated_power_current_max(self, val):
901+
self._interpreter.set_chan_attribute_double(self._handle, self._name, 0x31ef, val)
902+
903+
@ai_calculated_power_current_max.deleter
904+
def ai_calculated_power_current_max(self):
905+
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x31ef)
906+
907+
@property
908+
def ai_calculated_power_current_min(self):
909+
"""
910+
float: Specifies the current minimum value you expect to
911+
measure. This value is in the units you specify with a units
912+
property. When you query this property, it returns the
913+
coerced current minimum value that the device can measure
914+
with the current settings.
915+
"""
916+
917+
val = self._interpreter.get_chan_attribute_double(self._handle, self._name, 0x31f0)
918+
return val
919+
920+
@ai_calculated_power_current_min.setter
921+
def ai_calculated_power_current_min(self, val):
922+
self._interpreter.set_chan_attribute_double(self._handle, self._name, 0x31f0, val)
923+
924+
@ai_calculated_power_current_min.deleter
925+
def ai_calculated_power_current_min(self):
926+
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x31f0)
927+
928+
@property
929+
def ai_calculated_power_voltage_max(self):
930+
"""
931+
float: Specifies the voltage maximum value you expect to
932+
measure. This value is in the units you specify with a units
933+
property. When you query this property, it returns the
934+
coerced voltage maximum value that the device can measure
935+
with the current settings.
936+
"""
937+
938+
val = self._interpreter.get_chan_attribute_double(self._handle, self._name, 0x31ed)
939+
return val
940+
941+
@ai_calculated_power_voltage_max.setter
942+
def ai_calculated_power_voltage_max(self, val):
943+
self._interpreter.set_chan_attribute_double(self._handle, self._name, 0x31ed, val)
944+
945+
@ai_calculated_power_voltage_max.deleter
946+
def ai_calculated_power_voltage_max(self):
947+
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x31ed)
948+
949+
@property
950+
def ai_calculated_power_voltage_min(self):
951+
"""
952+
float: Specifies the voltage minimum value you expect to
953+
measure. This value is in the units you specify with a units
954+
property. When you query this property, it returns the
955+
coerced voltage minimum value that the device can measure
956+
with the current settings.
957+
"""
958+
959+
val = self._interpreter.get_chan_attribute_double(self._handle, self._name, 0x31ee)
960+
return val
961+
962+
@ai_calculated_power_voltage_min.setter
963+
def ai_calculated_power_voltage_min(self, val):
964+
self._interpreter.set_chan_attribute_double(self._handle, self._name, 0x31ee, val)
965+
966+
@ai_calculated_power_voltage_min.deleter
967+
def ai_calculated_power_voltage_min(self):
968+
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x31ee)
969+
885970
@property
886971
def ai_charge_units(self):
887972
"""
@@ -2410,6 +2495,25 @@ def ai_power_supply_fault_detect_enable(self, val):
24102495
def ai_power_supply_fault_detect_enable(self):
24112496
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x3191)
24122497

2498+
@property
2499+
def ai_power_units(self):
2500+
"""
2501+
:class:`nidaqmx.constants.PowerUnits`: Specifies the units to
2502+
use to return power measurements from the channel.
2503+
"""
2504+
2505+
val = self._interpreter.get_chan_attribute_int32(self._handle, self._name, 0x31ec)
2506+
return PowerUnits(val)
2507+
2508+
@ai_power_units.setter
2509+
def ai_power_units(self, val):
2510+
val = val.value
2511+
self._interpreter.set_chan_attribute_int32(self._handle, self._name, 0x31ec, val)
2512+
2513+
@ai_power_units.deleter
2514+
def ai_power_units(self):
2515+
self._interpreter.reset_chan_attribute(self._handle, self._name, 0x31ec)
2516+
24132517
@property
24142518
def ai_pressure_units(self):
24152519
"""

0 commit comments

Comments
 (0)