asr module
- class asr.Asr
Bases:
objectThis module can control ASR-2100.
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 asr inst = asr.Asr() inst.connect('<Instrument Serial Number>') print(inst.idn()) inst.close()
- clear_output_protection() None
Clear output protection alarms.
- Description:
This command clears alarms such as Over Current, Over Peak Current, Output Over-Power, Output Short, Output Overvoltage, and Sensing Voltage Error.
- get_frequency() float
Returns the SYNC signal source frequency in Hz. (Only AC+DC-sync or AC-sync Active)
- get_output_mode() str
Queries the output mode of the power supply.
- Returns:
- The current output mode. Possible return values are:
’ACDC-INT’ (0), ‘AC-INT’ (1), ‘DC-INT’ (2), ‘ACDC-EXT’ (3), ‘AC-EXT’ (4), ‘ACDC-ADD’ (5), ‘AC-ADD’ (6), ‘ACDC-SYNC’ (7), ‘AC-SYNC’ (8).
- Return type:
- get_seq_condition() int
Queries the current sequence status in Sequence Mode. (Only Sequence Mode Active)
- Returns:
- Current sequence status. Possible values are:
0: Idle mode
1: Run mode
2: Hold mode
- Return type:
- get_seq_cstep() int
Returns the currently running step number. (Only Sequence Mode Active)
- Returns:
The current step number (positive integer).
- Return type:
- get_sim_condition() int
Returns the simulation status. (Only Simulation Mode Active)
- Returns:
- Current simulation status. Possible values are:
0: Idle mode
1: Run mode
2: Hold mode
- Return type:
- 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:
- scpi_delay
SCPI delay.
- set_IPK_limit(high: str = 'MAX', low: str = 'MIN', enable: bool = True) None
Set the Ipk high and low limit parameters and enable/disable the limit for continuous operation mode.
- set_Irms(Irms: str | None = None, enable: bool | None = None) None
Set the Irms parameter and enable/disable the Irms limit for continuous operation mode.
- set_frequency(high: str | None = None, low: str | None = None, freq: str | None = None) None
Set the frequency parameters including upper limit, lower limit, and immediate frequency value. (Only AC+DC-INT or AC-INT or AC+DC-ADD or AC-ADD Active)
- set_gain(gain: str) None
Sets the input gain value. (Only AC+DC-EXT or AC-EXT or AC+DC-ADD or AC-ADD Active)
- set_ipeak_hold_time(time_ms: int) None
Sets the Ipeak hold time for peak current measurement when output is on.
- Parameters:
time_ms (int) – The Ipeak hold time in milliseconds (1 to 60,000).
- set_output_mode(mode: str) None
Sets the output mode of the power supply.
- Parameters:
mode (str, optional) – Output mode to set. Acceptable values are: ‘ACDC-INT’ (0), ‘AC-INT’ (1), ‘DC-INT’ (2), ‘ACDC-EXT’ (3), ‘AC-EXT’ (4), ‘ACDC-ADD’ (5), ‘AC-ADD’ (6), ‘ACDC-SYNC’ (7), ‘AC-SYNC’ (8).
- set_phase_parameters(start_state: str | None = None, stop_state: str | None = None, start_phase: float | None = None, stop_phase: float | None = None) None
Sets the state and phase values for the start and stop phases. (Not available for DC-INT, AC+DC-EXT and AC-EXT)
- Parameters:
start_state (str, optional) – State of start phase. Acceptable values are ‘FREE’, ‘FIXED’, or 0 (FREE), 1 (FIXED).
stop_state (str, optional) – State of stop phase. Acceptable values are ‘FREE’, ‘FIXED’, or 0 (FREE), 1 (FIXED).
start_phase (float, optional) – Start phase value in degrees. Acceptable values are: 0 to 359.9, ‘MIN’, or ‘MAX’.
stop_phase (float, optional) – Stop phase value in degrees. Acceptable values are: 0 to 359.9, ‘MIN’, or ‘MAX’.
- set_seq_execute(action: str) None
Sets the execution actions in sequence mode. (Only Sequence Mode Active)
- Parameters:
action (str) – Action to be executed. Acceptable values are: - ‘STOP’: Stops sequence execution - ‘STARt’: Starts sequence execution - ‘HOLD’: Holds sequence execution - ‘BRAN1’: Jumps to Branch 1 execution - ‘BRAN2’: Jumps to Branch 2 execution
- set_seq_parameters(step: int | None = None, cparams: dict | None = None, sparams: dict | None = None) None
Sets the common parameters for the Sequence mode. (Only Sequence Mode Active)
- Parameters:
step (int, optional) – Current step number (0 to 999).
cparams (dict, optional) – Dictionary containing the parameters. Acceptable keys are: - ‘step_time’ (float): Step time. - ‘on_phase’ (float): On phase value. - ‘on_phase_st’ (str or int): On phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0). - ‘off_phase’ (float): Off phase value. - ‘off_phase_st’ (str or int): Off phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0). - ‘term’ (str): Termination settings, can be ‘CONTinue’, ‘END’, or ‘HOLD’. - ‘jump_to’ (int): Jump step number (0 to 999). - ‘jump_st’ (str or int): Jump state, can be ‘ON’ (1), or ‘OFF’ (0). - ‘jump_cnt’ (int): Jump count (0 to 9999). - ‘sync’ (int): Synchronous code for each step, can be 0, 1 , 2 , or 3. (0: LL, 1: LH, 2: HL, 3: HH). - ‘br1’ (int): Branch 1 number (0 to 999). - ‘br1_st’ (str or int): Branch 1 state, can be ‘ON’ (1), or ‘OFF’ (0). - ‘br2’ (int): Branch 2 number (0 to 999). - ‘br2_st’ (str or int): Branch 2 state, can be ‘ON’ (1), or ‘OFF’ (0).
sparams (dict, optional) – Dictionary containing the step-specific parameters. Acceptable keys are: - ‘acv’ (float): AC voltage setting. - ‘acv_mode’ (str or int): ACV mode, can be ‘CONSt’ (0), ‘KEEP’ (1), or ‘SWEep’ (2). - ‘dcv’ (float): DC voltage setting (not applicable, will be ignored). - ‘dcv_mode’ (str or int): DCV mode, can be ‘CONSt’ (0), ‘KEEP’ (1), or ‘SWEep’ (2). - ‘freq’ (float): Frequency setting. - ‘freq_mode’ (str or int): Frequency mode, can be ‘CONSt’ (0), ‘KEEP’ (1), or ‘SWEep’ (2). - ‘waveform’ (str): Waveform type, can be ‘SIN’, ‘SQU’, ‘TRI’, or ‘ARB1’ to ‘ARB16’. - ‘phase’ (int): Phase angle (fixed to 0).
- set_sim_abnormal(code: str | None = None, freq: str | None = None, ph_start_st: str | None = None, ph_start: str | None = None, ph_stop_st: str | None = None, ph_stop: str | None = None, time: str | None = None, volt: str | None = None) None
Sets the abnormal step parameters in Simulation mode. (Only Simulation Mode Active)
- Parameters:
code (int or str, optional) – External trigger output code, can be 0, 1, 2, 3, ‘MINimum’, or ‘MAXimum’. (0: LL, 1: LH, 2: HL, 3: HH).
freq (float or str, optional) – Frequency of the abnormal step, can be a frequency value, ‘MINimum’, or ‘MAXimum’.
ph_start_st (str or int, optional) – ON phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_start (float or str, optional) – ON phase (start phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
ph_stop_st (str or int, optional) – OFF phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_stop (float or str, optional) – OFF phase (stop phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
time (str, optional) – Time value of the abnormal step, can be a time in seconds, ‘MINimum’, or ‘MAXimum’.
volt (str, optional) – Voltage value of the abnormal step, can be a numeric voltage value, ‘MINimum’, or ‘MAXimum’.
- set_sim_execute(action: str) None
Sets the execution actions in simulation mode. (Only Simulation Mode Active)
- Parameters:
action (str) – Action to be executed. Acceptable values are: - ‘STOP’: Stops simulation execution - ‘STARt’: Starts simulation execution - ‘HOLD’: Holds simulation execution
- set_sim_initial(code: str | None = None, freq: str | None = None, ph_start_st: str | None = None, ph_start: str | None = None, ph_stop_st: str | None = None, ph_stop: str | None = None, volt: str | None = None) None
Sets the initial step parameters in Simulation mode. (Only Simulation Mode Active)
- Parameters:
code (int or str, optional) – External trigger output code, can be 0, 1, 2, 3, ‘MINimum’, or ‘MAXimum’. (0: LL, 1: LH, 2: HL, 3: HH).
freq (float or str, optional) – Frequency of the initial step, can be a frequency value, ‘MINimum’, or ‘MAXimum’.
ph_start_st (str or int, optional) – ON phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_start (float or str, optional) – ON phase (start phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
ph_stop_st (str or int, optional) – OFF phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_stop (float or str, optional) – OFF phase (stop phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
volt (float or str, optional) – Voltage value of the initial step, can be a numeric voltage value, ‘MINimum’, or ‘MAXimum’.
- set_sim_normal(norm_idx: int, code: str | None = None, freq: str | None = None, ph_start_st: str | None = None, ph_start: str | None = None, ph_stop_st: str | None = None, ph_stop: str | None = None, time: str | None = None, volt: str | None = None) None
Sets the normal 1 or normal 2 step parameters in simulation mode. (Only Simulation Mode Active)
- Parameters:
norm_idx (int) – Normal index number, 1 for normal 1, 2 for normal 2.
code (int or str, optional) – External trigger output code, can be 0, 1, 2, 3, ‘MINimum’, or ‘MAXimum’. (0: LL, 1: LH, 2: HL, 3: HH).
freq (float or str, optional) – Frequency of the normal 1 step, can be a frequency value, ‘MINimum’, or ‘MAXimum’.
ph_start_st (str or int, optional) – ON phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_start (float or str, optional) – ON phase (start phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
ph_stop_st (str or int, optional) – OFF phase state, can be ‘FIXED’ (‘ON’) (1), or ‘FREE’ (‘OFF’) (0).
ph_stop (float or str, optional) – OFF phase (stop phase) value, can be a value between 0 and 359.9, ‘MINimum’, or ‘MAXimum’.
time (float or str, optional) – Time value of the normal step, can be a time in seconds (0.0001 to 999.9999), ‘MINimum’, or ‘MAXimum’.
volt (float or str, optional) – Voltage value of the normal 1 step, can be a numeric voltage value, ‘MINimum’, or ‘MAXimum’.
- set_sim_repeat(count: str | None = None, enable: str | None = None)
Configures the repeat parameters for the simulation mode. (Only Simulation Mode Active)
- set_sim_transition(trans_idx: int, time: str | None = None, code: str | None = None) None
Sets the transition step parameters in Simulation mode. (Only Simulation Mode Active)
- Parameters:
trans_idx (int) – Transition index number, 1 for transition 1, 2 for transition 2.
time (float or str, optional) – Time value of the transition step, can be a time in seconds (0 to 999.9999), ‘MINimum’, or ‘MAXimum’.
code (int or str, optional) – External trigger output code, can be 0, 1, 2, 3, ‘MINimum’, or ‘MAXimum’. (0: LL, 1: LH, 2: HL, 3: HH).
- set_sync_source(source: str) None
Sets the sync source state. (Only AC+DC-sync or AC-sync Active)
- Parameters:
source (str) – Sync source, can be ‘LINE’(0) or ‘EXT’(1).
- set_test_mode(mode: str) None
Sets the test mode for the power supply.
- Parameters:
mode (str) – The test mode to be set. Acceptable values are: - ‘CONTinuous’ or 0: Continuous mode (normal operating mode). - ‘SEQuence’ or 1: Sequence mode (available for AC+DC-INT, AC-INT, DC-INT modes). - ‘SIMulation’ or 2: Simulation mode (available only for AC+DC-INT mode).
- set_voltage_parameters(volt_range: str | None = None, limit_vrms: str | None = None, limit_vpp: str | None = None, limit_vpk_h: str | None = None, limit_vpk_l: str | None = None, vrms: str | None = None, offset: str | None = None) None
Sets various voltage parameters for the power supply.
- Parameters:
volt_range (str, optional) – Voltage range. Acceptable values are: 100, 200, ‘AUTO’. AUTO is only available in AC+DC-INT, AC-INT, DC-INT, AC+DC-SYNC, or AC-SYNC modes.
limit_vrms (str, optional) – RMS voltage limit. Acceptable values are: Any valid Vrms value, ‘MIN’, ‘MAX’. Only available in AC-INT, AC-ADD, or AC-SYNC modes.
limit_vpp (str, optional) – Vpp limit. Acceptable values are: Any valid Vpp value, ‘MIN’, ‘MAX’. Only available in AC-INT, AC-ADD, or AC-SYNC modes, with specific wave shape(TRI or ARB) and specific voltage Unit(p-p).
limit_vpk_h (str, optional) – Voltage high limit. Acceptable values are: Any valid voltage high limit value, ‘MIN’, ‘MAX’. Only available in AC+DC-INT, DC-INT, AC+DC-ADD, or AC+DC-SYNC modes.
limit_vpk_l (str, optional) – Voltage low limit. Acceptable values are: Any valid voltage low limit value, ‘MIN’, ‘MAX’. Only available in AC+DC-INT, DC-INT, AC+DC-ADD, or AC+DC-SYNC modes.
vrms (str, optional) – RMS voltage value. Acceptable values are: Any valid Vrms value, ‘MIN’, ‘MAX’. Not available in DC-INT, AC+DC-EXT, or AC-EXT modes.
offset (str, optional) – Voltage offset value. Acceptable values are: Any valid voltage offset value, ‘MIN’, ‘MAX’. Only available in AC+DC-INT, DC-INT, AC+DC-ADD, or AC+DC-SYNC modes.
- set_waveform(waveform: str) None
Sets the waveform of the power supply. (Not available for DC-INT, AC+DC-EXT, and AC-EXT)
- Parameters:
waveform (str) – The waveform to set. Can be one of the following: - ‘ARB1’ (0): Arbitrary wave 1 - ‘ARB2’ (1): Arbitrary wave 2 - ‘ARB3’ (2): Arbitrary wave 3 - ‘ARB4’ (3): Arbitrary wave 4 - ‘ARB5’ (4): Arbitrary wave 5 - ‘ARB6’ (5): Arbitrary wave 6 - ‘ARB7’ (6): Arbitrary wave 7 - ‘ARB8’ (7): Arbitrary wave 8 - ‘ARB9’ (8): Arbitrary wave 9 - ‘ARB10’ (9): Arbitrary wave 10 - ‘ARB11’ (10): Arbitrary wave 11 - ‘ARB12’ (11): Arbitrary wave 12 - ‘ARB13’ (12): Arbitrary wave 13 - ‘ARB14’ (13): Arbitrary wave 14 - ‘ARB15’ (14): Arbitrary wave 15 - ‘ARB16’ (15): Arbitrary wave 16 - ‘SIN’ (16): Sin wave - ‘SQU’ (17): Square wave - ‘TRI’ (18): Triangle wave