Showing posts with label TestStand. Show all posts
Showing posts with label TestStand. Show all posts

Thursday, May 11, 2017

Learning TestStand

Trying to become enough of an Instant Expert on TestStand that I can throw together a demo to convince management to buy it.

Like most modern-day NI products, it is so loaded up with deeply nested configuration options and counterinutive paradigms that you can't just start poking around with it and expect to be able to pick it up.

I am trying to make a test sequence that will do the following:

1. Prompt for a variety of parameters at the start of a test, not just UUT

2. Configure and enable a GPIB power supply

3. Call a Labview VI to read the output of the power supply via the DMM card in my PXI chassis

4. Run a short python script that produces a meaningless text file to the operating system and returns a pretend pass/fail result.

5. Produce a test report.

6. Produce a little file that has the information from the user prompt in it and put it in the same directory as the python file output.

7. Secure FTP the python output file, the metadata file and test report to a remote location into a directory on the remote system based on some of the information entered via the user prompt in step one.

Here are the pointers to how I learned to do all of these steps (some still in progress):

Basic tutorials/reviews of TestStand:

Here's the link to NI's vast suite of four introductory videos: http://www.ni.com/teststand/whatis/

Here's the first video. It's very short at 4 minutes and glosses over a lot of nuts and bolts: http://www.ni.com/video/3303/en/

This video of a guy poking around the various GUI screens for TestStand is a lot like the introductory video from NI, but he goes through nearly every screen and menu and it's step more in depth. Sadly, it does not seem as though he ever produced a follow-on video: https://www.youtube.com/watch?v=EMC-MXmmOvk

Here's a newer introductory video by NI placed onto YouTube. This one is actually pretty good. It goes over the same info as the one above, but with more narration and https://www.youtube.com/watch?v=GXj-ASlB_r0


1. Prompt for a variety of parameters at the start of a test, not just UUT

So according to the Getting Started Guide, the flow of sequence execution is called a Process Model. This can include Serial, Parallel, and Batch. There are hints that other Process Models besides these are possible. A Process Model can have one or more Entry Points. For Serial Process Models, there are two default Entry Points which are Test UUTs and Single Execution. These defaults for some reason are so standard that they're in the execute menu?

This help page contains an absolutely dense presentation of these and related concepts, with lots of links. I'm still trying to understand a least 50% of the information here: https://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/process_models_modify_entry_points/

I think that what it is that I want to do is customize an entry point, or create a new one maybe.

This link is super promising with the title "". It references a "NI TestStand Reference Manual" but elsewhere in NI's pages it says that the manual was eliminated, as if that was a good idea. Apparently this page is for versions of TestStand before 2012. However it contains an absolutely brilliantly clear set of flowcharts for the "Single Pass" and "Test UUTs" entry points.

Here are a chain of links to useful information
Guide to Getting Started. A page full of very promising links: http://www.ni.com/teststand/resources/
A Guide to TestStand Documentation. Very promising. They want you to stare at the architecture slides mostly, but there's a link to a page describing the Example Programs, which are supposedly all on my system already. This page was the first place that I saw the map to how the documentation is scattered between online and offline sources. Later reading of the GUI description indicated that they had several help buttons to get you to each of these sources. http://zone.ni.com/reference/en-XX/help/370052N-01/tshelp/infotopics/guidetodoc/
Here is the list of all the example programs supposedly on the system.






Here is a "white paper" from NI called "Top 5 TestStand Tips And Tricks." Nice enough but it also gives away that preUUT can be overloaded just like a C++ method. You apparently create an entire sequence (so this can contain things like Labview VIs) and then save it under the same name. http://www.ni.com/white-paper/6832/en/


2. Configure and enable a GPIB power supply.

This turned out to be trickier than it had any right to be. First I downloaded the Labview drivers for the supply and whipped up a quick control panel which had no problem configuring and enabling the supply, so I knew that the connections were working.

Next, it became clear that I need to download the IVI drivers for my particular supply. I went through the NI web site and found them and they installed fairly easily.

After that I found myself in an endless cycle of trying to edit a "IVI Power Supply" step to point to the IVI drivers for my device. The configuration has several screens, but the most important one to set up seems to be the first. The thing that I had to do was specify the logical name for the supply. This taught me that the majority of the work required to get this up and running is in NI MAX. When the drivers had been installed, it created an entry under "IVI Drivers >> Instrument Driver Software Modules", and a session in "IVI Drivers >> Driver Sessions" but nothing under Logical Names. I added a new logical name, which just had a drop-down menu for selecting the Driver Session to point to. Here's where I wasted a lot of time experimenting. It turns out that "Simulate With" in the "General" tab is a trap and I needed to set it to "Don't Simulate". In the "Hardware" tab I had to define one line, with apparently any name but have the Resource Descriptor match the VISA name actually assigned to my device in "Devices and Interfaces". The "Software" tab was all set up to point to my actual drivers and didn't need to be changed. Then the super important part was in the "Virtual Names" tab. This apparently is used to create a "name" for my control channel and link it to the actual control channel name as accessed through GPIB. By adding any name, it gave me a drop-down menu to pick the GPIB name for the channel from. TestStand seems to want to call the channels "CHANNEL 1" etc, so I had to use the name "CHANNEL 1" and select "1" from the drop-down menu. The "Initial Settings" tab seems to be useless for my supply, as there is no way to add initial settings so there probably aren't any. Some links:
Here's the NI tutorial where they show setup with my version of NI Max and suggest setting the simulation option to "Don't Simulate". At the point where it starts explaining how to configure "Virtual Names" it loses steam and fails to reveal what it is for and how to use it. http://www.ni.com/tutorial/4594/en/
Here's a much sparser tutorial, but it at least provides an example of the entire point of this IVI nightmare in "swapping" instruments using all the linkage built into the concept. http://www.ni.com/tutorial/3377/en/
Here's a tutorial that goes pretty nicely into core concepts, but it has a hefty disclaimer at the top that this is for earlier versions of NI Max and things are much different for the version that I'm running. http://www.ni.com/tutorial/4591/en/
Here are a couple of links to forum threads on NIs forums of people that had problems that are a little bit similar to mine, but their problems are either not solved or are solved in a way that doesn't make any sense to me particularly with what I now know and are basically nonapplicable but still may contain some helpful information:
http://forums.ni.com/ni/board/crawl_message?board.id=330&message.id=8491
http://forums.ni.com/t5/NI-TestStand/IVI-call-fails-with-a-bad-channel-name-that-is-in-fact-OK/m-p/148319?requireLogin=False
Here is a forum thread by a guy who seemed to be having exactly the same problem as me. I've skimmed the thread and it does seem to eventually settle on problems with the channel ID.http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Help-using-IVI-Power-Supply-step-in-TestStand/td-p/41815




3. Call a Labview VI to read the output of the power supply via the DMM card in my PXI chassis.

You'd think that calling a Labview VI, being the core software compatibility that TestStand is supposed to have, would be easy, but no.

To get a leg up on this one, I followed this video exactly, and from there began to learn how to call and get results from more complex VIs. There's no narration, just a music track that old fairly quickly. Nonetheless this is probably the best TestStand tutorial I've watched because it just freaking shows you how to make a test sequence. https://www.youtube.com/watch?v=NatLqcduBpY



4. Run a short python script that produces a meaningless text file to the operating system and returns a pretend pass/fail result.

5. Produce a test report.

Thank God this works right out of the box. The default report file type is ATML, which I have never ever heard of before, so even though it produces a nice sparse output that's easy on the eyes I have to remember to set this output report type to HTML.

6. Produce a little file that has the information from the user prompt in it and put it in the same directory as the python file output.

7. Secure FTP the python output file, the metadata file and test report to a remote location into a directory on the remote system based on some of the information entered via the user prompt in step one.


More info:

Here is a list of master-class examples which have very little to do with what I am trying to do but they all look very interesting. At least one has redesigned the deployable user interface: http://www.ni.com/example/14284/en/

Intermission:
Right after I successfully got my new version of PreUUT working, and experimented with generating the report file output path with dynamically, I came in the next day and TestStand was completely broken and nothing ran. While running any sequence I continually got an error message before it ran any part of any sequence. The message was:
"TestStand Unknown variable or property name 'FileGlobals.UUT' Step 'Set ReportOptions From Path Macros" of sequence 'Model Plugin - Initialize' in 'NI_ReportGenerator.seq'"
Googling this message didn't get me any hits that seemed to relate to my problem. I decided to completely uninstall and reinstall TestStand, but humorously this didn't fix the problem. I finally figured out that the issue must have been related to the test report output directory definition that I was fiddling with the day before, since it's a global setup. During the uninstall and reinstall the setup was somehow carried through, probably because I was in too much of a hurry to reboot in between. I went back to the "Results Generation" tab and set the report generation back to one of the more simple options and everything started to work again.
Here's a forum thread that came out of my google search that seems to be full of really useful information. This was started by somebody who is also trying to dynamically configure their output report path like I am. His problem gets solved in a couple of interesting ways that I need to spend some time investigating. There's apparently a process model that gets the current report file path (why not a step), there's some kind of macro to use in the path specification, there's some kind of plug-in to use, and then somebody suggests overloading PreUUT which seems to be the correct answer. Then somebody else posts and their problem seems to be very similar to mine and somebody suggests the solution, which is posted with great detail and screenshots. https://forums.ni.com/t5/NI-TestStand/Unknown-variable-or-property-name-ReportFilePath-Error-accessing/td-p/2825110

Amazon Web Services demo account
I needed a temporary SSH server somewhere to demonstrate uploading the results of the demo autonomously. I considered using one of my old accounts from a previous project but decided to do some googling and discovered that there are a few free options, one of which is a "Free Tier" account at Amazon Web Services. It's amazing because it's possible to get a Linux VM and a 5 GB of storage for free for the first 12 months! I guess they're counting on you becoming addicted to the storage or to expand to want bigger and better services. For my purposes this is great; I can just delete the account when I'm done with the demo! Here is my trail of links for learning how to do this:
A lot of people asked the same question as me and many of my early google results referenced the same solutions as in this collection of links and other peoples' forum threads: http://www.sftp.net/public-online-sftp-servers
The University service described in this forum thread has long been shut down, but there are other hints:http://stackoverflow.com/questions/3333973/address-of-public-sftp-test-server
A lot of suggestions to people who were looking for some kind of online service were instead to various cheap SFTP server programs, which is nice but doesn't help with the "on somebody else's computer" problem. Here is one frequentlyl reference mini SFTP server: http://labs.rebex.net/tiny-sftp-server
I've got Google accounts up the whazootie, I'd think that they'd throw in a Linux shell for free but it's not obvious if this is the case. Here is as far as I got to investigating this route before giving up: https://cloud.google.com/compute/docs/access/user-accounts/
Finally, I got to this Quora thread which has the great virtues of being exactly the question I was trying to ask and being chock full of answers. This is the hint that led me to AWS, but some of the other uninvestigated answers remain of interest too: https://www.quora.com/Is-there-any-way-to-get-a-single-free-Linux-VM-in-the-cloud
Here's the starting point for AWS Free Tier: https://aws.amazon.com/free/
Here's how to start my first VM. Interestingly, part of the process is generating a private key for accessing the VM, and apparently you can only log into the VM using the private key!: https://aws.amazon.com/getting-started/tutorials/launch-a-virtual-machine/
Here's how to SSH into the VM: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
Here's how to get to the VM via PuTTY. It requires taking the private key from creating the session and converting it to a .ppk file fairly easily using PuTTYgen. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
Just for quick reference, here is AWS's page of button links to all their tutorials:
https://aws.amazon.com/getting-started/tutorials/
Something that I had to do over and over again was fiddle with the access lists to my VM. Like just about everything else with AWS, doing this is a delightfully easy process, but nonetheless I keep forgetting how to do it and have to ew-read the tutorials every time. I've lost the links to my favorite tutorials, but here is the basic information in not as accessible a style from AWS:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html
Here's a stale old Google search for how to find the tutorials to changing the access lists to my VM. These search results don't lead to the links that I like but I used the correct terminology for what I'm searching for so I want to save that information:
https://www.google.com/search?q=AWS+add+ip+to+security+group