NIDAQDriver#
- class NIDAQDriver(device_id: str)[source]#
Bases:
DAQDriverBaseNI-DAQmx DAQ driver.
Attributes
Frozen snapshot of configured AI channels, keyed by alias.
Frozen snapshot of configured AO channels, keyed by alias.
Frozen snapshot of all configured AI/AO/DI/DO channels (excludes relays).
Frozen snapshot of configured DI channels, keyed by alias.
Frozen snapshot of configured DO channels, keyed by alias.
Frozen snapshot of configured relay channels, keyed by alias.
Methods
Close every DAQmx task this driver owns.
Close the relay (connect the circuit).
Deprecated: use
configure_ai_voltage_channel.Configure an analog current input channel on the NI device.
Configure hardware timing for the specified channels.
Configure a thermocouple input channel on the NI device; DAQmx reads
cjc_tempinunit.Configure an analog voltage input channel on the NI device.
Deprecated: use
configure_ao_voltage_channel.Configure an analog current output channel on the NI device.
Configure an analog voltage output channel on the NI device.
Parse
DevN/portM/lineP, add as CHAN_PER_LINE to the shared DI line task, and register the line.Parse
DevN/portM, add as CHAN_FOR_ALL_LINES to a dedicated DI task, and register the port.Parse
DevN/portM/lineP, add as CHAN_PER_LINE to the shared DO line task, and register the line.Parse
DevN/portM, add as CHAN_FOR_ALL_LINES to a dedicated DO task, and register the port.Build a
RelayChannelforphysical_channel(e.g."3101"= slot 3 / channel 101).Block until
samples_per_channelnew AI samples are available, then return them.Actual hardware sample rate achieved after
start().NI-DAQmx has no explicit connect — verifies the device is present in
niSystem.local().Open the relay (disconnect the circuit).
Read from analog input channels.
Sample a single DI line.
Sample a DI port as one N-bit integer; bit
ireflects linei.Start the DAQ device for data acquisition.
Stop the DAQ device.
Write
valueto AOchannel.Write to digital output channels.
Drive a DO port as one N-bit integer; bit
icontrols linei.- open()[source]#
NI-DAQmx has no explicit connect — verifies the device is present in
niSystem.local().
- configure_ai_channel(
- channel: AnalogChannel,
Deprecated: use
configure_ai_voltage_channel. Configures a channel on the NI device.
- configure_ao_channel(
- channel: AnalogChannel,
Deprecated: use
configure_ao_voltage_channel. Configures an AO channel on the NI device.
- configure_ai_voltage_channel(
- channel: AnalogVoltageChannel,
Configure an analog voltage input channel on the NI device.
- configure_ai_current_channel(
- channel: AnalogCurrentChannel,
Configure an analog current input channel on the NI device.
- configure_ao_voltage_channel(
- channel: AnalogVoltageChannel,
Configure an analog voltage output channel on the NI device.
- configure_ao_current_channel(
- channel: AnalogCurrentChannel,
Configure an analog current output channel on the NI device.
- configure_ai_thermocouple_channel(
- channel: AnalogThermocoupleChannel,
Configure a thermocouple input channel on the NI device; DAQmx reads
cjc_tempinunit.
- configure_ai_hw_timing(
- hw_timing_config: HWTimingConfig,
Configure hardware timing for the specified channels.
- configure_di_line_channel( )[source]#
Parse
DevN/portM/lineP, add as CHAN_PER_LINE to the shared DI line task, and register the line.
- configure_do_line_channel( )[source]#
Parse
DevN/portM/lineP, add as CHAN_PER_LINE to the shared DO line task, and register the line.
- configure_di_port_channel(
- physical_channel: str,
- logic: Logic,
- port_width: DigitalPortWidth,
- logic_level: float | None = None,
- alias: str | None = None,
Parse
DevN/portM, add as CHAN_FOR_ALL_LINES to a dedicated DI task, and register the port.
- configure_do_port_channel(
- physical_channel: str,
- logic: Logic,
- port_width: DigitalPortWidth,
- logic_level: float | None = None,
- alias: str | None = None,
Parse
DevN/portM, add as CHAN_FOR_ALL_LINES to a dedicated DO task, and register the port.
- fetch_analog() DAQmxData[source]#
Block until
samples_per_channelnew AI samples are available, then return them.Drivers should set
self.points_in_bufferfor buffer-depth telemetry and returndt(ns per sample) so the wrapper can build contiguous timestamps viaHWTimestamper.
- get_actual_sample_rate() float | None[source]#
Actual hardware sample rate achieved after
start().Default returns
None(driver doesn’t know or hasn’t started). Override on drivers whose SDK reports the effective rate (NI, MCC, LabJack T-series all do).
- write_analog_value(
- channel: AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel,
- value: float,
Write
valueto AOchannel. Override if the driver supports analog output.
- write_digital_line(
- channel: DigitalChannel,
- data: int,
Write to digital output channels.
- read_digital_line(
- channel: DigitalChannel,
Sample a single DI line. Returns 0 or 1 after applying
channel.logic.
- write_digital_port(
- channel: DigitalChannel,
- data: int,
Drive a DO port as one N-bit integer; bit
icontrols linei.
- read_digital_port(
- channel: DigitalChannel,
Sample a DI port as one N-bit integer; bit
ireflects linei.
- property ai_channels: Mapping[str, AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel]#
Frozen snapshot of configured AI channels, keyed by alias.
- property ai_hw_timing_config: HWTimingConfig | None#
- property ao_channels: Mapping[str, AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel]#
Frozen snapshot of configured AO channels, keyed by alias.
- property ao_hw_timing_config: HWTimingConfig | None#
- property channels: tuple[DAQChannel, ...]#
Frozen snapshot of all configured AI/AO/DI/DO channels (excludes relays).
- close_relay(channel: RelayChannel)#
Close the relay (connect the circuit). Override if the driver supports relays.
- define_relay_channel( ) RelayChannel#
Build a
RelayChannelforphysical_channel(e.g."3101"= slot 3 / channel 101).Default implementation suits the Keysight 34980A’s slot/channel addressing; override if the driver needs different parsing. Overrides must also record the resulting channel on
self._relay_channels.
- property di_channels: Mapping[str, DigitalChannel]#
Frozen snapshot of configured DI channels, keyed by alias.
- property di_hw_timing_config: HWTimingConfig | None#
- property do_channels: Mapping[str, DigitalChannel]#
Frozen snapshot of configured DO channels, keyed by alias.
- property do_hw_timing_config: HWTimingConfig | None#
- open_relay(channel: RelayChannel)#
Open the relay (disconnect the circuit). Override if the driver supports relays.
- property relay_channels: Mapping[str, RelayChannel]#
Frozen snapshot of configured relay channels, keyed by alias.