Error -1074118537: Advanced Sequence Does Not Exist in InstrumentStudio

Updated Apr 12, 2023

Reported In

Hardware

  • PXI Source Measure Unit

Software

  • InstrumentStudio

Driver

  • NI-DCPower

Issue Details

  • I have created a Sequence for my PXI Source Measurement Unit (SMU) and I want to Monitor it in InstrumentStudio. Whenever I do this, InstrumentStudio produces error -1074118537. Why is this happening?
  • I am running InstrumentStudio in Debug Mode to monitor an Advanced Sequence that I have created using NI-DCPower. Why does the below error keep appearing?
ModularInstruments.NIDCPower: The active advanced sequence does not exist.

Status Code: -1074118537
Error code: -1074118537


InstrumentStudioError.PNG

Solution

When in Debug Mode, InstrumentStudio automatically finds open device driver sessions. Error -1074118537 occurs because InstrumentStudio detected an open device driver session with an active Sequence, but the Sequence was deleted soon after.

To resolve this error, implement a short wait function (either a wait based on a user input or specific timeframe) before deleting the Sequence.

The example below shows a Python script that creates an Advanced Sequence for a PXIe-4137. An input() function is called before the session.delete_advanced_sequence() method to force Python to wait for a user input before deleting the Advanced Sequence.
import argparse
import hightime
import nidcpower
import sys

def example(resource_name, options, voltage_max, current_max, points_per_output_function, delay_in_seconds):
    timeout = hightime.timedelta(seconds=(delay_in_seconds + 1.0))

    with nidcpower.Session(resource_name=resource_name, 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)
            channel_indices = '0-{0}'.format(session.channel_count - 1)
            channels = session.get_channel_names(channel_indices)
            measurement_group = [session.channels[name].fetch_multiple(points_per_output_function * 2, timeout=timeout) for name in channels]
            input('Wait before deletion')
		
	
        session.delete_advanced_sequence(sequence_name='my_sequence')
        line_format = '{:<15} {:<4} {:<10} {:<10} {:<6}'
        print(line_format.format('Channel', 'Num', 'Voltage', 'Current', 'In Compliance'))
        for i, measurements in enumerate(measurement_group):
            num = 0
            channel_name = channels[i].strip()
            for measurement in measurements:
                print(line_format.format(channel_name, num, measurement.voltage, measurement.current, str(measurement.in_compliance)))
                num += 1