VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python API and Stimulus Profile question

Solved!
Go to solution

Hello,

 

I'm trying to use IronPython through Visual Studio 2010 to build some automated tests of a PXI device I have. Most of my API (and Python) knowledge so far has been coming from this Iron Python thread. Although very helpful. I'm not able to get the Stimulus profile parts working. I do have basic control over the line forcing an output voltage from the DAQ, but I was hoping to use the far more high level control provide by VeriStand.

 

My methodology so far has been 1) Create a Stimulus Profile in the editor (something simple like an offset sine wave) 2) I don't specify a specific channel in the profile (because I want to use the same waveform across multiple channels, sequentially) 3) Save 4) Point the Python script at the sinewave.nivstest file 5) Run. Is there anything wrong with this process?

 

The problem is that 'running' doesn't really do anything. I'll have to investigate this further with my scope, but the output does something (it almost starts working!) but for something that should be ~20 seconds long, it ends immediately after the first 'blip'.

 

I'm using Iron Python 2.7, VS 2010 Shell. If it matters for any reason, I'm using a NI Custom Device, FPGA card, and DAQ. And as far as I can tell forcing SetChannelValue(X) works for all the outputs.

 

Thanks much!

0 Kudos
Message 1 of 11
(9,025 Views)
Solution
Accepted by topic author Brzeski

It's probably because you're playing a stimulus that has no mapping. Does the same thing happen if you specify a mapping in the profile?

Unfortunately, there is no API in NI VeriStand in 2010 to change the mapping. So whatever you specify when you create it with the GUI is it. However, The nivstest file is actually just XML so you can use any XML parsing and editing API to change the mapping. If you don't want to use an XML editing API, you can try using the technique in the VI posted on this thread to change the mapping.

Stephen B
Message 2 of 11
(9,012 Views)

Stephen,

 

I added a stimulus mapping and you are right that does fix the problem.

 

From a high level I was trying to associate a stimulus profile with a channel so I could use the same profile on different channels for testing. Examining the code shows that I certainly didn't do that properly. I see your mention of the XML mapping... that might be a solution. I don't have access to LabView at the moment. Are those the only real possibilities? Should I be setting up stimulus profiles differently using a playback generator or would that still run into the same problem?

 

Also, I suppose the only reason I'm using the Python API is because I want to execute generators on specific channels sequentially, my tinkering with VeriStand only seemed to result in a massivly parallel test, do you know of any guides/user manuals that point out how to accomplish this? I looked through the existing VeriStand Help but didn't find anything. Should I be building procedures as well?

0 Kudos
Message 3 of 11
(9,010 Views)

Unfortunately there is no way to have one profile be played on different channels.. Because the mapping is saved into the profile and cannot be changed with any API (other than XML editing the profile file). This is something we hear a lot and will be improved in the future. The same thing goes for running multiple profiles at the same time.

 

I don't know what you mean by massively parallel test. Your python script should execute sequentially. So if you set some values, then play a nivstest file, then play a different nivstest file.... etc... it should all go sequentially.

 

 

Stephen B
0 Kudos
Message 4 of 11
(9,008 Views)

 


Also, I suppose the only reason I'm using the Python API is because I want to execute generators on specific channels sequentially, my tinkering with VeriStand only seemed to result in a massivly parallel test, do you know of any guides/user manuals that point out how to accomplish this? I looked through the existing VeriStand Help but didn't find anything. Should I be building procedures as well?

 


I should have been more clear, this question was directed at using vanilla VeriStand without the Python API.

 

0 Kudos
Message 5 of 11
(9,003 Views)
FYI, NI VeriStand 2011 just released. The main new feature was a revamped Stimulus Profile Editor and execution system. This new system was based on feedback such as yours. One of the highlights is improved test portability. In NI VeriStand 2011 you can create real-time sequences that define the profile, but then map them at run-time using the public API to a specific system definition channel. This allows much greater reuse of your test sequences and seems to solve the problem you posted about. For more info refer here: http://forums.ni.com/t5/NI-VeriStand/Python-API-and-Stimulus-Profile-question/td-p/1489060
Jarrod S.
National Instruments
0 Kudos
Message 6 of 11
(8,523 Views)

Hi Jarrod, this looks like what I'm trying to do as well. In your previous post you provided a link, but it appears to come back to this same thread. Did you mean to put a link to a different post? Thanks.

0 Kudos
Message 7 of 11
(7,955 Views)

I believe he was referring to steps 4 and 5 of this document

 

The idea being that you can write a Real-Time Sequence and call it from multiple different Stimulus Profiles for different system definitions and channels. 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 8 of 11
(7,930 Views)

h_yong,

 

I've since moved to VeriStand 2011 (and soon to 2012) and the new Stimulus Profile Editor is much more complete and feature rich than 2010. I gave up on this route trying of to control the Stimuls Profile API through Python because I would have had to edit xml files procedurally as I went through my custom sequence. Plus 2010 doesn't have the parallelism that I needed.

 

I know upgrading isn't always possible, but if you can, I'd recommend it. Hope that helps!

0 Kudos
Message 9 of 11
(7,916 Views)

Hi,

Yes, I am on 2011 now too. Thanks.

0 Kudos
Message 10 of 11
(7,909 Views)