LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving elements from array to array

thank you very much, now i tried to make it start counting how long have the elements been in the simulation. I tried experimenting with tick count, elapsed time and a few more, But it never seemed to work properly, I attached a small potion of my code, where i tried counting how long the elements have been there. So can you please tell me why isnt it working ( I need it to count time from when the element entered array 1 until it reached array 3, so after it gets to array 3 it stops counting)

0 Kudos
Message 51 of 84
(903 Views)

Ah what a mess!!!

 

You are mixing seconds (high resolution relative seconds) and milliseconds (tick count). You really should start with my latest template instead! It would be much easier to modify.

 

You should insert the current tick (use relative seconds and make the cluster entry DBL!) into the cluster then take the difference to the current tick to display the elapsed time.

0 Kudos
Message 52 of 84
(893 Views)

when you say insert the current tick, what exactly is a tick, and to "insert it into the cluster" do you mean the bundle by name function?

 

Because I tried a few more things but it still didn't work. so I guess I didn't really understand what you meant.

0 Kudos
Message 53 of 84
(880 Views)

If you look at my example again, you can see that I update the "relative seconds" whenever an item goes to the next queue. To show total elapsed time instead, simply don't that, but keep the value from when the item got generated.

 

This "tick" is just a time reference. We get the elapsed time for each item when we take the difference to the current "relative seconds" for display.

0 Kudos
Message 54 of 84
(876 Views)

I tried this, which is similar to how you displayed the time the element spends in queue 2 in the first VI you sent me. But this still didnt work.

0 Kudos
Message 55 of 84
(871 Views)

Subtracting zero from a value does not do anything important. As I said, once each element has a start tick, you need to subtract before displaying the elapsed time, but without modifying the value in the storage array. That's why my later code is better: It separates display processing from queue processing!

 

Are you familiar with the term coercion (the red dot you see when bundling? That means that you have a type mismatch. If you squeeze an orange value into an integer, it will get rounded to the next integer. The time in your cluster should be orange, right? (right-click...representation...dbl).

0 Kudos
Message 56 of 84
(859 Views)

Ok I think I understood, but I was looking at your code again and I just didn't understand how did u get that tick in the screenshot below, and is that the tick for each element from the time it was added to the first queue?

0 Kudos
Message 57 of 84
(855 Views)

It is the tick of each element added whenever the item moved to a new queue in my example. So yes, initially that's the tick when the item was added to the first queue.

0 Kudos
Message 58 of 84
(836 Views)

Ok thank you, but how do I get it (or what exactly is it, a control, a constant, an indicator), so I can subtract it from the high resolution seconds function.

0 Kudos
Message 59 of 84
(833 Views)

If it is in the queue, "use unbundle by name". See my queue processing subVI.

0 Kudos
Message 60 of 84
(825 Views)