load module

class load.Load

Bases: object

This module can control DC Electronic Loads.

It supports USB interface to use SCPI.

It will scan available instruments on your DSO, then require a serial number to specify and connect to it.

Usage:

import load
inst = load.Load()
inst.connect('<Instrument Serial Number>')
print(inst.idn())
inst.close()
close() None

Close the connection.

connect(SN: str, baudrate: int = 115200, timeout: int = 3) int

Connect to the Load.

Parameters:
  • SN (str) – Serial Number is necessary.

  • baudrate (int, optional) – baudrate. Defaults to 115200.

  • timeout (int, optional) – timeout. Defaults to 3.

Returns:

0 or -1

Return type:

int

delete_all_nseq() None

Delete all the steps of the selected normal sequence.

err() str
get_current_CCS(level: str = 'A', value: str | None = None) float

Get the current of the CC static mode.

Parameters:
  • level (str) – ‘A’ value or ‘B’ value.

  • value (str, optional) – ‘MAX’, ‘MIN’, or None (default).

Returns:

the current value.

Return type:

float

get_nseq_data_edit() str

Get the editing data of normal sequence.

Returns:

‘Step:, Value:, Time:, LOAD:, TRIG OUT:, RAMP:, PAUSE:’

Return type:

data (str)

get_nseq_edit_point() str

Get the editing step number of the normal sequence.

Returns:

The edit step number of the normal sequence, 1~1000.

Return type:

point (str)

get_nseq_para() str

Get parameters of the Normal Sequence function.

Returns:

Start:, Seq No:, Memo:, Mode:, Range:, Loop:, Last Load:, Last:, Chain:

Return type:

parameters (str)

get_voltage_CV(level: str = 'A', value: str | None = None) float

Get the CV mode voltage or the +CV voltage value.

Parameters:
  • level (str) – ‘A’ value or ‘B’ value.

  • value (str, optional) – ‘MAX’, ‘MIN’, or None (default).

Returns:

the voltage value.

Return type:

float

idn() str
is_on() bool

Get the status of the load.

max_current

MAX Current for this instrument. You will get it after connection.

max_voltage

MAX Voltage for this instrument. You will get it after connection.

meas_current() float

Query of current measurement.

Returns:

the current measurement.

Return type:

float

meas_power() float

Query of power measurement.

Returns:

the power measurement, unit is the watt.

Return type:

float

meas_voltage() float

Query of voltage measurement.

Returns:

the voltage measurement.

Return type:

float

min_current

MIN Current for this instrument. You will get it after connection.

min_voltage

MIN Voltage for this instrument. You will get it after connection.

mode() str

Get the operating function of the load.

Returns:

mode of operation.

Return type:

str

nseq_state() str

Get the state of the Normal Sequence function.

Returns:

“ON, {STOP | RUN | PAUSE}”, OFF

Return type:

state (str)

ocp() str

Query the OCP (over-current protection) settings.

Returns:

trip setting (‘LIMIT’, ‘Load off’, or ‘OFF’), and contain the over current limit value (if the trip setting is not ‘OFF’).

Return type:

settings (str, float)

opc() int
ovp() float

Query the OVP settings.

Returns:

over voltage limit value, or ‘OFF’ for function off.

Return type:

settings (float, str)

query(cmd: str) str

Send a query SCPI command to the instrument and return the result.

Parameters:

cmd (str) – SCPI command to be queried.

Returns:

Result of the SCPI command.

Return type:

str

readline() str

Read a line from the instrument’s communication port and return it as a string.

Returns:

The string read from the instrument.

Return type:

str

save_nseq() None

Save program of normal sequence.

scpi_delay

SCPI delay.

set_current_CCS(level: str = 'A', value=None) None

Set the current of the CC static mode.

Parameters:
  • level (str) – ‘A’ value or ‘B’ value.

  • value (str, float) – ‘MAX’, ‘MIN’, or the current value.

set_mode(mode: int) None

Set the operating function of the load.

Parameters:

mode (int) – 0:’LOAD’, 1:’PROG’, 2:’NSEQ’, 3:’FSEQ’,

set_nseq_data_edit(step: int = 1, total_step: int = 1, load_value: float = 0.0000, hours: int = 0, minutes: int = 0, seconds: int = 0, milliseconds: int = 0, load_state: str = 'OFF', RAMP: str = 'OFF', trig_out: str = 'OFF', pause: str = 'OFF') None

Set the editing data of normal sequence.

Parameters:
  • step (int) – The edit step number.

  • total_step (int) – The total number of steps.

  • load_value (float) – Set a load value of operation mode.

  • hours (int) – Set hours.

  • minutes (int) – Set minutes.

  • seconds (int) – Set seconds.

  • milliseconds (int) – Set milliseconds.

  • load_state (str) – ‘ON’, ‘OFF’

  • RAMP (str) – ‘ON’, ‘OFF’

  • trig_out (str) – ‘ON’, ‘OFF’

  • pause (str) – ‘ON’, ‘OFF’

set_nseq_edit_point(point: int = 1) None

Set the editing step number of the normal sequence.

Parameters:

point (int) – The edit step number of the normal sequence, 1~1000.

set_nseq_para(start: int = 1, seq_no: int = 1, memo: str = '', mode: str = 'CC', range: str = 'ILVL', loop: str = 'Infinity', last_load: str = 'OFF', last_value: float = 0.0000, chain: str = 'Off') None

Set parameters of the Normal Sequence function.

Parameters:
  • start (int) – start sequence number.(1~10)

  • seq_no (int) – sequence number.(1~10)

  • memo (str) – note of up to 12 characters. Enclose the string in double quotation marks.

  • mode (str) – ‘CC’, ‘CR’, ‘CV’, ‘CP’

  • range (str) – ‘IHVH’, ‘IMVH’, ‘ILVH’, ‘IHVL’, ‘IMVL’, ‘ILVL’

  • loop (str, int) – loop count.(‘INFinity’ / 0, 1~9999)

  • last_load (str) – ‘ON’, ‘OFF’

  • last_value (float) – Last Value after the end.

  • chain (int, str) – next sequence number (1~10), ‘OFF’ for No chain.

set_nseq_state(state: str) None

Set the state of the Normal Sequence function.

Parameters:

state (str) – OFF, ON, PAUSe, CONTinue, EXT

set_ocp_level(current: float = 15.75) None

Set the OCP (over-current protection) value in amps.

Parameters:

current (float) – current value.

set_ocp_trip(trip: str = 'LIM') None

Set the OCP (over-current protection) trip setting.

Parameters:

trip (str) – LOFF, LIM, or OFF.

set_off() None

Set to OFF in the input configuration of the Load. Sets stop of program, sequence, and OCP test.

set_on() None

Set to ON in the input configuration of the Load. Sets restart of program, sequence, and OCP test.

set_ovp(voltage: float = 'MAX') None

Set the OVP setting.

Parameters:

voltage (float, str) – over voltage limit value, ‘MAX’ for function off, ‘MIN’ for 0V.

set_scpi_delay(delay: float) None

Set the SCPI delay

Parameters:

delay (float) – delay time

set_voltage_CV(level: str = 'A', value=None) None

Set the CV mode voltage or the +CV voltage value.

Parameters:
  • level (str) – ‘A’ value or ‘B’ value.

  • value – (float) the voltage value of “A Value”. (str): ‘MAX’ or ‘MIN’

write(cmd: str) None

Write an SCPI command to the instrument.

Parameters:

cmd (str) – SCPI command to be written.