PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

measure rotor encoder signal

Dear Sir/madam,
                          Hi, im hoping someone can help me with this little problem.  Im pretty new to the labview and using data acquisition card (i have just completed the tutorial in getting start Smiley Happy  so i hoping to get some advice to start this task im trying to do.  So I have a 3MVA alternator with an optical encoder circuit where a 64 slotted disc is attached to it and it should generate a pulse train signal where i can measure speed and frequency of the machine.  Im using NI PCI-6052E.  To a certain extent i think my model is correct to a certain point, as i believe I can adjust the machine to the rated synchronous speed.  However from theory I believe that the waveform output should be squared not the waveform I have.
                          Another information is that I attached the optical encoder circuit output into the PFI9/GPCTR0_GATE to measure through my 20MHz internal clock.  I have attached the waveform at when the 4-pole machine is at synchronous speed which is 1500rpm.  Please let me know if there's other information i can provide to help.  Overall, I just want to acquire the rotor pulse train into my model display for further investigation and im trying to sample the signal at 1.6k samples/second, though im not sure how to check what sampling rate it's at.  Also for some reason im getting the error -100141.  Any help is much appreciated.  Thank you for your time.
 
Best Regards,
Coato
 
 
 
Download All
0 Kudos
Message 1 of 19
(5,916 Views)
Hi Coato,

When i run your VI I can sucessfully acquire the frequency measurements of a pulse train inputted into my DAQ Counter. After your mathmatical manipulation i can also see the data dispalyed on the graphs. The data looks lightly sinusoidal but the signal is effectivly constant since the oscillations are very small: bettween 6107.0 and 6107.6 using the set up I have here.

This all appears to be working okay so can you clarify exactly how your code is not functioning as you wish it to please, other than the error code?

As for the error code, i can't find any reference to this code in LabVIEW. Are you sure this is the correct code? What information is given when this error occours, and when does it occour in the program, as soon as you run the VI?

Best Regards,

Ian Colman
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 19
(5,891 Views)
Hi Ian,
          Thanks for your reply and I apologise on the late reply as i was out of the lab these few days.  It's great that the code works as I wasn't sure whether it was or not.  I mean my utlimate goal is to use this pulse train in calculating the rotor angle, so what i need is a square waveform of the rotor pulse train and the square wave of a phase voltage wave.  As from my knowledge, I was expecting the rotor signal acquired to be squared.  Therefore as you mentioned that you see that my wave is quite sinusoidal, so is there any other way to make it more squared? but also still be displaying the same amount of information without losing any.
 
         As for the error, i have done a screenshot of this with the error enlarged to see its contents.  This error happens from time to time, it definitely happens seconds after i run the program which stops my sinusoidal graphs running, I need to stop and run the vi again in order to continue viewing my signals, my thoughts were that it's somehting to do with the sampling rate of my card on the signals, how can i check the sampling rate of my card on say the rotor signal?
 
         Thank you for your time and I look forward to your reply.
 
Best Reagards,
Coato
 
 
 
0 Kudos
Message 3 of 19
(5,868 Views)
Hi Coato,

The input from your encoder will be squared, but your graphs display a approximated rpm based on that square wave. I would not expect you to see a square wave on any of the graphs that you are displaying.

I have found a good KB on the error that you are seeing but it seems to be common with DAQmx Base. What operating system, and NI Drivers are you using? Is it DAQmx, or DAQmx Base?

http://digital.ni.com/public.nsf/allkb/83656593DCF1FB0F862570B6004D7222?OpenDocument

Best Regards,

Ian

0 Kudos
Message 4 of 19
(5,854 Views)
Hi Ian,
          Apologise for the lateness of my reply but I had a look on the relevant document for the error and have installed the DAQmx-base 3.0 onto the computer, this took me a while as my interenet was unstable for the past week.  However, even after i installed the software, the error still pops up while running the program.  Is it enough by just installing the software, will I be required to update the relevant driver manually?
         Also for my sinusoidal graphs, is there any guidlnines you can give if I simply just want to display the squared wave from the encoder?  Any help is much appreciated.  Thank you for your time.
 
Best Regards,
Coato
0 Kudos
Message 5 of 19
(5,790 Views)
Hi Coato,

Upgrading to version 3 should be enough to potentially fix this error. You can check that you have sucessfully upgraded by going into Measurement & Automation Explorer and then clicking th software tab on the left. You can then find NI DAQmx Base, click on in and see the version number in the resultant field.

To just display the square wave input of your counter you should just connect the encoder to a digital or analogue input line as well as your counter then acquire the raw signal in.

Best Regards,

Ian
0 Kudos
Message 6 of 19
(5,763 Views)
Hi Ian,
         Thank you very much for your help, i now have the rotor square wave form from the rotor.  As for the error, it still exists, i have checked the version which displayed as 3.0.0f2 so i believe that I have updated correctly...
         If you dont mind i have a small follow up problem, the waveform that I got from the rotor is a 1600Hz frequency square wave and my goal is to divide it down to 50Hz so I can compare with a 50Hz voltage waveform to calculate the rotor angle of my system.  The current method that im using is implementing D flip-flops where it will divide the incoming signal by 2, and ultimately i will need to pass my rotor wave through 5 of these. 
         I have attached a simulation that i have been trying, the simulation has a 100Hz squared wave simulating out to the flip flop and I expect to see my Q output port with a 50Hz waveform but unfortunately im seeing nothing at the moment Smiley Sad  So could you please check the vi whether there's anything i need to change?? or maybe there's a better way, I have checked the forums for similiar issues but I want this to be performed all in software and there's no current solutions to it.  Any help would be very much appreciated.  thank you for your time.
 
Kind Regards,
Coato
0 Kudos
Message 7 of 19
(5,696 Views)
Hi Coato,

I'm still looking into why you are seeing that error still but as for your frequency opperations, take a look at the attached VI that I have written for you. It should do the trick but let me know how you get on with it or if you have any questions.

Kind Regards,

Ian
0 Kudos
Message 8 of 19
(5,688 Views)
Hi Coato,

As for the error, try going into DAQ assistant and increasing the buffer size by increasing the "Samples to read" control from 30 to something bigger like 1000 or 5000.

Let me know if you still get the error,

Best Regards,

Ian
0 Kudos
Message 9 of 19
(5,683 Views)

Hi Ian,

         Thanks again for helping out, I got the frequency divider working but i need to change it to exactly what i needed and im not getting it exactly...The thing is I have 2 signals, a phase voltage and the rotor encoder signal.  The voltage signal is 50 hz, hence i want the rotor encoder signal to be 50Hz as well, which is what you provided me but I need the amplitude of the rotor signal to be the same as well, so that i can calculate their phase difference, which i try to by passing them through the xor gate.  I have tried inputting an amplitude of 5 into the 'square waveform vi' but it gave me a range of -5 to 5 and when i tried using the 'greater than 0', things got messy.  Ultimately i want to pass this outputted phase difference signal out on one of my digital port so that i can wired it back into one of my counter ports for an accurate measurement of the pulse width but I seem to have an error of when i tried it.  Am i squaring the voltage wave correctly? and doing the phase difference correctly?  I have attached the vi I have been developing so could you take a look and give me any advice you can please.

As for the error, I have taken and tried your advice in tackling it, it seems that It delays the error for around 2 extra seconds before running into it again Smiley Sad I even tried up to 9000 samples to read.  I have attached the vi settings for measuring the frequency of my 1600 Hz rotor wave to see whether you can spot anything out of place.  I apologise for the messy vi at the moment as im trying everything Smiley Tongue , thank for your time.

Kind Regards,

Coato

0 Kudos
Message 10 of 19
(5,665 Views)