Showing results for 
Search instead for 
Did you mean: 

How to find RPM of an absolute encoder?

Thank you RavensFan.

So in the Producer/Consumer loop, I can use the Producer to acquire the signal and change that into RPM while in the Consumer I can save the RPM calculated through the producer. However, I am not sure about how this loop works. I searched for examples but I didn't find anything that explained the logic behind how one should set up the Producer/Consumer loop. Do I have to create a loop before the queue to find the RPM and then send the RPM through the queue or can I calculate the RPM inside the producer and graph the RPM and save it in the consumer? Thanks

0 Kudos
Message 11 of 31
You create the queue before both loops start.  In the producer loop, I would calculate the RPM there because it is a function of 2 things, your count and your timing of the loop.  Calculations don't take that long to run, so it won't really slow that that loop.  Then enqueue or calculated data.
The consumer loop will dequeue that data and do the time consuming functions of writing to file.
0 Kudos
Message 12 of 31
When I am using the producer/consumer loop, is the data fed into the enqueue element first and then sent to obtain queue or vice versa. I have a program written but it doesn't run and am not sure what is wrong with it. Thank you.
0 Kudos
Message 13 of 31
Go back and look at the examples for producer/consumer loops again and take a closer look at where all the queue functions are located.
You have several problems.
1  Obtain queue should go before both loops.  The queue wire would split and go to each of the loops.  As you have it now, you just obtain queues continuously in the top loop.
2.  You only enqueue once outside of the top loop, and only after you hit the stop button.
3.  The 2nd bottom loop run won't run until after that because of the dataflow of the wires.  Then it will run once
Put obtain before both loops.
Put Enqueue in top loop.
But Dequeue in bottom loop
But release queue after bottom loop.
0 Kudos
Message 14 of 31
I was wondering if this logic is correct. Also, for obtain queue, how do I define the element data type? In the tutorial it says that the best thing is to define it as clusters. In the producer loop after defining the element of the queue, I would connect the data to the enqueue element. In the consumer loop, from the dequeue element I would use the element out and connect it to a waveform graph to get my graph. I was wondering if these steps are correct. Thank you Ravens Fan. By the way are you from the DC area?
0 Kudos
Message 15 of 31
That looks good.  You can define the queue to use any datatype you want.  If it is something simple like a number, it could be double precision numeric.  If it is complicated with various arrays, booleans, ...., then you would create a cluster.  If you want a waveform, that will work to.
Whatever wire you want to send to the enqueue element function, right click on it and select create constant.  Move that constant outside and wire it into the obtain queue.  Then wire your waveform data to the enqueue element  You'll see that the queue wire looks like the datatype wrapped up in green.
I'm from the Baltimore area.  If I was from DC, I'd be a Redskins fan, then I would have to hate myself.Smiley Very Happy
0 Kudos
Message 16 of 31
I got the graph, but I also need to save the data that was calculated. I tried save to measurement file but it says that it only takes dynamic data, I tried playing around with other several storage commands but couldn't figure it out. I don't know how to convert the data from array of clusters to another form that can be saved. Also, the graph that i get is similar to the previous ones that I have. Thank you Ravens Fan for all your help.
PS: I am from DC area but not a redskins fan, more rams fan Smiley Happy but still root for both ravens and redskins...Smiley Wink
0 Kudos
Message 17 of 31
Take a look at the express pallette, then data manipulation.  There is an express VI there to convert to the Dynamic datatype from other datatypes  (arrays, waveforms ....)  And there is also one to convert from Dynamic datatype.
0 Kudos
Message 18 of 31
I was wondering if calculating the time this way would be better (using elapsted time VI). Also, it keeps giving me error because my input is 1D arrary of clusters of 1 element, and the sink does not match it. I tried all the possible combinations for convertion.
0 Kudos
Message 19 of 31
I'm sorry, but I don't see what you are talking about in the VI you posted.
0 Kudos
Message 20 of 31