National Instruments Equipment?

I know the stock answer will be openTAP allow the user to implement whatever they need. However to save time, is there any forum where Instrument source code is being shared for NI devices.?

My limited research is that openTAP seems to be Keysight’s method of selling their instruments just like TestStand is to enable national tools. Since it’s been 20 years since I used TestStand I’m not able to compare the effort to develop and deploy a tester. However openTAP would be a lot quicker if this “open platform” promoted the use of 3rd party instruments (without warranty of course).

So far the nicety in evaluating this has been to stress test a driver I wrote for a LIN Gateway using a custom ASSP. I had to download the BarCode Scanner instrument to get an idea of how to implement a very basic API. In my opinion, something like this should have been included in the examples.

First off, welcome to the community! Thanks for bringing this discussion to the forum.

Now, I think both of these platforms, TestStand and OpenTAP, are perfectly capable of interfacing with any type of instrument, and therefore are required to stand on their own merit. These are, yes, test automation solutions created by companies that do also manufacture test equipment, but I don’t think these platforms are required for selling equipment, nor do I think either of these companies need help from these platforms to sell their equipment.

I’m not aware of an effort elsewhere to create (and share) NI OpenTAP drivers, but the great thing about OpenTAP and the open-source community in general is that anyone can create their own plug-ins, publish them as packages, and upload them to the OpenTAP repo, for anyone to use!

@craig.petku while OpenTAP did come from Keysight original, we do envision being as HW agnostic as possible, and truly serving the needs of everyone in the T&M industry. Keysight is obviously not experts in other vendors HW, but we will gladly support and even host any plugins contributed.
There actually are some NI instrument plugins that have been contributed here:

As for the examples, we generally point people here (also included with an install):

But if you found stuff missing and/or not obvious, we are definitely interested in that feedback so that we can work to improve things.

The attached runs, with V19.0 of the NI DAQmx (21 seems to be broken) but has not been validated. It’s a simple example of a NI-9205 ADC Instrument. There are some nuances I don’t understand, but it may provide some value for bringing up a cDAQ system.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Data;
using NationalInstruments.DAQmx;
using OpenTap;

namespace OpenTap.Plugins.IndiePlugins
{
// A custom instrument (under development).
[Display(“NI-9205 ADC”, Groups: new { “Indie”, “Plugin Development” }, Description: “A simple instrument to read voltages using a NI-9205 ADC”)]

public class NI9205 : Instrument
{
    #region Settings
    // ToDo: Add property here for each parameter the end user should be able to change
    #endregion

    [Display("AvailableChannels", Group: "Instrument", Order: 1)]
    public string [] AvailableChannels { get; private set; }

    [Display("SelectedDdevice:", Group: "Instrument", Order: 2)]
    public string SelectedDevice { get; set; }

    [Display("SelectedChannel", Group: "Instrument", Order: 3)]
    public string SelectedChannel { get; set; }

    [Display("voltage:", Group: "DutMeasurement")]
    public double voltage { get; set; }

    private NationalInstruments.DAQmx.Task analogInTask;
    private NationalInstruments.DAQmx.AIChannel myAIChannel;
    private NationalInstruments.DAQmx.AnalogSingleChannelReader reader;

    public NI9205()
    {
        Name = "NI9205";

        voltage = 0;

        AvailableChannels = DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.AI, PhysicalChannelAccess.External);

        SelectedDevice = AvailableChannels[0].Split('/')[0];
        SelectedChannel = AvailableChannels[0].Split('/')[1]; ;
    }
    public override void Open()
    {
        base.Open();
    }

    public double readVoltage(string Channel, double range, AITerminalConfiguration config)
    {
        string temp;
        temp = string.Concat(SelectedDevice, "/", Channel);
        SelectedChannel = Channel;

        try
        {
            NationalInstruments.DAQmx.Task analogInTask = new NationalInstruments.DAQmx.Task();

            myAIChannel = analogInTask.AIChannels.CreateVoltageChannel(
                temp /* ex "cDAQ1Mod8/ai0" */,
                "myAIChannel",
                config  /* e.g., NationalInstruments.DAQmx.AITerminalConfiguration.Differential */,
                0,
                range /* e.g., 10 */,
                NationalInstruments.DAQmx.AIVoltageUnits.Volts);

            NationalInstruments.DAQmx.AnalogSingleChannelReader reader = new NationalInstruments.DAQmx.AnalogSingleChannelReader(analogInTask.Stream);

            double analogDataIn = reader.ReadSingleSample();
            voltage = analogDataIn;

            analogInTask.Dispose();
            myAIChannel.Dispose();
            reader = null;
            return analogDataIn;
        }
        catch 
        {
            Log.Error("NI-9205 unable to read channel {0}", temp);
            return -9999999; /* out of range */
        }
    }

    public override void Close()
    {
        // TODO:  Shut down the connection to the instrument here.
        base.Close();
    }
}

}

2 Likes

Thank you,

The Feasa plugin looks interesting for a project I’m working on.

1 Like

Hi @craig.petku welcome to the OpenTAP Forum (and the OpenTAP Community)! As noted by @brennen_direnzo it’s definitely not a limitation technically / architecturally or even limited by the vision and mission of OpenTAP.

One question…are you specifically looking for TestStand leverage and/or some specific NI instrument drivers? Or are you also looking for leverage & re-use of existing LabVIEW code?

If the latter, @GoranJohnsson might be interested in this discussion. He’s seen such a need both for LabVIEW as well as HP/Agilent/Keysight VEE.

1 Like

I’m looking for the shortest path to learn openTap while using some NI equipment and also custom (inhouse) equipment. As I build up test racks I will be open to sourcing power supplies and such from additional suppliers.

While I’ve meade significant progress in my understanding of how to write openTap instruments and teststeps over the past week or so, it would have been significantly easier if the examples included in the installation of VS actually opened and read a real IO port. Likewise a simple instrument example (like what I posted) for a National module would have saved hours .

3 Likes

Thanks @craig.petku I’ve documented these requests here:

I agree, having some real examples of device and instrument control would be helpful.

1 Like