# InstroELoad

## class InstroELoad( name: str | None = None, driver: ELoadDriverBase | None = None, publishers: list[Publisher] | None = None, config: ELoadConfig | dict | Path | str | None = None, autostart: bool = False, **kwargs, )[source]

Bases: [`Instrument`](https://dev.nominal.io/instro/ref/library/instro.lib.instrument.Instrument.md#instro.lib.instrument.Instrument "instro.lib.instrument.Instrument")

Electronic-load instrument. Methods return Measurement/Command for publishing.

Initialize an InstroELoad.

Provide either `config` or `driver`, not both.

Parameters:
:   - **name**

      Channel-name prefix for published data. Falls back to
      `config.device.name` when `config` is given.
    - **driver**

      Concrete E-Load driver; owns its own transport:

      ```
      eload = InstroELoad(
          "main",
          driver=BK85XXB("ASRL19::INSTR"),
      )
      ```
    - **publishers**

      Publishers that receive emitted Measurement/Command data.
      Combined with any publishers declared in `config`.
    - **config**

      An `ELoadConfig`, a dict, or a path to a JSON config file. Its
      `load` block is applied through the public setters on `open()`;
      the input is never enabled from config.
    - **autostart**

      When True, open the connection and start background polling.
    - ****kwargs**

      Default tags applied to every emitted Measurement/Command.
      Pass `dataset_rid="<rid>"` to auto-create a NominalCorePublisher
      (uses the on-disk ‘default’ Nominal credential).

Attributes

| [`background_interval`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.background_interval "instro.eload.InstroELoad.background_interval") | Seconds between background daemon iterations (0 = no wait). |
| --- | --- |
| [`channel_names`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.channel_names "instro.eload.InstroELoad.channel_names") | Return an insertion-ordered snapshot of all published channel names. |

Methods

| [`add_background_daemon_function`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.add_background_daemon_function "instro.eload.InstroELoad.add_background_daemon_function") | Append `method` to the daemon's call list. |
| --- | --- |
| [`add_publisher`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.add_publisher "instro.eload.InstroELoad.add_publisher") | Register a publisher to receive this instrument's Measurement/Command data. |
| [`close`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.close "instro.eload.InstroELoad.close") | Close the underlying driver and stop the daemon. |
| [`define_background_daemon`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.define_background_daemon "instro.eload.InstroELoad.define_background_daemon") | Replace all daemon functions with a single `method` (called with the given args). |
| [`get_channel`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.get_channel "instro.eload.InstroELoad.get_channel") | Return the most recent `length` samples for `channel_name` from the in-memory buffer. |
| [`get_current`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.get_current "instro.eload.InstroELoad.get_current") | Measure the current (amperes) sensed on `channel`. |
| [`get_single_channel_value`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.get_single_channel_value "instro.eload.InstroELoad.get_single_channel_value") | Return the most recent sample for `channel_name` from the in-memory buffer. |
| [`get_voltage`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.get_voltage "instro.eload.InstroELoad.get_voltage") | Measure the voltage (volts) sensed on `channel`. |
| [`open`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.open "instro.eload.InstroELoad.open") | Open the underlying driver and apply any configured load state. |
| [`output_enable`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.output_enable "instro.eload.InstroELoad.output_enable") | Enable or disable the output on `channel`. |
| [`publish`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.publish "instro.eload.InstroELoad.publish") | Fan `data` out to every configured publisher; `kwargs` pass through. |
| [`set_level`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.set_level "instro.eload.InstroELoad.set_level") | Set the operating level in the active mode's units (CC: A, CV: V, CP: W, CR: Ω). |
| [`set_mode`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.set_mode "instro.eload.InstroELoad.set_mode") | Set the channel's operation mode: CC, CR, CP, or CV. |
| [`set_range`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.set_range "instro.eload.InstroELoad.set_range") | Set the range from the expected maximum operating value in the active mode's units (CC: A, CV: V, CP: W, CR: Ω). |
| [`set_slewrate`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.set_slewrate "instro.eload.InstroELoad.set_slewrate") | Set the per-edge current slew rate (A/μs) for `direction` (RISE/FALL/BOTH). |
| [`short_output`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.short_output "instro.eload.InstroELoad.short_output") | Enable or disable the channel short. |
| [`start`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.start "instro.eload.InstroELoad.start") | Start the background daemon thread. |
| [`stop`](https://dev.nominal.io/instro/ref/instruments/instro.eload.InstroELoad.md#instro.eload.InstroELoad.stop "instro.eload.InstroELoad.stop") | Signal the background daemon to stop and join it. |

### property background_interval

Seconds between background daemon iterations (0 = no wait).

### open() → None[source]

Open the underlying driver and apply any configured load state.

### close() → None[source]

Close the underlying driver and stop the daemon.

### set_mode( mode: LoadMode, channel: int = 1, **kwargs, ) → Command[source]

Set the channel’s operation mode: CC, CR, CP, or CV. Not all models support every mode.

### set_level( value: float, channel: int = 1, curr_limit: float | None = None, **kwargs, ) → Command[source]

Set the operating level in the active mode’s units (CC: A, CV: V, CP: W, CR: Ω).

`curr_limit` applies only in CV mode. Raises `ValueError` if no mode has been set.

### short_output( enable: bool, channel: int = 1, **kwargs, ) → Command[source]

Enable or disable the channel short.

> **Warning**
>
> Takes effect IMMEDIATELY. `enable=True` shorts the channel output.

### set_range( value: float, channel: int = 1, **kwargs, ) → Command[source]

Set the range from the expected maximum operating value in the active mode’s units (CC: A, CV: V, CP: W, CR: Ω).

Raises `ValueError` if no mode has been set.

### set_slewrate( direction: SlewRateDirection, rate: float, channel: int = 1, **kwargs, ) → Command[source]

Set the per-edge current slew rate (A/μs) for `direction` (RISE/FALL/BOTH).

### output_enable( enable: bool, channel: int = 1, **kwargs, ) → Command[source]

Enable or disable the output on `channel`.

### get_current( channel: int = 1, **kwargs, ) → Measurement | None[source]

Measure the current (amperes) sensed on `channel`. Returns `None` if unavailable.

### get_voltage( channel: int = 1, **kwargs, ) → Measurement | None[source]

Measure the voltage (volts) sensed on `channel`. Returns `None` if unavailable.

### add_background_daemon_function( method: Callable, *args, **kwargs, )

Append `method` to the daemon’s call list. Use `define_background_daemon` to replace instead.

### add_publisher( publisher: Publisher, )

Register a publisher to receive this instrument’s Measurement/Command data.

### property channel_names: tuple[str, ...]

Return an insertion-ordered snapshot of all published channel names.

Names are complete after one full daemon iteration: {name}.loop_time publishes
every iteration, so call get_channel(“loop_time”, wait_for_new_samples=True)
then read channel_names to ensure the complete set has arrived.

Raises:
:   [**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError "(in Python v3.15)") – No background buffer; `start()` was not called.

### define_background_daemon( method: Callable, *args, **kwargs, )

Replace all daemon functions with a single `method` (called with the given args).

### get_channel( channel_name: str, length: int = 1, wait_for_new_samples: bool = False, timeout: float = 10.0, ) → Measurement

Return the most recent `length` samples for `channel_name` from the in-memory buffer.

If the channel does not exist yet, or no sample is available, the code will always block until `timeout` expires.

Parameters:
:   - **channel_name**

      Name of the channel to retrieve.
    - **length**

      Number of trailing samples to return.
    - **wait_for_new_samples**

      Block until at least `length` new values arrive.
    - **timeout**

      Seconds to wait when insufficient data exists or `wait_for_new_samples=True`.

Raises:
:   - [**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError "(in Python v3.15)") – No background buffer; `start()` was not called.
    - [**ChannelNotFoundError**](https://dev.nominal.io/instro/ref/library/instro.lib.publishers.channel_buffer.ChannelNotFoundError.md#instro.lib.publishers.channel_buffer.ChannelNotFoundError "instro.lib.publishers.channel_buffer.ChannelNotFoundError") – channel had no values and no data appeared before `timeout`.
      `wait_for_new_samples=True` and channel did not appear within `timeout`.
    - [**ChannelValueTimeoutError**](https://dev.nominal.io/instro/ref/library/instro.lib.publishers.channel_buffer.ChannelValueTimeoutError.md#instro.lib.publishers.channel_buffer.ChannelValueTimeoutError "instro.lib.publishers.channel_buffer.ChannelValueTimeoutError") – `wait_for_new_samples=True` and values did not arrive within `timeout`.

### get_single_channel_value( channel_name: str, ) → float | str | None

Return the most recent sample for `channel_name` from the in-memory buffer.

This will not wait, if data is not available then `None` is returned.

Parameters:
:   **channel_name**

    Name of the channel to retrieve.

Raises:
:   [**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError "(in Python v3.15)") – No background buffer; `start()` was not called.

### publish( data: Measurement | Command, **kwargs, )

Fan `data` out to every configured publisher; `kwargs` pass through.

### start()

Start the background daemon thread. No-op if already running.

### stop()

Signal the background daemon to stop and join it. No-op if not running.
