How do you calculate accumulated displacement?

Hello! I would like to calculate the amount of displacment accumulated during a laboratory test using LVDT positions. Acquiring the signal and determining the position is no problem. However, I cannot think of an efficient way to sum the displacement measured by the LVDTs during the test period. From a progamming standpoint, I would simply save an initial value and subtract the current loop value to obtain the displacement. In the attached example I use a method which uses a case structure and a shift register, but it seems a bit brute force. Do you know of a more elegant way of doing this? If not, how do I tidy it up?
Attachments:
LVDT_displacement.vi ‏145 KB
LVDT_DAQ_Assistant.PNG ‏22 KB

Evan,
Create control will create arrays on Add or Multiply only if an array is wired to one of the other terminals. Did you have the array from DDT wired to the Multiply (without the Index Array) when you first created the slope and intercept controls?  If you do not want arrays, go to the front panel, delete the array controls, and drop scalar controls on their places. Then wire the terminals to the numeric functions on the block diagram. Everything should then be scalars.
It looks like the DAQ Assistant is set to acquire data from two channels at 1000 samples per second and to retrieve 100 samples on each call.
When you convert from DDT to 1D array of DBL you get only one of the two channels. The array should contain 100 points from the first channel. All of the data from the second channel is lost. You then index out the first and second elements of the array from the first channel.
I doubt that this is what you really wanted to do.
The DAQmx VIs will give your direct control over the datatypes and eliminate the extra overhead of the DAQ Assistant.
You should be able to configure the From DDT to allow you to select the channels. Double click to bring up the configuration dialog. You can select 2D array of scalars and then use Index Array to get the channel you want. Another option is to use 2 copies of From DDT and select 1D array of scalars - single channel. Then choose the channel with the control below the Scalar Data Type box.
Once you get the arrays configured correctly I suggest that you calculate the Mean of each array and use that for your single value per iteration. Averaging the 100 points should significnatly reduce any noise on the signal.
Lynn

Similar Messages

  • I wanted to know how do you calculate the number of days between two dates

    i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • How do you calculater correlation coefficients for data?

    I would like to calculate the correlation coefficient for data which has a linear correlation. I can calculate the linear fit, but how do you calculate the correlation coefficient from this data. Any help would be greatly appreciated.

    If you're just looking for the correlation coefficient (r^2 or r) of a linear regression, you can use the method described HERE earlier.
    LabVIEW Champion . Do more with less code and in less time .

  • How do we calculate Accumulated Depreciation for a Particular Period

    Dear Members,
    How do we calculate the Accumulated Depreciation for a particular asset. It would be great if some body can explain me ,what tables should we use.
    I read that Accumulated Depreciation is nothing but deprn_reserve column in fa_deprn_summary table. I have to make a report which should show the accumulated depreciation for an asset by period name. (eg : For MAY-07 the report should give the accumulated depreciation for that asset).
    Please give your suggestions.
    Thanks
    sandeep

    Hi,
    You can use DEPRN_RESERVE from fa_deprn_summary to get accumulated deprn. Make sure you select the latest row from fa_deprn_summary for a particular period.
    Use FA_DEPRN_PERIODS to join with period_counter if you wnat to use Period Name as criteria.
    Cheers
    Sunil Chawla

  • How do you calculate the count in before a cue start?

    Here's what I can't figure out.
    I have a quicktime loaded and I need to start a cue at, let's say, 1:05:07:10. I want the tempo to be, oh, 120. I arbitrarily say - this will be measure 41 but it doesn't really matter, I just need my downbeat at that TC and the tempo to be correct.
    So far so good. I have no problem doing this with Tempo operations. I lock the time code, assign it a measure (in this case 41) and have logic calculate a single tempo from 1:00:00:00 (measure 1) to the desired start.
    Now here's my real question. How do I calculate 4 or 8 beats before 1:05:07:10 so I can have a count it at the correct tempo (120)?
    So I'm wonder how some of y'all handle this situation.
    Thanks

    As long as you are in the Fetch call, all other calls to the Scope
    driver will block until Fetch exits.  That's why the Abort doesn't
    do anything.  You have two options:
      1) Use a finite timeout.  Obviously, you are running into
    cases in which the trigger does not arrive, and want to exit
    cleanly.  This is exactly what the timeout is for.
      2) Determine the acquisition state before calling fetch. 
    If this is a finite, single-record acquisition, poll on acquisition
    status and do not call fetch until the status is 1 (acquisition
    complete).  If you're doing a finite, multi-record acquisition,
    poll on the Fetch>>Records Done property and only fetch the
    records that have completed.  If you're doing a continuous
    acquisition, poll on the Fetch>>Points Done or Fetch>>Fetch
    Backlog property and only fetch the number of points that have been
    acquired.
    There's no clean way to break the infinite timeout fetch without forcing LabVIEW to close.

  • How do you calculate a field

    Hi all,
    I would really appreciate some help as I do not know programing, java script or other programming languages.  I need to have a field calculate for me.
    The form has date of birth. Then I need the next field, (a text field) calculate the age on the previous field of the Date of Birth.  Does anyone have an idea how to do that?  I have gone through the help guide, but it assume you know the langauage to put in.
    thanks in advance.

    Janet, I've fixed the form and attached the updated version.  There were a couple of things that I changed:
    1. The form was saved as a static .pdf form.  This means that it's for display only; you can't run any scripts and change things programatically.  I changed it to be a dynamic form, which allows scripts to run when the user is entering data.  To do this I selected Save As from the file menu and then selected Save as type: Adobe Dynamic XML Form (*.pdf).
    2. Since the form was saved as static it stripped out the scripts.  I re-pasted the script that I gave you back into the calculate event for the Age field.
    I also changed the Language dropdown on the upper right side of the script window to Javascript, since that's the language that I used.
    3. The name of your DOB field is DateTimeField1.  You can see this by either looking at the Hierarchy window or by looking at the Field tab of the Object window.  In the future you should change the names of the fields from their default to something more descriptive.  For now it's fine.  I then replaced my references to "DOB" in my script with "DateTimeField1.
    4. Make sure that the preview type is set to dynamic.  Go to the File menu in designer and select the Form Properties item.  Click on the Preview tab and choose "Preview Type": Interactive Form and "Preview Adobe XML Form as": Dynamic XML form.
    The above changes made it work, but I changed one more thing:  The type of the DOB field is set to DateTime field, and when you use the pop-up calendar to select the date it gets saved in the data in a backward format (YYY-MM-DD).  This doesn't show up on the form since you have the display format set, but behind the scenes it messes up the date calculation in the script.  I set the edit pattern for the field to be either D/M/YYYY or D-M-YYYY to allow some flexibility when the user enters the date, and to force it to save in the proper format for the script.
    Oh, forgot to mention that "new Date()" gets the current date from the system, so you don't need a field on your form for it.  Green is a comment, not part of the script but just to document what's happening in the script.  Blue means reserved script instruction, black is everything else.  Makes more sense to you if you're a programmer. The Livecycle editor automatically colors the text to make it easier to read, we just type it in.
    Give this a try and let me know if you have more issues.
    Kevin

  • How do you calculate the instantane​ous frequency of a signal in LabView?

    I'm working with neural signals that can be described as a nonlinear series of action potentials.  I've already calculated the spike density function (spikes per second against time) and was wondering if this is the instantaneous frequency?  If not, could someone please describe how to calculate instantaneous frequency in LabView without the advanced signal processing toolkit.

    Instantaneous frequency is a term which seems to be context-sensitive.  In other words the definition can vary depending upon the application.
    Spikes per second would be more of an average frequency (averaged over one second).
    For your neural signals I would think that an instantaneous frequency would be defined as the reciprocal of the time between successive spikes.  Since you can count spikes, you should be able to determine the time of each spike.
    Lynn 

  • How do you calculate multiple fields in a Form?

    Hi,
    I have a spreadsheet with several headings and several fields as illustrated below, and description of each field and calculation required is listed below.
    Rate Per Day
    Days
    Course
    Attending
    Total
    $1,000
    2
    Course A
    Yes
    $2,000
    $2,000
    1
    Course B
    Yes
    $2,000
    $5,000
    5
    Course C
    No
    $2,000
    2
    Course D
    Yes
    $4,000
    Total:
    $8,000
    Rate per day:  Field value is inputted by us.
    Days:  Field value is inputted by us.
    Course:  Field value is inputted by us.
    Attending:  Is actually a check-box that the client ticks.
    Course Total:  This should be the calculation of RATE PER DAY * DAYS IF ATTENDING BOX IS CHECKED
    Total:  Sum of above COURSE TOTAL FIELDS
    We currently do this in EXCEL 2007, however we looking at converting it to a PDF Form for distribution to our clients to we can track responses, etc.
    My question is really ery simple ... how do I create the above calculations in a form that I want to distribute??  This possible?? If so how (please bear in mind I'm not a developer

    In re-reading your question, I realized you're using a check box. In that case, you will need to create a custom calculation script using JavaScript.
    Something like:
    // This is a custom calculation script
    (function () {
        // Get the value of the check box
        var v1 = getField("Attending1").value;
        if (v1 !== "Off") {
            var v2 = +getField("Rate1").value;
            var v3 = +getField("Days1").value;
            // Sum the two field values and set the value of this field to the result
            event.value = v2 + v3;
        } else {
            // Blank field if checkbox is unchecked
            event.value = "";
    You'd replace the field names I used with the field names you're using.
    This leaves out checking to see if the corresponding Couse field is filled-in, and you'll have to use a custom Format script if you want the type of formatting you show.

  • How do you calculate the age of a query?

    Hi,
    We are trying to determine how old a query is?  Do one of the statistical cubes/queries contain the age or created on date of a query?
    Thanks for you help.  Points will be rewarded for the correct answer.
    Thanks,
    Mike

    Hi rathi/mike,
    check these tables RSRREPDIR,RSZCOMPDIR.
    Cheers
    RK

  • How do you calculate difference in time (hours and minutes) between 2 two date/time fields?

    Have trouble creating formula using FormCalc that will calculate difference in time (hours and minutes) from a Start Date/Time field and End Date/Time field. 
    I am using to automatically calculate total time in hours and minutes only of an equipment outage based on a user entered start date and time and end date and time. 
    For example a user enters start date/time of an equipment outage as 14-Oct-12 08:12 AM and then enters an end date/time of the outage of 15-Oct-12 01:48 PM.  I need a return that automatically calculates total time in hours and minutes of the equipment outage.
    Thanks Chris

    Hi,
    In JavaScript you could do something like;
    var DateTimeRegex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d)/;
    var d1 = DateTimeRegex.exec(DateTimeField1.rawValue);
    if (d1 !== null)
        var fromDate = new Date(d1[1], d1[2]-1, d1[3], d1[4], d1[5]);
    var d2 = DateTimeRegex.exec(DateTimeField2.rawValue);
    if (d2 !== null)
        var toDate = new Date(d2[1], d2[2]-1, d2[3], d2[4], d2[5]);
    const millisecondsPerMinute = 1000 * 60;
    const millisecondsPerHour = millisecondsPerMinute * 60;
    const millisecondsPerDay = millisecondsPerHour * 24;
    var interval = toDate.getTime() - fromDate.getTime();
    var days = Math.floor(interval / millisecondsPerDay );
    interval = interval - (days * millisecondsPerDay );
    var hours = Math.floor(interval / millisecondsPerHour );
    interval = interval - (hours * millisecondsPerHour );
    var minutes = Math.floor(interval / millisecondsPerMinute );
    console.println(days + " days, " + hours + " hours, " + minutes + " minutes");
    This assumes that the values in DateTimeField1 and DateTimeField2 are valid, which means the rawValue will be in a format like 2009-03-15T18:15
    Regards
    Bruce

  • How do you calculate the length of a microcassette tape on the M-2000 transcriber?

    There is a counter that runs as you rewind a microcassette tape.  What is the equivalent in minutes?  I would like to know how long the tapes are that I am preparing to type.  Thanks for your prompt reply.

    Unfortunately, we have a very limited information about the M-2000 Micro Cassette Recorder since it was first released in the market last 7/1/1989. Perhaps, the manual here can be of help. 
    If my post answers your question, please mark it as "Accept as Solution"
    http://bit.ly/Win-4K

  • How do you calculate the number of bytes in a hexidecimal array?

    Hi can anybody help me calculate the number of bytes in a hexidecimal array ie:
    04h + 12h + 4Eh + 20h = 84h
    Thanks

    Hi,
    I'm not sure if you want to count the bytes or sum the array. But here's an example of both:
    Hope this helps,
    Paulo
    Attachments:
    ByteCount.vi ‏18 KB

  • How do you calculate a (base * power) sans math.pow?

    I've been tasked with trying to figure out how to do an exponent question without using the math.pow(3,2) method. How would I do that?

    Yeah it's a non negative number but I don't
    understand how a loop would complete this.Say you want to find the value of 10^5, you just do:
    int product = 1;
    product *= 10; // this is the same as product = product  * 10
    product *= 10;
    product *= 10;
    product *= 10;
    product *= 10; Use a for statement for this:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html

  • How do you calculate a date on a form?

    I am working on a form for our customers and our staff to use and I needfor it to calculate a date from another date. We are currently using an Excel spreadsheet that is working very well, but we are starting to run into customers who do not have access to Excel. Having the form in Adobe would give us more flexibility.
    Here is an example of exactly what I need:
    Last Read Date: 01/01/00
    Approximate Due Date_1: 01/26/00  (this is the Last Read Date + 26 days)
    Approximate Due Date_2: 02/26/00  (this is the Last Read Date + 56 days)
    Approximate Due Date_3: 03/26/00  (this is the Last Read Date + 85 days)
    Thank you

    Check out this previous topic: http://forums.adobe.com/thread/836872

  • Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Hi sashby51,
    I've moved your discussion to the PDF Forms forum--the folks who visit this forum regularly should be able to point you in the right direction.
    Best,
    Sara

Maybe you are looking for