How to use the nidcpower.OutputFunction function in nidcpower

To help you get started, we’ve selected a few nidcpower examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ni / nimi-python / src / nidcpower / system_tests / test_system_nidcpower.py View on Github external
def test_reset_device(session):
    channel = session.channels['0']
    default_output_function = channel.output_function
    assert default_output_function == nidcpower.OutputFunction.DC_VOLTAGE
    channel.output_function = nidcpower.OutputFunction.DC_CURRENT
    session.reset_device()
    function_after_reset = channel.output_function
    assert function_after_reset == default_output_function
github ni / nimi-python / src / nidcpower / system_tests / test_system_nidcpower.py View on Github external
def test_create_and_delete_advanced_sequence(single_channel_session):
    properties_used = ['output_function', 'voltage_level']
    sequence_name = 'my_sequence'
    single_channel_session.source_mode = nidcpower.SourceMode.SEQUENCE
    single_channel_session.create_advanced_sequence(sequence_name=sequence_name, property_names=properties_used, set_as_active_sequence=True)
    single_channel_session.create_advanced_sequence_step(set_as_active_step=True)
    assert single_channel_session.active_advanced_sequence == sequence_name
    single_channel_session.output_function = nidcpower.OutputFunction.DC_VOLTAGE
    single_channel_session.voltage_level = 1
    single_channel_session.delete_advanced_sequence(sequence_name=sequence_name)
    try:
        single_channel_session.active_advanced_sequence = sequence_name
        assert False
    except nidcpower.errors.DriverError:
        pass
github ni / nimi-python / src / nidcpower / examples / nidcpower_advanced_sequence.py View on Github external
session.voltage_level_autorange = True
        session.current_limit_autorange = True
        session.source_delay = hightime.timedelta(seconds=delay_in_seconds)
        properties_used = ['output_function', 'voltage_level', 'current_level']
        session.create_advanced_sequence(sequence_name='my_sequence', property_names=properties_used, set_as_active_sequence=True)

        voltage_per_step = voltage_max / points_per_output_function
        for i in range(points_per_output_function):
            session.create_advanced_sequence_step(set_as_active_step=False)
            session.output_function = nidcpower.OutputFunction.DC_VOLTAGE
            session.voltage_level = voltage_per_step * i

        current_per_step = current_max / points_per_output_function
        for i in range(points_per_output_function):
            session.create_advanced_sequence_step(set_as_active_step=False)
            session.output_function = nidcpower.OutputFunction.DC_CURRENT
            session.current_level = current_per_step * i

        with session.initiate():
            session.wait_for_event(nidcpower.Event.SEQUENCE_ENGINE_DONE)
            measurements = session.fetch_multiple(points_per_output_function * 2, timeout=timeout)

        session.delete_advanced_sequence(sequence_name='my_sequence')
        line_format = '{:,<4} {:,.6g} {:,.6g} {:<6}\n'
        print('{:<4} {:<10} {:,<10} {:<6}'.format('Num', 'Voltage', 'Current', 'In Compliance'))
        i = 0
        for measurement in measurements:
            print(line_format.format(i, measurement.voltage, measurement.current, str(measurement.in_compliance)))
            i += 1