# set Channel 1's voltage to 20 V
    tcp_socket.send_scpi_command('SOUR1:VOLT 20')

    # set Channel 1's modulated sequence to a DC staircase with 5 steps
    # There are 5 current steps that each last for 1 second: 40mA, 80mA, 120mA, 160mA, and 200mA
    tcp_socket.send_scpi_command('SOUR1:SEQ 1(1@20,1@40,1@60,1@80,1@100)')

    # Log all events since all settings are sent
    log_all_events(tcp_socket)

    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # Wait until channel is ready for a trigger command
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # Output modulated sequence
    tcp_socket.send_scpi_command('OUTP1:TRIG')

    # Wait until channel has completed it modulated sequence
    read_until_event(tcp_socket, 105)  # event 105 is "Modulated SEQ completed"

    # turn off Channel 1
    tcp_socket.send_scpi_command('OUTP1 0')

    # set Channel 1's modulated sequence to an infinite pulsing pattern. This pulsing pattern will repeatedly perform 3 steps:
    #       1.) it will pulse Off for 250ms, then On for 250ms at 120mA. This will happen twice
    #       2.) it will pulse Off for 500ms, then On for 500ms at 60mA. This will also happen twice
    #       3.) for one second, 180mA will be outputted
    tcp_socket.send_scpi_command(
    tcp_socket.send_scpi_command('SOUR1:CURR:RANG:AUTO 1')
    log_all_events(tcp_socket)

    # set Channel 1's current to start current and check for all events
    tcp_socket.send_scpi_command('SOUR1:CURR {}'.format(start_current_A))
    log_all_events(tcp_socket)

    # set Channel 1's Ramp mode to Fast and check for all events
    tcp_socket.send_scpi_command('OUTP1:RAMP FAST')
    log_all_events(tcp_socket)

    # start the Channel 1
    tcp_socket.send_scpi_command('OUTP1 ON')

    # wait until Channel 1 is ready
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # set Digitizer to abort any measurements
    tcp_socket.send_scpi_command('VOLT:ABOR')
    log_all_events(tcp_socket)

    # set Digitizer Aperture to 10us and check for all events
    tcp_socket.send_scpi_command('VOLT:APER 10')
    log_all_events(tcp_socket)

    # set Digitizer Trigger Count to step count and check for all events
    tcp_socket.send_scpi_command('VOLT:TRIG:COUN {}'.format(step_count))
    log_all_events(tcp_socket)

    # set Digitizer Read Count to 1 and check for all events
    tcp_socket.send_scpi_command('VOLT:READ:COUN 1')
예제 #3
0
    tcp_socket.send_scpi_command('SOUR1:PULS:TON 0.0001')
    tcp_socket.send_scpi_command('SOUR1:PULS:TOFF 0.0099')

    # set Channel 1's compensation settings to High/Fast
    # For higher power loads or shorter pulses, these settings may have to be adjusted to obtain ideal pulse shape
    tcp_socket.send_scpi_command('SOUR1:PULS:CCOM 1')
    tcp_socket.send_scpi_command('SOUR1:PULS:RCOM 1')

    # Check for any errors with initializing commands
    log_all_events(tcp_socket)

    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # Wait until Channel 1 is ready for a trigger command
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # Output pulsed sweep for Channel 1
    tcp_socket.send_scpi_command('OUTP1:TRIG')

    # Wait for the Pulsed Sweep to be complete
    read_until_event(tcp_socket, 109)  # event 109 is "Pulsed Sweep Complete"

    # Output pulsed sweep for Channel 1. Multiple sweeps can be run while the channel is enabled
    tcp_socket.send_scpi_command('OUTP1:TRIG')

    # Wait for the Pulsed Sweep to be complete
    read_until_event(tcp_socket, 109)  # event 109 is "Pulsed Sweep Complete"

    # turn off Channel 1 after routine is complete
    tcp_socket.send_scpi_command('OUTP1 0')