取消
显示结果 
搜索替代 
您的意思是: 

Sum generated values

已解决!
转到解答

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 项奖励
1 条消息(共 8 条)
3,417 次查看

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 项奖励
2 条消息(共 8 条)
3,402 次查看

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 项奖励
3 条消息(共 8 条)
3,386 次查看

Hi!

 

Thanks for a quick reply!

 

I have attached my VI for you to analyze.

 

Best regards Maurlind!

0 项奖励
4 条消息(共 8 条)
3,373 次查看

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 项奖励
5 条消息(共 8 条)
3,353 次查看

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 项奖励
6 条消息(共 8 条)
3,308 次查看
解答
接受人 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 项奖励
7 条消息(共 8 条)
3,293 次查看

never mind....

0 项奖励
8 条消息(共 8 条)
3,284 次查看