Measure time of 5 pulses

I need to measure the speed of a motor which has an eccentric load so the instantaneous speed of the motor looks like a sine wave. I have 5 hall pulses per one revolution so I want to measure the time of 5 hall pulses and convert this to a frequency to basically filter out the speed fluctuations. The frequency range of the hall pulses to be measured is from 4Hz to 50Hz. I have two motors that must be measured this way and two counters available on a 9172 with a 9411 module. I have tried most of the shipped examples but I have had no sucess trying to filter out the speed fluctuations. I am using LabView 2009.
Solved!
Go to Solution.

Use a running or moving average of the pulse periods.  (I am assuming that you are able to measure the time from one Hall pulse to the next for all the pulses). Since you want the speed based on five consecutive pulses, you really do not need the average, just the sum of the times.  See the attached example in which the pulse frequencies are random but in the 4 to 50 Hz range you expect.  Notice that the speeds are smoother than the pulse times.
Lynn 
Attachments:
Motor Speed test.vi ‏13 KB

Similar Messages

  • How to measure time difference between zero crossing of a sine wave and rise time of a pulse on a same graph?

    I have a 50Hz sine wave and a pulse signal on a same graph. The phase difference between two is between 0-90 degrees.
    Now I need to calculate the time difference between (when the sine wave crosses zero volts) and (when the pulse rises). The frequency will stay approximately same for both signals.
    The application is for a three phase generator. In simple words, when the time difference between the zero-crossing of sine wave and the pulse rises increases, that means that the load on the generator has increases.
    I am a beginner user of LabView (version 9, 2009), maybe it is a very simple problem but I've been pulling my hair out for the last few days and coudln't figure anything out. Any help would be greatly appreciated. I am using DAQ USB-6008 to measure these voltages and pulse from the generator and a sensor
    I have attached a jpg (a graph that i just made with excel to explain). The time 't' is what I am trying to measure
    Cheers
    Awais 
    Message Edited by awais.h on 03-30-2010 11:20 PM
    Message Edited by awais.h on 03-30-2010 11:21 PM
    Solved!
    Go to Solution.

    Hi
    Thanks for the code but I'm afraid it won't work. Like you said the probability of choosing a value that is on both graphs may not happen. This is something that I would like the code to do automatically.
    But I did use the previous code posted and made some modifications to it and it seems to work perfectly. Now the next thing is to be able to get just that one value that tells you the first time difference.
    Here is what I get using that code.
    As you can see from the t Values. I only need the one that is highlighted. If there is a way to filter out the rest it would be great.
    I was thinking of a while loop and as soon as the value is higher than 3E-5 it would store the number and stop the loop, but I'm not too familiar with arrays in labview.
    Here is the the code modified.
    As you can see, it wasn't that big of a modification and it still is your code.
    I will keep trying.
    Thanks for the help
    Attachments:
    FinalShockSpeed.vi ‏55 KB

  • Measuring time between activation of two boolean

    Hello 
    I want to measure the time elapsed between activation of two boolean variables/indicators. In my code I have DAQ acquiring 2 digital signals which trigger corresponding 2 boolean indicators. Now I am trying to measure time between the event when my first boolean indicator gets the signal  and the event when my second boolean gets the signal. I am attaching my code. I checked DAQ and my indicators everything works fine, but just when I try running the code with the 'elapsed time' part, its not running. Any help will be appreciated.
    Thank You. 
    Attachments:
    Test Code.vi ‏45 KB

    So, feel free to give more detail. I'll just give you a couple thoughts:
    1) The primary issue with your code is that it probably doesn't do what you think it does. How this VI will run is that it will get one data from the DAQmx routine, then pretty much stay in the inner while loop since the event structure has an indefinite timeout. Worse, I don't think changing the value of the boolean controls would trigger the value changed event anyways. In the end, you don't even need the Event Structure to do what you want to do, nor do you need the inner while loop. Just check the values for each iteration of the outer while loop instead and do what you need to do with those.
    2) You are acquiring only one data point at a time. Which is OK if your events are particularly slow with respect to the effective sampling rate of the of loop (which might be able to pick up signals that change on the order of milliseconds or perhaps a bit less). If your signals are faster, you need to think about reading lots of samples at a time (arrays of booleans) and properly triggering your acquisition close to the event it needs to pick.
    3) If your signal is a pulse, make sure that the pulse width of the signal is much longer than than 1 / sampling rate. If it isn't, you could miss the pulse entirely doing this approach.
    4) The faster signals (as long as your have a quick enough sampling rate), the best thing is always to use a counters approach. In many of the DAQ cards and peripherals that NI offers, there are counters that can be driven with the sample clock (one of the fastest clocks on the device) or even a faster time base, and then the 'events' can be used to trigger acquisitions of the counters. Meaning you get exactly what you want: data points that correspond to times when events occur.

  • Measuring period of a pulse

    Hi
    I m measuring period of a pulse coming from a magnetic proximity sensor. There r two porblems.
    1. I want to monitor the data coninuosly in a while loop but the moment it waits for pulse it doesn't stop and hangs for some time....
    2. While monitoring the data , sometimes high values appear ....... but these values are unwanted. Once if i want to filter out thse values and see only the exact pattern , how to make it...
    PLz. do answer these queries at earliest......
    Thanks and regards
    GNS

    Hi,
    To monitor data continuously without hanging:
    1. Configure your counter to do "buffered period measurement"
    2. In your loop, query the counter for "available points" using "Counter Get Attribute.vi"
    3. When == 0, do nothing. When > 0, read that # of points from the counter buffer. This way, you're never asking for any data that isn't already there and your loop won't ever have to hang and wait for it.
    4. Accumulate/store/graph your data according to the needs of your app.
    To filter out unwanted high values:
    First, I'm assuming that your "high values" are high frequencies, thus small periods. If so, these may be caused by sensor and/or electrical noise. The best thing to do first is try to reduce/eliminate the noise at its source. Failing that, there *may* be a way to make good estimates of the correct data, but it could get pretty tricky. Here's an outline of a way to think about and deal with the simplest case -- where you know the expected measured frequency and it's very nearly constant over time.
    The characteristic of such a noise glitch would be a a pair of transitions in rapid succession, either low-->high followed by high-->low or vice versa. Either way, you'll pick up one of those transitions in your buffered period measurement. The trouble is that it may happen anywhere within the nominal period, possibly more than once.
    Let's first look at a case where the nominal period is 1 msec +/- 20% and there is one glitch of duration 0.1 microsecond, occurring at the 70% point of the real period. The measurement should show one period of duration 1.0 msec, but the noise glitch will cause you to receive instead two periods of duration 0.7, and 0.3 msec.
    The simplest correction would be to simply trash all measurements outside the acceptable range of [0.8, 1.2] msec, including these two. Note however that a noise glitch occurring at the 90% point would lead you to trash the 0.1 msec measurement, but believe and keep the 0.9 msec measurement. Note also that if noise glitches are distributed randomly in time, you would end up keeping 40% of such erroneous data (glitches in either the first 20% or final 20% of the real period).
    Another correction would be to estimate the period interrupted by the glitch. Start by assuming no more than one glitch per legitimate period. Since the glitch subdivides the true period into a pair, you can re-create the true interval by summing the pair of periods. The catch is to identify which pair needs summing.
    The smaller of the pair will show a period <= 50% of the real period, and can be identified. However, the larger of the pair cannot always be identified. The larger of the pair can be anywhere from 50%-99.999% of the real period and may located either right before or right after the smaller of the pair. If you wish to recreate the real period, you'll need to make a mathematically educated guess about which adjacent period to consider as the "larger of the pair."
    This is tricky enough as a post-processing exercise, but it's even worse when you process the data as it comes in. Then there will be times where the last element in the buffer is the "smaller of the pair" and you don't yet have the "larger of the pair" data. There will also be (rarer) times when the last element is the "larger of the pair" but you can't yet know that it needs to be summed with the next "smaller of the pair" measurement.
    Now consider a case where there could be two or more glitches inside true period. You'll need to evaluate the best choice of summing any two, three, four, etc. consecutive periods to reconstruct the real period. {note that for n glitches and a +/-20% acceptance criteria, then (2/5)^n of the glitched intervals will produce one measurement within the +/-20% bounds.} In such a scenario, I would advise working *really hard* on eliminating the glitches at the source.
    Whew, that's a mouthful and a half! Reply if you'd like an outline for an alternate approach, involving buffered semi-period measurement...

  • Ni scope measurement time delay

    使用niscope measurement  测量 time delay ,如何使测量更加准确,现在测出来的值的浮动范围很大,另,能不能提供其测量的具体算法编程

    The PXI 1031 is just the chassis and power supply.  It does not read anything.  So I am guessing that the 5105 is doing the measurements.
    What is the resistor value you are using to convert the current to voltage?  Have you verified that the resistor is actually close to the nominal value? Is the voltage in the current loop within the common mode range of the measurement device?  Do you have the loop grounded at two different points?  Does the pressure actually exceed 62 bar?  Does the current from the transducer actually go to 20 mA?
    Your calculation is correct for a 1-5 V input corresponding to 0-100 bar.
    You have several questions which all seem to be related to the same project.  Do you have a good overall plan for the total project? Did someone sit down and create a specification for the hardware and the software? Have the various subsystems been designed in detail before you started developing code and buying hardware?  Do you have a System Architect (Project Manager, or other title) who has a good overall idea of how this thing is supposed to work?
    Without that you will likely continue to be frustrated and not too productive.
    Lynn

  • Measure time of an measurement and if measurement time is less than 90 second wait until 90 second and then proceed to next steps or stop.

    Hi
    I am trying to make a program
          During execute a measurement count the time.
          If  measurement time is more than 90 second proceed to the next steps (or stop the measurement)
          If measurement time is less than 90 second, wait until 90 second and then proceed to next steps or stop
    I appreciate deeply if some help me.

    What sort of measurement are you talking about? What affects the time of your measurement? The very basic description you have is of a state machine and there are numerous examples of that
    1. Actually I would like measure the time of "Alignment" function done by wafer test equipment name Prober ( the model is "UF3000" made by TOKYO SEIMITSU CO., LTD.
    2.. Right now  the "Alignment" function is started when a  GPIB command is written as "N" and wait for resposne 70 in polling.
    Please refer to the attachment for Alignement function if it help you.
    In the attahement
    For Alignment error delay we are using =600
    Alignment counter =30000
    align loop cnt = 30000
    This is a program wriiten by another person and he is not availabe any more. What I am trying to do is
    1.  During execute a "Alignment " function count the time.
    2. If  "Alignment " function time is more than 90 second proceed to the next steps
    3.  If "Alignment " function is less than 90 second, wait until 90 second and then proceed to next steps
    Attachments:
    Alignment function.xlsx ‏153 KB

  • Best way to measure time?

    I have labview 7.0 and SC-2345 with several digital inputs. I have to measure time between digital input(rise or fall)and stop signal comes in my program with compare etc.
    I have tried to measure time with 4 sequences and "get date/time in seconds" and i have also tried to use loop with shift register.
    It seems not to work or accuracy is not enough. so how to do that?

    I am very sorry If you feel I came across unfriendly in any way, my intentions were sincere and I wanted to help you improve your code by pointing out some common mistakes. Believe me, some of my early labVIEW diagrams from 10 years ago are much worse. In the meantime I have accumulated some experience with daily use, but am still learning every day.
    By the way, I an not affiliated with National instruments. This is mostly a peer help forum where LabVIEW users from all over the world help each other improve their coding skills. (Only users with blue names are employed by NI!)
    Certain things are not obvious looking at your code and once the desired functionality is clear we can help you to a more optimized version that actually works. Whatever you are feeding to the "elapsed time" indicator has nothing to do with elapsed time, but counts the iterations of the middle while loop. It is either 1 or 2, depending on the inputs. There has to be a more interesting output (see my next post!).
    For example, let's just look at your inner while loop (see attached image). (1) The number of iterations is known when the loop starts, thus a FOR loop is more appropriate. (2) You are comparing a DBL with an integer using "equal". If by chance the operator would enter a fractional time (e.g. 1000.5), the comparison would never become true and this loop would go on forever. Your program will never finish! Not good!
    An alternative, but safe code is shown below in the image. For integer times, it has exactly the same functionality.
    Apparently, you want to measure elapsed time, and I am guessing elapsed time used by the code in your middle loop. I will attach a simplified example based on your program in the next message here.
    LabVIEW Champion . Do more with less code and in less time .

  • "Measurement time cannot be in the future ".

    Hi Gurus
    I am doing testing for a Computer manufacturing company.When i am trying do confirmation against a production oder via t code CO11N system giving the message "Measurement time cannot be in the future ".
    Could you pls help to resolve this issue.
    Regards
    Sandip

    Hi
    Posting date is the current date.The details of the error given below.
    Measurement time cannot be in the future
    Message no. IR023
    Diagnosis
    The measurement time that you have entered is in the future.
    A measurement reading describes an actual state, and therefore the measurement time cannot normally be in the future.
    System Response
    Processing will not be continued.
    Procedure
    Enter a measurement time in the past.
    If this is an exceptional case, contact your system administrator.
    Procedure for the system administrator
    In exceptional cases, tolerances must be allowed in the entry of measurement times.
    Example:
    Measurements are taken automatically and are then transferred to the SAP System. The system time of the measurement system varies from that of the SAP System for technical reasons.
    You can define an appropriate tolerance level in Customizing for each measuring point category.
    Pls suggest some solution.
    Regards
    sandip

  • How to Measure time taken for a some lines of code in a program?

    Hi
    I have one requirement to measure time taken for executing a  block of code in report . How we can find it ?
    Is there any way to code something in report to caluculate it ?
    Please send solution as early as possible
    thank u

    Ok.. try this code...
    DATA : t1 TYPE i,
    t2 TYPE i,
    delta(16) TYPE p.
    GET RUN TIME FIELD t1.
    PERFORM get_data. "your block of code
    GET RUN TIME FIELD t2.
    delta = t2 - t1.
    delta = delta / 1000000.
    WRITE :/ 'Time elapsed : ', delta , 'Secs'. "time in secs.

  • How to measure time delayed measurement

    Hi All:
    I am using TDS3064 scope to measure time delay betwwen two channels (using IVI driver
    complience package 2.2 for scope IVI driver). I look through drivers, but not able to find
    delayed measurement function. Is there any alternate way to measure time delay betwwen two
    channels. If possible please provide me example. I am new to LV programming.
    Thanks
    DBhagat

    You have to understand something about IVI class drivers. To support portability, those functions that are common to a class are what you see in the driver. Some scopes might have the ability to measure time delay between trigger points on different waveforms but many don't. If there is such a function supported by your scope, then you can make a call to the instrument specific driver or a VISA Write/Read. Of course, you then loose the portability feature of IVI which, imho, is about the only reason to use IVI class drivers. What I would recomend is that you do a capture of both traces and then do an analysis of the raw data in LabVIEW. One way to do this is with Trigger Detection for 1 Channel (Analyze>Waveform Monitoring palette). Wire each channels data to the function and obtain the time for each trigger event. The function will return the time for each event that you can use to calculate the difference.

  • Measuring time in smaller unit than millisecond

    I need to be able to measure time to a higher precision than Java provides. Is there any way that I can achieve this using a windows platform preferably?

    Here is the code JNI C code:
    JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceFrequency (JNIEnv *env, jobject obj) {
         LARGE_INTEGER lFrequency;
         ::QueryPerformanceFrequency(&lFrequency);
         return (jdouble)lFrequency.QuadPart;
    JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceCounter (JNIEnv *env, jobject obj) {
         LARGE_INTEGER lpCounter;
         ::QueryPerformanceCounter(&lpCounter);
         return (jdouble)lpCounter.QuadPart;
    }Here is the java code:
    import javax.swing.JOptionPane;
    import javax.swing.*;
    import java.net.*;
    import java.awt.*;
    public class Win32Native {
       public native double queryPerformanceFrequency();
       public native double queryPerformanceCounter();
       static {
             System.out.println("Loading library...");
             System.loadLibrary("Win32Native");
             System.out.println("Loaded ok!");
       public static void main(String[] args)  {
          Win32Native nat = new Win32Native();
          // You can call functions here as a quick test
          System.exit(0);
    }

  • Measuring time in milliseconds

    Hi,
    I have to measure time in millisecond between two user events in Applet, so I did this:
    Date startDate = new Date();
    // Users answer some questions
    Date endDate = new Date();
    int timeElapsed = endDate.getTime() - startDate.getTime();It was all fine, until the users figured out to cheat this system: they changed their computer's clock before answering the final question.
    So, is there any way to measure time in milliseconds and its independent from the computers clock?
    Thanks!

    meikop wrote:
    Thanks!
    I have a client - server application indeed.
    So as I understand, there's no good solution on the client (applet) side only - there's no way I can measure exact time and not be worried about clients computer clock? Any theoretical explenation ?
    Otherwise I have to mesure the time on the server side - I had it implemented some time ago:), but the clients started to complain about network latency etc so I decided to measure the time on the client side - not so good idea after all :)?
    I'll probably have to calculate each clients average network latency and so on...
    One can handle the client side clock being changed by the user by keeping a 'correction' in the client which is the difference between the client clock and the server clock. This way one only needs to update the correction at intervals - I use 1 minute update in my Bridge game. I don't need millisecond accuracy but it would not seem to be too difficult to correct for the network latency in calculating the correction.
    P.S. You would do better to use System.currentTimeMillis() rather than construct a Date() object which actually uses currentTimeMillis() behind the scenes.

  • Measure time until I get a signal?

    Hello,
    I'm quite new here, and I feel stupid about asking this question, but  I have been trying now for a couple of days to make a VI that measure times until I get a signal in. I'm testing a timers accuracy, so when it turns on the power the VI should show me the time elapsed.
    I'm just fighting with different kind of loops, but can't get any sense from it.
    /gusse

    Hi.
    What kind of a signal is available? Since you post in 'counter/timers', let's assume it is some kind of 5V logical signal, which you can set to high als long as your timer runs.
    Then, what you need is a simple tick count which is controlled by a gate. Use MAX to set-up a counting task. When choosing the counter, you will be shown which lines to hook up to. Measurment then is
    'When Gate is high, count ticks till gate is low.'
    Accuracy and time depends on the tick source. On a dedicated counter card such as 6602, 80 Mhz is available, hence 1/80 000 000 s is duration of one tick. Uncertainty in counting results mostly from the gate not knowing, when a tick comes by as it opens and shuts. So this gives a max error of 2 ticks. Other (probably main) source is signal quality, i.e. slew rate of your logical gate signal.
    Does that help already? If not, please ask further.
    Michael 

  • How can I measure time between transitions at digital input

    I am using LabVIEW 6.0 to measure the time duration between 2 transitions in a digital input port. I have a set up including an HP 34970A Data Acquisition unit with the 34907A Multifunction Module plug-in. The LabVIEW program is trying to poll the digital input for level changes and then using the Time function(Tick Count) to check the times at the transitions. However this method doesn't work reliably as I have to measure time periods of 500ms.
    Is there any good way of mesuring time period with the above setup. I don't have a module which connects to the internal multimeter in the 34970A. The other stuff I have are a HP 34903A(Actuator Module) and a HP 33120A(Function/Waveform Generator).
    Any method for m
    ore accurate time measurement with the above setup will be appreciated. If not, what else do I need to make accurate time measurements.

    Frankly I doubt that you're going to be able to measure time interval with much accuracy. You're periidically polling a static digital input and how often you poll is going to vary. You could try polling as fast as possible and eliminate as many background tasks as you can. If your tolerance for the measurement is plus or minus 100 msce, then maybe you'll get a decent measurement most of the time. If it's plus or minus 5/10 msec, then it will never happen. The pc's clock is just not that accurate and a software timed loop on Windows is not deterministic enough. Get a counter/timer board for something really accurate or use a scope to capture the waveform.

  • To high measurement time for NI PXI 4132

    Hi,
    I'm using 4132 to measure very small current of photo transistor device. with 25v source to the DUT it takes me more than 100ms to get an stable current reading.
    How will i reduce measurement time?
    tnx!

    Hi edakoto, 
    What current levels are you reading?  How are you acquiring the data in software?
    One thing to try is to reduce the Aperture time of the device.  The PXI 4132 defaults to an aperture time of 16.6 ms.  You can reduce this using the Configure Aperture Time VI or function.  For more information see here:
    http://zone.ni.com/reference/en-XX/help/370736F-01/ni_dc_power_supplies_help/4132_aperture/
    Thanks
    Patrick W.
    Applications Engineer
    National Instruments

Maybe you are looking for

  • How can I put my iPod's songs into my pc?

    Hi!I bought my iPod in November and this week I putted all the music which was in my PC into my iPop, and there is a thing I don't understand: how can I do to put my iPod's music into my PC? I'll be really pleased if you asnwer my question!bye

  • Name of tables of fb50 and fb60 and fb70 and fbcj

    hi all i make a query from sq01 and it for all  transactions io make tranaction in fb50 and fb60 and fb70 and fbcj but i need the name of these tables tables of documnt header and line items tables of vendor header and line items tables of customer h

  • Web service wsdl problem

    I have a very simple web service cfc file that uses another cfc component in the returntype. Both cfc files are on the same directory in the server. It fails to register (wsdl) on the CF server. If I change the returntype of the web service call to "

  • Chart plotting?

    Hi, I need to plot some simple chart in JAVA and print it out or export it to Excel. Is there any simple package out there for this function? Or I need to draw the chart as a graphics from scratch? Thanks a lot.

  • Disk suite 4.2.1 Bug

    Ok Looks like I found a bug in Disk Suite 4.2. I am not sure with the other versions. So here is my finding. If I have any meta device either mirrored or raid or stripe. While my metadevice is mounted I can create a soft partation on top of it. Once