LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How create a variable that changes (by 0.05) on each iteration in a loop?

We are trying to control  New Era Syringe pumps using Labview. We want that those pumps could dispense different volumes on wells. For example 0.05ml in well one (using actuators we can move the wells),  0.1ml in well 2, 0.15ml in well 3 and so on. We think that we may need a "For loop" in which the number of iteration is the number of wells, but we do not know how to create a variable, inside the loop that can increase .05 on each iteration, and then we can use that variable as a "volume input" in our program.

0 Kudos
Message 1 of 6
(3,448 Views)

Hi AnaChavez,

 

what about (i+1)/20? Simple math, uh? ("i" is the iterator terminal of a loop...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,432 Views)

You can use a shift register and any incremental value as shown below:

 

Increment.png

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 6
(3,402 Views)

Hi tbob,

 

 

multiple add operations with floats may induce more errors than a multiply/divide due to floating point representations (especially on numbers that can't be represented exactly, like 0.05)... The next step in this routine might be a comparison of setpoint and measurement value Smiley Wink

Message Edited by GerdW on 05-10-2010 08:04 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,395 Views)

I ran the loop one million times.  The output was 50000.0000007.  Then I tried dividing as you mentioned ((i+1)/20).  The output was 50000.0000000.  So multiplying is a little more accurate.  However, I don't think it makes any significant differnece if you are adding 50000.0000000 or 50000.0000007 mL of substance to a mix unless this is some super-duper accuracy is needed.  So either method will work.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 6
(3,386 Views)

Hi tbob,

 

yes, I know the difference is not much, but it's there...

 

I wanted to warn AnaChavez to think about number representation and other possible side effects - especially on such a noob question (sorry AnaChavez, don't want to offense you). Just a warning - when other operations like comparisons and similar are comin' your way...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(3,371 Views)