LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sum generated values

Solved!
Go to solution

Hi !


I have constructed a VI that is supposed to calculate the total number of revolutions of a spinning motor. I have a knob that controls the RPM of the motor and a clock that calculates the current time.
The problem that I have is that I can't figure out how to summerise the revolution values. Say that I set my knob to 3000rpm and the time has gone for 60 seconds then my indicator displays 3000 revolutions, but if I change the knob to zero, it will display zero revolutions.

 

I would like it to show the current revolutions and even if I decrease or turn off the motor.


I have tried to implement a shift register and build array, but I can't get it to work.

 

Best regards Maurlind!

0 Kudos
Message 1 of 8
(3,256 Views)

Attach your VI so we can see how you implemented your shift register and be able to figure out why it didn't work.

0 Kudos
Message 2 of 8
(3,241 Views)

Unless I am misundertanding, I dont think you would want to use build array. If you just want the total number of revolutions, you dont need an array at all, just a number. Depending on how you have the loop and timing setup, you just add the number of revolutions per iteration to the shift register each iteration, and it will store the total. No array needed. But, as Ravens indicated, seeing your code would help to ensure correct advice could be given. 

0 Kudos
Message 3 of 8
(3,225 Views)

Hi!

 

Thanks for a quick reply!

 

I have attached my VI for you to analyze.

 

Best regards Maurlind!

0 Kudos
Message 4 of 8
(3,212 Views)

Maurlind,

 

I think your math is suspect.

 

Let Rev[i] repesent the number of revolutions completed after iteration "i". Similarly the speed is RPM[i] and the elapsed time is t[i]. The timestamp value will be T[i]. Let RPS be the speed in revolutions per second.

 

Then the following relationships should get you Rev[i]

 

Rev[-1] = 0

T[-1] = 0

T[0] = timestamp in True case.

t[i] = T[i] - T[0]

RPM[i] = current value of frequency dial

RPS[i] = RPM[i]/60

Rev[i] = Rev[i-1] + RPS[i] * (t[i] - t[i-1])

 

I have not tested, but I think this may be what you want or close enough to get you started.

 

Lynn

 

0 Kudos
Message 5 of 8
(3,192 Views)

Hi!

 

johnsold, I don't understand how to implement your method in Labview. How do I find these valuse for each iteration?

I know how to do  it in other programming language but not in Labview.

 

Best regards Maurlind!

0 Kudos
Message 6 of 8
(3,147 Views)
Solution
Accepted by maurlind

Maurlind,

 

When you have current value, previous value situations, think of shift registers. The current value is wired to the right terminal and the previous value is available at the left terminal. 

 

Your VI has a shift register which holds rev[i] and Rev[i-1]. Adding a shift register for t[i] and t[i-1] and a few calculations will give you what you need. You can either initialize all the shift registers via the case structure and First Call? or by wiring to the left terminals from outside the loop as you did with Revolutions.

 

Place labels beside the wires showing the symbolic values on the wires. This can help you visualize the relationship between the algorithm as I expressed it in my earlier post and the LabVIEW code. 

 

RPM test.png

 

You might get some benefit from working through the on-line tutorials for LabVIEW to help you with the differences from other programming languages.

 

Try to implement what I suggested. The image above shows part of the modifications I made to your VI which appears to determine Revolutions correctly.  If you get stuck, post your latest attempt so we can help you learn.

 

Lynn

0 Kudos
Message 7 of 8
(3,132 Views)

never mind....

0 Kudos
Message 8 of 8
(3,123 Views)