nibcq.DCIR
- class nibcq.DCIR(device: nibcq._device.Device, test_parameters: DCIRTestParameters)
Bases:
nibcq.measurement.MeasurementDirect Current Internal Resistance (DCIR) measurement handler class.
This class implements two-point DC resistance measurements using a Source Measure Unit (SMU) 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 (nibcq._device.Device)
test_parameters (DCIRTestParameters)
- DEVICE_FAMILY: Final[nibcq.enums.DeviceFamily]
Device family for DCIR measurements.
- Type:
- 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:
- 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:
- 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:
- 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:
- Raises:
ValueError – If the calculated resistance is NaN (zero current difference) or infinite (indicating measurement or calculation errors), if device configuration fails due to invalid parameters, or if measurement data validation fails.
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")
- abstractmethod run_with_switching()
Execute DCIR measurement with automatic switching between multiple DUTs.
This method would coordinate DCIR measurements across multiple Device Under Test (DUT) connections using switch matrix hardware. The switching capability would allow sequential testing of multiple cells or devices without manual reconnection, enabling automated battery pack testing and multi-cell analysis.
Currently not implemented for DCIR measurements due to complexity of coordinating electronic load operations with switching matrix timing and the specialized requirements for current sinking applications.
- Raises:
NotImplementedError – DCIR switching functionality is not currently available. Standard DCIR measurements should use the run() method instead.
Note
Future implementation would return a list of tuples containing (SMUCellData, resistance_result) pairs for each tested DUT position.
- property has_switch_capability: bool
Check if the device has switch capability.
- Returns:
True if switch capability is available, False otherwise
- Return type:
- connect_channel(channel: SMUCellData) None
Connect to a specific DUT channel using the device’s switch capability.
- Parameters:
channel (SMUCellData) – SwitchChannel containing connection information
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- disconnect_all() None
Disconnect all channels using the device’s switch capability.
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- wait_for_debounce() None
Wait for switch relays to settle using the device’s switch capability.
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- property switch_cells: List[str] | List[SMUCellData]
Get the configured switch cells from the device.
- Returns:
A list of DUT channel names or SMUCellData objects, which contain the DUT and switch channel information.
- Return type:
List[str] | List[SMUCellData]
- 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:
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:
- 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:
- measure_temperature() CenteredRange
Get a new temperature reading from the device.
- Returns:
Current temperature reading, or NaN if no temperature capability
- Return type:
- 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:
- Raises:
ValueError – 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)