nibcq.DCIR ========== .. py:class:: nibcq.DCIR(device: nibcq._device.Device, test_parameters: DCIRTestParameters) Bases: :py:obj:`nibcq.measurement.Measurement` Direct 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. .. rubric:: 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") .. py:attribute:: DEVICE_FAMILY :type: Final[nibcq.enums.DeviceFamily] Device family for DCIR measurements. :type: DeviceFamily .. py:property:: test_parameters :type: 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. :rtype: DCIRTestParameters :raises ValueError: If test parameters have not been properly initialized during object construction. .. py:property:: measurement_data :type: 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. :rtype: SMUMeasurement .. py:property:: result :type: 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. :rtype: float .. py:method:: 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. :rtype: float :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. :raises RuntimeError: If the measurement process fails at any step due to hardware communication errors, device malfunctions, or resource conflicts with other measurement sessions. :raises TimeoutError: If the measurement sequence does not complete within the calculated timeout period. .. rubric:: 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") .. py:method:: run_with_switching() :abstractmethod: 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. .. py:property:: has_switch_capability :type: bool Check if the device has switch capability. :returns: True if switch capability is available, False otherwise .. py:method:: connect_channel(channel: SMUCellData) -> None Connect to a specific DUT channel using the device's switch capability. :param channel: SwitchChannel containing connection information :raises RuntimeError: If no switch capability is available .. py:method:: disconnect_all() -> None Disconnect all channels using the device's switch capability. :raises RuntimeError: If no switch capability is available .. py:method:: wait_for_debounce() -> None Wait for switch relays to settle using the device's switch capability. :raises RuntimeError: If no switch capability is available .. py:property:: switch_cells :type: 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. .. py:property:: acceptable_temperature_delta :type: 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 :rtype: float .. rubric:: Examples >>> measurement = EIS(device) >>> measurement.acceptable_temperature_delta = 2.5 >>> delta = measurement.acceptable_temperature_delta .. py:property:: temperature :type: float Get the latest temperature reading from the device. :returns: The most recent temperature measurement, or NaN if no temperature capability .. py:property:: temperature_range :type: 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). .. py:method:: measure_temperature() -> CenteredRange Get a new temperature reading from the device. :returns: Current temperature reading, or NaN if no temperature capability .. py:method:: 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. :param target_temperature: 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. :rtype: bool :raises ValueError: If the current temperature exceeds the target ± delta range (only raised when capability is configured) .. rubric:: Examples >>> measurement = EIS(device) >>> measurement.measure_temperature() >>> target = compensation.temperature_parameter >>> is_valid = measurement.validate_temperature(target)