VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using loop counter in channel names

In a stimulus profile, I would like to have a while or for loop which, on each iteration, does an operation on a different channel. Is it possible to format the loop counter into a channel name in the stimulus profile editor?

For example, only iteration 1, I would like to set the value of channel 1. On iteration 2, I would like to set the value of channel 2, etc. Thanks.

0 Kudos
Message 1 of 8
(6,419 Views)

Hello Harris,

 

Unfortunately this isn't available currently in the stimulus profile to pull a loop's counter value. You can implment a local variable that increments after each iteration and stop the loop once it has reached a specific value. You'd then pass the value to your sequence that would apply to each channel based on that value.

 

Thank you and have a great day,

Kyle Hartley
Senior Embedded Software Engineer

0 Kudos
Message 2 of 8
(6,388 Views)

Hi Kyle,

Thanks for the response. I didn't quite understand what you were suggesting. Would you mind clarifying? For me, I'd like to be able to address a different channel on each iteration.

0 Kudos
Message 3 of 8
(6,372 Views)

Hey Harris,


I appologize for the vagueness of my statement. No we can't work with strings on the RT side, you could maybe do something with a model or a custom device but I think this would be more work than you'd want.

 

Here is a picture from the editor of I think what the workaround would be. You could change the assignments to sequence calls and pass the reference of the channels you want to modify.

channels.PNG

 

Kyle Hartley
Senior Embedded Software Engineer

0 Kudos
Message 4 of 8
(6,357 Views)
Kyle, Thanks for the example. It's similar to what I thought I'd do. Alternatively I was thinking I could explore the stimulus profile API which I have not yet used. There I assume I could format my strings and use them as channel references. However, it's not clear to me whether I can have a profile that calls a sequence that was written with the API, or do I have to do everything in the API once I start a profile or sequence with the API? Thank you.
0 Kudos
Message 5 of 8
(6,354 Views)

Harris,

 

Unfortunately you can't write a real-time test sequence in LabVIEW. You can control sequences but to actually write the sequence you'd write it in the profile editor.

 

The API allows you to programmatically control which tests are running. This alleviates the need to have an operator use the Workspace to control things if its not needed.

 

 

Kyle Hartley
Senior Embedded Software Engineer

0 Kudos
Message 6 of 8
(6,351 Views)

Hey Harris,

 

The above post isn't entirely correct... yes you can execute and interact with running real time sequences and stimulus profiles with LabVIEW (using the NIVS .NET API under the hood) but you can also use the NIVS .NET API to author and edit real time sequences and stimulus profiles.

 

Information on the .NET calls to do so can be found in the NIVS help file for the .NET API which is available in your start menu. Its called the "configuration API" (don't ask me why...)

 

There are some examples for authoring/editing real time sequences using this API from LabVIEW installed to <Program Files>\LabVIEW <2011 or later>\Examples\NI VeriStand\API

 

Unfortunately there are no installed examples for editing stimulus profiles... but the API is similar to the one for real time sequences so you should be able to figure it out. And also, if you're running the real time sequences from LabVIEW anyway... you may not need stimulus profiles at all.

Stephen B
0 Kudos
Message 7 of 8
(6,323 Views)
Hi StephenB, Thanks, these will be useful. In order for me to use LabVIEW to manipulate channel names based on a loop counter, however, there is one additonal functionality that I haven't quite figured out. It appears that, in nested sequences, in order for a sequence to read or write to a user variable at the system definition level, I have to do so via parameters, but those parameters have to be passed in via the sequence call. Is there any way around this? I'd just like to use some user variables like global variables so I don't have to worry about passing them from one level to another. It seems that if I don't pass them in with the sequence call, then the compiler complains. Thanks.
0 Kudos
Message 8 of 8
(6,303 Views)