Capture Last ten Shots (Shift Registers)?

Situation: -
I am continuously acquiring data on 4 channels of the DAQ card using conditional triggering. Each loop captures 2000 samples, which are stored in 2-D waveform arrays containing each scan of each channel. The data is continually updated on a waveform graph for the user to monitor. After a period of "test time" or when you press a button, the loop will end and the last loop of waveform data gets passed to the analysis VI where all the calcs are performed (I only perform calcs/analysis on static data once test time has completed).
Problem: -
I now want to average the last 5-10 points prior to the while loop ending (as the injection needle will jump around slightly shot to shot). I can enable indexing on the while loop and then select the points I require afterwards (i.e. the last 5-10 or whatever), but this takes up a hell of alot of memory and the processor starts caching to disk too often. Can you imagine just how many points are stored in memory (2000 samples/channel, 4 channels per scan, sampling at 80KHz, for 10mins).
There is no need to store all these points. Each time the loop iterates, the buffer is cleared so the program runs quickly and smoothly. All I need to do is store the last 5-10 waveform array's and pass these on to the next VI, not the whole XXXXXX amount of arrays/point.
I may try and use a sequence, so that the first sequence uses disable indexing and ends after the "Test time" has elapsed. This then continues into the next sequence and proceeds to capture a further 5-10 shots with indexing enabled, before passing to analysis VI. This still doesn't really capture the last 5-10 iterations, it captures the next 5-10 iterations, but it would do.
Ideally, I want the while loop to execute with indexing disabled, and at a certain point in time (comparing the "Test Time" with the "sample rate"), the while loop changes to 'indexing enabled' which will build up an array of waveform data until the loop ends (about 5-10 iterations later).
Any Ideas. If you've got time on your hands..........

You can use a shift register. This will just maintain the last "n" amounts of data sets. I've attached a really simple example to illustrate this.
This may work for you needs however there is an issue that the shift registers are in essence being used the whole time so you will have more memory interaction than you may want ... which depending on your performance requirements may not be desirable.
If that is the case then it may be best to slightly modifiy the approach you're using. Indexing continually instead of in the main loop. Set up a condition/case upon which within the main loop you initiate a sub loop that then starts logging the data you require for averaging.
Hope this helps,
Kamran
Attachments:
ShiftRegister.vi ‏36 KB

Similar Messages

  • Hi out there. To capture a screen shot one uses: Command-Shift-3 or 4. I have done this for a long time. Now suddenly neither screen shot works anymore. Suggestions how to get this useful function back? Thanks, Georgx

    Hi out there. To capture a screen shot one uses: Command-Shift-3 or 4. I have done this for a long time. Now suddenly neither screen shot command works anymore. Suggestions how to get this useful function back? Thanks, Georgx

    Command-Shift-3 and 4 works just fine on several Macs that I have here.
    Try restarting your Mac....or post in the specific support area for your Mac model....for more advice.
    https://discussions.apple.com/index.jspa

  • Want to learn more about shift registers and formula nodes

    I am new to Labview and have looked at the example files and help files regarding shift registers and formula nodes. I was hoping that someone has a simple and detailed VI expaining how each of them(shift registers and formula nodes) works.

    Formula nodes are not one of the first things you will need to be looking at. look at the help files (press ctrl-H) for some syntax examples. Shift registers are easy: they carry the value from the end of the loop back into the start of the loop. The great power of shift registers is to use them without initializing. In that case they will retain their last value as long as the vi is in memory. This is a little more advanced topic, though.
    I included a simple example that illustrates what a shift register does. Requires Labview 7.1
    Good luck,
    aartjan
    Attachments:
    shift (LV7.1).vi ‏19 KB

  • Better method than using a large number of shift registers?

    I'm trying to work with example code provided free by stanford research systems (http://www.srsys.com/downloads/soft.htm).
    Their example software alows the user to run an analog scan across 100 masses (the x axis) which progressively produces a graph of all the data. It repeats scanning (and updating the graph)until the user hits stop.
    My goal is to find a way to make the program display the graph of the last scan while it is displaying the current scan (this way it is possible to compare the graphs and see how they change). But as best I can tell the data is generated and plotted in a while loop piece by piece so the best thing my labview inept mind has managed so far is using a large nu
    mber of shift registers and graphing the points as they generated along with points that were generated 10 cycles ago in a different color.
    So I hope to either find a good way to use shift registers to get values from over 100 cycles ago (which doesn't really seem to work unless i just make space for over 100 little arrows in my loop) or to find a better approach to the whole mess.
    The example does not seem to use XY plot and to tell the truth I don't know exactly what its using to plot.
    Can anyone offer any guidance or at least understand my question enough to point me in the right direction.
    I'm including the stock example and my adaptation to it but if you need to use the included sub vi's the package is on that SRS webpage I listed above (look under RGA).
    I suppose this may all be too much to ask but I can dream can't I?
    Attachments:
    original.vi ‏87 KB
    changed.vi ‏92 KB

    I certainly agree that the DAQ programming is the part leaving me most confused. I'll attach the package that I am trying to modify, the trouble is there are so many sub vis involved in actually acquiring the data that I am not entirely sure what format the data comes out in.
    Perhaps to someone more skilled than I am with lab view the inner workings of this package would be clearer. If you are up for it then look at SRSRGAa simple analog.vi in SRSRGA61.lib and you can see what I'm working with.
    I'll also attach my attempt to modify the code to make it work like altenbachs example... however somehow it would seem my timing/synchronization is off. Hope some of this makes sense, I'll see what luck I can have with get w
    aveform components, I suppose I have been approaching this so far as if my DAQ was just giving me data points as opposed to a waveform.
    Attachments:
    rga_lv_61.zip ‏2132 KB
    graph_app.1.vi ‏101 KB

  • Static Shift registers

    My understanding of shift registers is that if you don't initiaze them
    then they will hold the value from the last instance, hence be static.
    I've created a subvi and placed multiple copies in a case statement,
    all it does is check to see if the value has changed, yet when it runs
    the second time it starts out at zero when it should be  whatever
    number went through the sub the last time.
    Am I missing something here?
    Bundle to byte array contains single to byte array sub vi
    Ron
    Attachments:
    Bundle to Byte array w change.vi ‏29 KB
    Single to Byte array w change.vi ‏10 KB

    You should always consider initializing shift registers. Keep in mind that if you just opened a VI that contains uninitialized shift registers, it won't remember the data from the last time it was run (because it has been unloaded from memory since then), so it's more likely the values in that shift register are garbage. That could be even more dangerous, since how LabVIEW interprets that data could cause very strange and erratic behavior in your application.
    Here's my solution that works for Functional Globals and general shift registers: Consider initializing them the first time the VI is called inside the While Loop, as demonstrated below:
    The First Call VI outputs a true the first time that instance of it is called, and false every other time. For Functional Globals you could alternatively have a dedicated Initialize case to perform this function. The advantage of the technique listed above is that you are guaranteed initialization on the first call, regardless of whether the client programmer remembers to call an initialization case.
    Message Edited by Jarrod S. on 04-11-200612:33 PM
    Message Edited by Jarrod S. on 04-11-2006 12:33 PM
    Jarrod S.
    National Instruments
    Attachments:
    Pic1.jpg ‏7 KB
    Pic2.jpg ‏14 KB

  • Number of Stacked Shift Registers based on Control

    Hello,
    I'm using stacked shifts in my code and I would like the number of stack shifts to correspond to a number from a control. Is there a way to do this? Thanks!

    I'm trying to average numbers and doing so by using stacked shift registers in a loop. The only issue is the number of numbers being averaged is not constant and I don't want it to average the last x amount of numbers. I will look into using an Action Engine.

  • Simplify VI that is recording a rate but is currently using too many shift registers

    I have a VI that was made by the director of scary movie, so beware, this VI is a nightmare!...or at least to me it is.
    Background:
    I have 20 pans and I have a water level sensor that outputs a voltage from 0-5 Volts. By knowing the volume of the pans, I calibrated the output to be in gallons. The real output I need is a volumetric flux, which is gallons per minute per square foot. We are currently achiving this by using a VI that a summer intern made (See attached). It works well, but it is just so messy and hard to clean up and expand. The plan is to have 100 pans total and I don't want to copy paste this code 5 more times!
    Questions:
    -How can I collect a rate  differently? If you notice on the calibration subvi attachement, the rate is calculated manually knowing how fast the loop is going in the main VI. I don't know if this is the best way
    -Can I get rid of the shift registers some how?
    -Is there a way for me to combine the  calibration subVIs so that I don't have to have one subvi for each channel?
    Thanks in advanced! 
    Solved!
    Go to Solution.
    Attachments:
    calibration subvi.JPG ‏29 KB
    Shift register mess.JPG ‏79 KB

    Hi all,
    I will attach the actual code in a few minutes. There's some propietary information that I need to remove before uploading. I'll be right back
    EDIT:
    Ok guys, please see VI's attached. The VI that I need help with is "AWC - Commercial Main VI - Rev0" and the messy part it's towards the bottom.
    I have been cleaning up this VIs and making subVIs for a few months now (time on and off) but I can't seem to get a grasp on how to minimize the big shift register mess.
    Maybe some background on myself might help? I'm a ME but I have been using LabView for easy project for the last 2 years. I took Core 1,2,3 class of LabView so I guess I know enought to be dangerous and to get myseld into trouble. I don't practice as much as I would like to and that's probably why I'm stuck with this big mess.
    I will also accept any other tips that anybody has offer in any other part of the VI. I can also clarify any parts of the VI if that helps.
    Thanks,
    Pepi
    Attachments:
    NI Help.zip ‏366 KB

  • How do you capture a screen shot

    how do you capture a screen shot on a MacBook Air

    Quickest way is Command-Shift-3:
    This takes a screenshot of the screen, and you can then save it as a file on the desktop
    Cheers!

  • Is there and alternativ​e to shift registers for saving data across iterations in a subVI operating inside a loop?

    I am creating a subVI state machine (case structure) which will run inside a while loop which will be executing every 250ms. The reason I wanted to make the state machine case structure into a subVI is because I want to execute 64 of the machines within the same loop. The goal is to monitor certain types of voltage changes on 64 I/O channels on a FP2200 RT module and report periodic details about state changes to a database. My thinking was that by executing each independent machine in the same loop structure, I will only worry about one thread. It seems that the alternative of having one state machine thread per I/O channel is probably more than the RT module can handle. Please correct me if I am wrong on that.
    The issue I'm now having is as I'm creating the state machine, I am finding that I need to keep track of some pieces of data from one loop iteration to the next. This is easy enough to do with shift registers but in order to use them, I have to create additional input nodes to my SubVI as well as output nodes. For example, I want to use a queue to buffer some I/O data but as of now, I have to create this queue outside the loop, pull it into the loop across a shift register, feed it to the subVI, and output it to the out Shift register. It would be better if I didn't have to output this queue because there's no reason for anything to have access to it outside the subVI. It just creates an extra set of wires to look at and makes me worry a bit about maintainability. 
    Is there a better way to approach this problem? 

    You could place a while loop inside your sub vi that has a true constant wired to the stop condition. Then add unitialized shift registers to that while loop to keep data between iterations.
    or you could use a feedback node inside the sub vi

  • LV 8.21: strange behavior with DAQ tasks, parallel running VI's and shift registers

    Hello,
    I have made a VI using DAQmx vi's. The VI uses shift registers to store DAQ tasks and other (internal) information. I have implemented  several modes of operation (enum control with a case structure) like 'init', 'read AD', 'config AD' etc. If I use this multi mode VI in a single main VI everything work as expected. I have attached a jpg that shows one example where the DAQ VI is called from 2 parallel running while loops. One loop aquires the data (LOOP 1) while the other loop configures the aquisition task (LOOP 2). If I implement the same thing by putting LOOP2 in a different VI that runs seperately from the first VI I get an error message (200428):
    Possible reason(s):
    Measurements: Value passed to the Task/Channels In control is invalid.
    The value must refer to a valid task or valid virtual channels.
    Task Name: EasyDAQ_AD
    Of course, the second VI is started manually after the 1. VI has passed the initialization part. The error message is triggered from the 1. VI that executes the DAQ task. From my understanding of the LV execution system this seems like a bug to me. Does anyone have an idea what could go wrong here?
    klaus
    Attachments:
    problem.jpg ‏30 KB

    1. In general, this kind of technique is something I've been using successfully for years.  (Ben recently wrote up a very nice treatment of these "Action Engines" as a "Community Nugget.")  So I don't start by expecting this to be a bug in the LV execution system.
    2. Your description of the problem sounds almost backwards.  You say you manually start the 2nd vi ("Config AD") *after* running the 1st vi ("Read AD").  Seems like you'd need to do the Config 1st and then do the Read, right?   I kinda suspect you actually did it in the right order, but described it wrong.
    3. The next likely scenario is that the Config failed, but you didn't trap the error and were unaware of it.  Then it makes sense that the Read would also fail.
    4. A couple issues I regularly deal with in these DAQ Action Engines is internal error handling.  I often keep a shift register inside to store errors generated inside the Action Engine.  But it can get a little tricky doing sensible things with both the internal error and any other error being wired in as input.
    I said all that so I can say this: if you have complex nested case statements, or lots of different action cases to handle, double check that the task wire makes it from all the way from left shift register to right.  Sometimes they get lost if they go through a case statement, the output tunnel is set to "use default if unwired", and 1 or more of the cases don't wire the output.
    -Kevin P.

  • Shift Registers not working properly with counter group .vi

    Because I'm not sure how to refer to them as a group.
    Well, because my previous vi only let my DAQ(STC) model no. 6020E read on one channel, I switched to a new set of .vis. They solved my channel problem, but in exchange, they introduced a set of new ones.
    First, when the .vi runs without shift registers(used a function generator for testing), the count ascends at a steady linear rate. That means with shift registers, I should be getting a horizontal line or close to it, right? For some reason, instead of a horizontal line, I instead get a zigzaging line that steadily ascends the amount its supposed to. 
    Sometimes, the count just zigzags up in down from 4 mill to 0 and back again for reasons I do not comprehend.
    I'll upload my new .vi and my old .vi.
    Screenshots too
    http://imageshack.us/g/192/shiftregisterproblem.pn​g/
    http://imageshack.us/photo/my-images/560/idonteven​p.png/
    Attachments:
    Pulse Counter attempt mkIII.vi ‏96 KB
    Pulse Counter attempt mkII.vi ‏43 KB

    Ok, here are the pictures and one of the vis uploaded .
    Attachments:
    idontevenp.png ‏238 KB
    shiftregisterproblem.png ‏223 KB
    daq-stc.llb ‏1736 KB

  • Routine to capture last month data

    Hello Frnds,
    For a Dataload from the datasource Actual Cost Component Split(0CO_PC_ACT_10), we want to capture last month data ,
    we are planning to write a routine in infopackage level,
    using the option 6-ABAP routine, to select the last month data ,
    we have the time characteristics 0FISCPER, At present we managing the load by manually changing the selection for last month every time ,
    It would be a great help if anybody can show a sample code to select last month data,
    Thanks,
    saty

    If 'last month data' for you is equivalent to 'actual month data', post this code (corrected) into your IPACK dynamic selection:
    DATA: zyear type /BI0/OIFISCYEAR,
    ______zperiod type /BI0/OIFISCPER3,
    ______zfiscper type /BI0/OIFISCPER.
    CLEAR: zyear,
    _______Zperiod,
    _______zfiscper.
    MOVE sy-datum+0(4) to zyear.
    MOVE sy-datum+4(2) to zperiod.
    concatenate  zyear zperiod into zfiscper.
    l_t_range-iobjnm = '0FISCPER'.
        l_t_range-fieldname = '/BI0/FISCPER'.
        l_t_range-sign = 'I'.
        l_t_range-option = 'EQ'.
        l_t_range-low  = zfiscper.
        l_t_range-high = zfiscper.
        APPEND l_t_range.
    Message was edited by: Claudio Caforio

  • Multiple shift registers in For loop

    I'm using multiple shift registers to find the number of different string in a string array. However, the shift register got refreshed every time it finds a different string and returns back to 0. How can I have the register remember its previous value after it encounters a new string value?
    Solved!
    Go to Solution.
    Attachments:
    count.vi ‏19 KB

    You should think about making your code scalable. At the moment, you need to re-architect the VI from scratch whenever the sensor names or their number changes. If you suddenly have 1000 sensor names, the code would be unmamangeable because the sheer number of cases and shift registers!
    Attached is an simple alternative. As you can see, the code remains the same, even if the number of sensors or their names changes in the future. See if it makes sense. (You can easily modify it to also count unrecognized names, for example).
    Modify as needed.
    Some other possible bugs in your VI:
    You should initialize the shift register with zero, not one. Right now the results are one too high.
    Case "B" is actually "B." and the count is only accidentally correct because it is also the default case and there are no other sensor names (e.g. F) in the input array.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CountMOD.png ‏19 KB
    countMOD.vi ‏19 KB

  • How to generate pseudo random noise(PRN) binary sequence using shift registers?

    what is the block diagram to generate pseudo random noise (PRN) binary sequence of 1's and 0's using shift registers
    please help
     i need 2 submit this project in this week

    This is a fairly simple homework problem. My hints (on the LabVIEW side):
    1- look at while loops
    2- look at shift registers on while loops with multiple input elements
    3-look at the logic components, AND, OR XOR
    Look at this wiki article: http://en.wikipedia.org/wiki/Linear_feedback_shift_register
    Do the work, you won't learn if someone shows you how it is done! The palette that the previous post points to are of PRN and other "noise generators" but I suspect that is not what you are after.
    Know that creating a PRN with a reasonable number of shift register taps produces very pseudo results, as the "random" pattern begins to repeat pretty quickly, thereby making it not a truly random number. 
    When you have an attempt that is sort of working and want additional suggestions, post the code here. We won't do your work, we will help you try to do it, and learn it, yourself.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Any way to sample segment length longer than loop iterations w/o shift registers?

    Hi all,
    My loop iterates approx every 0.06s and now i've been asked to add to the program a function which will sample the most recent 3s of data and return the max/min value for two of the signals.  I can think of a programmatically clumsy way to do this with shift registers- take the max/min for each iteration, save-repeat-compare until you have enough iterations to fill 3s of time.  But I can't help but think there has to be a cleaner(better?) way to do this. 
    Any help?
    Thanks
    Solved!
    Go to Solution.

    Hi there,
    Try looking into a circular buffer.  
    http://zone.ni.com/devzone/cda/tut/p/id/7188
    Once you've determined how often you're putting entries into the buffer, you'll know exactly how big of an array to grab and do the Min/Max on.  
    Another option is to use a circular array.  
    http://decibel.ni.com/content/docs/DOC-3414
    I would set this up to function a little like a Functional Global or an Action Engine.   The subVI would then be used in your DAQ loop to "stack" new data.   And then called in another loop or part of your code to be read every three seconds.  
    Patrick Allen

Maybe you are looking for

  • Error while Appending a  work-area in a table

    Hi Experts, Requirement :- I want to append a row in the the table but the work-area with which i am appendign the values is of different type than the target so i am getting error . Code :- APPEND WA_SOURCE TO RESULT_PACKAGE Error :-  A line of RESU

  • How do I begin payment for a webMarketing Business Catalyst subscription?

    Extreme frustration here.  I have a subscription to Muse, built an awesome website for my company, we have been testing it live under the "xxxx.businesscatalyst.com" option. I have looked everywhere and cannot find the place where I pay for a busines

  • Variables not updating in Snippets

    Hi there.  I'm currently still on RoboHELP 8 and about to upgrade but I've found this issue is still a problem when I've upgrading my project to a trial version of RoboHELP 9 (with the critical update applied).  It's on my local drive - no networks i

  • REMARKS IN AVAILABLE BATCHES IN BATCH NUMBER SELECTION

    IS IT POSSIBLE TO GET AN ACTIVE COLUMN IN AVAILABLE BATCHES FORM IN BATCH NUMBER SELECTION. THE SCENARIO IS THAT I WANT TO GIVE REMARKS TO THE BATCH WHICH HAS BEEN TRANSFERRED FROM ANOTHER WAREHOUSE. CAN I GET AN ACTIVE COLUMN IN BATCH DETAILS. KINDL

  • Wine unable to initialize 3D output

    I've got an error while im trying to run GuildWars2 on my Linux. I think its an wine error and not an GW2 error, but I'm not sure. Here i've a pic about the errormessage error message pls help me, its important troopa Last edited by Troopa (2012-04-2