03-01-2022 02:03 PM
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)
03-01-2022 02:42 PM
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.
03-02-2022 06:18 AM
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.
03-02-2022 06:45 AM
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.
03-02-2022 07:52 AM
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.
03-02-2022 10:21 AM - edited 03-02-2022 10:21 AM
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).
03-02-2022 10:36 AM
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?
03-02-2022 12:51 PM
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.
03-02-2022 01:01 PM - edited 03-02-2022 01:06 PM
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.
03-02-2022 01:25 PM
If it is in the queue, "use unbundle by name". See my queue processing subVI.