FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

how to measure and log frequency with fieldpoint CTR

Hi,

I am developing a data acquistion and control system for an engine dynamometer using the fieldpoint modules and Labview.  One of the most important signals is the engine speed, measured in RPM.  The RPM signal is a 0-12V pulse where one pulse equals one revolution of the engine.  As well as being an important piece of data for later analysis, engine RPM will also be in the input into a PID controller, so the signal must be both accurate and have a high measurement frequency. 

Currently I am using the FP-CTR500 modules to measure the frequency of the signal.  I am already aware of the included frequency measurement VI example, as well as the one posted before for low frequency measurements, and I have gotten both to work with my setup.  I would be using the low frequency VI becuase the max frequency measurement would be in the 200Hz range. 

The first problem I am having is with the structure of the VI and how the data is output.  The case structure in the VI activates when the counter is read and resets the counter, then switches to the next case.  I would like the RPM number to output out of the case structure into a write_to_file VI and PID controller input.  The problem is that when the case switches, the counter is reset to 0, which will be recorded in the written file. 
This is some example output data (RPM):

1232
0
2321
0
2400
0
2521
0

The data is being written correctly, but of course I can't have 0 readings when the case structure changes.  This would be especially problematic when input into a controller VI. 

The next problem I am having is with sampling rate.  If I were to use the low frequency measurement VI, the sampling rate of RPM would be variable based upon the the speed of the signal.  Or, the original frequency measurement VI has an adjustable sampling rate.  Of course, in my system there are a number of other signals that need to be recorded at the same time.  I have found that as I am collecting data, the "write to file frequency" is entirely dependent on the read frequency of the frequency measurement.  Therefore, if I had set the read frequency VI to read at 1 Hz, data will be recorded only every 2Hz.  Ideally I would like an overall measurement frequency of all channels (mix of analog and digital) to read between 20-50Hz, but if I am limited by the frequency measurement. 

Any ideas on how to solve this problem, either through Fieldpoint or Labview?

I can post my VI if this help.

Thanks,

Huang
0 Kudos
Message 1 of 4
(3,655 Views)
Greetings!

    On your first question, it sounds like you can modify your LabVIEW VI to solve the problem. You can add a case structure before passing the value to the PID controller input. You can choose to discard the value and move to the next iteration if it’s zero and for other values perform a PID through the true case of the case structure. Is this what you are looking for, if not please let me know more details by posting your VI.

On your second questions, are you doing the file I/O in the same loop as the acquisition. Are you opening and closing the file on every point of acquisition inside a loop. Listed below are some useful links.  You mentioned "Therefore, if I had set the read frequency VI to read at 1 Hz, data will be recorded only every 2Hz.” Are you meaning from an external flash or from memory. And is this loop dependant on the acquisition loop. All the other signals that you are recording through other modules should be independent on what you are setting on the counter module.  
http://zone.ni.com/devzone/cda/tut/p/id/3777

http://digital.ni.com/public.nsf/websearch/D8DB42F9FDC3607E862568640047F144?OpenDocument

http://forums.ni.com/ni/board/message?board.id=110&message.id=3619&requireLogin=False

http://digital.ni.com/public.nsf/websearch/CC670C74F354966C86256EC1006E1176?OpenDocument

Hope this helps. Can you explain in detail if this is not what you are looking for?
Best regards
Avi Harjani




0 Kudos
Message 2 of 4
(3,626 Views)

Thanks for your reply. 

I should probably describe my current setup before I go into anymore details with the problem.  As for my specific setup, I am using an FP-1000 connected with an AIO600, AI110, CTR500, and TC120 all running through the RS232 line to a desktop running labview 8.  The actual counter module is reading a tachometer signal output from a separate engine controller.  THe output is a 0-12V ON 50% duty cycle signal.  As for data logging, i am simply using a "write to measurement file"  Express VI.  I have a while structure which holds all of the express VIs which access the fieldpoint IO, and these are all routed to the "write to" VI. 

As for the specifics of the data logging problem, as I said, when I set the count frequency of the "Fieldpoint Frequency Measurement" VI to 1Hz, (which means the VI calls the case structure at 2Hz), the "write to measurment file" VI is called at the same rate (2Hz).  Which means that the overall logging rate of the VI is only 2Hz.  Is there someway to decouple this? 

I was able to solve the problem of calling the frequency variable from the case structure by using a local variable which is called outside the case structure. 

And now I have been having a lot of problems with reading the actual frequency from my engine controller.  THe actual signal will only range from 0 to around 200Hz.  I noticed, by comparing the actual signal to what was being read in my labview program, that after around 80Hz the signal increases by around 1.5times more than the actual signal.  ie.  Actual signal = 100hz, Read Signal = 150Hz.  After trying to figure out what was the problem, I decided to change the Noise Filter settings to 200Hz.  It actually worked for all the frequency ranges up to around 150Hz but after that the filter attenuates the signal to the point where the actual signal is 160Hz, but is being read at 100Hz.  My question is if there is a way to change the actual filter setting outside of the 2 given setpoints (200hz and 40khz) or if you have any other suggestions on how to fix this problem?  I was thinking of creating a noise filter input in MAX so that i could play with the values in Labview, but am i only limited to those two filters? 

Thanks again for your help,

Huang

0 Kudos
Message 3 of 4
(3,570 Views)

Hi Huang:

     For the specific FP ctr module, the Count inputs - 50 kHz or software-enabled 200 kHz lowpass filter. Those are the two filter settings you are allowed.

http://digital.ni.com/public.nsf/websearch/0053D93F4FDDD91B862571220075597E?OpenDocument

  You want to make sure that the I/O is independent of the logging. You should consider using multiple (two) loop architectures where you have one loop doing the FP acquisition and the other loop doing the data logging. This way your first loop can in a software loop keep the acquisition going and there will not be any dependence on in deterministic tasks like file I/O. Keep in mind that express VI's do the File open, File write and the File close inside them. Hence it is expected to take slightly longer. 

If you post a snapshot of the VI or even zip up the code and post it that would really help me narrow down on the problem.

http://forums.ni.com/ni/board/message?board.id=110&message.id=340&requireLogin=False

Thanks and hope this helps

Best regards
Avi Harjani

0 Kudos
Message 4 of 4
(3,551 Views)