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,
Bases:
InstrumentElectronic-load instrument. Methods return Measurement/Command for publishing.
Initialize an InstroELoad.
Provide either
configordriver, not both.- Parameters:
name
Channel-name prefix for published data. Falls back to
config.device.namewhenconfigis 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. Itsloadblock is applied through the public setters onopen(); 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
Seconds between background daemon iterations (0 = no wait).
Return an insertion-ordered snapshot of all published channel names.
Methods
Append
methodto the daemon's call list.Register a publisher to receive this instrument's Measurement/Command data.
Close the underlying driver and stop the daemon.
Replace all daemon functions with a single
method(called with the given args).Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.Measure the current (amperes) sensed on
channel.Return the most recent sample for
channel_namefrom the in-memory buffer.Measure the voltage (volts) sensed on
channel.Open the underlying driver and apply any configured load state.
Enable or disable the output on
channel.Fan
dataout to every configured publisher;kwargspass through.Set the operating level in the active mode's units (CC: A, CV: V, CP: W, CR: Ω).
Set the channel's operation mode: CC, CR, CP, or CV.
Set the range from the expected maximum operating value in the active mode's units (CC: A, CV: V, CP: W, CR: Ω).
Set the per-edge current slew rate (A/μs) for
direction(RISE/FALL/BOTH).Enable or disable the channel short.
Start the background daemon thread.
Signal the background daemon to stop and join it.
- property background_interval#
Seconds between background daemon iterations (0 = no wait).
- set_mode( ) Command[source]#
Set the channel’s operation mode: CC, CR, CP, or CV. Not all models support every mode.
- set_level( ) Command[source]#
Set the operating level in the active mode’s units (CC: A, CV: V, CP: W, CR: Ω).
curr_limitapplies only in CV mode. RaisesValueErrorif no mode has been set.
- short_output( ) Command[source]#
Enable or disable the channel short.
Warning
Takes effect IMMEDIATELY.
enable=Trueshorts the channel output.
- set_range( ) 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
ValueErrorif no mode has been set.
- set_slewrate(
- direction: SlewRateDirection,
- rate: float,
- channel: int = 1,
- **kwargs,
Set the per-edge current slew rate (A/μs) for
direction(RISE/FALL/BOTH).
- get_current(
- channel: int = 1,
- **kwargs,
Measure the current (amperes) sensed on
channel. ReturnsNoneif unavailable.
- get_voltage(
- channel: int = 1,
- **kwargs,
Measure the voltage (volts) sensed on
channel. ReturnsNoneif unavailable.
- add_background_daemon_function(
- method: Callable,
- *args,
- **kwargs,
Append
methodto the daemon’s call list. Usedefine_background_daemonto 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 – 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( ) Measurement#
Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.If the channel does not exist yet, or no sample is available, the code will always block until
timeoutexpires.- Parameters:
channel_name
Name of the channel to retrieve.
length
Number of trailing samples to return.
wait_for_new_samples
Block until at least
lengthnew values arrive.timeout
Seconds to wait when insufficient data exists or
wait_for_new_samples=True.
- Raises:
RuntimeError – No background buffer;
start()was not called.ChannelNotFoundError – channel had no values and no data appeared before
timeout.wait_for_new_samples=Trueand channel did not appear withintimeout.ChannelValueTimeoutError –
wait_for_new_samples=Trueand values did not arrive withintimeout.
- get_single_channel_value(
- channel_name: str,
Return the most recent sample for
channel_namefrom the in-memory buffer.This will not wait, if data is not available then
Noneis returned.- Parameters:
channel_name
Name of the channel to retrieve.
- Raises:
RuntimeError – No background buffer;
start()was not called.
- publish(
- data: Measurement | Command,
- **kwargs,
Fan
dataout to every configured publisher;kwargspass 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.