NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand if statement

Solved!
Go to solution

In my Teststand sequence I am ruunning a loop which is iterating for different frequencies. I need to assign a value for a variable for example,

 

For Frequency = 50Hz, K=1

For Frequency = 60Hz,  K=2

For Frequency = 70 Hz, K=3

............................................

............................................

 

I know I can put a if statement or use case structures, but the problem is i have a lot of frequency steps so it will mean that I will have a lot of if statement or case structures. is there an easy way to solve this?

 

Thank you

0 Kudos
Message 1 of 8
(4,729 Views)

You could make a local array of numbers to hold the frequencies and loop through it.   If you have other values to associate with each frequency, you could create a container type that holds all the values and make a local array of your new type.

0 Kudos
Message 2 of 8
(4,701 Views)

I made an array of the frequencies and using For each function  to use the frequency array to iterate over, but putting the other variable K value for each frequency is the problem here. Could be kindly show me an example to do it. would be of great help

 

thank you

0 Kudos
Message 3 of 8
(4,686 Views)

How about this? (see attached)

0 Kudos
Message 4 of 8
(4,665 Views)

Thank you for the sequence file. I have an excel file which will have the following format:

 

Frequency Resistance Voltage

 

50Hz         2ohm             3V

60Hz         4ohm             6V

...........................................

............................................

 

Is there a way to create the array of container file directly by calling the excel file either via teststand or labview instead of assigning the values manually in teststand. Second thing I wanted to ask so consider i set that the loop should run for 5 frequencies 50Hz, 60Hz , 70Hz, 80Hz how can i do it so that at every frequency it compares the frequency valyue with the container frequency value and when it finds the exatc value it assigns the value of those two other variable . So i seleect run for 50Hz it checks the excel file for 50Hz point and automatically assigns 2ohm to resistance variable and 3V to the voltage variable. 

 

thank you very much for your patience

0 Kudos
Message 5 of 8
(4,654 Views)

See attached

Download All
Message 6 of 8
(4,631 Views)

Thank you very much for the codes. It was a great help. One thing I wanted to ask could you explain the excel file a bit. Like how you got the property group id. I will have a general excel file. So i wanted to learn a bit how to make a file like you did from a generic excel file.

 

Thank you again.

0 Kudos
Message 7 of 8
(4,612 Views)
Solution
Accepted by zakariarahman

I used Tools>>Import/Export Properties... to create the file.

 

After exporting the contents of Locals.IterationParameterArray to get the file, I set the number of elements in the array to zero so that the only elements would be those loaded from the file at runtime by the Property Loader Step.

 

I'm not sure what the property group id the export tool created is for or whether it is absolutely required for this case. You might be able to find that in the property loader documentation.  I tried taking it out without changing anything else and it did cause an error.

0 Kudos
Message 8 of 8
(4,592 Views)