04-10-2012 02:28 AM
Hi,
I am new to test stand and have just finished my first sequence. I have a couple of questions about how to make it better.
My sequence has about 100 steps it executes. One of the steps that occur quite frequently is a pause so that the previous VI output can take affect. At the moment I'm just using a VI with a that takes an integer as an input and pauses for that amount of time. Is there a more elegant way of doing this?
Another VI that I am using logs some data and is run every 6th step or so. The only difference between each run is a path parameter for the log fill to be outputted. I'd like the sequence to be as neat and tidy as possible. Is there any clever way of shorting the number of steps down?
Solved! Go to Solution.
04-10-2012 03:09 AM
Hi,
There is a Wait step type in TestStand, it would be better to use it instead of a LabVIEW VI.
Your sequence contains 100 steps, have you considered using subsequences?It would be neater.
What are you loggin?
regards,
04-10-2012 05:38 AM
Thank you for your answers!
Great, I'll use the wait step then.
I'm already using subsequences in some cases. If there are several of the same VI executing, but with different parameters, but mostly I have sequences that go something like this:
Move the servos to some position
pause
Log type A in file 1
pause
Log type B in file 2
move servo
Log type A in file 3
pause
Log type A in file 4
log type B in file 5
and so forth.
There are 2 logging VIs, they both take 1 parameter, then there is the pause and move servos VI.
Can you think of any way of making this type of setup neat?
I'm logging data from a gyro.
Thanks again!
04-10-2012 06:09 AM
I don't like the way you are loggin results (My opinion is a single file would be clearer)
04-10-2012 06:18 AM
It's a long story, but I have to log several different files for further processing. It's sort of out of my hands.
But lets say I did only log to one file, woudn't it be pretty much the same? It would be something like this:
Move sensors
Log 5 min
Pause
Move sensors
Log 2 min
Move sensors
Pause
and so on.
Any cleaver way of making this approach neater?
Thanks again for you time
04-10-2012 08:30 AM
Basically it seems that you have essentially 3 things that could potentially happen: Move Sensor, Log, Pause.
So why not create a datatype for each thing. For instance your MoveSensor datatype would be a container that looks like this:
MoveSensor
Boolean SensorFlag
Numeric NewPosition
Numeric CurrentPosition
etc...
Your Log datatype would look like this:
Boolean LogFlag
String FilePath
Numeric Time
etc...
Your Pause would just be a number (PauseTime)
Then you make a container with each datatype in it. And then make an array of those containers.
Now using the flow control step type ForEach you can iterate the array. The pseudo code would look like this:
ForEach element in my array
If CurrentElement.MoveSensor.SensorFlag is true
MoveSensor to CurrentElement.MoveSensor.NewPosition
CurrentElement.MoveSensor.CurrentPosition equals new position
If LogFlag is true
Log to LogPath (maybe loop on this for a certain amount of time)
Wait (CurrentElement.PauseTime) set it to 0 if you don't need to pause
End ForEach
That way you would just simply add elements to the array. You could also write the array out to a property object file (read about those in the help) and depending on the test just read in a different property object file which would fill your array with different values.
Hope this helps some,
04-11-2012 02:09 AM
This sounds like what I'm looking for, but I'm not quite sure if I compleatly understand it. Is this datatype created in TS or in LV? The way I understand it, I would created a new VI that makes the datatypes and the array that contains them, and use the output of this VI in the for loop?
04-11-2012 04:28 AM
Never mind I understand now! Great advice, thanks a lot! I had to change your approach a bit, but this is much better!
I have one question though;
I'm using a case structure inside my ForEach loop. My array has a string variable that can be "Initial Log", "Sequence Log", "Pause" and so forth. If the string is "Sequence Log" I would like to run one of the 13 sequences I have created. I have another variable that specifies which one, going from 1 to 13. My question is; how can I use this variable to run the corresponding sequence without creating a nested case structure with one case of each of the 13 sequences?
Thanks again!
04-11-2012 08:00 AM
I think your question was answered in the other thread. However, instead of having a number as a part of your datatype make it a string and the string would sequence name to which it would call. Then just do the Specify By Expression and put that variable in there.
Regards,
04-12-2012 01:42 AM
That's what I did, thanks again for your help!