LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dial to Calculate Speed

Hi Mr Thomas,
 
Thank you for the example VI. But it is not working properly still. I am also trying to edit your VI but cant figure out yet the correct logic. I noticed few items on the VI;
1. The elapsed time is not updating,
2. The lower case structure do not detect a case. I run the vi in highlight mode and i dont see it is reading a case,
3. What is the purpose of calculating for the mean instead of showing the actual data from the dial?
 
Thanks a lot for your kind help.
B
0 Kudos
Message 11 of 18
(1,130 Views)
Hi Bong

Unfortunately I'm not in the office today, but I'll review the vi and answer you as soon as possible.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 12 of 18
(1,121 Views)

Hi Bong

I'm back in the office, so here are the answers:

1. Well, time elapsed is updating, but it's always the same value: 50ms, which is the same as the time constant I want the loop to wait after each iteration. Additionally, this calculated values is averaged as well, so you don't see any changing value in general.

2. Of course the lower case structure handles different cases, but it depends on the size of the buffer arrays. During the 10 first iterations of the loop, the buffer arrays are smaller than 10 elements, so the case "0..9, Default" is executed. Afterwards it is the other Frame (10..). I strongly assume you started the vi and turned the highlighting mode on after a moment. Turn the highlighting mode on and start the vi after this - you should see what I mean.

3. The purpose of buffering the data and calculating the mean valus is this: Firstly, I can have a higher iteration rate. Secondly, if I have a value very different to the others, the difference is decreased. So you kind of "break" peaks.

If you have more questions, don't hesitate to ask.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 13 of 18
(1,106 Views)
Hi Mr Thomas,
 
Thank you for your explanations. Today I made test to the actual Machine using the VI you made for me. I placed the compass on the machine and rotated the machine clockwise and counterclockwise to check the calculated speed. I observed the following;
1.  The machine rated speed is 0.54 rpm, and the VI calculated speed runs from 0.45 to 0.7. For smooth operation its about 0.5 to 0.57 but sometimes it jumps to 0.6, 0.7, 0.4, 0.45.
It will not actually indicate a precise 0.54 maybe because of some mechanical factors, i.e. gears...
2.  When the machine actually stops, the angular speed still continues to register data for about 2 to 3 seconds before it will finally come to 0.0000.
3.  Regarding the data of Angle Diff (deg), is this the average data too? How can I understand (in laymans view) the calculated Angle Diff because what i am seeing are decimal data only?
 
I have also follow up questions to your answers for my better understanding;
1. "Well, time elapsed is updating, but it's always the same value: 50ms, which is the same as the time constant I want the loop to wait after each iteration. Additionally, this calculated values is averaged as well,"
   - When you say the time elapsed is "averaged", does this mean for every iteration the VI calculates the average time?
2.
3. "The purpose of buffering the data and calculating the mean valus is this: Firstly, I can have a higher iteration rate"
    - What will I gain having a higher iteration rate? Does this mean a faster reading of data? When you have a higher iteration rate, will this affect the whole VI or Main VI or just for the purpose of calculating for mean values?
 
For your information, I also placed a "Absolute Value" function after the first case structure to get rid of negative numbers.
 
Sorry for lots of question. I just want to understand more how the VI works. Thank you very much for your kind help.
 
Regards,
Bong  
0 Kudos
Message 14 of 18
(1,091 Views)

Hi Bong

Firstly, my VI is not intended to be the final version. It just could be a possible solution which may be optimized.

To comment your points:
1. If you measure data you never get an exact value. It will always jump (the raw value) due to A/D conversion
2. As the data is buffered, it takes at least 0.5sec (10 cycles with 50ms) to empty the buffer, but as long as there is data measured, the buffer can not be emptied.
3. Did you really have a look at the vi? If you just follow the wire from the control backwards you will come to the Mean.vi - so it obviously must be averaged. As I do not know what kind of data you get, I just used the dial to simulate an angle value in degrees. So the dial has a range from 0 - 360°.

Now the answers to your follow up questions:
1. The time difference between the measurements is calculated. In general this value should be 50ms, but as you never know if this rate is fixed, I calculate the time difference between each reading of the dial value. To make this more precise, the dial control and the current time ms should be placed in a simple sequence, to make sure that there is no time delay between reading the dial and the current time.
2. -
3. If you read data in the loop, the you have faster reading. In general, you can be more precise. Just an example: If you measure the rpm of a motor and it is setup to have its maximum speed after one second, you have a different number of values depending on the iteration speed of the loop. If you have 250ms per cycly, you would just get 4 values. With 50ms you get 20 values.

The negative values indicate the rotation direction, so if I was you, I would not get rid of it.

As I said at the beginning of my post, this vi should just help you to find a solution and I just can recommend to debug my vi, so that you understand how it works. Basically there is nothing difficult about it - some data buffering and some calculations.

Thomas

p.s.: don't worry about the questions - that's ok (as long as you do not just give 1 star ratings ;))

 

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 15 of 18
(1,084 Views)

Hi Mr Thomas,

Thanks again for the reply.

When I first received your VI i test it immediately here in my table together with the compass. At one glance i thought it makes sense. It is calculating distance travelled and speed. So, i move on and test it on the actual machine to get rid of magnetic errors. And it looks fine too. But I guess buffering I need to understand more to know how the VI is really working. I will continue to study your VI and will make correction or improvement (if any) if needed.

Thanks a lot for everything. You have been very helpful.

Best regards,

bong

0 Kudos
Message 16 of 18
(1,068 Views)

Hi Bong

Maybe this helps: The "buffering" you could also call moving average.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 17 of 18
(1,054 Views)
Hi Mr Thomas,
 
"Moving average" is easier for me to understandSmiley Happy
I was comparing the "buffer" term when we are dealing with serial instrument and the buffering term we use in this post.
Now its more easy to analyze the VI.
 
Thanks a lot again.
0 Kudos
Message 18 of 18
(1,051 Views)