nibcq.DCIR

class nibcq.DCIR(device: nibcq._device.Device, test_parameters: DCIRTestParameters)

Bases: nibcq.measurement.Measurement

Direct Current Internal Resistance (DCIR) measurement handler class.

This class implements two-point DC resistance measurements using an Electronic Load (ELoad) configured as an electronic load. DCIR measurements characterize the internal resistance of electrochemical systems, batteries, fuel cells, and other devices by applying controlled current loads and measuring voltage response.

The DCIR measurement applies two sequential current loads: first a light load (20% of maximum current) followed by a heavy load (100% of maximum current). The internal resistance is calculated using Ohm’s law from the voltage and current differences: R = (V1 - V2) / (I1 - I2).

This measurement is fundamental in battery testing and electrochemical analysis for characterizing device performance, health monitoring, and quality control. Unlike AC impedance measurements, DCIR provides the DC resistance component which is critical for power delivery and efficiency calculations.

The class supports only NI PXIe-4051 electronic loads, which provide the necessary current sinking capability and measurement precision required for accurate DCIR measurements.

Example

>>> # Configure measurement parameters
>>> params = DCIRTestParameters(
...     max_load_current=2.0,
...     powerline_frequency=PowerlineFrequency.FREQ_50_HZ
... )
>>>
>>> # Connect to electronic load device
>>> device = Device.create(DeviceFamily.ELOAD, "PXI1Slot2")
>>> dcir = DCIR(device, params)
>>>
>>> # Run measurement
>>> resistance = dcir.run()
>>> print(f"Internal resistance: {resistance:.4f} Ohms")
Parameters:
DEVICE_FAMILY: Final[nibcq.enums.DeviceFamily]

Device family for DCIR measurements.

Type:

DeviceFamily

property test_parameters: DCIRTestParameters

Get the current DCIR test configuration parameters.

Returns:

The current measurement configuration including

max_load_current and powerline_frequency settings. These parameters control the discharge current levels and noise rejection characteristics.

Return type:

DCIRTestParameters

Raises:

ValueError – If test parameters have not been properly initialized during object construction.

property measurement_data: nibcq.measurement.SMUMeasurement

Get the processed measurement data from the last DCIR test.

Returns voltage and current measurement data collected during the two-phase discharge sequence. This data includes all samples from both discharge periods and can be used for detailed analysis or custom calculations.

Returns:

Processed measurement data containing voltage_values and

current_values lists with samples from both discharge periods. tone_frequency is set to 0 for DC measurements. Returns None if no measurement has been performed yet.

Return type:

SMUMeasurement

property result: float

Get the calculated internal resistance result from the last measurement.

Returns:

The calculated internal resistance in Ohms from the most recent

DCIR measurement. Calculated using R = (V1 - V2) / (I1 - I2) where subscripts refer to the two discharge current levels. Returns None if no measurement has been completed.

Return type:

float

run() float

Execute the complete DCIR measurement process and return the result.

Performs the full DCIR measurement sequence including device configuration, two-phase discharge measurement, and internal resistance calculation. The method coordinates all measurement steps and ensures proper resource management through session locking.

The measurement process follows these steps: 1. Acquire exclusive device session lock for thread safety 2. Configure the electronic load with calculated parameters 3. Execute the two-phase discharge measurement sequence 4. Calculate internal resistance from voltage and current data 5. Validate the result for mathematical and physical validity 6. Release device session lock and return the resistance value

Returns:

The measured internal resistance in Ohms. Valid results are finite,

positive values representing the DC resistance of the DUT under the specified load conditions.

Return type:

float

Raises:
  • ValueError – If the calculated resistance is NaN (zero current difference) or infinite (indicating measurement or calculation errors), or if measurement data validation fails.

  • SMUParameterError – If device configuration fails due to invalid parameters

  • RuntimeError – If the measurement process fails at any step due to hardware communication errors, device malfunctions, or resource conflicts with other measurement sessions.

  • TimeoutError – If the measurement sequence does not complete within the calculated timeout period.

Example

>>> # Configure and run DCIR measurement
>>> params = DCIRTestParameters(max_load_current=2.0)
>>> dcir = DCIR(device, params)
>>> resistance = dcir.run()
>>> print(f"DCIR: {resistance:.4f} Ohms")
property acceptable_temperature_delta: float

Get the acceptable temperature delta for compensation validation.

Returns the maximum allowed temperature difference from the device’s temperature capability. This is a pass-through property that delegates to the underlying TemperatureCapability.

Returns:

The acceptable temperature delta in degrees, or NaN if no temperature capability

Return type:

float

Examples

>>> measurement = EIS(device)
>>> measurement.acceptable_temperature_delta = 2.5
>>> delta = measurement.acceptable_temperature_delta
property temperature: float

Get the latest temperature reading from the device.

Returns:

The most recent temperature measurement, or NaN if no temperature capability

Return type:

float

property temperature_range: CenteredRange

Get the latest temperature reading from the device, coupled with the user-set delta.

Returns:

A CenteredRange representing the most recent temperature measurement (NaN if not available), along with the acceptable temperature delta (NaN if not set).

Return type:

CenteredRange

measure_temperature() CenteredRange

Get a new temperature reading from the device.

Returns:

Current temperature reading, or NaN if no temperature capability

Return type:

CenteredRange

validate_temperature(target_temperature: CenteredRange) bool

Validate the current temperature against the compensation file’s target.

Delegates to the device’s temperature capability for validation. The capability handles all validation logic including checking if thermocouple is configured, using overridden delta values if set, and printing appropriate warnings.

Parameters:

target_temperature (CenteredRange) – The target temperature parameters for validation

Returns:

True if thermocouple is configured and temperature is within range.

False if thermocouple is not configured (capability missing or not set up), or if target temperature/delta is NaN.

Return type:

bool

Raises:

TemperatureError – If the current temperature exceeds the target ± delta range (only raised when capability is configured)

Examples

>>> measurement = EIS(device)
>>> measurement.measure_temperature()
>>> target = compensation.temperature_parameter
>>> is_valid = measurement.validate_temperature(target)