Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement nidcpower API parity with NI-DCPower 2023 Q1. #1907

Merged
merged 10 commits into from
Apr 11, 2023
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,25 @@ All notable changes to this project will be documented in this file.
* ### `nidcpower` (NI-DCPower)
* #### Added
* Pass Python interpreter information if the driver runtime version supports it. This is used by NI in order to better understand client usage.
* Enums added:
* `CurrentLimitBehavior`
* API parity with NI-DCPower 2023 Q1.
* Properties added:
* `measure_complete_event_output_behavior`
* `measure_complete_event_toggle_initial_state`
* `sequence_engine_done_event_output_behavior`
* `sequence_engine_done_event_toggle_initial_state`
* `sequence_iteration_complete_event_output_behavior`
* `sequence_iteration_complete_event_toggle_initial_state`
* `source_complete_event_output_behavior`
* `source_complete_event_toggle_initial_state`
marcoskirsch marked this conversation as resolved.
Show resolved Hide resolved
* Enums added:
* `CurrentLimitBehavior`
* `EventOutputBehavior`
* `EventToggleInitialState`
* Enum values added:
* `AS_CONFIGURED` added to enum `LCROpenShortLoadCompensationDataSource`
* Methods added:
* `configure_lcr_compensation`
* `get_lcr_compensation_data`
* #### Changed
* Enums reordered:
* `AutoZero`
Expand Down
454 changes: 454 additions & 0 deletions docs/nidcpower/class.rst

Large diffs are not rendered by default.

64 changes: 62 additions & 2 deletions docs/nidcpower/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ AutoZero



Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated.
Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated.



Expand Down Expand Up @@ -461,6 +461,56 @@ Event



EventOutputBehavior
-------------------

.. py:class:: EventOutputBehavior

.. py:attribute:: EventOutputBehavior.PULSE



Output generates a pulse when the event is triggered.





.. py:attribute:: EventOutputBehavior.TOGGLE



Output toggles state when the event is triggered.





EventToggleInitialState
-----------------------

.. py:class:: EventToggleInitialState

.. py:attribute:: EventToggleInitialState.LOW



The initial state is low.





.. py:attribute:: EventToggleInitialState.HIGH



The initial state is high.





InstrumentMode
--------------

Expand Down Expand Up @@ -671,6 +721,16 @@ LCROpenShortLoadCompensationDataSource



.. py:attribute:: LCROpenShortLoadCompensationDataSource.AS_CONFIGURED



Uses the LCR compensation data supplied to :py:meth:`nidcpower.Session.configure_lcr_compensation`. Use this option to manage multiple sets of LCR compensation data.





LCRReferenceValueType
---------------------

Expand Down Expand Up @@ -1130,7 +1190,7 @@ PowerSourceInUse



Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113.
Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113.



Expand Down
6 changes: 6 additions & 0 deletions generated/nidcpower/nidcpower/_grpc_stub_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def configure_aperture_time(self, channel_name, aperture_time, units): # noqa:
grpc_types.ConfigureApertureTimeRequest(vi=self._vi, channel_name=channel_name, aperture_time=aperture_time, units_raw=units.value),
)

def configure_lcr_compensation(self, channel_name, compensation_data): # noqa: N802
raise NotImplementedError('configure_lcr_compensation is not supported over gRPC')

def configure_lcr_custom_cable_compensation(self, channel_name, custom_cable_compensation_data): # noqa: N802
self._invoke(
self._client.ConfigureLCRCustomCableCompensation,
Expand Down Expand Up @@ -251,6 +254,9 @@ def get_ext_cal_recommended_interval(self): # noqa: N802
)
return response.months

def get_lcr_compensation_data(self, channel_name): # noqa: N802
raise NotImplementedError('get_lcr_compensation_data is not supported over gRPC')

def get_lcr_compensation_last_date_and_time(self, channel_name, compensation_type): # noqa: N802
response = self._invoke(
self._client.GetLCRCompensationLastDateAndTime,
Expand Down
18 changes: 18 additions & 0 deletions generated/nidcpower/nidcpower/_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, ctypes_library):
self.niDCPower_ClearLatchedOutputCutoffState_cfunc = None
self.niDCPower_CommitWithChannels_cfunc = None
self.niDCPower_ConfigureApertureTime_cfunc = None
self.niDCPower_ConfigureLCRCompensation_cfunc = None
self.niDCPower_ConfigureLCRCustomCableCompensation_cfunc = None
self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc = None
self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc = None
Expand All @@ -50,6 +51,7 @@ def __init__(self, ctypes_library):
self.niDCPower_GetExtCalLastDateAndTime_cfunc = None
self.niDCPower_GetExtCalLastTemp_cfunc = None
self.niDCPower_GetExtCalRecommendedInterval_cfunc = None
self.niDCPower_GetLCRCompensationData_cfunc = None
self.niDCPower_GetLCRCompensationLastDateAndTime_cfunc = None
self.niDCPower_GetLCRCustomCableCompensationData_cfunc = None
self.niDCPower_GetSelfCalLastDateAndTime_cfunc = None
Expand Down Expand Up @@ -140,6 +142,14 @@ def niDCPower_ConfigureApertureTime(self, vi, channel_name, aperture_time, units
self.niDCPower_ConfigureApertureTime_cfunc.restype = ViStatus # noqa: F405
return self.niDCPower_ConfigureApertureTime_cfunc(vi, channel_name, aperture_time, units)

def niDCPower_ConfigureLCRCompensation(self, vi, channel_name, compensation_data_size, compensation_data): # noqa: N802
with self._func_lock:
if self.niDCPower_ConfigureLCRCompensation_cfunc is None:
self.niDCPower_ConfigureLCRCompensation_cfunc = self._get_library_function('niDCPower_ConfigureLCRCompensation')
self.niDCPower_ConfigureLCRCompensation_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405
self.niDCPower_ConfigureLCRCompensation_cfunc.restype = ViStatus # noqa: F405
return self.niDCPower_ConfigureLCRCompensation_cfunc(vi, channel_name, compensation_data_size, compensation_data)

def niDCPower_ConfigureLCRCustomCableCompensation(self, vi, channel_name, custom_cable_compensation_data_size, custom_cable_compensation_data): # noqa: N802
with self._func_lock:
if self.niDCPower_ConfigureLCRCustomCableCompensation_cfunc is None:
Expand Down Expand Up @@ -316,6 +326,14 @@ def niDCPower_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802
self.niDCPower_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405
return self.niDCPower_GetExtCalRecommendedInterval_cfunc(vi, months)

def niDCPower_GetLCRCompensationData(self, vi, channel_name, compensation_data_size, compensation_data): # noqa: N802
with self._func_lock:
if self.niDCPower_GetLCRCompensationData_cfunc is None:
self.niDCPower_GetLCRCompensationData_cfunc = self._get_library_function('niDCPower_GetLCRCompensationData')
self.niDCPower_GetLCRCompensationData_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405
self.niDCPower_GetLCRCompensationData_cfunc.restype = ViStatus # noqa: F405
return self.niDCPower_GetLCRCompensationData_cfunc(vi, channel_name, compensation_data_size, compensation_data)

def niDCPower_GetLCRCompensationLastDateAndTime(self, vi, channel_name, compensation_type, year, month, day, hour, minute): # noqa: N802
with self._func_lock:
if self.niDCPower_GetLCRCompensationLastDateAndTime_cfunc is None:
Expand Down
24 changes: 24 additions & 0 deletions generated/nidcpower/nidcpower/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ def configure_aperture_time(self, channel_name, aperture_time, units): # noqa:
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return

def configure_lcr_compensation(self, channel_name, compensation_data): # noqa: N802
vi_ctype = _visatype.ViSession(self._vi) # case S110
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
compensation_data_size_ctype = _visatype.ViInt32(0 if compensation_data is None else len(compensation_data)) # case S160
compensation_data_ctype = _get_ctypes_pointer_for_buffer(value=compensation_data, library_type=_visatype.ViInt8) # case B550
error_code = self._library.niDCPower_ConfigureLCRCompensation(vi_ctype, channel_name_ctype, compensation_data_size_ctype, compensation_data_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return

def configure_lcr_custom_cable_compensation(self, channel_name, custom_cable_compensation_data): # noqa: N802
vi_ctype = _visatype.ViSession(self._vi) # case S110
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
Expand Down Expand Up @@ -379,6 +388,21 @@ def get_ext_cal_recommended_interval(self): # noqa: N802
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return int(months_ctype.value)

def get_lcr_compensation_data(self, channel_name): # noqa: N802
vi_ctype = _visatype.ViSession(self._vi) # case S110
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
compensation_data_size_ctype = _visatype.ViInt32() # case S170
compensation_data_ctype = None # case B580
error_code = self._library.niDCPower_GetLCRCompensationData(vi_ctype, channel_name_ctype, compensation_data_size_ctype, compensation_data_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
compensation_data_size_ctype = _visatype.ViInt32(error_code) # case S180
compensation_data_size = compensation_data_size_ctype.value # case B590
compensation_data_array = array.array("b", [0] * compensation_data_size) # case B590
compensation_data_ctype = _get_ctypes_pointer_for_buffer(value=compensation_data_array, library_type=_visatype.ViInt8) # case B590
error_code = self._library.niDCPower_GetLCRCompensationData(vi_ctype, channel_name_ctype, compensation_data_size_ctype, compensation_data_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return compensation_data_array

def get_lcr_compensation_last_date_and_time(self, channel_name, compensation_type): # noqa: N802
vi_ctype = _visatype.ViSession(self._vi) # case S110
channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010
Expand Down
30 changes: 28 additions & 2 deletions generated/nidcpower/nidcpower/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AutoZero(Enum):
'''
ONCE = 1024
r'''
Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated.
Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated.
'''
ON = 1
r'''
Expand Down Expand Up @@ -197,6 +197,28 @@ class Event(Enum):
'''


class EventOutputBehavior(Enum):
PULSE = 1147
r'''
Output generates a pulse when the event is triggered.
'''
TOGGLE = 1148
r'''
Output toggles state when the event is triggered.
'''


class EventToggleInitialState(Enum):
LOW = 1149
r'''
The initial state is low.
'''
HIGH = 1150
r'''
The initial state is high.
'''


class InstrumentMode(Enum):
SMU_PS = 1061
r'''
Expand Down Expand Up @@ -301,6 +323,10 @@ class LCROpenShortLoadCompensationDataSource(Enum):
r'''
Uses the LCR compensation data represented by the relevant LCR compensation properties as generated by perform_lcr_open_compensation, perform_lcr_short_compensation, and perform_lcr_load_compensation. Use this option to manage multiple sets of LCR compensation data. This option applies compensation data from the following properties: lcr_open_conductance, lcr_open_susceptance, lcr_short_resistance, lcr_short_reactance, lcr_measured_load_resistance, lcr_measured_load_reactance, lcr_actual_load_resistance, lcr_actual_load_reactance.
'''
AS_CONFIGURED = 1146
r'''
Uses the LCR compensation data supplied to configure_lcr_compensation. Use this option to manage multiple sets of LCR compensation data.
'''


class LCRReferenceValueType(Enum):
Expand Down Expand Up @@ -498,7 +524,7 @@ class PowerSourceInUse(Enum):
'''
AUXILIARY = 1004
r'''
Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113.
Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113.
'''


Expand Down
1,010 changes: 503 additions & 507 deletions generated/nidcpower/nidcpower/nidcpower_pb2.py

Large diffs are not rendered by default.

33 changes: 0 additions & 33 deletions generated/nidcpower/nidcpower/nidcpower_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ def __init__(self, channel):
request_serializer=nidcpower__pb2.ConfigureOutputFunctionRequest.SerializeToString,
response_deserializer=nidcpower__pb2.ConfigureOutputFunctionResponse.FromString,
)
self.ConfigureOutputRange = channel.unary_unary(
'/nidcpower_grpc.NiDCPower/ConfigureOutputRange',
request_serializer=nidcpower__pb2.ConfigureOutputRangeRequest.SerializeToString,
response_deserializer=nidcpower__pb2.ConfigureOutputRangeResponse.FromString,
)
self.ConfigureOutputResistance = channel.unary_unary(
'/nidcpower_grpc.NiDCPower/ConfigureOutputResistance',
request_serializer=nidcpower__pb2.ConfigureOutputResistanceRequest.SerializeToString,
Expand Down Expand Up @@ -923,12 +918,6 @@ def ConfigureOutputFunction(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigureOutputRange(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ConfigureOutputResistance(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -1773,11 +1762,6 @@ def add_NiDCPowerServicer_to_server(servicer, server):
request_deserializer=nidcpower__pb2.ConfigureOutputFunctionRequest.FromString,
response_serializer=nidcpower__pb2.ConfigureOutputFunctionResponse.SerializeToString,
),
'ConfigureOutputRange': grpc.unary_unary_rpc_method_handler(
servicer.ConfigureOutputRange,
request_deserializer=nidcpower__pb2.ConfigureOutputRangeRequest.FromString,
response_serializer=nidcpower__pb2.ConfigureOutputRangeResponse.SerializeToString,
),
'ConfigureOutputResistance': grpc.unary_unary_rpc_method_handler(
servicer.ConfigureOutputResistance,
request_deserializer=nidcpower__pb2.ConfigureOutputResistanceRequest.FromString,
Expand Down Expand Up @@ -2861,23 +2845,6 @@ def ConfigureOutputFunction(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ConfigureOutputRange(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nidcpower_grpc.NiDCPower/ConfigureOutputRange',
nidcpower__pb2.ConfigureOutputRangeRequest.SerializeToString,
nidcpower__pb2.ConfigureOutputRangeResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ConfigureOutputResistance(request,
target,
Expand Down
Loading