Skip to content

PSU (Power Supply Unit)¤

Interface¤

power supply (PSU) instrument interface and helpers.

Defines NominalPSU and related helpers. Transport/protocols: SCPI, VISA.

Public API

NominalPSU, NominalPSUFacade

logger module-attribute ¤

logger = getLogger(__name__)

NominalPSU ¤

Bases: NominalInstrument

Power Supply hardware abstraction to communicate with various models and vendor power supplies.

Methods return Measurement and Command data types to be compatible with Nominal Instrumentation tools.

Parameters:

  • name ¤

    (str) –

    A name to identify this power supply instance. Used in channel naming and published data.

  • connection_config ¤

    (ConnectConfig) –

    Connection configuration for the power supply (SCPI/VISA).

  • driver ¤

    (PSUDriverBase) –

    The driver instance for the specific power supply vendor/model.

  • num_channels ¤

    (int) –

    The number of output channels on this power supply.

  • publishers ¤

    (list[Publisher] | None, default: None ) –

    List of publishers to send data to when executing methods. Defaults to None.

  • **kwargs ¤

    Optional keyword arguments used as tags throughout the life of the instrument. These tags are applied to the Measurement and Command objects and can be utilized by publishers like NominalCorePublisher as added metadata.

    Special keyword arguments: dataset_rid (str): If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID. Assumes a Nominal 'default' credential is stored on disk.

name instance-attribute ¤

name = name

data_handler instance-attribute ¤

data_handler = (
    None
    if connection_config is None
    else DataHandler(select(connection_config))
)

publishers instance-attribute ¤

publishers = publishers or []

default_tags instance-attribute ¤

default_tags: dict[str, str] = {}

background_interval property writable ¤

background_interval

Get the background worker interval setting.

Returns:

  • float

    The current interval in seconds between background worker iterations. The worker waits this duration between executing background daemon functions.

background_enable property writable ¤

background_enable

Get the background worker enable state.

Returns:

  • bool

    True if the background worker is enabled, False otherwise.

auto_create classmethod ¤

auto_create(
    name: str,
    resource: ConnectConfig,
    num_channels: int,
    publishers: list[Publisher] | None = None,
    **kwargs,
) -> NominalPSU

Discover and create a NominalPSU instance by querying the instrument's IDN.

This factory method automatically discovers the power supply model and creates an appropriate driver instance from Nominal's list of registered psu vendors/models.

The discovery process: 1. Open a VISA session to the resource string. 2. Send '*IDN?' query. 3. Parse the returned vendor/model string. 4. Find a matching driver subclass. 5. Close the temporary session. 6. Create and return a NominalPSU instance with the appropriate driver.

Parameters:

  • name ¤
    (str) –

    A name to identify this power supply instance. Used in channel naming and published data.

  • resource ¤
    (ConnectConfig) –

    A ConnectConfig for SCPI/VISA devices.

  • num_channels ¤
    (int) –

    Number of channels on the power supply.

  • publishers ¤
    (list[Publisher] | None, default: None ) –

    List of publishers to send data to when executing methods. Defaults to None.

  • **kwargs ¤

    Optional keyword arguments used as tags throughout the life of the instrument. These tags are applied to the Measurement and Command objects and can be utilized by publishers like NominalCorePublisher as added metadata.

    Special keyword arguments: dataset_rid (str): If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID. Assumes a Nominal 'default' credential is stored on disk.

Returns:

  • NominalPSU ( NominalPSU ) –

    Configured power supply instance with the appropriate driver.

Raises:

  • ValueError

    If no matching driver is found for the IDN string.

  • TypeError

    If resource is a string (vendor library devices require manual construction).

open ¤

open()

Establish connection to the device.

close ¤

close()

Disconnect from the device.

set_voltage ¤

set_voltage(voltage: float, channel: int = 1, **kwargs) -> Command

Set the voltage on the power supply.

Parameters:

  • voltage ¤
    (float) –

    The voltage to set (in volts).

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Command ( Command ) –

    A Command object containing the channel name, value, timestamp, and tags. The command is automatically published to all configured publishers.

get_voltage ¤

get_voltage(channel: int = 1, **kwargs) -> Measurement | None

Query the voltage that the power supply senses is active on its terminals.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Measurement | None

    Measurement | None: A Measurement object containing the channel name, voltage value, timestamp, and tags. The measurement is automatically published to all configured publishers. Returns None if the measurement could not be obtained.

set_current_limit ¤

set_current_limit(
    current_limit: float, channel: int = 1, **kwargs
) -> Command

Set the current limit on the power supply.

Parameters:

  • current_limit ¤
    (float) –

    The current limit to set (in amperes).

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Command ( Command ) –

    A Command object containing the channel name, value, timestamp, and tags. The command is automatically published to all configured publishers.

get_current ¤

get_current(channel: int = 1, **kwargs) -> Measurement | None

Query the current that the power supply senses through its terminals.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Measurement | None

    Measurement | None: A Measurement object containing the channel name, current value, timestamp, and tags. The measurement is automatically published to all configured publishers. Returns None if the measurement could not be obtained.

output_enable ¤

output_enable(enable: bool, channel: int = 1, **kwargs) -> Command

Enable or disable the power supply output.

Parameters:

  • enable ¤
    (bool) –

    True to enable the output, False to disable.

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Command ( Command ) –

    A Command object containing the channel name, value, timestamp, and tags. The command is automatically published to all configured publishers.

get_output_status ¤

get_output_status(channel: int = 1, **kwargs) -> Measurement | None

Query if the power supply output is on or off.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    For multi-channel power supplies. Defaults to 1.

  • **kwargs ¤

    Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.

Returns:

  • Measurement | None

    Measurement | None: A Measurement object containing the channel name, output status , timestamp, and tags. The measurement is automatically published to all configured publishers. Returns None if the measurement could not be obtained.

add_publisher ¤

add_publisher(publisher: Publisher)

Add a publisher to the list of publishers for this instrument.

Publishers receive all Measurement and Command objects that are published by this instrument. Multiple publishers can be added to send data to different destinations.

Parameters:

  • publisher ¤
    (Publisher) –

    The publisher instance to add.

publish ¤

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

Publish a Measurement or Command to all configured publishers.

This method sends the data to all publishers that have been added to this instrument. Additional keyword arguments are passed through to each publisher's publish method.

Parameters:

  • data ¤
    (Measurement | Command) –

    The measurement or command data to publish.

  • **kwargs ¤

    Optional keyword arguments passed to each publisher's publish method.

get_identity ¤

get_identity() -> str

Query the instrument's identity string.

This method sends the SCPI "*IDN?" command to retrieve the instrument's identification information, which typically includes manufacturer, model number, serial number, and firmware version.

Returns:

  • str ( str ) –

    The instrument's identity string.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

open_and_get_identity staticmethod ¤

open_and_get_identity(connection_config: ConnectConfig) -> str

Convenience method to open a connection, query identity, and close.

This static method creates a temporary instrument instance, opens a connection, queries the identity, closes the connection, and returns the identity string. Useful for instrument discovery without maintaining a long-lived connection.

Parameters:

  • connection_config ¤
    (ConnectConfig) –

    The connection configuration for the instrument.

Returns:

  • str ( str ) –

    The instrument's identity string.

Raises:

  • RuntimeError

    If the connection cannot be established or the identity cannot be queried.

send_arbitrary_command ¤

send_arbitrary_command(command: str)

Send an arbitrary command string to the instrument.

This method allows sending custom commands directly to the instrument without going through the instrument's high-level API. Useful for accessing instrument-specific features not exposed by the standard interface.

Parameters:

  • command ¤
    (str) –

    The command string to send to the instrument.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

query_arbitrary_command ¤

query_arbitrary_command(command: str) -> str

Send an arbitrary command string and return the instrument's response.

This method sends a command and waits for a response, useful for querying instrument state or configuration. The response is returned as a string.

Parameters:

  • command ¤
    (str) –

    The query command string to send to the instrument.

Returns:

  • str ( str ) –

    The instrument's response to the query command.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

add_background_daemon_function ¤

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

Adds a function (and its arguments) to be periodically called by the background worker daemon.

There may already be functions defined and this will add to the end of that list. Call define_background_daemon to clear and define a new function if you do not want the default functions to run.

Parameters:

  • method ¤
    (Callable) –

    The method/function to be invoked in the background thread.

  • *args ¤

    Positional arguments to pass to the method.

  • **kwargs ¤

    Keyword arguments to pass to the method.

start ¤

start()

Start the background worker thread.

This method creates and starts a daemon thread that periodically executes all registered background daemon functions. If the thread is already running, this method does nothing. The thread will continue running until stop() is called.

stop ¤

stop()

Stop the background worker thread.

This method signals the background worker thread to stop and waits for it to complete. If the thread is not running, this method does nothing.

get_channel ¤

get_channel(
    channel_name: str,
    length: int = 1,
    wait_for_latest: bool = False,
    timeout: float = 10.0,
) -> Measurement

Get most recent Measurement data for a specific channel from the buffer.

Parameters:

  • channel_name ¤
    (str) –

    The name of the channel from which to retrieve data.

  • length ¤
    (int, default: 1 ) –

    The number of most recent samples to return.

  • wait_for_latest ¤
    (bool, default: False ) –

    Block and wait for the next channel value(s).

  • timeout ¤
    (float, default: 10.0 ) –

    Timeout in seconds when waiting for channel or values. Defaults to 10.0 seconds. Only applies when wait_for_latest=True.

Returns:

  • Measurement ( Measurement ) –

    A Measurement object containing the requested channel data and timestamps.

Raises:

  • RuntimeError

    No background buffer exists because start() was not called.

  • ChannelNotFoundTimeoutError

    If wait_for_latest=True and the channel does not appear within timeout.

  • ChannelValueTimeoutError

    If wait_for_latest=True and sufficient values are not available within timeout.

define_background_daemon ¤

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

Clear all background daemon functions and register a single custom method.

This method clears any previously registered background daemon functions and registers a new method to be called in the background daemon loop. This is useful when you want to replace the default background functions with a custom implementation.

Parameters:

  • method ¤
    (Callable) –

    The method to call as part of the background daemon.

  • *args ¤

    Positional arguments to pass to the method when it is called.

  • **kwargs ¤

    Keyword arguments to pass to the method when it is called.

NominalPSUFacade ¤

NominalPSUFacade(nominal_psu: NominalPSU)

Facade class that provides drivers with access to NominalPSU configuration.

This class implements the APINominalPSU interface and allows drivers to access power supply configuration without direct access to the NominalPSU instance's internal state.

Parameters:

  • nominal_psu ¤

    (NominalPSU) –

    The NominalPSU instance to provide access to.

Driver Interface¤

power supply (PSU) instrument interface and helpers.

Defines PSUDriverBase and related helpers. Transport/protocols: SCPI.

Public API

APINominalPSU, PSUDriverBase, PSUDriverDataHandler

logger module-attribute ¤

logger = getLogger(__name__)

APINominalPSU ¤

Bases: Protocol

PSUDriverBase ¤

Bases: ABC

Abstract base class for vendor power supply.

Each concrete provider implements sending and receiving data for its vendor/model.

hal instance-attribute ¤

open ¤

open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤

close() -> None

Close connection to the device. Override in subclasses if needed.

set_voltage abstractmethod ¤

set_voltage(voltage: float, channel: int = 1) -> None

Send the command to set the output voltage.

Parameters:

  • voltage ¤
    (float) –

    in volts.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_voltage abstractmethod ¤

get_voltage(channel: int = 1) -> float

Query the current setpoint/output voltage from the supply.

Return the voltage in volts.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

set_current_limit abstractmethod ¤

set_current_limit(current_limit: float, channel: int = 1) -> None

Set the current limit.

Parameters:

  • current_limit ¤
    (float) –

    in amperes.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_current abstractmethod ¤

get_current(channel: int = 1) -> float

Query the actual output current.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

output_enable abstractmethod ¤

output_enable(enable: bool, channel: int = 1) -> None

Enable the output.

Parameters:

  • enable ¤
    (bool) –

    Enable or disable the output.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_output_status abstractmethod ¤

get_output_status(channel: int = 1) -> bool

Query whether the output is enabled.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

PSUDriverDataHandler ¤

PSUDriverDataHandler()

Bases: PSUDriverBase

data_handler property ¤

data_handler: DataHandler

Get the data handler, ensuring it's been set.

hal instance-attribute ¤

set_data_handler ¤

set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤

get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

match_idn abstractmethod classmethod ¤

match_idn(idn: str) -> bool

Check if this driver can handle the given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

  • bool

    True if this driver can handle the instrument, False otherwise

check_errors abstractmethod ¤

check_errors() -> None

Query the error queue / status register and raise exception if error pending.

If no errors, return silently.

open ¤

open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤

close() -> None

Close connection to the device. Override in subclasses if needed.

set_voltage abstractmethod ¤

set_voltage(voltage: float, channel: int = 1) -> None

Send the command to set the output voltage.

Parameters:

  • voltage ¤
    (float) –

    in volts.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_voltage abstractmethod ¤

get_voltage(channel: int = 1) -> float

Query the current setpoint/output voltage from the supply.

Return the voltage in volts.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

set_current_limit abstractmethod ¤

set_current_limit(current_limit: float, channel: int = 1) -> None

Set the current limit.

Parameters:

  • current_limit ¤
    (float) –

    in amperes.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_current abstractmethod ¤

get_current(channel: int = 1) -> float

Query the actual output current.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

output_enable abstractmethod ¤

output_enable(enable: bool, channel: int = 1) -> None

Enable the output.

Parameters:

  • enable ¤
    (bool) –

    Enable or disable the output.

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

get_output_status abstractmethod ¤

get_output_status(channel: int = 1) -> bool

Query whether the output is enabled.

Parameters:

  • channel ¤
    (int, default: 1 ) –

    output channel (default is 1).

Vendor Drivers¤

BK Precision (Single Channel)¤

Bk Single Channel driver for power supply (PSU) instruments.

Implements BKSingleChannelDriver and supporting helpers. Transport/protocols: SCPI.

Public API

BKSingleChannelDriver

BKSingleChannelDriver ¤

BKSingleChannelDriver()

Bases: PSUDriverDataHandler

Driver for BK Precision 9115 PSU.

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

BK Precision (Multi Channel)¤

Bk Multi Channel driver for power supply (PSU) instruments.

Implements BKMultiChannelDriver and supporting helpers. Transport/protocols: SCPI.

Public API

BKMultiChannelDriver

BKMultiChannelDriver ¤

BKMultiChannelDriver()

Bases: PSUDriverDataHandler

Driver for BK Precision 9140 Series of PSUs.

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
channel_select ¤
channel_select(channel: int)
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

Rigol¤

Rigol driver for power supply (PSU) instruments.

Implements RigolPSUDriver and supporting helpers. Transport/protocols: SCPI.

Public API

RigolPSUDriver

RigolPSUDriver ¤

RigolPSUDriver()

Bases: PSUDriverDataHandler

SCPI mapping for Rigol multi-channel PSUs.

idn instance-attribute ¤
idn = ''
hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
query_status ¤
query_status() -> dict

Query the status of the PSU.

open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

Siglent¤

Siglent driver for power supply (PSU) instruments.

Implements SiglentPSUDriver and supporting helpers. Transport/protocols: SCPI.

Public API

SiglentPSUDriver

SiglentPSUDriver ¤

SiglentPSUDriver()

Bases: PSUDriverDataHandler

SCPI mapping for Siglent PSUs.

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
query_status ¤
query_status() -> dict

Query the status of the PSU.

open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

TDK Lambda¤

Tdk Lambda driver for power supply (PSU) instruments.

Implements TDKLambdaPSUProvider and supporting helpers. Transport/protocols: SCPI.

Public API

TDKLambdaPSUProvider

TDKLambdaPSUProvider ¤

TDKLambdaPSUProvider()

Bases: PSUDriverDataHandler

SCPI mapping for TDK Lambda PSUs (e.g. Genesys).

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match

Simulated¤

Simulated driver for power supply (PSU) instruments.

Implements SimulatedPSUDriver and supporting helpers. Public API: SimulatedPSUDriver

SimulatedPSUDriver ¤

SimulatedPSUDriver()

Bases: PSUDriverDataHandler

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool
set_voltage ¤
set_voltage(voltage: float, channel: int = 1) -> None
get_voltage ¤
get_voltage(channel: int = 1) -> float
set_current_limit ¤
set_current_limit(current_limit: float, channel: int = 1) -> None
get_current ¤
get_current(channel: int = 1) -> float
output_enable ¤
output_enable(enable: bool, channel: int = 1) -> None
get_output_status ¤
get_output_status(channel: int = 1) -> bool
check_errors ¤
check_errors() -> None
open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication

get_driver classmethod ¤
get_driver(idn: str) -> type[PSUDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match