Average in FPGA or RT

Hi all, I am very new to this Labview. I currently trying to measure voltage in the NI 9205. I went through the tutorial in the data logging to disk Link and i kinda build my application based on that. I want to take the average of some samples every so long. For exmple, i want to average 1 second of data every 20 seconds. I read through some of the posts that it mentioned some code that can be used. However, i am not sure where should i put the averaging. Would that be in the FPGA vi or the RT vi?? My logic told me that it should be at the FPGA vi b/c then i only need to pass data that i want to the FIFO and to the RT. However, i tried a few of them and none of them work.
Also, i used the DO channel on the 9205 to activiate a power supply which is needed for the measurement. Should that be in the FPGA vi or the RT vi. I have attached the pic of the vi i had here.
Thanks in advance for the help.
Attachments:
FPGA-vi.png ‏156 KB
RT-vi.png ‏203 KB

That was my work in progress shot. Yes, I used a relay circuit to trigger the power supply with the DO channel. I have attached the following pictures with the setup that i had. I tried to connect mean.vi and it said there is an error with the type of data. How could i convert the data??
What i am trying to do here is before the measurement, allow 3 sec to turn on the power supply and achieve a stable voltage, then read data for 1 sec to the FIFO. Then on the RT side, average out the 1 sec of data and write it to the tdms file. Is this the proper way to do it??
Thanks again for the help.
Attachments:
RT-vi.png ‏198 KB
FPGA-vi.png ‏196 KB

Similar Messages

  • Labview FPGA encoder reading

    hello,
    I an new in LabVIEW FPGA programing so I would appreciate any help. I am using sb-rio 9636 card and optocoupler for speed messaurment of DC motor. I have conected everyting right and the sensor is giving me date. But messauring the speed the oscilations of sensor data are huge. I am not changing the speed and motor continiousliy is rotating in the same speed but data are not the same. For example im 12 V that is the max speed motor schould rotate in 6500 rpm/min but in one second it is showing 6500 and in the other 5500 rpm/min.  think that there is not problem in the code but that the messaurment are not reliable. I will put my code. I need to know is there anz other way to do encoder readings.
    Thank you

    I don't see anything in your loop that guarantees the timing of your sampling of the digital encoder pulses.  It appears you expect that loop to run at 1MHz based on the uS unit label on your time of flight indicator.
    Because you are using front panel indicators for some of your calculation variables, I can't see all the numbers going into your calculations.
    How much variance do you see in the time of flight measurement on your front panel?  You must remember that you are making measurements in whole integers of uS.  How much change in the RPM calculation do you see if the uS measurement drifts by 1 uS?
    If the impact of 1uS change in pulse to pulse measurement has a big impact on your calculation, then you will need to adjust your algorithm to get a more precise measure of the time of flight.
    Some ideas:
    The faster your sampling loop runs, the more likely you will sample the signal right after the pulse transistion.  Consider using a Single-Cycle Timed Loop to sample at speeds in the 40MHz (25ns period) range.  This will give you more precision.  One risk I can't rule out in your existing code is that you may be sampling slow enough that in some cases you miss a pulse completely.  If you want to ensure that you do not miss any pulse edged, then you must ensure that the loop is sampling at least 2x the frequency of your pulse train, assuming the pulses have a clean 50% duty cycle. If that duty cycle is not 50%, then the maximum sampling period must be shorter than the shortest pulse you expect.
    Rather than measuring the time difference from pulse to pulse, measure the time of 10 pulses, or 1000 pulses, or some other larger number. This averages a larger number of pulses so that the difference of 1us resolution has less impact on the calculated measurement.
     

  • Calculate the average value

    the data I measured changed rapidly, so i want get the average value of the data
    Do not tell me to use mean.vi , i have already know that.
    and i got an idea which is add the data into an array every time, then sum of all the data value and take the result divide by the number of elements
    but i dont know how to achieve that, anyone can build a simple vi to show me ? thank you
    i have attached my vi which is using mean.vi to calc the average value, you can delete it and using in your way ,  thank you !
    Solved!
    Go to Solution.
    Attachments:
    EN-new.vi ‏274 KB

    Hi I got a similar issue for averaging. I used the mean.vi from the math function but the average is rolling when i run it. I am trying to calculate the average for the data i read to the RT FIFO (which is around 40000 lines).I got the writing part working, however, when i am reading the data, I couldn't get it working. I thought i read the data as a 1-D array, and then pass it to the Mean.vi and then got the result. But seems like the mean is only showing the last data in the array.
    Can someone help me with this??
    Attachments:
    FPGA-vi.png ‏242 KB
    RT-vi.png ‏182 KB
    RT-2mod.vi ‏515 KB

  • How can I use Easy Custom Device Tool to do the same thing LabVIEW the Basic Averaged DC-RMS VI does

    I am using a cRio 9024 and am reading PWM with a 9205 analog input card.  It was suggested that I use the Basic Averaged DC-RMS VI to convert the PWM signal voltage into an analog signal (RMS value) for use in my system.  The issue is that the 9024 cannot use LabVIEW models (it is VxWorks). I am working through the Easy Custom Device Tool, and wonder if someone can guide me in the right direction.
    Solved!
    Go to Solution.

    Hello,
    Can you give more details about your VeriStand configuration ? Are you using the Scan Interface (and thus the Scan Engine Custom Device) or are you using the FPGA of your cRIO chassis to access the I/O ?
    If you are programming the FPGA and using a FPGA Personalty in VeriStand you can probably add the calculations such as RMS to the FPGA code directly.
    If you are using the Scan Engine, you will need a custom device. The Easy Custom  Device Tool is just a tool, you will need to know more about what a custom device is and how to develop one:
    - http://www.ni.com/white-paper/12712/en/
    Regards
    Eric M. - Application Engineering Specialist
    Certified LabVIEW Architect
    Certified LabWindows™/CVI Developer

  • NI FPGA based programmed delay generator

    Hello,
    I am seeking for some suggestions from those working with degital delay generators.
    We have a TTL trigger pulse train in which pulses are not equidistant in time (seperation between two pulses is not the same, it can be few ns to few microsecond), however, on average, the rate would be <2MHz. The pulses are 10-20ns width and 2.5V amplitude. From this, we want to generate 3-4 trigger pulse trains, which would be delayed with respect to the initial (input) pulse train by some arbitrary values (ns to few microsecond). However, the point is, we also want some trigger pulse trains in which only even number of triggers (or odd triggers) could be present. So in other words, we want to program the delay generator in such a way that one of the outputs could have only even or odd trigger pulses of the initial trigger pulse. 
    We first tried to look for available delay generator boxes and PCI delay generators. The problem is that they have insertion delay of typically 50ns or more. So in other words, the output triggers would be delayed from the initial trigger pulse not less than 50ns. Other, If we program them with labview, It seems the output response would be after few ms. These are quite large delays for us.
    One such delay box manufecturing company suggested us to use FPGA based delay generators, as they say that these devices are having low insertion delays and quite fast programmable response. I looked in NI website for insertion delay and other parameters, but could not find these values. Pl. suggest whether FPGA based delay generators have low insertion time (<10-30ns) and if we program them, the output could be generated within ns response time?? As I am new with such devices, I would sppreciate if anyone could suggest about the possibilities to generated the delay sequences (even only or odd only triggers) using FPGA devices.
    Thank you

    MWM,
    If you are planning to use the analog input I would recommend using the the 783x family of boards. They have analog inputs and they can provide the +/-10 v to the cRIO-9263 boards

  • How can I reduce FPGA compiler time

    Hi,
    I am trying to implement a PID control loop on the FPGA of a cRIO. 
    The VI which runs on the FPGA target takes very long to compile (1h+).
    Does anyone have an idea while the compilation takes so long and how I might be able to inprove compilation time?
    The program can be found in attachment.
    Best regards,
    Jasper
    Attachments:
    PID FPGA TEST.zip ‏160 KB

    Hi Jasper,
    FPGA's normally take a very long time to compile compared to software compilations. 1 hour sounds about right for a slightly above average sized project. Compile times of anywhere from 2-4 hours (and longer for larger devices!) are not unheard of.
    Companies who are serious about FPGA compilation and rely on quick turnaround invest in servers which contain many computers to work on the compilation (this is also why when you compile, it asks you if you would like to compile on the "local sever" (your computer) or an external server).
    NI also has a cloud compiler available that will let you compile your code on their servers, however you must pay for the time. I think they offer a free trial if you wanted to see how it works.
    So if you seriously need quick turnaround, you must consider some serious hardware.
    Otherwise, you will have to queue up multiple compilations and let them run overnight like the rest of us.  
    www.movimed.com - Custom Imaging Solutions

  • Write latency on PCIe from PC (host) to FPGA

    Hello,
    In my application, the target is to write 64 Bytes from the PC to the FPGA with the minimum latency.
    I have implemented the “Virtex-7 FPGA Gen3 Integrated Block for PCI Express(3.0)” IP, that seems the best candidate for that and I am using the AXI STREAM “m_axi_cq” interface to write data to internal FPGA memory.
    The configuration is this one:
    PCIe GEN 3 / 8 lanes.
    AXI at 250 MHz with data bus = 256 bits.
    On the µP = XEON E5 V2, the right core is bound to the FPGA.
    I am using, specific Intel instruction to transfer directly bloc of 256 bits (in my example I am using 2 times this instruction in C code). I do not want to call a DMA, because I am afraid to lose more time to call the DMA than to make a direct memory write.
    In the FPGA, I put an ILA core to monitor the access (see waveforms).
    - First bus is the output of the Xilinx core (“m_axi_cq” bus)
    - Second bus is the “memory write signal” of 8 memories of 32 bits data width => 16 x writes of 32 bits = 64 Bytes
    Question:
    - Even if I use 2 Intel instruction to transfer 2x256 bits, I see 4 transfers of 128 bits => is it normal ?
    - It seems that we cannot have a TLP bigger than 256 bits (without DMA access) => do you confirm?
    - Between 2 write access, I have 23 clock cycles = 23*4ns = 92 ns, and I do not arrive to decrease this score => did I reached the minimum possible ?
    Many thanks for your attention

     
    Be careful with watching the latency. 
    It's HIGHLY variable in our cases.
    We've got our PCIE block (endpoint on the FPGA) issuing block reads to the cpu host and/or an NVIDIA GPU.
    We've measured on various systems, average latencies in the 180-240 clocks range.  (Clock = pcie user clock, 250 MHz).  That's not's great, but for us tolerable. 
    The problem was the distribution in the latencies.  The WORST case latencies can be terrible.  > 1600 clocks in some cases.    Plotting a few series of results, we see a bimodal distbution of latencies.  I.e. a bunch hovering around 150, and a bunch hovering around 300.  The average being the above results.  Usually around the point where the latencies are tending to move from one "average" to the other, we get the outlier extra long latency.
    Probably something to do with cache flushes/fills happening over on the CPU.
    In any event, because of this high variability of latencies, our first designs broke real time.  We had to re-architect things to handle.
    Bandwidth's not a problem for PCIE. Predicable latency, however is troublesome...
    Regards,
    Mark
     

  • Acquiring data in LabVIEW FPGA

    Hello,
    I am working on LabVIEW FPGA where I have to acquire data from a source and take its average. One way to do that is to keep adding every new signal to the sum f the older ones and then average.
    However, I wish to store all the incoming values into a file and save it. But when I tried doing so, it gives an error saying "array size cannot be changed". With this constraint, I am unable to write the data into an array.
    Please suggest.
    Thank you. 
    Dheeraj Bharadwaj
    IIT-Madras
    Solved!
    Go to Solution.

    You need to acquire data, pass it to the RT, then log there. You cannot use build array on the FPGA because FPGA will not allow for dynamically allocating memory like this. You must preallocate the array then use replace array subset. A better way is to use DMA FIFOs. Have a look at the FPGA examples in LabVIEW for streaming data. Then, on the RT, you can just add in your file logging functions.
    CLA, LabVIEW Versions 2010-2013

  • How to take a derivative of a signal in Labview Fpga

    How to make derivative of a position signal acquiring using AI module of cRIO to get the velocity signal.
    I got one example in forum and i m attaching that, bt i need to implement this in FPGA.
    Note : The position is varying at 30Hz to 80Hz Freq.
    Attachments:
    derivative.jpg ‏48 KB
    derivative.jpg ‏48 KB

    I forgot to mention that one problem with numerical differentiation is that if you have a noisy signal, the noise is amplified!
    You can try implementing a moving average or median filter in the FPGA code. There are a number of previous threads and Community posts on these, ranging from simple implementations to more complex ones. Try using the search function at the top of the page to look for them.
    Of course, it's easier to acquire the raw data, send it to the RT host and do your processing there, depending on resources.
    Regarding the sampling time, you have hopefully set this via the tick delay you set in the FPGA acquisition loop.
    CLD

  • Report generation for FPGA VI

    Hello..
                  I want to include the number of resources used by FPGA (LUTs, slices, blockrams etc) in my report generation. 
    After compilation is completed, a window showing these resources will occur. But, how can I add this compilation report in my report generation...
    Please let me know..
    Thanks
    Prashanth
    Solved!
    Go to Solution.

    Hi
    I made a small code which helps you achieve this functionality.
    Hope it helps!
    In this code: I read from "toplevel_gen_xst.log" file generated for the project; search for the string "Device utilization summary" and extract the part of interest Now you add this extract to your report compiled using report generation toolkit.
    regards,
    Ravi.
    Attachments:
    image.jpg ‏60 KB
    FPGA Utilization.vi ‏10 KB

  • Average & SUM in a Single criteria in the Pivot View

    Hi,
    Can you plese let me know whether it is possible to have SUM at the Grand Total level & Average on the Right Hand side of the Pivot Table view at the same time.
    Thanks & Regards
    Siva.

    Hi,
    The way you want to do it is not possible.
    What you can do is make a union of 2 reports one is using the Sum and the other the AVG and not use the Grand total provided by OBIEE.It's kind of creating your own Grand Totals
    Look at this thread it will help:
    http://obiee101.blogspot.com/2010/08/obiee-combine-with-similar-request.html
    If you are using pivot table you can think about a new calculate item as a GT
    http://varanasisaichand.blogspot.com/2010/12/aggregate-functions-on-grand-total.html
    Best regards
    Adil
    PS: Please don't forget to close the thread and assign points when your question is answered
    Edited by: adil.harrab on Jun 6, 2011 1:36 PM

  • IMAQ Resample performanc​e. Any better choice for 50% downsample​? (average 2x2 - 1 pixel)

    My video source is a 4 Mpixel (2k x 2k resolution) USB3 camera. This is displaying a live image OK in Labview at 45 fps using only 20% CPU.  So far, so good.
    I added a "IMAQ Resample" block to downsize this to 1024 x 1024 image. That works with almost no additional processing time if I select "Zero Order" interpolation (eg. plain subsample to value of nearest pixel). However, I want to average each 2x2 block (4 pixels) in the input image into 1 output pixel. I *think* that is the effect of selecting Bi-Linear interpolation. Doing that works, but takes about 45% of CPU.  I want to do some other processing but am worried I will quickly run out of CPU time and start dropping frames.
    Is there any better way to do this simple 50% downsize (2x2 average), that would take less CPU overhead, or is this the best way?

    Hi jbeale1,
    In NI-MAX (Measurement & Automation Explorer) select your camera. Under the  'Acquistion Attributes' tab do you see an option to change the Video Mode of your camera to a different resolution? If your camera supports it, it would be more efficient to change the resolution there.
    If not , here is a little more info regarding the IMAQ Resample VI:
    http://zone.ni.com/reference/en-XX/help/370281P-01​/imaqvision/imaq_resample/
    You are correct, the Bi-Linear option uses a more intensive interpolation technique which is why it is more taxing on your CPU. I hope this is helpful.
    Robert S.
    Applications Engineer
    National Instruments

  • SSRS 2008 Column Chart with Calculated Series (moving average) "formula error - there are not enough data points for the period" error

    I have a simple column chart grouping on 1 value on the category axis.  For simplicity's sake, we are plotting $ amounts grouping by Month on the category axis.  I right click on the data series and choose "Add calculated series...".  I choose moving average.  I want to move the average over at least 2 periods.
    When I run the report, I get the error "Formula error - there are not enough data points for the period".  The way the report is, I never have a guaranteed number of categories (there could be one or there could be 5).  When there is 2 or more, the chart renders fine, however, when there is only 1 value, instead of suppressing the moving average line, I get that error and the chart shows nothing.
    I don't think this is entirely acceptable for our end users.  At a minimum, I would think the moving average line would be suppressed instead of hiding the entire chart.  Does anyone know of any workarounds or do I have to enter another ms. connect bug/design consideration.
    Thank you,
    Dan

    I was having the same error while trying to plot a moving average across 7 days. The work around I found was rather simple.
    If you right click your report in the solution explorer and select "View Code" it will give you the underlying XML of the report. Find the entry for the value of your calculated series and enter a formula to dynamically create your periods.
    <ChartFormulaParameter Name="Period">
                      <Value>=IIf(Count(Fields!Calls.Value) >= 7 ,7, (Count(Fields!Calls.Value)))</Value>
    </ChartFormulaParameter>
    What I'm doing here is getting the row count of records returned in the chart. If the returned rows are greater than or equal to 7 (The amount of days I want the average) it will set the points to 7. If not, it will set the number to the amount of returned rows. So far this has worked great. I'm probably going to add more code to handle no records returned although in my case that shouldn't happen but, you never know.
    A side note:
    If you open the calculated series properties in the designer, you will notice the number of periods is set to "0". If you change this it will overwrite your custom formula in the XML.

  • Moving average price in case of goods receipt with free of charge

    Hello everyone,
    Need some inputs......
    Sometimes we receive materials from suppliers free of charge (e.g. warranty replacement) u2013 moving average goes down u2013 worst case 0,01 EUR/piece. This causes problems in government reporting and export documentation EX1 and clearance/pro-forma invoice) for deliveries to field engineers (Order type ZIS1, ZIS3 u2013 item cat. ZICA), because moving average price is used for the values in government reporting and on the invoices. In government reporting and on invoices we need to state a true value of the part.On the other hand, the value warehouse stock is depending on the moving average cost as well.Could you please let me know, how to handle such receipts from the supplier to have a correct stock value and correct values on invoices and government reporting?
    Thanks
    Deepthi...

    Hello Deepthi,
    It depends on your company policy. If you want to valuate the material along with the material purchased handled in moving average price, free consignment will bring down the MAP for the material.
    In that case, you can revaluate the material to the original price in MR21 transaction.
    If you are not going to handle the materials received free of charge along with the purchased material, you can go with another material code, with non valuated material type.
    But i guess, no company will be asking for another material code. So go for revaluation after the receipt of free consignment.
    Regards

  • Query Scenario Help - Average of Multiple Regions

    Hi, I have a query scenario I can't create and I hope someone can help with.
    The user inputs a sales Area and the report is to output the regions in that area and provide the Volume (easy) and the Average of all the presented regions.  The problem is that the number of regions is dynamic so I don't know how to go about determining the average and making it constant across the regions.  The user can also drill down on a region to present divisions and I would then need the average for the divisions this time instead of regions.  Can you help?
    Example 1
    Input Sales Area 1000000
    Region               1000001  1000002  1000003
    Product1  Volume       100      120      105
    Product1  Average      108      108      108
    Product2  Volume       200      400      325
    Product2  Average      308      308      308
    Example 2
    Input Sales Area 2000000
    Region               2000001  2000002  2000003  2000004
    Product1  Volume       100      120      105      180
    Product1  Average      126      126      126      126     
    Product2  Volume       200      400      325      600
    Product2  Average      381      381      381      381
    To get this layout I have the following in the query builder:
    The 2 Products are in a structue under Rows
    The Key figures structure is also under Rows
    The Region is under the columns

    If you redesign the report slightly to move the "Average" to a column at the end of each row (which really makes more sense, IMHO), then the answer is easy. Just change the Suppress Results Row property to "Never" for Region, and change the Display Results As property to "Average" for Volume.
    You could also make this same change to Division and/or any other free characteristic they might use as a drill-across in the report.
    Hope this helps...
    Bob

Maybe you are looking for