DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in calculating displacement from velocity

Solved!
Go to solution

Hi. I have measured velocity and my intention is make an integration on velocity to calculate displacement. I am sure that velocity and time have a correct unit. My x values represent time in seconds. My starting velocity is zero. When I do an integration my results of displacement is definitely not correct.

 

So I try to calculate displacement with using a double integration from acceleration. And the error shows at the first step. I see that calculated velocity is not equal to measured velocity. But also I can say that form of displacement seems pretty good.

 

Do you know the solution for this problem?

 

Of course I add an email attachemnt to this post

 

Please helpSmiley Wink

Regards, Krzysiek

0 Kudos
Message 1 of 10
(6,696 Views)

Hi K,

 

When you integrate, you introduce an arbitrary constant that can be added to the result.  You need to match that constant to your known starting conditions.  In other words, when you integrate your measured velocity to get displacement, you need to add/subtract a constant from the resulting displacement curve in order for the first displacement value in the resulting channel to match the known initial displacement.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 10
(6,668 Views)

Hi Brad,

Thanks for answer,

 

I know that I must add/subtract some known constant to displacement, to get continuation. But my problem is that the displacement on pic.2 is oscillating around zero value (this is not a merged displacement, this is one continuous range). And I want to get displacement like this on pic.5.
I mean that after three hours I know that my point moved for 0,0005m. As you can see there is a smooth change od displacement. And i want to get result like this only by integration of velocity, not by double integration from acceleration. Unfortunately I can not attach the data file because it is too big.

 

I hope that I explained clearly what I mean.

0 Kudos
Message 3 of 10
(6,648 Views)

And one more question but diffrent topic, Is it any posibilty to write VBS script wchich could be able to paste the last value from channel A to the first row of chanel B? Next last from B to first row of C and so on... I need this because when i have 30 parts of displacement, it is very problematic to copy and paste values to offset manually.

 

Regards,

Krzysiek

0 Kudos
Message 4 of 10
(6,638 Views)

Hi K,

 

Just looking at the graph of the measured velocity, it is not at all obvious that the displacement should decrease sharply at the end of the measurement the way it does in Fig. 5.  That would require the time averaged velocity value to be negative, and it does not appear to be.  Perhaps it is slightly negative, but there's no way to tell by just looking at the graph.  Just looking at the velocity graph, I'd say that a resulting displacement that oscillates around zero (or some other arbitracry constant value) looks to be the correct result.

 

I'd be happy to take a quantitative look at that velocity integration if you post your data set to NI's incoming ftp site at:

 

ftp.ni.com\incoming

 

If you do, please let me know what the file name is,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 10
(6,620 Views)

Hi K,

 

Sure, you can create a VBScript to copy values from position N of channel A to position 1 of channel B, and so on, like this.

 

Set Group = Data.Root.ChannelGroups(1)
Set ChannelA = Group.Channels("A")
Set ChannelB = Group.Channels("B")
N = ChannelA.Size
ChannelB.Values(1) = ChannelA.Values(N)

If you provide more details, and ideally a data set, I can give you a more thorough example script.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 10
(6,619 Views)

Hi Brad,
Thanks for your time, you are very helpfull
I attached the word document with detailed description of my problem. I also put tdm/tdx files on ftp.ni.com/incoming/. The files names are displacement_offset and example_of_displacement calc

0 Kudos
Message 7 of 10
(6,594 Views)

Hi K,

 

I'm going to assume that your data channels are waveforms (no Time channel).  I'm also going to assume that all the displacement segment channels are in the same group with no other channels in that group.  I'm also going to assume that the order of the displacement segment channels in that group appear as the occurred chronologically.  I wouldn't have to make assumptions if you had sent a data set, but hopefully I'm guessing correctly on all these counts.  Here is a VBScript that adjusts all the values of the j+1 displacement segment channel so that it matches the last (N) value of the previous (j) displacement segment channel.

 

Set Group = Data.Root.ChannelGroups(1)
jMax = Group.Channels.Count
FOR j = 1 TO jMax-1
  Set ChannelA = Group.Channels(j)
  Set ChannelB = Group.Channels(j+1)
  N = ChannelA.Size
  Offset = ChannelB(1).Values(1) - ChannelA.Values(N)
  Call ChnLinScale(ChannelB, ChannelB, 1, -Offset)
NEXT ' j

I don't see any reason for your parabolic shape.  I believe that you're getting that result, but I don't understand why.  It looks like you'll have to send in that data set if I'm going to be able to help on that question.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 8 of 10
(6,548 Views)

Hi Brad,
Thanks again for help.
I get through displacement offset. I works perfectly.
But, as I said, I do no understand shape of displacement too. I think that we both know that shape after first interation  from velocity and second integration from acceleration should be the same.
I send data set to  ftp.ni.com\incoming The files name is example_of_displacement calc (The fourth file from the end), There are data set with:

 

1.Velo_Z(measured)
2.Time
3.Displacement_from_velocity (1st integration)
4.Acceleration_from_velocity
5.Velocity_recalculated_from acceleration

6.Displacment_from_acceleration (2nd integration)


If you could take a look on it, I would be grateful.

Regards,
Krzysiek

0 Kudos
Message 9 of 10
(6,534 Views)
Solution
Accepted by Krzysiek_F

Hi K,

 

I asked for R&D to look into this.  They re-calculated the Sum and  the Trapezodial and the Simpson Integral and got virtually the same results each time and all were parabola-like in shape.  They agree that this is a strange shape, but they suggest there is a simple explanation for this.  R&D suspects that the raw aquired velocity originally had a vertical offset and that the average value of the velocity was subtracted from it before sending it to NI.  R&D also suspects there was a slight sensor drift to the signal, like in this drawing:

 

Velocity offset and drift.png

 

The original blue signal has an offset and the drift. If you subtract the offset you get the red signal which has an average of zero, but the green integral of velocity highlights this velocity drift shape, since it starts at zero and going back to zero in a paraloba-like shape. If the drift is constant over the whole time, you can use the liner regression to compensate offset and drift. The shape of your velocity integral indicates that the drift is not exactly linear, so you probably need a different method to compensate for it more accurately. It is possible that a high pass filter is better for this because a typical sensor drift is not following a mathematical function. Sensor drift depends on temperatures and other internal and external factors. It’s more or less random behavior. The Velo_Z signal has a frequency of 1 as a waveform. I think a low pass filter at 0.25 (sampling frequency /4) is probably giving the expected result by eliminating the static offset and the slowly changing drift.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

Message 10 of 10
(6,454 Views)