06-24-2020 09:16 AM
Hi
I am trying to measure the time taken by each case of the given case structure and then store the values in an array to check it later in text file.
I tried using shift registers and tick counters in my code.
How should i proceed?
06-24-2020 09:44 AM
Start by sharing your code. We have no idea what your setup looks like and therefore our advice will be complete shots in the dark and most likely useless.
06-24-2020 10:59 AM - edited 06-24-2020 11:00 AM
@CocaSaiVikas wrote:
I am trying to measure the time taken by each case of the given case structure and then store the values in an array to check it later in text file.
You you want to keep separate times for each possible case?
Do all cases execute the same number of times and always in the same order?
Do you know the final array size? (1D? 2D? ragged 2D?)
What time should be stored for cases that never execute?
What are typical times (milliseconds? Hours?)
Does order matter in the output? If so do you also want a timestamp for each case time?
@CocaSaiVikas wrote:I tried using shift registers and tick counters in my code.
A good start. I would also use a case structure, build array, a loop, some wires, etc. etc. 🙂
@CocaSaiVikas wrote:
How should i proceed?
Either try, try, try again or show us your code. You could also search the forum. I am sure there are plenty of good examples, but they might be hard to find.
06-24-2020 03:30 PM
I got to calculate the time taken by each case.
I used a tick counter outside the loop. And one inside the case structure, this time is sent to a shift register and later is subtracted from the start time.
The values of each case are stored in a array and later sent to a text file using "Write to Spreadsheet function.vi"
Yes, I want separate times for each case.
They all don't follow the same order.
The final array is 1 D, since i will subtract the times and get 1 value.
Almost all the cases are performed, which aren't included I wont count them.
Units are milliseconds
No, order of the output doesn't matter because there are different buttons for different tasks.
I have attached the program below.
Thanks in advance🙂
06-24-2020 04:37 PM
Ouch. Sorry, my monitor is not big enough to debug your VI. Did you know that "index array" is resizeable and gives you the elements in index order? Did you know you can use FOR loops for repeated operations?
Do you want the total time spent in each case? E.g. if case "Read MFC" occurs 5x, do you want five results or the sum of all five?
06-25-2020 01:44 AM
Yes the total time is required.
I have attached what i did.
But it is not giving proper values when run with the setup.
06-25-2020 01:46 AM
Here is the code and i have also attached what i have done.
06-25-2020 06:53 AM
If i get the 5 results, ill take the average of them to get the time.
So what should i do, because whenever i run the program its giving a ZERO value
06-25-2020 10:25 AM
A lot of your code is highly suspect and unnecessarily convoluted, so I am focusing on case timing. Here is a simple example that keeps track of the count and average time for each of four cases. See if it can give you some ideas.