LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array manipulation

I've attached my attempt to initialise the tank to 100 litres with a calculation to find the tank contents values at 1 second intervals.  Unfortunately this doesn't work (signal incompatibilities).

0 Kudos
Message 11 of 21
(639 Views)

then use a loop as apok already suggested.

 

Start with auto indexing the loop:

 

(this also works with a while loop)

 

Clipboard01.png

 

btw the arrays in your vi attached are empty..

 

if you did convert your arrays to array-constants, your values would have been stored.

0 Kudos
Message 12 of 21
(637 Views)

Then give this guy a try.

 

I am using a FOR loop with autoindexing to loop through the two arrays and create another.  A shift register is used to keep track of the contents at the end of each iteration.  So the contents after an iteration is the contents from the previous iteration plus the contents added minus the contents removed.


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 13 of 21
(624 Views)

Thanks for your response however I am unable to open your vi since its created in a later version than the one I have (LabVIEW 2010 Student Edition).  Can you re-send it in older 2010 version ?

0 Kudos
Message 14 of 21
(615 Views)

With reference to the attached vi I have now established the basis for calculation however how can I build an array to show all the iteration calculations ?  My vi only displays one array cell value not the list across a row.

0 Kudos
Message 15 of 21
(602 Views)

@bunnykins wrote:

Thanks for your response however I am unable to open your vi since its created in a later version than the one I have (LabVIEW 2010 Student Edition).  Can you re-send it in older 2010 version ?


How about a snippet instead.


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 16 of 21
(600 Views)

@bunnykins wrote:

With reference to the attached vi I have now established the basis for calculation however how can I build an array to show all the iteration calculations ?  My vi only displays one array cell value not the list across a row.


You are so close.

 

Look at the snippet I just posted.  You will see that I an also autoindexing out the tank contents.  This will build the array automatically for you.

 

Also, you don't need to wire to the N of the FOR loop.  The autoindexing of the input arrays will tell the loop how many iterations to perform.


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 17 of 21
(594 Views)

Many thanks for the valuable guidance.  I have now cracked it with your help.  I did the calculation part differently but the results are correct and what I am expecting.

 

I have one further question....Since the array values of my tank outlet contents are coming from a Simulation & Control Loop frame (where For or While loops are not permitted to be embedded within such a loop), how can I extract out the array values from a Simulation & Control Loop ?

0 Kudos
Message 18 of 21
(589 Views)

I have attached the referenced vi explained in previous post.  Here at the bottom the Hopper contents or XY graph doesn't display properly.  I'm guessing that this is something to do with the data or signals being processed.  There are no error messages reported when this program is run however the displays are not correct.

0 Kudos
Message 19 of 21
(581 Views)

Isn't this message thread pretty much the same as your other one? Re: Iterative calculation - retaining and using values

 

There you were talking about tons of stuff in a hopper, now you are talking about liters of fluid in a tank.  But you were talking about 100 in either message thread.  Even in this thread, your VI talks about tons rather than liters.

0 Kudos
Message 20 of 21
(575 Views)