PSU (Power Supply Unit)¤
Errors raised by these methods are documented in Exceptions.
Interface¤
Bases: Instrument
Power-supply instrument. Methods return Measurement/Command for publishing.
Provide either config or driver/num_channels together, not both.
Parameters:
-
(name¤str | None, default:None) –Channel-name prefix for published data. Falls back to
config.device.namewhenconfigis given. -
(driver¤PSUDriverBase | None, default:None) –Concrete PSU driver; owns its own transport::
psu = InstroPSU( name="main", driver=BK9115("USB0::0xFFFF::0x9115::SN::INSTR"), num_channels=1, )
-
(num_channels¤int | None, default:None) –Number of output channels on this PSU.
-
(publishers¤list[Publisher] | None, default:None) –Publishers that receive emitted Measurement/Command data. Combined with any publishers declared in
config. -
(config¤PSUConfig | dict | Path | str | None, default:None) –A
PSUConfig, a dict, or a path to a JSON config file. -
(autostart¤bool, default:False) –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).
channel_names
property
¤
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.
add_publisher
¤
add_publisher(publisher: Publisher)
Register a publisher to receive this instrument's Measurement/Command data.
publish
¤
publish(data: Measurement | Command, **kwargs)
Fan data out to every configured publisher; kwargs pass through.
add_background_daemon_function
¤
add_background_daemon_function(method: Callable, *args, **kwargs)
Append method to the daemon's call list. Use define_background_daemon to replace instead.
get_channel
¤
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¤str) –Name of the channel to retrieve.
-
(length¤int, default:1) –Number of trailing samples to return.
-
(wait_for_new_samples¤bool, default:False) –Block until at least
lengthnew values arrive. -
(timeout¤float, default:10.0) –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
¤
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:
Raises:
-
RuntimeError–No background buffer;
start()was not called.
define_background_daemon
¤
define_background_daemon(method: Callable, *args, **kwargs)
Replace all daemon functions with a single method (called with the given args).
apply
¤
apply(
*,
current_limit: float,
voltage: float,
enable: bool = False,
channel: int,
**kwargs,
) -> list[Command]
Set the current limit, then the voltage, then the output state on channel.
The output stays off unless enable=True is passed, and on the default
path it is disabled before the new setpoints are written, so setpoints are
never applied to a live output. Every argument is keyword-only, so a value
can't land on the wrong setpoint and the output can't be energized without
enable=True spelled out at the call site.
Holds the resource lock across all steps so nothing observes a half-applied channel, and publishes only after releasing it so publisher I/O never blocks the background daemon or other threads waiting on the instrument.
Not atomic on the instrument: if a step raises, earlier steps have already been committed and the channel is left in an unknown state. Commands for the steps that did land are still published before the exception propagates.
set_voltage
¤
Set the output voltage (volts) on channel.
get_voltage
¤
get_voltage(channel: int, **kwargs) -> Measurement | None
Measure the voltage (volts) sensed at channel terminals. Output may vary from voltage setpoint outside of constant voltage mode. Returns None if unavailable.
set_current_limit
¤
Set the current limit (amperes) on channel.
get_current
¤
get_current(channel: int, **kwargs) -> Measurement | None
Measure the current (amperes) flowing through channel. Output may vary from current-limit setpoint outside of constant current mode. Returns None if unavailable.
output_enable
¤
Enable or disable the output on channel.
get_output_status
¤
get_output_status(channel: int, **kwargs) -> Measurement | None
Query whether the output on channel is enabled. Returns None if unavailable.
get_voltage_setpoint
¤
get_voltage_setpoint(channel: int, **kwargs) -> Measurement | None
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode. Returns None if unavailable.
get_operating_mode
¤
get_operating_mode(channel: int, **kwargs) -> Measurement | None
Query whether channel is regulating in constant voltage, constant current, or off (published as a string).
get_current_setpoint
¤
get_current_setpoint(channel: int, **kwargs) -> Measurement | None
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode. Returns None if unavailable.
set_overvoltage_protection_level
¤
Set the overvoltage protection threshold (volts) on channel.
get_overvoltage_protection_level
¤
get_overvoltage_protection_level(
channel: int, **kwargs
) -> Measurement | None
Query the overvoltage protection threshold (volts) on channel. Returns None if unavailable.
set_overvoltage_protection_enabled
¤
Enable or disable overvoltage protection on channel.
get_overvoltage_protection_enabled
¤
get_overvoltage_protection_enabled(
channel: int, **kwargs
) -> Measurement | None
Query whether overvoltage protection is enabled on channel. Returns None if unavailable.
set_overvoltage_protection_delay
¤
Set the overvoltage protection trip delay (seconds) on channel.
get_overvoltage_protection_delay
¤
get_overvoltage_protection_delay(
channel: int, **kwargs
) -> Measurement | None
Query the overvoltage protection trip delay (seconds) on channel. Returns None if unavailable.
set_overcurrent_protection_level
¤
Set the overcurrent protection threshold (amperes) on channel.
get_overcurrent_protection_level
¤
get_overcurrent_protection_level(
channel: int, **kwargs
) -> Measurement | None
Query the overcurrent protection threshold (amperes) on channel. Returns None if unavailable.
set_overcurrent_protection_enabled
¤
Enable or disable overcurrent protection on channel.
get_overcurrent_protection_enabled
¤
get_overcurrent_protection_enabled(
channel: int, **kwargs
) -> Measurement | None
Query whether overcurrent protection is enabled on channel. Returns None if unavailable.
set_remote_sense_enabled
¤
Enable or disable remote sense on channel.
get_remote_sense_enabled
¤
get_remote_sense_enabled(channel: int, **kwargs) -> Measurement | None
Query whether remote sense is enabled on channel. Returns None if unavailable.
Driver Interface¤
Bases: ABC
Base class for PSU drivers.
set_voltage
abstractmethod
¤
Set the output voltage (volts) on channel.
get_voltage
abstractmethod
¤
Query the measured output voltage (volts) on channel. Output may vary from voltage setpoint outside of constant voltage mode.
set_current_limit
abstractmethod
¤
Set the current limit (amperes) on channel.
get_current
abstractmethod
¤
Query the measured output current (amperes) on channel. Output may vary from current-limit setpoint outside of constant current mode.
output_enable
abstractmethod
¤
Enable or disable the output on channel.
get_output_status
abstractmethod
¤
Query whether the output on channel is enabled.
get_voltage_setpoint
¤
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode.
get_current_setpoint
¤
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode.
get_operating_mode
¤
get_operating_mode(channel: int) -> OperatingMode
Query whether channel is regulating in constant voltage, constant current, or off.
set_overvoltage_protection_level
¤
Set the overvoltage protection threshold (volts) on channel.
get_overvoltage_protection_level
¤
Query the overvoltage protection threshold (volts) on channel.
set_overvoltage_protection_enabled
¤
Enable or disable overvoltage protection on channel.
get_overvoltage_protection_enabled
¤
Query whether overvoltage protection is enabled on channel.
set_overvoltage_protection_delay
¤
Set the overvoltage protection trip delay (seconds) on channel.
get_overvoltage_protection_delay
¤
Query the overvoltage protection trip delay (seconds) on channel.
set_overcurrent_protection_level
¤
Set the overcurrent protection threshold (amperes) on channel.
get_overcurrent_protection_level
¤
Query the overcurrent protection threshold (amperes) on channel.
set_overcurrent_protection_enabled
¤
Enable or disable overcurrent protection on channel.
get_overcurrent_protection_enabled
¤
Query whether overcurrent protection is enabled on channel.
set_remote_sense_enabled
¤
Enable or disable remote sense on channel.
Vendor Drivers¤
BK Precision 9115 (Single Channel)¤
B&K Precision 9115-series PSU driver. SCPI surface is shared with other single-channel B&K models.
BK9115
¤
BK9115(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
B&K Precision 9115-series single-channel PSU.
set_overvoltage_protection_level
¤
set_overvoltage_protection_enabled
¤
set_overvoltage_protection_delay
¤
set_overcurrent_protection_level
¤
set_overcurrent_protection_enabled
¤
get_voltage_setpoint
¤
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode.
get_current_setpoint
¤
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode.
BK Precision 914X (Multi Channel)¤
B&K Precision 914X-series PSU driver.
BK914X
¤
BK914X(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
B&K Precision 914X-series multi-channel PSU.
set_overvoltage_protection_level
¤
set_overvoltage_protection_enabled
¤
set_overvoltage_protection_delay
¤
set_overcurrent_protection_level
¤
set_overcurrent_protection_enabled
¤
get_voltage_setpoint
¤
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode.
get_current_setpoint
¤
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode.
Keysight E36100¤
Keysight E36100-series PSU driver.
KeysightE36100
¤
KeysightE36100(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
Keysight E36100-series single-channel PSU.
set_overvoltage_protection_level
¤
set_overvoltage_protection_enabled
¤
set_overvoltage_protection_delay
¤
set_overcurrent_protection_level
¤
set_overcurrent_protection_enabled
¤
get_voltage_setpoint
¤
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode.
get_current_setpoint
¤
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode.
Rigol DP800¤
Rigol DP800-series PSU driver. Covers DP811, DP821, DP831, DP832.
RigolDP800
¤
RigolDP800(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
Rigol DP800-series multi-channel PSU (DP811/DP821/DP831/DP832).
Siglent SPD3303¤
Siglent SPD3303-series PSU driver.
SiglentSPD3303
¤
SiglentSPD3303(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
Siglent SPD3303-series PSU.
TDK Lambda Genesys¤
TDK Lambda Genesys-family PSU driver (single-channel).
TDKLambdaGenesys
¤
TDKLambdaGenesys(visa_resource: str | VisaConfig)
Bases: PSUDriverBase
TDK Lambda Genesys-family single-channel PSU.
set_overvoltage_protection_level
¤
set_overvoltage_protection_enabled
¤
set_overvoltage_protection_delay
¤
set_overcurrent_protection_level
¤
set_overcurrent_protection_enabled
¤
get_voltage_setpoint
¤
Query the configured voltage setpoint (volts) on channel. Output may vary from actual measured voltage outside of constant voltage mode.
get_current_setpoint
¤
Query the configured current-limit setpoint (amperes) on channel. Output may vary from actual measured current outside of constant current mode.
Simulated¤
Simulated PSU driver.
SimulatedPSU
¤
SimulatedPSU(visa_resource: str | VisaConfig)