Zero-cross​ing function

Hi,
I found this zero-crossing function in one of the old forums and I'm trying to understand how it works. In my case I have two sine waves, instead of one square pulse but I can't really figure out how this function works. I know that first, the waves are generated then you get their attributes, the data values go into the zero-crossing detector that controls the case statement but I don't know how the trigger time and time interaval are used to build the array, I think the timestamp outside the 'for' loop is for storing the previous itteration of the zero-crossings but I'm not really sure.I have no clue what happens in the final step before the zero-crossing times are subtarcted, as in the threshold array and so on. I've read how each function individually but I can't add the blocks together.
So I was wondering if someone could please explain how this works?
Thanks
Solved!
Go to Solution.
Attachments:
Zerocros.png ‏131 KB

Adding to what crossrulz said, it helps to understand what the code you're looking at is.
It would appear you don't quite understand what t0 and dt are.  t0 is the time at the initial point in the waveform.  This can be a wide variety of times rather than simply 0.  dt is the amount of time between samples.  If we multiply the iteration by dt, we know how much time has passed since the first sample.  After 0, 0dt is the same as 0s.  From there, 1dt, 2dt, 3dt, etc can all be calculated to a value measuring time.  But, it's only measuring "time since the first sample."  If it's only measuring that, the timestamp could be meaningless.  If you want to convert the time since first sample to an actual time, you need to add the initial time to it.  As an example, if dt is 1s and t0 is 4:00:00pm, after 3 samples we are at 2dt so 2 seconds.  Do we care about 2 seconds or 4:00:02?
The "big timestamp array" is being fed into what is called a shift-register.  You can use this register to pass values between iterations of a loop.  Before the loop, we feed an uninitialized array into the shift register.  The first time the build array is used, it's fed an empty array and the first timestamp to save.  This is then output to the shift register on the right side of the loop.  This value is passed to the next iteration.  It will persist until we reach the build array for the second time.  Now, the 1 element array is fed into the top input of the build array and a new timestamp is added to the end of the array.  This will continue with the n-sized array being fed to the top input and the newest timestamp being added to the end to make an array of size n+1.  If we want to maintain all of the timestamps, we need logic similar to this.  You could plug it into the bottom and the new timestamp to the top.  This would put the newest timestamps in the first element of the array.  You just want to include the old array so you keep all of the timestamps instead of just the most recent.

Similar Messages

  • Zero crossing, "Triggering" and XY-Graphs

    I'm trying to measure the electrical hysteresis of a sample.  The way in which I do this is by measuring two voltages within a circuit, sending them to my DAQ, and then plotting them in an XY-Graph to view the shape of the curve.  I can somewhat see the hysteresis, but II need to measure the "zero-crossings"; that is to say, the value of one function, when the other is 0, and vice versa.  So when V1 = 0, I want to know what V2 is, and when V2 = 0, I want to know what V1 is.  Seems simple enough, and I have included my VI.
    First I tried the ZeroCrossingPtbyPt, along witha Relay, which never seemed to trigger properly.
    Second, I tried using Trigger and Gate, but that seems to give inflated values.
    This VI can be tested by removing the DAQ assitant and replacing it with two "Generate Signal"(s),  with the same frequency, different amplitudes, and a small phase difference, and this will produce a similar effect without the real signals.
    Next, I am sending the raw voltage signals into a Waveform Graph.  However, it is impossible to get the traces to stay "still" on the graph.  In other words, if this were a real oscilloscope, there would be a "triggering" problem, and if the trigger were set to the proper value, the oscilloscope would be able to track the waveform without it jittering left to right in time.  Any ideas on this?  I've tried to change just about everything in the Waveform Graph with no difference.  Do I need to send in some other signal to get the graph to follow the waveform properly?  This is really important because it will tell me if my sample rate is good enough to capture the signal (a sine wave at 1 kHz).
     Finally, the hysteresis curve on the XY Graph seems to cover many cycles (periods) of the waveform, but I want it to cover only 1 cycle at a time, so it isn't so sketchy-looking.  It's very boxy as well.  So in short, the number of points it is plotting is fine, but it is not plotting them quickly enough, since I'd like all of the points it plots to be over a single period of the waveform.
    Please help!  Thanks in advance.
    Attachments:
    hysteresis.vi ‏176 KB

    As it turns out, the issue was that I was not collecting enough samples at a high enough sample rate from the DAQ.  This is why it worked with "Generate Signals" and did not work with the DAQ Assistant.  Because there were not enough samples, the apparent zero crossing was occuring either too early or too late, leading to an incorrect value.  Therefore, the best solution when it comes to finding zero crossings is make sure your # of samples, and sample rate are high enough to get an accurate measurement.
    As a result, this is why my XY Graph was showing blocky hysteresis loops, rather than nice smooth curve hysteresis loops.  The data being sent to it was not quick enough, and therefore the XY- Graph connected the dots between the points that it was sent, yielding a truncated loop, which appeared blocky or sketchy.
    On the issue of triggering, this can apparently be set within the DAQ Assistant in the "Triggering" tab; the key is chosing the correct channel to trigger from, and a reasonable trigger level.  This was my problem, and this is why my Graph appeared to jitter.  It was not the graph itself, but the DAQ Assistant that did not tell it the proper triggering timing.
    So, in short, I solved my own problems, but I leave this as a record for those who encounter similar problems in the future.
    Thanks.

  • Looking for zero crossing point

    Hello,
    I have Amplitude vs. time data (wave).    
    I need to find the zero crossing time. Now I am using "For loop"  to search the Amplitude array for the index of the neighbor to zero through point by point, and then by linear inerpolating to get the zero crossing time.  When the point number is large, say 60kpts, it gets slow because the for loop "point by point" searching method, I think.
    I am wondering if there is any quick way to do that.
    Thanks,
    Wei Tong

    Try something like this, maybe? See if it makes sense.
    (It currently fails if a value is exactly zero and the function does not switch sign afterward. It just needs a bit more code to fix that. Modify as needed.)
    Message Edited by altenbach on 04-13-2008 12:52 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ZeroCrossings.png ‏33 KB
    ZeroCrossings.vi ‏57 KB

  • 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

  • Projects Cross-charge functionality Vs Inter-project Billing

    Hi,
    We are currently evaluating the funtionalities of Project Cross Charge Vs Inter-project billing. Our setup is such that we have 3 Legal Entities, 3 Business groups, 3 SOB's and 3 operating units, each tied to their own legal entity, Business group and Set of Bools. When reviewing the documentation, it looks like the Cross charge functionality does not support operating units that are in two different business groups. Does that imply that we have use the Inter-project billing to charge projects across operating units.
    We will really appeciate, if one can provide some additional insight in this regard.
    Regards,
    - Vasu Krishnaswamy -

    Hi,
    It is possible to have cross charge across the Business groups. It is also mentioned in Oracle Projects fundamentals guide. Please refer to the Global Project Support Chapter. Below is the extract from it.
    Providing Data Access Across Business Groups
    Global enterprises have resources and projects that are located, managed, and accounted
    for in different business groups or different countries. To meet the needs of these
    enterprises, Oracle Projects provides the following functionality:
    • Globally located resources can charge their time and expenses to projects that are
    owned outside their respective business groups.
    • Resources can manage and administer projects located in different business groups.
    • Oracle Projects produces appropriate accounting entries, intercompany invoices, and
    management reports even if the resource organization and project owning
    organization have different accounting calendars and job definitions.
    This functionality is provided through the use of global organization hierarchies, global
    jobs, and cross charge functionality.
    Hope this helps!
    Thanks,
    Sathish
    www.projectsaccounting.com

  • Cross docking functionality in SAP F&R

    Hi All,
        I want to know how the cross docking functionality is handled in SAP F&R.
       Whether I should give RP type 11 in store level and RP type 01/02 in DC level for these cross docking products?
       Whether anyone has done the dynamic allocation functionality for cross docking products in which there should be an option to send the latest Order proposal values to ECC from SAP F&R so that STO s can be done with those new OP values?
    Regards,
    Resmi Raj.

    Hi Eduardo,
    Thanks for your reply. I have the similar scenario
    Herein, we have kept relationship as mentioned below
    Article: 100050
    Store: FRS4
    DC: FRD4
    Vendor - TESTVEND1
    For Vendor -> DC, we have maintained the distribution profile as FTM (Cross docking) and the RP type for article as 01
    For DC -> Store, we have maintained RP type as 11
    Now when we have updated the consumption data for both DC & store for the article at DC / store. We ran FRP for both DC (FRD4) and store (FRS4). The order proposal was getting created correctly for store, while no order proposal was created for DC as per the RP type.
    Now, how is it being classified as a Cross docking scenario as we expect that the OP (STO's), once their inbound delivery is created, then they should be cumulated in ECC and generated a collective PO for Cross docking. Is that correct. Also, can you please let know the exact process to be followed for the same.
    thanks
    Best Regards
    Prashant

  • Record time of zero crossing

    I am trying to record the time for zero crossing in order to get the phase angle and inevitably get the power facto . soi was trying out a few ideas to  see if this is achievable and i came up with this . can someone tell me where i am wrong . or what to do  get the right values .. 
    Solved!
    Go to Solution.
    Attachments:
    zero crossing in waveform.vi ‏17 KB
    Zero Crossing.PNG ‏21 KB

    1. You need to pass the waveform into the Get Waveform Time Array.
    2. No need to wire up the N on the FOR loop since you are using Autoindexing tunnels.
    3. The Conditional Indexing tunnel is your friend here.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    zero crossing in waveform_BD.png ‏20 KB

  • Zero crossing and syncronizing

    I use 2 programs.I have atachetted them below.
     In "Line zero cross sync" I detect the crossings through zero of a sine and then for every crossing I try to write on a analog output an impulse.
     The second program "sincronizare cu reteaua subvi" measures the frequency of the signal and calculates a delay time.
     How can I delay the moment between detecting a zero crossing and writing the impuls, with the value calculated with the second program.
     The second problem: If I use a loop to delay the time how can I make sure that the two operations will be syncronized (if I modify the frequncy of the signal during the measurement I want the second program to modify the delay time simultaneously,not with a delay).
    I am using LabVIEW 8.0. 
    Thank you
    Attachments:
    Line zero cross sync.vi ‏85 KB
    sincronizare cu reteaua subvi.vi ‏32 KB

    I solved the problem.Thank you anyway

  • I wanted a zero crossing detector for a a acquired wave form.

    it shoul detect the zero crossing of a wave

    The technique for finding a zero crossing is basically to detect a change in sign between two consecutive numbers. You need to evaluate the previous number sign with the current number.
    A common way to do so is by multiplying the previous number and the current number. If the product is positive, both has the same sign and thus there was no zero crossing. If the product is negative, there was a zero crossing.
    Make sure you are sampling you signal fast enough to accurately detect when the zero crossing occur. If you know your signal, you may easily calculate the exact moment based on your aqcuired information.
    Best regards;
    Enrique Vargas
    www.vartortech.com

  • Duration of a zero crossing

    Hi all,
    I m a newbie to LabVIEW and I really need some help with some zero
    crossing issues.
    I have a wave generated from the values output by a pressure sensor. I
    differentiated this wave to obtain a wave with peaks, valleys and zero-
    crossings. Then I used the sign generating vi to generate another
    square wave depending on if the value is positive negative or zero.
    What I need to do now is to find the time duration between each zero
    crossing.i.e. How much time elapses before the next zero crossing
    occurs. Any ideas how to do this ?
    Thanks and regards.

    Here's a small VI which does part of that
    Have a nice day!!!
    LabVIEW | LabWindows/CVI | TestStand
    Certified LabVIEW Architect
    Attachments:
    Duration between peaks.vi ‏18 KB

  • Phase angle measurement using zero crossing

    I am using  zero crossing to measure the phase angle between (voltage and current) which is represented as  two input in my vi  to  eventually get the power factor. But however the reading i got for the power factor remain at 1 all through no changes. I am using an SCT- 013 -000 current transformer for the current and a power transformer for the voltage 240 - 6V . below is my vi . Can anyone help me troubleshoot why my result is showing 1 for different loads  including resistive , capacitive and inductive loads . 
    Attachments:
    Phase Angle Measurement.vi ‏39 KB

    Are you working with Nigel91 who posted a similar question in the Electrical Power Suite board?
    You have the same problem that he has. For dt = 0.02 (equivalent to a 50 Hz sampling rate) you cannot measure anything about a signal with a frequency higher than 25 Hz. And you could not get meaningful phase information at frequencies above a few hertz.
    To get good phase information at typical power line frequencies sampling rates of 1000-1200 Hz or higher should be used.
    Lynn

  • Method that fines zeros of a function.

    I've a method:
    double y (double x)
    I need a method:
    find_zeroes(range_min, range_max )
    that gives me back an array with the passages on zero of the "y" function in the range between range_min and range_max
    I mean that if at [x], [y=-0.001] and at [x+0.001], [y=+0.001] then probably at [x] there will be a zero of the function so, it will be returned as an element of the array.
    is there any code around that does this work?
    thanks

    Is this homework?
    Look up Newton-Raphson method. There are other methods.

  • OBIEE: non empty cross join function problem with some reports

    Hi all,
    I am getting some problem ,when we are excuting some requests in OBIEE its taking long time , Actually our OBIEE is connected with Essbase when we are generating some reports its taking long time so i captured the Query in OBIEE and Iam excuting that query in Essbase MDX editor
    its having the the function " NON EMPTy CROSS JOIN"
    which reports having non empty crossjoin function its taking long time so how can i disable this function in OBIEEfor that reports
    I dont want to use that function for my reports so how can i do this in OBIEE
    your help would be appriciated.
    Thanks
    Edited by: user8815661 on 26 mai 2010 08:44

    Any Help

  • Remove leading zeros using MDX function

    Hello,
    BO XI R3.1 SP2 FP2.5, SAP BW 7.0
    This seems simple, but I cannot find a solution.
    How do I remove leading zeros from a character field in a OLAP universe. Is there any MDX function?
    I tried
    <EXPRESSION>
    Value([0MATERIAL].[LEVEL01].[[20MATERIAL]].[Value])
    </EXPRESSION>
    <EXPRESSION>
    StrToValue([0MATERIAL].[LEVEL01].[[20MATERIAL]].[Value])
    </EXPRESSION>
    I can remove the leading zeros in Webi, but we require it for ad-hoc reporting? Is there a way to do this in the universe?
    Thanks,
    Nikhil

    Hi,
    SAP BW MDX only allows calcuated expressions that return numeric values: this is one if the main SAP MDX limitations.
    By the way there is the abilitiy to return string only for those expressions:
    [Dimension].currentmember.name
    [Dimension].currentmember.uniquename
    So you can do this:
    <EXPRESSION>
    (right([0MATERIAL].currentmember.name, 4))
    </EXPRESSION>
    <EXPRESSION>
    (right([0MATERIAL].currentmember.uniquename, 4))
    </EXPRESSION>
    <EXPRESSION>
    (left([0MATERIAL].currentmember.name, 3))
    </EXPRESSION>
    <EXPRESSION>
    (left([0MATERIAL].currentmember.uniquename, 3))
    </EXPRESSION>
    Otherwise you can use WebI formulas as described in the thread.
    Regards
    Didier

  • Splitting up plots on XY Graphs depending on zero crossing

    Hi,
    I posted this question earlier and thought I got a solution. Please read the old thread: http://forums.ni.com/ni/board/message?message.uid=1098899#U1098899
    Basically, my problem now is that the way its being done now, whenever it crosses the zero axis with a negative slope, it temporarily creates another plot and as soon as it crosses it with a positive slope, it merges those 2 graphs together. So somewhere between the slope going from -'ve to +'ve and crossing the zero, I have an extra plot, and it distorts the colors of my plots, which seems like a bug to the user and may confuse them. I have attached a VI below where you can see this behavior in the 2D array indicator.
    Attachments:
    XY Example VI.vi ‏18 KB

    I don't know what your intentions are with this VI, or what you mean by "temporarily creates another plot".
    You've got a lot of array manipulation going on inside those loops.  You are just going to have to sit down, figure out how those loops are currently working, and how to change them if they aren't doing what you want.

Maybe you are looking for

  • Excel's Freeze Pane Property  in RTF template for XML Publisher Report

    Hi all, I have created RTF template and it's output type is Excel. I want to apply Freeze Pane Property of Excel in rtf template so that it can be applied to Excel Output. Please let me know any information regarding this. ta, P

  • I'm looking for a good case for the 7th gen iPod classic. Not some silicon skin but a good case.  Help?

    I really do want a new case for my 7th gen iPod classic. It seems there's barely anything on the market anymore except skins.  I don't want a skin. Anything still out there? Searching the web is depressing me.

  • Vendor adress in po

    hi i want to changes vendor address in PO in PO on header level in address tab we can changes it but in PO print or in PO print preview it shows vendor master record address so how we can archive this ? Regards kailas

  • Switching to Panasonic HVX200... HD Monitor?

    Hello, I am not even sure where to start... we do primarily wedding videos and are looking to take things to the next level, hence the HVX200. The way I see it, we would be using the Firestore to capture the footage which we then bring into FCP. Curr

  • Laptop won't start after cutting out during an update

    Dear All, My laptop cut out during a software update (I think the battery died, although the screen readout said I had plenty of life left) and since then it won't start up. When I turn it on it just goes to the grey screen with the apple logo and th