How to use the nidcpower.OutputFunction.DC_VOLTAGE 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_measure(single_channel_session):
    single_channel_session.source_mode = nidcpower.SourceMode.SINGLE_POINT
    single_channel_session.output_function = nidcpower.OutputFunction.DC_VOLTAGE
    single_channel_session.voltage_level_range = 6
    single_channel_session.voltage_level = 2
    with single_channel_session.initiate():
        reading = single_channel_session.measure(nidcpower.MeasurementTypes.VOLTAGE)
        assert single_channel_session.query_in_compliance() is False
    assert reading == 2
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 / examples / nidcpower_advanced_sequence.py View on Github external
timeout = hightime.timedelta(seconds=(delay_in_seconds + 1.0))

    with nidcpower.Session(resource_name=resource_name, channels=channels, options=options) as session:

        # Configure the session.
        session.source_mode = nidcpower.SourceMode.SEQUENCE
        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
github ni / nimi-python / src / nidcpower / examples / nidcpower_source_delay_measure.py View on Github external
def example(resource_name, channels, options, voltage1, voltage2, delay):
    timeout = hightime.timedelta(seconds=(delay + 1.0))

    with nidcpower.Session(resource_name=resource_name, channels=channels, options=options) as session:

        # Configure the session.
        session.source_mode = nidcpower.SourceMode.SINGLE_POINT
        session.output_function = nidcpower.OutputFunction.DC_VOLTAGE
        session.current_limit = .06
        session.voltage_level_range = 5.0
        session.current_limit_range = .06
        session.source_delay = hightime.timedelta(seconds=delay)
        session.measure_when = nidcpower.MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE
        session.voltage_level = voltage1

        with session.initiate():
            print('Voltage 1:')
            print_fetched_measurements(session.fetch_multiple(count=1, timeout=timeout))
            session.voltage_level = voltage2  # on-the-fly set
            print('Voltage 2:')
            print_fetched_measurements(session.fetch_multiple(count=1, timeout=timeout))
            session.output_enabled = False