06-16-2017 02:39 PM
O am using TestStand 2016. I have several steps I need to execute that load firmware into the UUT by calling third party applications. Then only way I know if it succeeded is by the time it takes. If it succeeds it takes longer. I need to determine how long it took to execute the step. I have found several articles and posts that said to use the following:
Locals.ResultList[0].TS.TotalTime
I added a Statement step, and used the above to try to get the time for the step in question, but my sequence won't even execute. I get the error: Unknown variable of property name 'Locals.ResultList[0].TS'. I noticed all the posts were from years ago, so maybe something has changed in more recent versions of TestStand.
How do I get the step execution time?
Solved! Go to Solution.
06-18-2017 11:16 PM
You can only use that expression after the step has executed. When a step executes a lot is going on. You can see all of the actions here: https://zone.ni.com/reference/en-XX/help/370052R-01/tsfundamentals/infotopics/step_execution/
Notice that not until actions 35 and 36 (which are the last actions) does the step actual put anything of value into ResultList. It will create the spot in ResultList in action 1.
What does that mean? you cannot access that data until after the step has executed.
So what is a better solution? Check out the following code. I use a pre and post expression to grab the time and then calculate the difference it took to run my code module (action 16 of the step execution).
Let me know if you have any questions.
Hope this helps,
06-19-2017 09:54 AM
Just a thought - you could do away with the need for a local variable by writing the start time to the result.numeric and then use that in the calculation for the elapsed time:
Pre-Expression
Step.Result.Numeric = Seconds(True)
Post-Expression
Step.Result.Numeric = (Seconds(True) - Step.Result.Numeric)
Regards,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
06-19-2017 12:44 PM
Thanks for the help.
06-19-2017 11:24 PM
@CharlieRodway wrote:
Just a thought - you could do away with the need for a local variable by writing the start time to the result.numeric and then use that in the calculation for the elapsed time:
Pre-Expression
Step.Result.Numeric = Seconds(True)
Post-Expression
Step.Result.Numeric = (Seconds(True) - Step.Result.Numeric)
Regards,
Clever. I'll keep this in my bag of tricks. Usually I use an attribute but this is even easier.
Thanks,