LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simulation loop - acquire data

Good day,

I have some problems with the simulation loop. I want to collect my simulation data but without the express-vi "Collector". Therefore I used an array with feedback node. But if I start my simulation the array gets bigger and bigger (the new data is stored in the array but the old data exist there too).

 

So, is it possible to reset that array? The "initialize feedback node" does not work : /

 

 

 

 

0 Kudos
Message 1 of 5
(2,450 Views)

Keep in mind that wiring the Initialize terminal only affects the feedback node the first time it is called.

 

Sounds like you want to conditionally change the stored value. This can be as simple as wiring a boolean control to a Select function, where you select between the array you have been building or an empty array. The result is wired to the input of the Feedback Node.

0 Kudos
Message 2 of 5
(2,429 Views)

Hi, 

 

I suggest you to use fixed sized array for buffering your data. It is a kind of performance enhancement technique. You mentioned "reset" for your buffer. I practice we do not reset or clear the entire array only "update" a specific item in it, mostly the oldest item in the array is updated at first. 

 

Please google for "ring buffer", that may help. 

 

Good luck!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 3 of 5
(2,408 Views)

Hey,

garretmarsh's solution worked for me.

 

Thanks to both of you.

0 Kudos
Message 4 of 5
(2,378 Views)

Glad to hear it Thion. I will say that D60 has a very good point - constantly resizing the array, like you are doing, is very bad for memory usage and efficiency. It may be sufficient for this task, but in general, it is best practice to use some kind of fixed-size buffer instead.

0 Kudos
Message 5 of 5
(2,367 Views)