LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation of time for multiple cases in case structure

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? 

0 Kudos
Message 1 of 9
(2,204 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(2,193 Views)

@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.

 

 

0 Kudos
Message 3 of 9
(2,166 Views)

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🙂

0 Kudos
Message 4 of 9
(2,137 Views)

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?

 

altenbach_0-1593034399946.png

 

 

 

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?

0 Kudos
Message 5 of 9
(2,126 Views)

Yes the total time is required.

 

I have attached what i did.

But it is not giving proper values when run with the setup.

Download All
0 Kudos
Message 6 of 9
(2,088 Views)

Here is the code and i have also attached what i have done.

Download All
0 Kudos
Message 7 of 9
(2,087 Views)

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

0 Kudos
Message 8 of 9
(2,065 Views)

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.

 

 

altenbach_0-1593098577922.png

 

0 Kudos
Message 9 of 9
(2,045 Views)