PSU (Power Supply Unit)¤
Interface¤
Bases: Instrument
Power-supply instrument. Methods return Measurement/Command for publishing.
Parameters:
-
(name¤str) –Channel-name prefix for published data.
-
(driver¤PSUDriverBase) –Concrete PSU driver; owns its own transport::
psu = InstroPSU( name="main", driver=BK9115("USB0::0xFFFF::0x9115::SN::INSTR"), num_channels=1, )
-
(num_channels¤int) –Number of output channels on this PSU.
-
(publishers¤list[Publisher] | None, default:None) –Publishers that receive emitted Measurement/Command data.
-
–**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).
background_interval
property
writable
¤
background_interval
Seconds between background-worker iterations (0 = no wait).
background_enable
property
writable
¤
background_enable
Whether the background worker daemon is enabled (must still be start()-ed).
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_latest: bool = False,
timeout: float = 10.0,
) -> Measurement
Return the most recent length samples for channel_name from the in-memory buffer.
Parameters:
-
(channel_name¤str) –Name of the channel to retrieve.
-
(length¤int, default:1) –Number of trailing samples to return.
-
(wait_for_latest¤bool, default:False) –Block until at least
lengthnew values arrive. -
(timeout¤float, default:10.0) –Seconds to wait when
wait_for_latest=True.
Raises:
-
RuntimeError–No background buffer;
start()was not called. -
ChannelNotFoundTimeoutError–wait_for_latest=Trueand channel did not appear withintimeout. -
ChannelValueTimeoutError–wait_for_latest=Trueand values did not arrive withintimeout.
define_background_daemon
¤
define_background_daemon(method: Callable, *args, **kwargs)
Replace all daemon functions with a single method (called with the given args).
set_voltage
¤
Set the output voltage (volts) on channel.
get_voltage
¤
get_voltage(channel: int = 1, **kwargs) -> Measurement | None
Measure the voltage (volts) sensed at channel terminals. Returns None if unavailable.
set_current_limit
¤
Set the current limit (amperes) on channel.
get_current
¤
get_current(channel: int = 1, **kwargs) -> Measurement | None
Measure the current (amperes) flowing through channel. Returns None if unavailable.
output_enable
¤
Enable or disable the output on channel.
get_output_status
¤
get_output_status(channel: int = 1, **kwargs) -> Measurement | None
Query whether the output on channel is enabled. Returns None if unavailable.
Driver Interface¤
Bases: ABC
Vendor PSU driver contract. Concrete drivers own their transport and lifecycle.
set_voltage
abstractmethod
¤
Set the output voltage (volts) on channel.
get_voltage
abstractmethod
¤
Query the measured output voltage (volts) on channel.
set_current_limit
abstractmethod
¤
Set the current limit (amperes) on channel.
get_current
abstractmethod
¤
Query the measured output current (amperes) on channel.
output_enable
abstractmethod
¤
Enable or disable the output on channel.