lab_driver.ngux01#

Module Contents#

Classes#

API#

class lab_driver.ngux01.DriverNGUX01[source]#

Initialization

Class for handling the Rohde and Schwarz Sourcemeter NGUX01 in Python

SerialDevice: pyvisa.Resource#

None

SerialActive#

False

sync(timeout=86400000) None[source]#

Wait until all queued commands have been processed Args: timeout: timeout in milliseconds, VISA exception thrown on timeout, default 1 day Returns: None

serial_open_known_target(resource_name: str, do_reset: bool = False) None[source]#

Open the serial connection to device

serial_start(do_reset: bool = False) None[source]#

Open the serial connection to device

serial_close() None[source]#

Closing the serial connection

get_id(do_print=True) str[source]#

Getting the device ID

do_beep(num_iterations=1) None[source]#

Doing a single beep on device

do_reset() None[source]#

Reset the device

do_get_system_runtime() None[source]#

Getting the actual runtime of device in seconds

do_get_system_time() None[source]#

Getting the actual system time of device

set_voltage_range(range: int) bool[source]#

Set measurement voltage range Args: range: voltage range 6 or 20 volts Returns: True when argument is invalid

get_voltage_range() float[source]#

Get measurement voltage range Returns: Range 6 or 20 volts

set_current_range(range: float) bool[source]#

Set measurement current range Args: range: current range 2, 0.1 or 0.01 Returns: True when argument is invalid

get_current_range() float[source]#

Get measurement current range Returns: Range from 0 to 8 Amps

set_voltage(val: float) None[source]#

Setting the channel voltage value

set_current(val: float) None[source]#

Setting the channel voltage value

set_current_limits(val_min: float, val_max: float) None[source]#

Setting the current limitations value Args: val_min: Lower limit in Amps val_max: Upper limit in Amps Returns: None

set_output_impedance(resistance: float) None[source]#

Setting the output impedance of device Args: resistance: Impedance in Ohms Returns: None

set_output_mode(mode=0) None[source]#

Setting the output mode Args: mode: 0 = Auto, 1 = Sink, 2 = Source Returns: None

output_activate(use_fast_output: bool = False) None[source]#

Activating the output Args: use_fast_output: (De-)Activate fast transient response Returns: None

output_deactivated() None[source]#

Deactivating the output Returns: None

get_measurement_voltage(do_print: bool = False) float[source]#

Reading the voltage Args: do_print: Also print the voltage value to stdout Returns: The voltage value

get_measurement_current(do_print: bool = False) float[source]#

Reading the current Args: do_print: Also print the current value to stdout Returns: The current value

get_measurement_power(do_print: bool = False) float[source]#

Reading the power Args: do_print: Also print the power value to stdout Returns: The power value

get_measurement_energy(do_print: bool = False) float[source]#

Reading the energy Args: do_print: Also print the energy value to stdout Returns: The energy value

set_fastlog_sample_rate(rate: float) bool[source]#

Set sample rate of FastLog Args: rate: Either 500, 250, 50, 10, 1 or 0.1 kilosamples per second Returns: True when argument is invalid

get_fastlog_sample_rate() float[source]#

Get sample rate of FastLog Returns: FastLog sample rate in kilosamples per second

set_fastlog_duration(duration: int) None[source]#

Set duration of a FastLog sample Args: duration: Sample duration in seconds Returns: None

get_fastlog_duration() int[source]#

Get duration of a FastLog sample Returns: Duration in seconds

set_fastlog_triggered(triggered: bool) None[source]#

Set whether FastLog is started by a trigger event Args: triggered: True to receive triggers, False to ignore Returns: None

get_fastlog_triggered() bool[source]#

Get whether FastLog is started by a trigger event Returns: True if trigger is activated, False if not

do_fastlog(duration: int = None, sample_rate: float = None) bool[source]#

Start a FastLog measurement Args: duration: Optional; set the duration of the measurement sample_rate: Optional; set a sample rate before measuring Returns: True when arguments are invalid or USB device not detected

abort_fastlog() None[source]#

Abort a running FastLog measurement. Progress is saved. Args: N/A Returns: None

is_usb_connected() bool[source]#

EVENT - Check for USB device connection Returns: True if USB device is detected, False otherwise

is_usb_disconnected() bool[source]#

EVENT - Convenience function for negation of is_usb_connected, to avoid lambda expression Returns: True if no USB device is detected, False otherwise

has_usb_switched_state() bool[source]#

EVENT - Check if USB device has been (dis-)connected since the last call of this function or since serial connection has been established if called for the first time Returns: True if USB device has been disconnected when it was connected before or vice versa

is_fastlog_running() bool[source]#

EVENT - Check if FastLog measurement is currently running Returns: True if FastLog measurement is running, False otherwise

is_fastlog_finished() bool[source]#

EVENT - Convenience function for negation of is_fastlog_running, to avoid lambda expression Returns: True if FastLog measurement has finished or is not running, False otherwise

event_handler(event, action, *args, **kwargs)[source]#

Listen for events and execute an action when triggered. The desired event is polled for every 100 ms, sleeping in-between, hence this is a blocking function. Args: event: Some event listener function action: Any action to be executed *args: Positional arguments passed to action **kwargs: Keyword arguments passed to action Returns: Whatever the action returns

test(cmd)[source]#