nidcpower module
Installation
As a prerequisite to using the nidcpower module, you must install the NI-DCPower runtime on your system. Visit ni.com/downloads to download the driver runtime for your devices.
The nimi-python modules (i.e. for NI-DCPower) can be installed with pip:
$ python -m pip install nidcpower
Usage
The following is a basic example of using the nidcpower module to open a session to a Source Meter Unit and measure voltage and current.
import nidcpower
# Configure the session.
with nidcpower.Session(resource_name='PXI1Slot2/0') as session:
session.measure_record_length = 20
session.measure_record_length_is_finite = True
session.measure_when = nidcpower.MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE
session.voltage_level = 5.0
session.commit()
print('Effective measurement rate: {0} S/s'.format(session.measure_record_delta_time / 1))
samples_acquired = 0
print('Channel Num Voltage Current In Compliance')
row_format = '{0:15} {1:3d} {2:8.6f} {3:8.6f} {4}'
with session.initiate():
channel_indices = '0-{0}'.format(session.channel_count - 1)
channels = session.get_channel_names(channel_indices)
for i, channel_name in enumerate(channels):
samples_acquired = 0
while samples_acquired < 20:
measurements = session.channels[channel_name].fetch_multiple(count=session.fetch_backlog)
samples_acquired += len(measurements)
for i in range(len(measurements)):
print(row_format.format(channel_name, i, measurements[i].voltage, measurements[i].current, measurements[i].in_compliance))
API Reference
- Session
- Methods
- abort
- clear_latched_output_cutoff_state
- close
- commit
- configure_aperture_time
- configure_lcr_compensation
- configure_lcr_custom_cable_compensation
- create_advanced_sequence
- create_advanced_sequence_commit_step
- create_advanced_sequence_step
- delete_advanced_sequence
- disable
- export_attribute_configuration_buffer
- export_attribute_configuration_file
- fetch_multiple
- fetch_multiple_lcr
- get_channel_name
- get_channel_names
- get_ext_cal_last_date_and_time
- get_ext_cal_last_temp
- get_ext_cal_recommended_interval
- get_lcr_compensation_data
- get_lcr_compensation_last_date_and_time
- get_lcr_custom_cable_compensation_data
- get_self_cal_last_date_and_time
- get_self_cal_last_temp
- import_attribute_configuration_buffer
- import_attribute_configuration_file
- initiate
- lock
- measure
- measure_multiple
- measure_multiple_lcr
- perform_lcr_load_compensation
- perform_lcr_open_compensation
- perform_lcr_open_custom_cable_compensation
- perform_lcr_short_compensation
- perform_lcr_short_custom_cable_compensation
- query_in_compliance
- query_latched_output_cutoff_state
- query_max_current_limit
- query_max_voltage_level
- query_min_current_limit
- query_output_state
- read_current_temperature
- reset
- reset_device
- reset_with_defaults
- self_cal
- self_test
- send_software_edge_trigger
- set_sequence
- unlock
- wait_for_event
- Properties
- active_advanced_sequence
- active_advanced_sequence_step
- actual_power_allocation
- aperture_time
- aperture_time_auto_mode
- aperture_time_units
- autorange
- autorange_aperture_time_mode
- autorange_behavior
- autorange_maximum_delay_after_range_change
- autorange_minimum_aperture_time
- autorange_minimum_aperture_time_units
- autorange_minimum_current_range
- autorange_minimum_voltage_range
- autorange_threshold_mode
- auto_zero
- auxiliary_power_source_available
- cable_length
- channel_count
- compliance_limit_symmetry
- current_compensation_frequency
- current_gain_bandwidth
- current_level
- current_level_autorange
- current_level_range
- current_limit
- current_limit_autorange
- current_limit_behavior
- current_limit_high
- current_limit_low
- current_limit_range
- current_pole_zero_ratio
- dc_noise_rejection
- digital_edge_measure_trigger_input_terminal
- digital_edge_pulse_trigger_input_terminal
- digital_edge_sequence_advance_trigger_input_terminal
- digital_edge_shutdown_trigger_input_terminal
- digital_edge_source_trigger_input_terminal
- digital_edge_start_trigger_input_terminal
- driver_setup
- exported_measure_trigger_output_terminal
- exported_pulse_trigger_output_terminal
- exported_sequence_advance_trigger_output_terminal
- exported_source_trigger_output_terminal
- exported_start_trigger_output_terminal
- fetch_backlog
- instrument_firmware_revision
- instrument_manufacturer
- instrument_mode
- instrument_model
- interlock_input_open
- io_resource_descriptor
- isolation_state
- lcr_actual_load_reactance
- lcr_actual_load_resistance
- lcr_ac_dither_enabled
- lcr_ac_electrical_cable_length_delay
- lcr_automatic_level_control
- lcr_current_amplitude
- lcr_current_range
- lcr_custom_measurement_time
- lcr_dc_bias_automatic_level_control
- lcr_dc_bias_current_level
- lcr_dc_bias_current_range
- lcr_dc_bias_source
- lcr_dc_bias_transient_response
- lcr_dc_bias_voltage_level
- lcr_dc_bias_voltage_range
- lcr_frequency
- lcr_impedance_auto_range
- lcr_impedance_range
- lcr_impedance_range_source
- lcr_load_capacitance
- lcr_load_compensation_enabled
- lcr_load_inductance
- lcr_load_resistance
- lcr_measured_load_reactance
- lcr_measured_load_resistance
- lcr_measurement_time
- lcr_open_compensation_enabled
- lcr_open_conductance
- lcr_open_short_load_compensation_data_source
- lcr_open_susceptance
- lcr_short_compensation_enabled
- lcr_short_custom_cable_compensation_enabled
- lcr_short_reactance
- lcr_short_resistance
- lcr_source_aperture_time
- lcr_source_delay_mode
- lcr_stimulus_function
- lcr_voltage_amplitude
- lcr_voltage_range
- logical_name
- measure_buffer_size
- measure_complete_event_delay
- measure_complete_event_output_behavior
- measure_complete_event_output_terminal
- measure_complete_event_pulse_polarity
- measure_complete_event_pulse_width
- measure_complete_event_toggle_initial_state
- measure_record_delta_time
- measure_record_length
- measure_record_length_is_finite
- measure_trigger_type
- measure_when
- merged_channels
- output_capacitance
- output_connected
- output_cutoff_current_change_limit_high
- output_cutoff_current_change_limit_low
- output_cutoff_current_measure_limit_high
- output_cutoff_current_measure_limit_low
- output_cutoff_current_overrange_enabled
- output_cutoff_delay
- output_cutoff_enabled
- output_cutoff_voltage_change_limit_high
- output_cutoff_voltage_change_limit_low
- output_cutoff_voltage_output_limit_high
- output_cutoff_voltage_output_limit_low
- output_enabled
- output_function
- output_resistance
- overranging_enabled
- ovp_enabled
- ovp_limit
- power_allocation_mode
- power_line_frequency
- power_source
- power_source_in_use
- pulse_bias_current_level
- pulse_bias_current_limit
- pulse_bias_current_limit_high
- pulse_bias_current_limit_low
- pulse_bias_delay
- pulse_bias_voltage_level
- pulse_bias_voltage_limit
- pulse_bias_voltage_limit_high
- pulse_bias_voltage_limit_low
- pulse_complete_event_output_terminal
- pulse_complete_event_pulse_polarity
- pulse_complete_event_pulse_width
- pulse_current_level
- pulse_current_level_range
- pulse_current_limit
- pulse_current_limit_high
- pulse_current_limit_low
- pulse_current_limit_range
- pulse_off_time
- pulse_on_time
- pulse_trigger_type
- pulse_voltage_level
- pulse_voltage_level_range
- pulse_voltage_limit
- pulse_voltage_limit_high
- pulse_voltage_limit_low
- pulse_voltage_limit_range
- query_instrument_status
- ready_for_pulse_trigger_event_output_terminal
- ready_for_pulse_trigger_event_pulse_polarity
- ready_for_pulse_trigger_event_pulse_width
- requested_power_allocation
- reset_average_before_measurement
- samples_to_average
- self_calibration_persistence
- sense
- sequence_advance_trigger_type
- sequence_engine_done_event_output_behavior
- sequence_engine_done_event_output_terminal
- sequence_engine_done_event_pulse_polarity
- sequence_engine_done_event_pulse_width
- sequence_engine_done_event_toggle_initial_state
- sequence_iteration_complete_event_output_behavior
- sequence_iteration_complete_event_output_terminal
- sequence_iteration_complete_event_pulse_polarity
- sequence_iteration_complete_event_pulse_width
- sequence_iteration_complete_event_toggle_initial_state
- sequence_loop_count
- sequence_loop_count_is_finite
- sequence_step_delta_time
- sequence_step_delta_time_enabled
- serial_number
- shutdown_trigger_type
- simulate
- source_complete_event_output_behavior
- source_complete_event_output_terminal
- source_complete_event_pulse_polarity
- source_complete_event_pulse_width
- source_complete_event_toggle_initial_state
- source_delay
- source_mode
- source_trigger_type
- specific_driver_description
- specific_driver_prefix
- specific_driver_revision
- specific_driver_vendor
- start_trigger_type
- supported_instrument_models
- transient_response
- voltage_compensation_frequency
- voltage_gain_bandwidth
- voltage_level
- voltage_level_autorange
- voltage_level_range
- voltage_limit
- voltage_limit_autorange
- voltage_limit_high
- voltage_limit_low
- voltage_limit_range
- voltage_pole_zero_ratio
- Repeated Capabilities
- Enums
- ApertureTimeAutoMode
- ApertureTimeUnits
- AutoZero
- AutorangeApertureTimeMode
- AutorangeBehavior
- AutorangeThresholdMode
- CableLength
CableLength
CableLength.ZERO_M
CableLength.NI_STANDARD_0_5M
CableLength.NI_STANDARD_1M
CableLength.NI_STANDARD_2M
CableLength.NI_STANDARD_4M
CableLength.NI_STANDARD_TRIAXIAL_1M
CableLength.NI_STANDARD_TRIAXIAL_2M
CableLength.NI_STANDARD_TRIAXIAL_4M
CableLength.CUSTOM_ONBOARD_STORAGE
CableLength.CUSTOM_AS_CONFIGURED
- ComplianceLimitSymmetry
- CurrentLimitBehavior
- DCNoiseRejection
- Event
- EventOutputBehavior
- EventToggleInitialState
- InstrumentMode
- LCRCompensationType
- LCRDCBiasSource
- LCRDCBiasTransientResponse
- LCRImpedanceRangeSource
- LCRMeasurementTime
- LCROpenShortLoadCompensationDataSource
- LCRReferenceValueType
- LCRSourceDelayMode
- LCRStimulusFunction
- MeasureWhen
- MeasurementTypes
- OutputCapacitance
- OutputCutoffReason
OutputCutoffReason
OutputCutoffReason.ALL
OutputCutoffReason.VOLTAGE_OUTPUT_HIGH
OutputCutoffReason.VOLTAGE_OUTPUT_LOW
OutputCutoffReason.CURRENT_MEASURE_HIGH
OutputCutoffReason.CURRENT_MEASURE_LOW
OutputCutoffReason.VOLTAGE_CHANGE_HIGH
OutputCutoffReason.VOLTAGE_CHANGE_LOW
OutputCutoffReason.CURRENT_CHANGE_HIGH
OutputCutoffReason.CURRENT_CHANGE_LOW
- OutputFunction
- OutputStates
- Polarity
- PowerAllocationMode
- PowerSource
- PowerSourceInUse
- SelfCalibrationPersistence
- SendSoftwareEdgeTriggerType
- Sense
- SourceMode
- TransientResponse
- TriggerType
- Exceptions and Warnings
- Examples
- gRPC Support